Tải bản đầy đủ (.pdf) (12 trang)

Tài liệu Chapter-31-Keeping up to date pptx

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (114.16 KB, 12 trang )

10 April 2003, 06:13:07 The Complete FreeBSD (current.mm), page 581
31
Keeping up to date
In this chapter:
• FreeBSD releases
and CVS
• FreeBSD releases
• Getting updates from
the Net
• Creating the source
tree
In this chapter:
• FreeBSD releases
and CVS
• FreeBSD releases
• Getting updates from
the Net
• Creating the source
tree
FreeBSD is constantly changing. The average time that elapses between changes to the
source tree is in the order of a fewminutes. Obviously you can’tkeep up to date with
that pace of change.
In the following three chapters we’ll look at howtokeep up to date. In this chapter,we’ll
look at:
• FreeBSD releases: howthe FreeBSD project comes to terms with the rapid rate of
change, and howitkeeps the system stable despite the changes.
• Howthe system sources are stored, and howyou can update them.
In Chapter 32, Updating the system software,we’ll look at howtoupgrade FreeBSD to a
newrelease, with particular reference to upgrades to FreeBSD Release 5, and in Chapter
33, Custom kernels,we’ll look at building special kernels.
FreeBSD releases and CVS


The FreeBSD project keeps the entire operating system sources in a single master source
tree, called a repository,which is maintained by the Concurrent Versions System,orCVS.
It’sincluded in most multi–CD-ROM distributions of FreeBSD. The repository contains
all versions of FreeBSD back to Release 2.0 and the last release from the Computer
Sciences Research Group of the University of California at Berkeley, 4.4BSD-Lite, upon
which it was based. Forcopyright reasons FreeBSD Release 1 was not included, because
at the time, as the result of the lawsuits described on page 8, it was not permitted to
distribute it freely.That situation changed in early 2002, but it’snow too late to include
FreeBSD Release 1 in the repository.
current.mm,v v4.17 (2003/04/09 19:28:00) 581
582 Chapter 31: Keeping up to date
10 April 2003, 06:13:07 The Complete FreeBSD (../tools/tmac.Mn), page 582
CVS is built on top of the Revision Control System,orRCS. RCS keeps multiple versions
of files, called re visions,ina single RCS file. Each revision has a number indicating its
relationship to the other revisions. The oldest revision has the number 1.1, the next oldest
has the number 1.2, and so on. The RCS file contains the most recent revision of the file
along with instructions for creating anyother revision.
In addition to this linear sequence, it’spossible to update a specific revision in more than
one way.The obvious way to update revision 1.2 would create revision 1.3; but it’salso
possible to create branches,which get numbers like1.2.1.1. Updating revision 1.2.1.1
would create revision 1.2.1.2, and so on. By contrast, the revisions with a two-part
number are collectively called the trunk of the tree.
Symbolic names or tags
In addition to the numeric identifiers, each of which relates only to a single file, RCS
allows you to attach symbolic names to specific revisions. CVS generally calls these
names tags,and that’sthe term you’ll see most often. FreeBSD uses tags to indicate the
revisions corresponding to a particular release. Forexample, in the directory
/usr/src/sys/kern,revision 1.13 of kern_clock.c,revision 1.12 of kern_fork.c and revision
1.21.4.1 of kern_exec.c participate in RELENG_2_1_0_RELEASE.We’ll look at tags in
more detail on page 588.

RCS stores its files either in the same directory as the working files it is tracking, or in a
subdirectory RCS if it exists. Toavoid file name conflicts, RCS appends the characters ,v
to the RCS file, so the working file main.c would correspond to the RCS file main.c,v.
Formore details of RCS,see the man page.
CVS is an extension to RCS that allows concurrent access, making it more suitable for
projects involving more than one person. Unlike RCS,itstores its RCS files in a separate
directory hierarchy, called a repository.Each directory in the working tree contains a
subdirectory CVS with information on the location of the repository,the revisions of the
working files and a tag if the revision isn’tonthe trunk.
If you’re a serious developer,there are a number of advantages to keeping a copyofthe
repository.Ifyou’re a casual user,it’sprobably overkill.
FreeBSD releases
There are four main versions of FreeBSD, each intended for use by different people:
FreeBSD-RELEASE
Fr eeBSD-RELEASE is the latest version of FreeBSD that has been released for general
use. It contains those newfeatures that are stable, and it has been through extensive
testing. You can get it on CD-ROM. FreeBSD-RELEASEs are givenarelease number
that uniquely identifies them, such as 5.0. There are three or four releases a year.Anew
branch is made for each release of FreeBSD.
current.mm,v v4.17 (2003/04/09 19:28:00)
FreeBSD releases 583
10 April 2003, 06:13:07 The Complete FreeBSD (../tools/tmac.Mn), page 583
FreeBSD-STABLE
Fr eeBSD-STABLE is an updated version of FreeBSD-RELEASE to which all possible
bugfixeshav e been applied, to makeitasstable as possible. Fixes are made on a daily
basis. It is based on the same source branch as FreeBSD-RELEASE, so it has all the
features and fewer bugs. It may contain additional features, but newfeatures are tested in
the -CURRENT branch first.
Due to the frequent updates, FreeBSD-STABLE is not available on CD-ROM.
Security fix releases

Despite the name, FreeBSD-STABLE is subject to some problems. Every change to a
source tree has the potential to go wrong. In manycases, you’re more interested in
keeping your system running than you are in getting minor bug fixes. FreeBSD also
maintains a second ‘‘stable’’branch consisting of the release and only very important bug
fixes, including security updates. This branch does not have a well-defined name, but it’s
generally referred to as the security branch.
FreeBSD-CURRENT
Fr eeBSD-CURRENT is the very latest version of FreeBSD, located on the trunk of the
tree. All newdev elopment work is done on this branch of the tree. FreeBSD-CURRENT
is an ever-changing snapshot of the working sources for FreeBSD, including work in
progress, experimental changes and transitional mechanisms that may or may not be
present in the next official release of the software. Manyusers compile almost daily from
FreeBSD-CURRENT sources, but there are times when the sources are uncompilable, or
when the system crashes frequently.The problems are always resolved, but others can
taketheir place. On occasion, keeping up with FreeBSD-CURRENT can be a full-time
business. If you use -CURRENT,you should be prepared to spend a lot of time keeping
the system running. The following extract from the RCS log file for /usr/src/Makefile
should give you a feel for the situation:
$ cvs log Makefile
...
revision 1.152
date: 1997/10/06 09:58:11; author: jkh; state: Exp; lines: +41 -13
Hooboy!
Did I ever spam this file good with that last commit. Despite 3
reviewers, we still managed to revoke the eBones fixes, TCL 8.0 support,
libvgl and a host of other new things from this file in the process of
parallelizing the Makefile. DOH! I think we need more pointy hats - this
particular incident is worthy of a small children’s birthday party’s worth of
pointy hats. ;-)
Icertainly intend to take more care with the processing of aged diffs

in the future, even if it does mean reading through 20K’s worth of them.
Imight also be a bit more anal about asking for more up-to-date changes
before looking at them. ;)
This example also shows the list of the symbolic names for this file, and their
corresponding revision numbers. There is no symbolic name for -CURRENT,because it is
current.mm,v v4.17 (2003/04/09 19:28:00)
584 Chapter 31: Keeping up to date
10 April 2003, 06:13:07 The Complete FreeBSD (../tools/tmac.Mn), page 584
located on the trunk. That’sthe purpose of the line head:,which shows that at the time
of this example, the -CURRENT revision of this file was 1.270.
So whyuse -CURRENT?The main reasons are:
• Youmight be doing development work on some part of the source tree. Keeping
‘‘current’’isanabsolute requirement.
• Youmay be an active tester,which implies that you’re willing to spend time working
through problems to ensure that FreeBSD-CURRENT remains as sane as possible.
Youmay also wish to maketopical suggestions on changes and the general direction
of FreeBSD.
• Youmay just want to keep an eye on things and use the current sources for reference
purposes.
People occasionally have other reasons for wanting to use FreeBSD-CURRENT.The
following are not good reasons:
• Theysee it as a way to be the first on the block with great newFreeBSD features.
This is not a good reason, because there’snoreason to believe that the features will
stay,and there is good reason to believe that theywill be unstable.
• Theysee it as a quick way of getting bug fixes. In fact, it’saway of testing bugfixes.
Bug fixes will be retrofitted into the -STABLE branch as soon as theyhav e been
properly tested.
• Theysee it as the newest officially supported release of FreeBSD. This is incorrect:
FreeBSD-CURRENT is not officially supported. The support is provided by the
users.

If you do decide to use -CURRENT,read the suggestions on page 621.
Snapshots
FreeBSD-CURRENT is available in the form of ISO (CD-ROM) images. From time to
time, at irregular intervals when the tree is relatively stable, the release team makes a
snapshot release from the -CURRENT source tree. Theyare also available on CD-ROM
from some vendors; check the online handbook for details. This is a possible alternative
to online updates if you don’twant the absolute latest version of the system.
Getting updates from the Net
There are a number of possibilities to keep up with the daily modifications to the source
tree. The first question is: howmuch space do you want to invest in keeping the sources?
Table 31-1 shows the approximate space required by different parts of the sources. Note
that the repository keeps growing faster than the source tree, because it includes all old
revisions as well.
current.mm,v v4.17 (2003/04/09 19:28:00)
Getting updates from the Net 585
10 April 2003, 06:13:07 The Complete FreeBSD (../tools/tmac.Mn), page 585
Table 31-1: Approximate source tree sizes
Component Size (MB)
Repository src/sys 250
Repository src 1000
Repository ports 300
Source tree /usr/src/sys 110
Source tree /usr/src 450
Source tree /usr/ports 200
Object tree /usr/obj 160
The size of /usr/src/sys includes the files involved in a single kernel build. You can
remove the entire kernel build directory,but if you want to be able to analyze a panic
dump, you should keep the kernel.debug file in the kernel build directory.This changes
the size of /usr/src as well, of course. The other object files get built in the directory
/usr/obj.Again, you can remove this directory tree entirely if you want, either with the

rm command or with make clean.Similarly,the size of /usr/ports includes a few
ports. It will, of course, growextremely large (manygigabytes) if you start porting all
available packages.
If you’re maintaining multiple source trees (say,for different versions), you still only
need one copyofthe repository.
CVSup
CVSup is a software package that distributes updates to the repository.You can run the
client at regular intervals—for example, with cron (see page 151) to update your
repository.
To get started with CVSup,you need the following:
• Asource tree or repository,which doesn’thav e to be up to date. This is not
absolutely necessary,but the initial setup will be faster if you do it this way.
• Acopyofthe cvsup program. Install it with pkg_add from the CD-ROM
(/cdrom/packages/Latest/cvsup.tbz).
• A cvsupfile,acommand file for cvsup.We’ll look at this below.
• A mirror site from which you can load or update the repository.We’ll discuss this
belowaswell.
The cvsupfile contains a description of the packages you want to download. You can find
all the details in the online handbook, but the following example shows a reasonably
normal file:
current.mm,v v4.17 (2003/04/09 19:28:00)

×