Опубликован: 06.08.2012 | Уровень: специалист | Доступ: платный
Лекция 31:

Keeping up to date

< Лекция 30 || Лекция 31: 1234 || Лекция 32 >

Release tags

FreeBSD identifies releases with two or more numbers separated by periods. Each number represents a progressively smaller increment in the functionality of the release. The first number is the base release of FreeBSD. The number is incremented only when significant functionality is added to the system. The second number represents a less significant, but still important difference in the functionality, and the third number is only used when a significant bug requires rerelease of an otherwise unchanged release. Before Release 3 of FreeBSD, a fourth number was sometimes also used.

Tags for released versions of FreeBSD follow the release numbers. For release x.y.z you would look for the tag RELENG_x_y_z_RELEASE. For example, to get the current state of the FreeBSD 5.0 source tree, you would look for the tag RELENG_5_0_0_RELEASE.

Tags for the -STABLE branch are simpler: they just have the release number, for example RELENG_4.The security branch has an additional number, for example RELENG_4_7.

Some tags diverge from this scheme. In particular, CSRG and bsd_44_lite both refer to the original 4.4BSD sources from Berkeley. If you feel like it, you can extract this source tree as well.

To find out what tags are available, do:

# cd $CVSROOT/src
# rlog Makefile,v | less
RCS file: /hcme/ncvs/src/Makefile, v
RCS file: /home/ncvs/src/Makefile, v
Working file: Makefile
head: 1.270
branch:
locks: strict
access list:
symbolic names:
RELENG_5_0_0_RELEASE: 1.271    5.0 RELEASE
…
RELENG_4_7_0_RELEASE: 1.234.2.18    4.7-RELEASE
RELENG_4_7: 1.234.2.18.0.2    4.7security fixes only
RELENG_4_7_BP: 1.234.2.18    branch point for 4.7
RELENG_4_6_2_RELEASE: 1.234.2.12    4.6.2-RELEASE
RELENG_4_6_1_RELEASE: 1.234.2.12    4.6.1-RELEASE
RELENG_4_6_0_RELEASE: 1.234.2.12    4.6-RELEASE
…
RELENG_4: 1.234.0.2    4-STABLE
…
RELEASE_2_0: 1.30    2.0 2.0-RELEASE
BETA_2_0: 1.30
ALPHA_2_0: 1.29.0.2
bsd_44_lite: 1.1.1.14.4BSD-Lite
CSRG: 1.1.1
keyword substitution: kv
total revisions: 179; selected revisions: 179
description:

This example shows the same file we saw on page 583. This time we use the rlog command, which is part of RCS, to look at the revision log. Normally you'd use cvslog, but that only works in a checked out source tree.

There are a number of ways to tell cvs the name of its repository: if you already have a CVS subdirectory, it will contain files Root and Repository. The name of the repository is in Root, not in Repository. When you first check out files, you won't have this directory, so you specify it, either with the -d option to cvs or by setting the CVSROOT environment variable. As you can see in the example above, it's convenient to set the environment variable, since you can use it for other purposes as well.

The repository contains a number of directories, usually one for each collection you track. In our case, we're tracking the source tree and the Ports Collection, so:

  • CVSROOT contains files used by CVS. It is not part of the source tree.
  • ports contains the Ports Collection.
  • src contains the system sources.

The directories ports and src correspond to the directories /usr/ports and /usr/src for a particular release. To extract the src tree of the most up-to-date version of FreeBSD-CURRENT, do the following:

cd /usr
#cvs co src 2<&1 | tee /var/tmp/co.log

To check out any other version, say, everything for Release 4.6, you would enter:

#cd /usr
# cvs co -r RELENG_4_6_RELEASE src 2>&1 | tee /var/tmp/co.log

If you need to check out an older version, for example if there are problems with the most recent version of -CURRENT, you could enter:

#cvs co -D "10 December 2002" src/sys

This command checks out the kernel sources as of 10 December 2002. During checkout, cvs creates a subdirectory CVS in each directory. CVS contains four files. We'll look at typical values when checking out the version of the directory /usr/src/usr.bin/du for Release 4.6, from the repository at /home/ncvs:

  • Entries contains a list of the files being maintained in the parent directory, along with their current versions. In our example, it would contain:
    /Makefile/1.4.2.1/Sun Jul 2 10:45:29 2000//TRELENG_4_6_0_RELEASE
    /du.1/1.15.2.7/Thu Aug 16 13:16:47 2001//TRELENG_4_6_0_RELEASE
    /du.c/1.17.2.3/Thu Jul 12 08:46:53 2001//TRELENG_4_6_0_RELEASE
    D
    

    Note that cvs prepends a T to the version name.

  • Repository contains the name of the directory in the repository that corresponds to the current directory. This corresponds to $CVSROOT/directory. In our example, it would contain src/usr.bin/du.
  • Root contains the name of the root of the repository. In our example, it would contain /home/ncvs.
  • Tag contains the version tag of the source tree. This is the RCS tag prefixed by a T. In this case, it is TRELENG_4_6_0_RELEASE.

cvs co produces a lot of output—at least one line for each directory, and one line for each file it checks out. Here's part of a typical output:

Usrc/usr.sbin/mrcuted/rsrr_var.h
Usrc/usr.sbin/mrouted/vif.c
Usrc/usr.sbin/mrouted/vif.h
cvs checkout: Updating src/usr.sbin/mrouted/common
Usrc/usr.sbin/mrouted/ccmmon/Makefile
cvs checkout: Updating src/usr.sbin/mrcuted/map-mbcne
Usrc/usr.sbin/mrcuted/map-mbcne/Makefile
cvs checkout: Updating src/usr.sbin/mrcuted/mrinfc
Usrc/usr.sbin/mrcuted/mrinfc/Makefile
cvs checkout: Updating src/usr.sbin/mrcuted/mrcuted
Usrc/usr.sbin/mrcuted/mrcuted/Makefile
cvs checkout: Updating src/usr.sbin/mrcuted/mtrace
Usrc/usr.sbin/mrcuted/mtrace/Makefile
cvs checkout: Updating src/usr.sbin/mrcuted/testrsrr
Usrc/usr.sbin/mrcuted/testrsrr/Makefile

The flag at the beginning of the line indicates what action cvs took for the file. The meanings are:

  • U means that cvs updated this file. Either it didn't exist previously, or it was an older version.
  • You won't normally see P on a local update. It implies that cvs patched the file to update it. Otherwise it has the same meaning as U.
  • ? means that cvs found the file in the directory, but it doesn't exist in the repository.
  • M means that cvs found that the file in your working directory has been modified since checkout, but it either didn't need to change it, or it was able to apply the changes cleanly.
  • C found that the file in your working directory has been modified since checkout, and it needed to change it, but it was not able to apply the changes cleanly. You will have to resolve the conflicts manually.

After checkout, check the log file for conflicts. For each conflict, you must check the files manually and possibly recover the contents. See the man page cvs(1) for more details.

Updating an existing tree

Once you have checked out a tree, the ground rules change a little. Next time you do a checkout, files may also need to be deleted. Apart from that, there isn't much difference between checkout and updating. To update the /usr/src directory after updating the repository, do:

# cd /usr/src
# cvs update -Pd

Note that this time we can start in /usr/src: we now have the CVS/ subdirectories in place, so cvs knows what to do without being given any more information.

Using a remote CVS tree

A CVS tree takes up a lot of space, and it's getting bigger all the time. If you don't check out very often, you may find it easier to use anonymous CVS, where the tree is on a different system. FreeBSD provides the server anoncvs.FreeBSD.org for this purpose.

For example, to check out the -CURRENT source tree, perform the following steps:

$ cd /usr    go to the parent directory
$ CVSROOT=:pserver:anoncvs@anoncvs.FreeBSD.org:/home/ncvs    set the server path
$ cvs login    You only need to do this once
Logging in to :pserver:anoncvs@anoncvs.freebsd.org:2401/home/ncvs
CVS password:    enter anoncvs; it doesn't echo
$ cvs co src
cvs server: Updating src
U src/COPYRIGHT
U src/Makefile
U src/ Makefile.incl
(etc)
< Лекция 30 || Лекция 31: 1234 || Лекция 32 >
Бехзод Сайфуллаев
Бехзод Сайфуллаев
Узбекистан, Бухара, Бухарский институт высоких технологий, 2013
Василь Остапенко
Василь Остапенко
Россия