1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
|
#!/usr/contrib/bin/perl5
($newvernum, $oldvernum) = @ARGV;
($dir) = `pwd`;
chomp $dir;
print "dir $dir\n";
($path, $prog) = ($dir =~ m,(.*)/(.*),);
($name, $ver) = ($prog =~ m,(.*)-(.*),);
print "prog $prog, name $name, ver $ver\n";
@subs = split( /\./, $ver );
@new = @subs;
@old = @subs;
$new[$#new] ++;
$old[$#old] --;
$newvernum = join( '.', @new ) unless $newvernum;
$oldvernum = join( '.', @old ) unless $oldvernum;
$newprog = $name . "-" . $newvernum;
$oldprog = $name . "-" . $oldvernum;
$newdir = $path . "/" . $newprog;
print "prog $prog, name $name, ver $ver, newprog $newprog, oldprog $oldprog, newdir $newdir\n";
@err = `rm -f $path/$name-*gz*`;
# check in current version
print "doing gmake cifast\n";
# `gmake cifast 2>&1 1>/dev/tty`;
@err = `gmake cifast`;
if( $? ){
die "gmake cifast failed - @err $!\n";
}
# make a distribution
print "doing gmake dist\n";
# `gmake dist 2>&1 1>/dev/tty`;
@err = `gmake dist`;
if( $? ){
die "gmake dist failed - @err $!\n";
}
if( ! -d "$path/OLD" ){
mkdir "$path/OLD",0755 or die "cannot make $path/OLD - $!\n";
}
@err = `cp $path/$prog.tgz $path/OLD `;
if( $? ){ die "cp $path/$prog.tgz $path/OLD failed - $!\n"; }
print "doing: cd $path/OLD; tar zxf $prog.tgz >/dev/tty\n";
@err = `cd $path/OLD; tar zxf $prog.tgz >/dev/tty`;
if( $? ){ die "untar OLD failed - $!\n"; }
$patch="$name-$oldvernum-$ver.patch";
@err = `rm -f $path/$patch $path/$patch.gz`;
open(PATCH,">$path/$patch") or die "cannot open $path/$patch - $!\n";
print PATCH <<"EOF" ;
# $patch Patch File- version $name-$oldvernum to $prog
#
# If the $name software current distribution directory is
# $prog, and this patch file is $patch.gz,
# do the following. NOTE - the -p flag to patch is CRITICAL,
# otherwise the wrong files will get patched.
#
# cd $name-$oldvernum
# gunzip -c $patch.gz | patch -p
# cd ..
# mv $name-$oldvernum $prog
#
# ------ Patch starts here ----
EOF
close PATCH;
print "cd $path/OLD/$prog; diff -c3 -i -r -P ../$name-$oldvernum . >>$path/$patch\n" ;
@err = `cd $path/OLD/$prog; diff -c3 -i -r -P ../$name-$oldvernum . >>$path/$patch` ;
print "doing gzip $path/$patch and md5 digest\n";
@err = `gzip $path/$patch`;
@err = ` md5 $path/$patch.gz | pgp -fast -u papowell\@astart > $path/$patch.gz.md5 `;
print "\nupdating directory name and links\n";
@err = `mv $dir $newdir`;
if( $? ){ die "mv $dir $newdir failed - @err $!\n"; }
if( -l "$path/$name" ){
print "removing link $path/$name\n";
@err = `rm $path/$name`;
if( $? ){ die "rm link $prog failed - @err $!\n"; }
}
@err = `chdir ..; ln -s $newprog $name`;
if( $? ){ die "ln -s $newprog $name failed - @err $!\n"; }
# make new version
`gmake update 2>&1 1>/dev/tty`;
if( $? ){
die "gmake update failed - $!\n";
}
|