diff options
Diffstat (limited to 'Tools/scripts/release')
-rw-r--r-- | Tools/scripts/release/Makefile | 48 | ||||
-rw-r--r-- | Tools/scripts/release/README | 26 | ||||
-rwxr-xr-x | Tools/scripts/release/checkdeps.pl | 15 | ||||
-rw-r--r-- | Tools/scripts/release/config | 16 | ||||
-rwxr-xr-x | Tools/scripts/release/doit.sh | 136 | ||||
-rwxr-xr-x | Tools/scripts/release/oneshot.pl | 425 | ||||
-rwxr-xr-x | Tools/scripts/release/scrubindex.pl | 31 | ||||
-rwxr-xr-x | Tools/scripts/release/setup.sh | 19 |
8 files changed, 0 insertions, 716 deletions
diff --git a/Tools/scripts/release/Makefile b/Tools/scripts/release/Makefile deleted file mode 100644 index d48f66cf6c6a..000000000000 --- a/Tools/scripts/release/Makefile +++ /dev/null @@ -1,48 +0,0 @@ -# $FreeBSD$ -# -# The purpose of this Makefile is to setup a standardized environment -# for making package splits. Basically, for each split the organization -# looks like this: -# -# src/release/scripts -# ports/Tools/scripts/release -# RELEASE (e.g. 4.6-RELEASE or 4.6-RC1) -# symlinks to scripts required -# directories used by scripts -# config files -# -# The desire is to provide the scripts with the environment they -# expect while preserving the ability to cvs update them. - -RELEASE?= -SRCSCRIPTDIR?= /usr/src/release/scripts -SRCSCRIPTS= print-cdrom-packages.sh -PORTSCRIPTS!= echo *.pl *.sh -FORCE?= no -PWD!= pwd - -all: - @if [ -z "${RELEASE}" ]; then \ - echo "Release must be specified, i.e.:"; \ - echo " make RELEASE=4.6-RELEASE"; \ - exit 1; \ - fi - @if [ -d "${RELEASE}" -a "${FORCE}" = "no" ]; then \ - echo "The release directory ${RELEASE} already exists."; \ - echo "To force setup type:"; \ - echo " make RELEASE=${RELEASE} FORCE=yes"; \ - exit 1; \ - fi - # We *could* use mkdir -p, but being explicit helps. - mkdir ${RELEASE} -.for SUBDIR in disc1 disc3 gen - mkdir ${RELEASE}/${SUBDIR} -.endfor -.for SCRIPT in ${PORTSCRIPTS} - cd ${RELEASE} && ln -s ../${SCRIPT} . -.endfor -.for SRCSCRIPT in ${SRCSCRIPTS} - cd ${RELEASE} && ln -s ${SRCSCRIPTDIR}/${SRCSCRIPT} . - @echo "Done." -.endfor - cd ${RELEASE} && ln -s ../config . diff --git a/Tools/scripts/release/README b/Tools/scripts/release/README deleted file mode 100644 index 9e1ea5e2270c..000000000000 --- a/Tools/scripts/release/README +++ /dev/null @@ -1,26 +0,0 @@ -$FreeBSD$ - -This directory contains the scripts that are used to break up the packages -for a given release, so that they fit on a particular 4 CD set. They rely -on src/release/scripts/print-cdrom-packages.sh to give preference for -particular packages to be located on particular CDs. - -The approximate procedure is: - -1) CVSROOT/avail lockout -2) cvs rtag RELEASE_4_5_0 ports - -PWD=`pwd` -1) cd $PWD && cvs co -d srcscripts src/release/scripts - OR - cd $PWD/srcscripts && cvs up -dP -2) cd $PWD && cvs co -d releng ports/Tools/scripts/release - OR - cd $PWD/releng && cvs up -dP -3) cd $PWD/releng -4) make RELEASE=4.6-RELEASE SRCSCRIPTDIR=${PWD}/srcscripts -5) cd 4.6-RELEASE -6) ./doit.sh <path to ports/packages to split> - [ answer prompts and stuff as it appears ] - -More documentation to come later. diff --git a/Tools/scripts/release/checkdeps.pl b/Tools/scripts/release/checkdeps.pl deleted file mode 100755 index 3b53aa32f71b..000000000000 --- a/Tools/scripts/release/checkdeps.pl +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/perl -# $FreeBSD$ - -die "$0 <pkgdir> <indexfile>\n" if ($#ARGV != 1); - -$pkg_dir = shift(@ARGV); - -while (<>) { - chomp; - @f = split(/\|/); - @deps = split(/\s+/, $f[8]); - foreach (@deps) { - print "$_\n" if (! -f "$pkg_dir/$_.tgz"); - } -} diff --git a/Tools/scripts/release/config b/Tools/scripts/release/config deleted file mode 100644 index 4f9f4734f9f0..000000000000 --- a/Tools/scripts/release/config +++ /dev/null @@ -1,16 +0,0 @@ -# $FreeBSD$ -# -# disc information -# -# Format: -#disc_name packages_OK distfiles_OK available_space -disc1 1 0 435000000 -disc2 1 0 0 -disc3 1 0 650000000 -disc4 1 0 650000000 -disc5 1 1 0 -disc6 1 1 0 -disc7 1 1 0 -disc8 1 1 0 -disc9 1 1 0 -disca 1 1 0 diff --git a/Tools/scripts/release/doit.sh b/Tools/scripts/release/doit.sh deleted file mode 100755 index 96f42885d51f..000000000000 --- a/Tools/scripts/release/doit.sh +++ /dev/null @@ -1,136 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -pathtoports=$1 -dir=`dirname $0` -if [ "X$dir" = "X." ]; then - dir=`pwd` -fi - -############################################################################## -# -# Tweak these parameters to match your configuration and make sure to check -# that the disc information in config is correct. -# -# You'll also want to place a recent copy of print-cdrom-packages.sh in the -# $scripts directory. -# - - ports="$dir/ports" - dists="$ports/distfiles" - logs="$dir/gen" - pkgs="$ports/packages/All" -scripts="$dir" - xdep_re="^XFree86-3.3.6_1[0-9]$" -#indexfile="INDEX-5" -indexfile="INDEX" -# -############################################################################## - -test -d $logs || mkdir -p $logs - -if [ ! -d "$ports" ]; then - if [ -z "$pathtoports" ]; then - echo "Missing path to ports/packages toree to process for setup.sh." - exit 1 - fi - $scripts/setup.sh $pathtoports - echo "" - echo "Make sure you tweak $dir/config to suit your needs." - echo "" -fi - -if [ ! -f "$logs/restricted.sh" ]; then - echo "===> restricted list generation started at $(date)" - (cd $ports; PORTSDIR=$ports make ECHO_MSG=/usr/bin/true \ - clean-restricted-list > $logs/restricted.sh) - echo "===> restricted list generation ended at $(date)" - echo $(grep -c '^#' $logs/restricted.sh) "ports in $logs/restricted.sh" -fi - -if [ ! -f "$logs/.restricted.done" ]; then - echo "===> cleaning restricted files" - sh $logs/restricted.sh - touch $logs/.restricted.done -fi - -if [ ! -f "$logs/cdrom.sh" ]; then - echo "===> cdrom list generation started at $(date)" - (cd $ports; PORTSDIR=$ports make ECHO_MSG=/usr/bin/true \ - clean-for-cdrom-list > $logs/cdrom.sh) - echo "===> cdrom list generation ended at $(date)" - echo $(grep -c '^#' $logs/cdrom.sh) "ports in $logs/cdrom.sh" -fi - -if [ ! -f "$logs/.cdrom.done" ]; then - echo "===> cleaning non-CDROM-able files" - sh $logs/cdrom.sh - touch $logs/.cdrom.done -fi - -if [ ! -f "$logs/$indexfile" ]; then - echo "===> copying INDEX file from $ports/$indexfile" - $scripts/scrubindex.pl $pkgs $ports/$indexfile > $logs/INDEX - $scripts/checkdeps.pl $pkgs $logs/INDEX | sort -u | \ - sed -e 's/^/missing dependency: /' -fi - -echo -n "Create a list of needed files for each disc? [y] " -read ans -if [ X$ans != Xn -a X$ans != XN ]; then - >$logs/need.ALL - for disc in `cat config | grep -v '#' | sed -e 's/[ ].*//'`; do - echo "disc $disc" >> $logs/need.ALL - $scripts/print-cdrom-packages.sh `echo $disc | sed -e 's/^disc//'` \ - $ports | grep -Ev $xdep_re | tee $logs/need.$disc >> $logs/need.ALL - done -fi - -echo -n "Populate the discs now? [y] " -read ans -if [ X$ans != Xn -a X$ans != XN ]; then - for disc in `ls -d disc? 2>/dev/null`; do - echo "===> deleting $disc" - rm -rf $disc - done - if [ -d "scratch" ]; then - echo "===> deleting scratch" - rm -rf scratch - fi - echo "Calling oneshot.pl config $logs/need.ALL $logs/INDEX $ports $pkgs/../ $dists" - $scripts/oneshot.pl config $logs/need.ALL $logs/INDEX $ports $pkgs/../ $dists - for disc in `ls -d disc? 2>/dev/null`; do - echo "===> cleaning $disc" - if [ -d "$disc/packages/All" ]; then - $scripts/checkdeps.pl $disc/packages/All $disc/packages/INDEX | \ - sort -u | sed -e 's/^/missing package: /' - ( - cd $disc/packages/All; \ - $scripts/scrubindex.pl . ../INDEX > ../INDEX.new; \ - mv ../INDEX.new ../INDEX; \ - find . -name '*.tgz' | xargs /sbin/md5 > CHECKSUM.MD5; \ - ) - fi - du -ck $disc | grep total - done -fi - -echo -n "Make sure the 'needed' packages made it on the right disc(s)? [y] " -read ans -if [ X$ans != Xn -a X$ans != XN ]; then - for disc in `ls -d disc? 2>/dev/null`; do - echo "===> checking $disc" - > $logs/have.$disc - if [ -d "$disc/packages/All" ]; then - ( cd $disc/packages/All && find . -name '*.tgz' | \ - sed -e 's/\.tgz//' -e 's/^\.\///' | sort) > \ - $logs/have.$disc - fi - diff -u $logs/have.$disc $logs/need.$disc | grep -e '^\+' | \ - grep -v -e '^\+* ' | sed -e 's/\+//' > $logs/missing.$disc - if [ -s $logs/missing.$disc ]; then - echo "===> missing required packages on $disc" - cat $logs/missing.$disc - fi - done -fi diff --git a/Tools/scripts/release/oneshot.pl b/Tools/scripts/release/oneshot.pl deleted file mode 100755 index dfb34a3ff6af..000000000000 --- a/Tools/scripts/release/oneshot.pl +++ /dev/null @@ -1,425 +0,0 @@ -#!/usr/bin/perl -# $FreeBSD$ - -use File::Basename; -use File::Find; -use File::Path; - -my $debug = 1; -my $fake = 0; -my $pkg_ext = "tbz"; - -my %discs; -my %distfiles; -my %index; -my %unplaced; - -sub copyDist($$) { - my $disc = shift; - my $name = shift; - - my $distfile = "$disc/distfiles/$name"; - my $dir = dirname($distfile); - mkpath($dir); - - debugPrint("copying $distfile"); - if ($fake) { - system("touch $distfile"); - } else { - system("cp $distDir/$name $distfile"); - } -} - -sub copyPkg($$) { - my $disc = shift; - my $name = shift; - my $pkg = $index{$name}; - my $base = $pkg->{base}; - my $text = $pkg->{INDEX}; - - # Copy over the package. - debugPrint("copying $disc/packages/All/$name.$pkg_ext"); - mkpath("$disc/packages/All"); - if ($fake) { - system("touch $disc/packages/All/$name.$pkg_ext"); - } else { - system("cp -f $pkgDir/All/$name.$pkg_ext $disc/packages/All"); - } - - # Create symlinks in each category. - foreach $cat (@{$pkg->{cats}}) { - debugPrint("creating $disc/packages/$cat/$name.$pkg_ext"); - mkpath("$disc/packages/$cat"); - symlink("../All/$name.$pkg_ext", "$disc/packages/$cat/$name.$pkg_ext"); - } - - # If required created the Latest symlink. - mkpath("$disc/packages/Latest"); - if ($pkg->{latest}) { - symlink("../All/$name.$pkg_ext", "$disc/packages/Latest/$base.$pkg_ext"); - } - - # Add the package to INDEX. - open(BAR, ">>$disc/packages/INDEX"); - print(BAR "$text\n"); - close(BAR); -} - -sub debugPrint($) { - my $line = shift; - print STDERR $line . "\n" if $debug; -} - -sub addDistfile() { - return if -d; - - my $name = $File::Find::name; - my $size = (stat($name))[7]; - - # Don't record distfiles that are of zero length. - if ($size == 0) { - debugPrint("zero length distfile: $name"); - return; - } - - $name =~ s!$distDir/!!; - $distfiles{$name} = $size; -} - -sub doDistfiles() { - my %clumps; - - # Get a list of all the disfiles and their sizes. - find(\&addDistfile, $distDir); - - # xxx Need to clump distfiles so that all the ones for a port end up - # xxx on the same disc. For now each distfile is it's own clump. :( - foreach $distfile (sort keys %distfiles) { - my @a = ($distfile); - $clumps{$distfiles{$distfile}} = \@a; - } - - # Place as many clumps as we can fit on each disc. - foreach $disc (sort keys %discs) { - next if ! $discs{$disc}->{distFlag}; - - my $d = $discs{$disc}; - my @keys = sort { $a <=> $b } (keys %clumps); - - debugPrint("placing distfiles on $disc ..."); - - while ($d->{avail} > 0) { - my $workDone = 0; - - foreach $size (@keys) { - last if ($size > $d->{avail}); - placeDist($disc, $size, @{$clumps{$size}}); - delete $clumps{$size}; - $workDone++; - } - - debugPrint("workDone = $workDone"); - last if (!$workDone); - } - } - - # Put the remaining clumps on the scratch disc. - foreach $size (keys %clumps) { - placeDist('scratch', $size, @{$clumps{$size}}); - } -} - -sub doPackages() { - # Place as many packages as we can fit on each disc. - foreach $disc (sort keys %discs) { - next if ! $discs{$disc}->{pkgFlag}; - - my $d = $discs{$disc}; - - debugPrint("placing packages on $disc ..."); - my $d = $discs{$disc}; - - while ($d->{avail} > 0) { - redoImpact($disc); - - my $workDone = 0; - my @keys = sort { $impact{$a} <=> $impact{$b} } (keys %unplaced); - - foreach $name (@keys) { - if ($impact{$name} <= $d->{avail}) { - placePkg($disc, $name, 0); - $workDone = 1; - last; - } - } - - last if (!$workDone); - } - } - - # Put all the unplaced packages on the scratch disc. - redoImpact('scratch'); - foreach $name (keys %unplaced) { - debugPrint("uplaced package: $name"); - placePkg('scratch', $name, 0); - } -} - -sub isLatest($$) { - my ($name, $base) = @_; - my $link = "$pkgDir/Latest/$base.$pkg_ext"; - my $pkg = "$pkgDir/All/$name.$pkg_ext"; - - return 0 if ! -l $link; - - my ($dev1, $ino1) = stat($pkg); - my ($dev2, $ino2) = stat($pkg); - - return $dev1 == $dev2 && $ino1 == $ino2; -} - -sub placeDist($$@) { - my $disc = shift; - my $size = shift; - my @distfiles = @_; - my $d = $discs{$disc}; - - # Adjust sizes of disc based on the impact of this package. - $d->{used} += $size; - $d->{avail} -= $size; - - # Add each of the distfiles to this disc. - foreach $name (@distfiles) { - debugPrint("placing $name on $disc"); - $d->{distfiles}->{$name}++; - } -} - -sub placeNeeded() { - local *NEEDED; - - debugPrint("reading $neededPkgs and placing packages ..."); - open(NEEDED, $neededPkgs) - or die "unable to read $neededPkgs: $!\n"; - - my $disc; - - $_ = <NEEDED>; - chomp; - - if (/^disc (\w+)/) { - $disc = $1; - } else { - die "invalid first line in $neededPkgs: $_"; - } - - while (<NEEDED>) { - chomp; - - if (/^disc (\w+)/) { - $disc = $1; - next; - } - - if (defined($index{$_})) { - placePkg($disc, $_, 1); - } else { - # die "missing needed package: $_"; - } - } - - close(NEEDED); -} - -sub placePkg($$$) { - my $disc = shift; - my $name = shift; - my $nodeps = shift; - - debugPrint(" placing $name on $disc"); - - my $size; - - if ($nodeps) { - $size = $index{$name}->{size}; - } else { - $size = $impact{$name}; - } - - # Adjust sizes of disc based on the impact of this package. - my $d = $discs{$disc}; - - $d->{used} += $size; - $d->{avail} -= $size; - - # Remove this package from unplaced and place it on this disc. - delete $unplaced{$name}; - $d->{pkgs}->{$name}++; - - # Now do the same thing for the dependencies. - return if $nodeps; - - foreach (@{$index{$name}->{rdeps}}) { - delete $unplaced{$_}; - $d->{pkgs}->{$_}++; - } -} - -sub readDiscInfo() { - local *INFO; - - # Make sure we have at least disc that will be the place overflow will go. - my $disc = { - 'avail' => 0, - 'distFlag' => 0, - 'distfiles' => {}, - 'name' => 'scratch', - 'pkgFlag' => 0, - 'pkgs' => {}, - 'size' => 0, - 'used' => 0 - }; - $discs{'scratch'} = $disc; - - debugPrint("reading $discInfo ..."); - open(INFO, $discInfo) - or die "unable to read $discInfo: $!"; - - while (<INFO>) { - chomp; - next if (/^#/); - - my @f = split(/\s+/); - next if (@f != 4); - - my $disc = { - 'avail' => $f[3], - 'distFlag' => $f[2], - 'distfiles' => {}, - 'name' => $f[0], - 'pkgFlag' => $f[1], - 'pkgs' => {}, - 'size' => $f[3], - 'used' => 0 - }; - - $discs{$f[0]} = $disc; - } - - close(INFO); -} - -sub readIndex() { - local *INDEX; - - debugPrint("reading $indexFilename ..."); - open(INDEX, $indexFilename) - or die "unable to read $indexFilename: $!"; - - while (<INDEX>) { - chomp; - - my @f = split(/\|/); - my $name = $f[0]; - my $base = $name; - - $base =~ s/-[^-]*$//; - - my $pkg = { - 'INDEX' => $_, - 'base' => $base, - 'cats' => [split(/\s+/, $f[6])], - 'distfiles' => {}, - 'latest' => isLatest($name, $base), - 'name' => $name, - 'rdeps' => [split(/\s+/, $f[8])], - 'size' => (stat("$pkgDir/All/$name.$pkg_ext"))[7], - }; - - # debugPrint("adding " . $pkg->{name}); - # die "duplicate package: $name" if ($debug && defined($index{$name})); - $index{$name} = $pkg; - $unplaced{$name} = 1; - } - - close(INDEX); -} - -sub _impact($$) { - my $disc = shift; - my $name = shift; - - # Return previously calculated value if we have it. - return $impact{$name} if defined($impact{$name}); - - my $pkg = $index{$name}; - my @rdeps = @{$pkg->{rdeps}}; - my $size = $pkg->{size}; - - # If no dependencies then the impact is the size of this package. - return $impact{$name} = $size if (!@rdeps); - - # Otherwise the impact is this package's size plus any dependencies - # that are not already on this disc. - foreach (@rdeps) { - $size += $index{$_}->{size} if !defined($discs{$disc}->{pkgs}->{$_}); - } - - return $impact{$name} = $size; -} - -sub redoImpact($) { - my $disc = shift; - - # Reset the impact hashtable. - %impact = undef; - - # Calculate the impact for each unplaced package. - foreach $pkg (keys %unplaced) { - $impact{$pkg} = _impact($disc, $pkg); - } -} - -MAIN: { - if ($#ARGV != 5) { - die "$0 <disc_info> <needed_pkgs> <INDEX> <ports_dir> <pkg_dir> <dist_dir>"; - } - - $discInfo = shift(@ARGV); - $neededPkgs = shift(@ARGV); - $indexFilename = shift(@ARGV); - $portsDir = shift(@ARGV); - $pkgDir = shift(@ARGV); - $distDir = shift(@ARGV); - - readDiscInfo(); - readIndex(); - placeNeeded(); - - # bail if any of the discs have overflowed. - foreach (keys %discs) { - my $avail = $discs{$_}->{avail}; - die "disc $_ has overflowed: avail = $avail\n" if ($avail < 0); - print "avail for disc $_ = $avail\n" if ($debug); - } - - doPackages(); - doDistfiles(); - - # Now that we know where everything should go. Make it so. - foreach $disc (sort keys %discs) { - debugPrint("copying packages to $disc ..."); - foreach $name (keys %{$discs{$disc}->{pkgs}}) { - copyPkg($disc, $name); - } - - debugPrint("copying distfiles to $disc ..."); - foreach $name (keys %{$discs{$disc}->{distfiles}}) { - copyDist($disc, $name); - } - } - - foreach $disc (sort keys %discs) { - debugPrint("$disc: avail = " . $discs{$disc}->{avail}); - } -} diff --git a/Tools/scripts/release/scrubindex.pl b/Tools/scripts/release/scrubindex.pl deleted file mode 100755 index 608d4d359a24..000000000000 --- a/Tools/scripts/release/scrubindex.pl +++ /dev/null @@ -1,31 +0,0 @@ -#!/usr/bin/perl -# $FreeBSD$ - -die "$0 <pkgdir> <indexfile>\n" if ($#ARGV != 1); - -$xdep = 'XFree86-3\.3\.6_10'; -$pkgdir = shift(@ARGV); -#$ext = 'tbz'; -$ext = 'tgz'; - -print STDERR "scrubindex pkgdir: $pkgdir\n"; - -my $cnt = 0; - -LOOP: -while (<>) { - s/$xdep//g; - s/ */ /g; - s/\| /\|/g; - - @f = split('\|'); - next if (! -f "$pkgdir/$f[0].$ext"); - - foreach $dep (split(' ', $f[8])) { - next LOOP if (! -f "$pkgdir/$dep.$ext"); - } - - $cnt++; - print; -} -print STDERR "$cnt lines copied from scrubindex.pl" diff --git a/Tools/scripts/release/setup.sh b/Tools/scripts/release/setup.sh deleted file mode 100755 index 017abd8e2407..000000000000 --- a/Tools/scripts/release/setup.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -dir=$@ -if [ -z $dir ]; then - echo "Usage: $0 <path to dir with ports and packages to split>" - exit 1 -fi -if [ ! -d $dir ]; then - echo "Directory not found. Aborting." - exit 1 -fi - -tar xzvf $dir/ports.tar.gz -cd ports -rm -f distfiles packages -mkdir distfiles packages -(echo "copying packages ..." && cd packages && cp -R $dir/packages/ .) -#(echo "copying distfiles ..." && cd distfiles && cp -R $dir/distfiles/ .) |