Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 3 Mar 95 09:26:59 -0500
From:      crtb@helix.nih.gov (Chuck Bacon)
To:        questions@FreeBSD.org
Subject:   CDROM usable for building kernel?
Message-ID:  <9503031426.AA22803@helix.nih.gov>

next in thread | raw e-mail | index | archive | help
I just received O'Reilly's 4.4BSD manual set, with accompanying CDROM
of 4.4BSD-Lite.  To find out if there's much code in common with
FreeBSD2.0R, I decided to compare /cdrom/4.4BSD-Lite/usr/src/sys with
/usr/src/sys.  So I cobbled a perl script which asks the central
question: for each file in the /usr/src/sys tree, is there a matching
file in the /cdrom/4.4BSD-Lite/usr/src/sys tree which is identical?
If so, it's a candidate to become a symlink and save me some disk space.

Well, I was disappointed.  Only 11 out of 602 files had identical mates
on the /cdrom.  Following a sneaking suspicion, I found that if I
replace `cmp $a $b` in the script with `diff $a $b` and checked for an
output of two or less lines, I had 87 out of 602 files which I could
replace with symlinks.

A single line has been added to all of the source files, for RCS.
It looks like:
 * stdarg.h,v 1.5 1994/08/02 07:39:09 davidg Exp

I'd like someone with a 2.0R FreeBSD CDROM, who is tracking -current
or 2.1dev., or any other variant, to run this script, and on a wider
tree than /usr/src/sys, perhaps /usr/src.  I'd like to know about
how much disk space an updated distribution will take, and how that
grows over time.  Obviously, I could build a 2.0R kernel easily with
no disk space, other than symlinks (and binaries of course :-).
I guess what I'm interested in is the dynamics of a static CDROM,
and the rate at which it becomes obsolete.

At the risk of derision for making such grungy code public, here's
the script I ran.  Rewrite to suit.
=======================
#!/usr/local/bin/perl
#	src-comp.pl
# Compare the CDROM and my /usr/src/sys directories, making a table of
# similarities and differences.

$cdrom = '/cdrom/4.4BSD-Lite/usr/src/sys';
$disk = '/usr/src/sys';
@diskdu = `cd $disk; du`;		# Get names of all directories
for (@diskdu) { s/^\d+\s+\.\/(.*)\s+/$1/; }	# Keep only the names
pop (@diskdu);				# Discard "Total" line
for $d (@diskdu) {		# For each directory, get all the plain files
  $ddir = "$disk/$d";
  $cdir = "$cdrom/$d";
  chop (@ls = `ls $ddir`);
  for $file (@ls) {
    next if -d "$ddir/$file";
    if (-r "$ddir/$file" && -r "$cdir/$file") {
      @result = `diff $ddir/$file $cdir/$file`;
      if (@result > 2) {
	push (@nohits, "$d/$file");
       } else {
	push (@hits, "$d/$file");
        print "HIT $d/$file\n";		# These 'prints' are volatile.
	print @result;			# I want to see that alleged RCS stuff
       }
     }
   }
 }
open (R,"> report") || die "Can't write report: $!\n";
print R "Hits\n";
for (@hits) { print R '  ', $_, "\n"; }
print R "\nChanged files\n";
for (@nohits) { print R '  ', $_, "\n"; }
close (R);
 }
=======================
	Chuck Bacon - crtb@helix.nih.gov
		ABHOR SECRECY	-   DEFEND PRIVACY




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?9503031426.AA22803>