Mentioned that the daemon now logs connections.
[rsync/rsync.git] / packaging / release-rsync
index fa6761d..e70691e 100755 (executable)
@@ -31,33 +31,65 @@ my $note = <<EOT;
 EOT
 
 my $live = shift;
+my $skipping = '';
 
 if ($live) {
     print "This will release a new version of rsync onto an unsuspecting world.\n";
 } else {
     print "**** TESTMODE **** (add \"live\" arg to avoid this)\n";
     $dest =~ s#([^/]+$)#tmp/$1#;
+    $skipping = ' ** SKIPPING **';
 }
 die "$dest does not exist\n" unless -d $dest;
 
-print "\nPlease enter the version number of this release: ";
-my $version = <STDIN>;
-chomp $version;
+print "Checking out the latest rsync into $releasedir...\n";
+
+mkdir($releasedir, 0755) or die $! unless -d $releasedir;
+chdir($releasedir) or die $!;
+
+system "rm -rf rsync rsync-*";
+
+system "cvs checkout -P rsync";
+
+chdir('rsync') or die $!;
+
+my($version, $lastversion);
+open(IN, 'configure.in') or die $!;
+while (<IN>) {
+    if (/^RSYNC_VERSION=(.*)/) {
+       $version = $lastversion = $1;
+       last;
+    }
+}
+close IN;
+
+$lastversion =~ s/(\d+)cvs$/ $1 - 1 /e;
+$version =~ s/cvs/pre1/ || $version =~ s/pre(\d+)/ 'pre' . ($1 + 1) /e;
+
+print "\nPlease enter the version number of this release: [$version] ";
+chomp($_ = <STDIN>);
+if ($_ eq '.') {
+    $version =~ s/pre\d+//;
+} elsif ($_ ne '') {
+    $version = $_;
+}
 $version =~ s/[-.]*pre[-.]*/pre/;
 
+$lastversion =~ s/(\d+)pre\d+$/ $1 - 1 /e unless $version =~ /pre/;
+
 my $cvstag = "release-$version";
 $cvstag =~ s/[.]/-/g;
 $cvstag =~ s/pre/-pre/;
 
-print "Enter the previous version to produce a patch against: ";
-my $lastversion = <STDIN>;
-chomp $lastversion;
+print "Enter the previous version to produce a patch against: [$lastversion] ";
+chomp($_ = <STDIN>);
+$lastversion = $_ if $_ ne '';
 $lastversion =~ s/[-.]*pre[-.]*/pre/;
 
-print "Please enter the RPM release number of this release (default 1): ";
-my $release = <STDIN>;
-chomp $release;
-$release = 1 if $release eq '';
+my $release = 1;
+print "Please enter the RPM release number of this release: [$release] ";
+chomp($_ = <STDIN>);
+$release = $_ if $_ ne '';
 
 my $diffdir;
 if ($lastversion =~ /pre/) {
@@ -84,8 +116,6 @@ print <<EOT;
 \$release is "$release"
 
 About to:
-    - create and/or clean the \$releasedir
-    - checkout rsync into \$releasedir
     - tweak NEWS and OLDNEWS to update the release date
     - tweak the version in configure.in, configure, and the spec files
     - tweak the date in the *.yo files and re-generate the man pages
@@ -96,15 +126,6 @@ EOT
 print "<Press Enter to continue> ";
 $_ = <STDIN>;
 
-mkdir($releasedir, 0755) or die $! unless -d $releasedir;
-chdir($releasedir) or die $!;
-
-system "rm -rf rsync rsync-$version rsync-$lastversion";
-
-system "cvs checkout -P rsync";
-
-chdir('rsync') or die $!;
-
 print $dots;
 
 system "./prepare-source && touch proto.h";
@@ -151,8 +172,8 @@ system "cvs -q diff | egrep -v '^(===============|RCS file: |retrieving revision
 print <<EOT;
 
 About to:
-    - "cvs commit" all changes
-    - "cvs tag" this release as $cvstag
+    - "cvs commit" all changes$skipping
+    - "cvs tag" this release as $cvstag$skipping
 
 EOT
 if ($live) {
@@ -162,13 +183,15 @@ if ($live) {
     system "cvs commit -m 'Preparing for release of $version'";
     system "cvs tag -F $cvstag .";
 } else {
-    print "\n**** Skipping cvs commit and tagging in TESTMODE ****\n";
+    print "** Skipping prompt in TESTMODE **\n";
 }
 
 print <<EOT;
 
 About to do the following in the samba-rsync-ftp dir:
     - change the diffs in the patches dir to include generated files
+    - move the old tar/diff files into the appropriate old-* dirs
+    - hard-link the new tar/diff files to the old files on samba.org$skipping
     - create release tar "$tarfile"
     - create release diffs
     - update README, *NEWS, TODO, and cvs.log
@@ -193,22 +216,36 @@ system "rsync -aC --exclude=.cvsignore rsync/ rsync-$version";
 if ($diffdir ne $dest) {
     chdir($dest) or die $!;
 
-    # We need to run this regardless of $lastversion's "pre"ness. */
+    # We need to run this regardless of $lastversion's "pre"ness.
+    my @moved_files;
     foreach my $fn (glob('rsync*pre*.tar.gz*'), glob('rsync*pre*-NEWS')) {
-       rename($fn, "old-previews/$fn");
+       link($fn, "old-previews/$fn") or die $!;
+       push(@moved_files, $fn);
     }
-    system "rm -f rsync*pre*.diffs.gz*";
 
     if ($version !~ /pre/) {
        foreach my $fn (glob('rsync*.tar.gz*'), glob('rsync*-NEWS')) {
-           rename($fn, "old-versions/$fn");
+           next if $fn =~ /^rsync.*pre/;
+           link($fn, "old-versions/$fn") or die $!;
+           push(@moved_files, $fn);
        }
 
        foreach my $fn (glob('rsync*.diffs.gz*')) {
-           rename($fn, "old-patches/$fn");
+           next if $fn =~ /^rsync.*pre/;
+           link($fn, "old-patches/$fn") or die $!;
+           push(@moved_files, $fn);
        }
     }
 
+    # Optimize our future upload (in the absence of --detect-renamed) by
+    # uploading the above hard-linked files that we are about to delete.
+    if ($live) {
+       system "rsync -avHC --include='rsync*.gz*' --include='old-*/' --exclude='*' . samba.org:/home/ftp/pub/rsync";
+    }
+    foreach (@moved_files, glob("rsync*pre*.diffs.gz*")) {
+       unlink($_);
+    }
+
     chdir($releasedir) or die $!;
 }
 system "fakeroot tar czf $tarfile rsync-$version";
@@ -229,7 +266,7 @@ system "rsync -a $cvsroot/CVSROOT/rsync.updates $dest/cvs.log";
 system "yodl2html -o $dest/rsync.html rsync/rsync.yo";
 system "yodl2html -o $dest/rsyncd.conf.html rsync/rsyncd.conf.yo";
 
-system "rm -rf rsync rsync-$version rsync-$lastversion";
+system "rm -rf rsync rsync-*";
 
 if ($live) {
     chdir($dest) or die $!;