Rename configure.in to configure.ac, the current autoconf standard.
[rsync/rsync.git] / packaging / release-rsync
index 957e892..0b906c4 100755 (executable)
@@ -1,11 +1,11 @@
-#!/usr/bin/perl -w
-use strict;
-
+#!/usr/bin/perl
 # This script expects the directory ~/samba-rsync-ftp to exist and to be a
 # copy of the /home/ftp/pub/rsync dir on samba.org.  When the script is done,
 # the git repository in the current directory will be updated, and the local
 # ~/samba-rsync-ftp dir will be ready to be rsynced to samba.org.
 
+use strict;
+use warnings;
 use Cwd;
 use Getopt::Long;
 use Term::ReadKey;
@@ -14,6 +14,7 @@ use Date::Format;
 my $dest = $ENV{HOME} . '/samba-rsync-ftp';
 my $passfile = $ENV{HOME} . '/.rsyncpass';
 my $path = $ENV{PATH};
+my $make_gen_cmd = 'make -f prepare-source.mak conf && ./config.status && make gen';
 
 &Getopt::Long::Configure('bundling');
 &usage if !&GetOptions(
@@ -60,22 +61,11 @@ die "There is no .git dir in the current directory.\n" unless -d '.git';
 die "'a' must not exist in the current directory.\n" if -e 'a';
 die "'b' must not exist in the current directory.\n" if -e 'b';
 
-open(IN, '-|', 'git status') or die $!;
-my $status = join('', <IN>);
-close IN;
-die "The checkout is not clean:\n", $status unless $status =~ /\nnothing to commit \(working directory clean\)/;
-my($cur_branch) = $status =~ /^# On branch (.+)\n/;
-if ($cur_branch ne $master_branch) {
-    print "The checkout is not on the $master_branch branch.\n";
-    exit 1 if $master_branch ne 'master';
-    print "Do you want to release branch $cur_branch? [n] ";
-    $_ = <STDIN>;
-    exit 1 unless /^y/i;
-    $master_branch = $cur_branch;
-}
+require 'packaging/git-status.pl';
+check_git_state($master_branch, 1, 1);
 
 my $confversion;
-open(IN, '<', 'configure.in') or die $!;
+open(IN, '<', 'configure.ac') or die $!;
 while (<IN>) {
     if (/^RSYNC_VERSION=(.*)/) {
        $confversion = $1;
@@ -83,7 +73,7 @@ while (<IN>) {
     }
 }
 close IN;
-die "Unable to find RSYNC_VERSION in configure.in\n" unless defined $confversion;
+die "Unable to find RSYNC_VERSION in configure.ac\n" unless defined $confversion;
 
 open(IN, '<', 'OLDNEWS') or die $!;
 $_ = <IN>;
@@ -191,7 +181,7 @@ print "\n", $break, <<EOT;
 
 About to:
     - tweak SUBPROTOCOL_VERSION in rsync.h, if needed
-    - tweak the version in configure.in and the spec files
+    - tweak the version in configure.ac and the spec files
     - tweak NEWS and OLDNEWS to ensure header values are correct
     - tweak the date in the *.yo files and generate the manpages
     - generate configure.sh, config.h.in, and proto.h
@@ -205,7 +195,7 @@ my %specvars = ( 'Version:' => $finalversion, 'Release:' => $release,
                 '%define fullversion' => "\%{version}$pre", 'Released' => "$version.",
                 '%define srcdir' => $srcdir );
 my @tweak_files = ( glob('packaging/*.spec'), glob('packaging/*/*.spec'), glob('*.yo'),
-                   qw( configure.in rsync.h NEWS OLDNEWS options.c ) );
+                   qw( configure.ac rsync.h NEWS OLDNEWS options.c ) );
 
 foreach my $fn (@tweak_files) {
     open(IN, '<', $fn) or die $!;
@@ -273,7 +263,7 @@ print $break, <<EOT;
 
 About to:
     - commit all version changes
-    - merge the $master_branch branch into the patch/* branches
+    - merge the $master_branch branch into the patch/$master_branch/* branches
     - update the files in the "patches" dir and OPTIONALLY
       (if you type 'y') to launch a shell for each patch
 
@@ -287,10 +277,14 @@ print "Updating files in \"patches\" dir ...\n";
 system "packaging/patch-update --branch=$master_branch";
 
 if ($ans =~ /^y/i) {
-    print "\nVisiting all \"patch/*\" branches ...\n";
+    print "\nVisiting all \"patch/$master_branch/*\" branches ...\n";
     system "packaging/patch-update --branch=$master_branch --shell";
 }
 
+if (-d 'patches/.git') {
+    system "cd patches && git commit -a -m 'The patches for $version.'" and exit 1;
+}
+
 print $break, <<EOT;
 
 About to:
@@ -308,6 +302,9 @@ EOT
 print "<Press Enter to continue> ";
 $_ = <STDIN>;
 
+# We want to use our passphrase-providing "gpg" script, so modify the PATH.
+$ENV{PATH} = "$curdir/packaging/bin:$path";
+
 my $passphrase;
 while (1) {
     ReadMode('noecho');
@@ -325,17 +322,23 @@ while (1) {
     umask $oldmask;
     $ENV{'GPG_PASSFILE'} = $passfile;
 
-    # We want to use our passphrase-providing "gpg" script, so modify the PATH.
-    $ENV{PATH} = "packaging/bin:$path";
     $_ = `git tag -s -m 'Version $version.' v$version 2>&1`;
-    $ENV{PATH} = $path;
-    unlink($passfile);
     print $_;
     next if /bad passphrase/;
-    last unless /failed/;
-    exit 1;
+    exit 1 if /failed/;
+
+    if (-d 'patches/.git') {
+       $_ = `cd patches && git tag -s -m 'Version $version.' v$version 2>&1`;
+       print $_;
+       exit 1 if /bad passphrase|failed/;
+    }
+
+    unlink($passfile);
+    last;
 }
 
+$ENV{PATH} = $path;
+
 # Extract the generated files from the old tar.
 @_ = @extra_files;
 map { s#^#rsync-$lastversion/# } @_;
@@ -343,7 +346,7 @@ system "tar xzf $lasttar_file @_";
 rename("rsync-$lastversion", 'a');
 
 print "Creating $diff_file ...\n";
-system "./config.status Makefile; make gen; rsync -a @extra_files b/";
+system "$make_gen_cmd && rsync -a @extra_files b/" and exit 1;
 my $sed_script = 's:^((---|\+\+\+) [ab]/[^\t]+)\t.*:\1:';
 system "(git diff v$lastversion v$version; diff -upN a b | sed -r '$sed_script') | gzip -9 >$diff_file";
 system "rm -rf a";