Enhanced the release scripts to be able to handle a branch release.
authorWayne Davison <wayned@samba.org>
Thu, 24 Jul 2008 06:21:42 +0000 (23:21 -0700)
committerWayne Davison <wayned@samba.org>
Thu, 24 Jul 2008 06:40:06 +0000 (23:40 -0700)
NEWS
packaging/patch-update
packaging/release-rsync

diff --git a/NEWS b/NEWS
index bc1640e..02be935 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,22 +1,12 @@
 NEWS for rsync 3.1.0 (UNRELEASED)
 Protocol: 30 (unchanged)
-Changes since 3.0.3:
+Changes since 3.0.4:
 
   BUG FIXES:
 
-    - Fixed a bug in the hard-linking code where it would sometimes try to
-      allocate 0 bytes of memory (which fails on system OSes).
-
     - Changed the way --progress overwrites its prior output in order to make
       it nearly impossible for the progress to get overwritten by an error.
 
-    - Improved the keep-alive in-loop check in the generator to work properly
-      in incremental recursion mode.
-
-    - Fixed a couple issues in the --fake-super handling of xattrs when the
-      destination files have root-level attributes (e.g. selinux values) that
-      a non-root copy can't affect.
-
   ENHANCEMENTS:
 
     - Added the --remote-option=OPT (-M OPT) command-line option that is useful
@@ -30,9 +20,6 @@ Changes since 3.0.3:
       MD5 checksum of any transferred file, or all files if --checksum was
       specified (when protocol 30 or above is in effect).
 
-    - Rsync will not send an -e option to the server if the user specifies the
-      --protocol=29 option.  This lets rsync3 use an overly-restrictive server.
-
   DEVELOPER RELATED:
 
     - Added more conditional debug output.
@@ -42,6 +29,3 @@ Changes since 3.0.3:
 
     - The pool_alloc library has received some minor improvements in alignment
       handling.
-
-    - The Makefile will not halt for just a timestamp change on the Makefile
-      or the configure files, only for actual changes in content.
index 62f9980..46d9ff8 100755 (executable)
@@ -13,6 +13,7 @@ my $tmp_dir = "patches.$$";
 
 &Getopt::Long::Configure('bundling');
 &usage if !&GetOptions(
+    'branch|b=s' => \( my $master_branch = 'master' ),
     'skip-check' => \( my $skip_branch_check ),
     'shell|s' => \( my $launch_shell ),
     'gen:s' => \( my $incl_generated_files ),
@@ -53,15 +54,13 @@ if ($incl_generated_files) {
 }
 our $last_touch = time;
 
-my(%patches, %local_patch);
+my %patches;
 
 # Start by finding all patches so that we can load all possible parents.
-open(PIPE, '-|', 'git', 'branch', '-a') or die $!;
+open(PIPE, '-|', 'git', 'branch', '-l') or die $!;
 while (<PIPE>) {
-    if (m# origin/patch/(.*)#) {
+    if (m# patch/(.*)#) {
        $patches{$1} = 1;
-    } elsif (m# patch/(.*)#) {
-       $patches{$1} = $local_patch{$1} = 1;
     }
 }
 close PIPE;
@@ -70,19 +69,23 @@ my @patches = sort keys %patches;
 
 my(%parent, %description);
 foreach my $patch (@patches) {
-    my $branch = ($local_patch{$patch} ? '' : 'origin/') . "patch/$patch";
+    my $branch = "patch/$patch";
     my $desc = '';
-    open(PIPE, '-|', 'git', 'diff', '-U1000', "master...$branch", '--', "PATCH.$patch") or die $!;
+    open(PIPE, '-|', 'git', 'diff', '-U1000', "$master_branch...$branch", '--', "PATCH.$patch") or die $!;
     while (<PIPE>) {
        last if /^@@ /;
     }
     while (<PIPE>) {
        next unless s/^[ +]//;
        if (m#patch -p1 <patches/(\S+)\.diff# && $1 ne $patch) {
-           $parent{$patch} = $1;
+           my $parent = $parent{$patch} = $1;
+           if (!$patches{$parent}) {
+               die "Parent of $patch is not a local branch: $parent\n";
+           }
        }
        $desc .= $_;
     }
+    close PIPE;
     $description{$patch} = $desc;
 }
 
@@ -90,8 +93,11 @@ if (@ARGV) {
     # Limit the list of patches to actually process based on @ARGV.
     @patches = ( );
     foreach (@ARGV) {
-       s{^(patches|patch|origin/patch)/} {};
+       s{^patch(es)?/} {};
        s{\.diff$} {};
+       if (!$patches{$_}) {
+           die "Local branch not available for patch: $_\n";
+       }
        push(@patches, $_);
     }
 }
@@ -123,17 +129,13 @@ sub update_patch
        }
        $parent = "patch/$parent";
     } else {
-       $parent = 'master';
+       $parent = $master_branch;
     }
 
     print "======== $patch ========\n";
 
     sleep 1 while $incl_generated_files && $last_touch >= time;
-    if ($local_patch{$patch}) {
-       system "git checkout patch/$patch" and return 0;
-    } else {
-       system "git checkout --track -b patch/$patch origin/patch/$patch" and return 0;
-    }
+    system "git checkout patch/$patch" and return 0;
 
     my $ok = system("git merge $parent") == 0;
     if (!$ok || $launch_shell) {
@@ -174,8 +176,13 @@ sub update_patch
     close PIPE;
 
     if ($incl_generated_files) {
-       $parent =~ s#.*/##;
-       open(PIPE, '-|', 'diff', '-up', "$tmp_dir/$parent", "$tmp_dir/$patch") or die $!;
+       my $parent_dir;
+       if ($parent eq $master_branch) {
+           $parent_dir = 'master';
+       } else {
+           ($parent_dir) = $parent =~ m{([^/]+)$};
+       }
+       open(PIPE, '-|', 'diff', '-up', "$tmp_dir/$parent_dir", "$tmp_dir/$patch") or die $!;
        while (<PIPE>) {
            s#^(diff -up) $tmp_dir/[^/]+/(.*?) $tmp_dir/[^/]+/(.*)#$1 a/$2 b/$3#o;
            s#^\Q---\E $tmp_dir/[^/]+/([^\t]+)\t.*#--- a/$1#o;
index 50c940a..6fa4213 100755 (executable)
@@ -7,6 +7,7 @@ use strict;
 # ~/samba-rsync-ftp dir will be ready to be rsynced to samba.org.
 
 use Cwd;
+use Getopt::Long;
 use Term::ReadKey;
 use Date::Format;
 
@@ -14,6 +15,13 @@ my $dest = $ENV{HOME} . '/samba-rsync-ftp';
 my $passfile = $ENV{HOME} . '/.rsyncpass';
 my $path = $ENV{PATH};
 
+&Getopt::Long::Configure('bundling');
+&usage if !&GetOptions(
+    'branch|b=s' => \( my $master_branch = 'master' ),
+    'help|h' => \( my $help_opt ),
+);
+&usage if $help_opt;
+
 my $now = time;
 my $cl_today = time2str('* %a %b %d %Y', $now);
 my $year = time2str('%Y', $now);
@@ -56,7 +64,7 @@ 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\)/;
-die "The checkout is not on the master branch.\n" unless $status =~ /^# On branch master\n/;
+die "The checkout is not on the $master_branch branch.\n" unless $status =~ /^# On branch $master_branch\n/;
 
 my $confversion;
 open(IN, '<', 'configure.in') or die $!;
@@ -221,7 +229,7 @@ print $break, <<EOT;
 
 About to:
     - commit all version changes
-    - merge the master branch into the patch/* branches
+    - merge the $master_branch branch into the patch/* branches
     - update the files in the "patches" dir and OPTIONALLY
       (if you type 'y') to launch a shell for each patch
 
@@ -232,11 +240,11 @@ my $ans = <STDIN>;
 system "git commit -a -m 'Preparing for release of $version'" and exit 1;
 
 print "Updating files in \"patches\" dir ...\n";
-system "packaging/patch-update";
+system "packaging/patch-update --branch=$master_branch";
 
 if ($ans =~ /^y/i) {
     print "\nVisiting all \"patch/*\" branches ...\n";
-    system "packaging/patch-update --shell";
+    system "packaging/patch-update --branch=$master_branch --shell";
 }
 
 print $break, <<EOT;
@@ -305,7 +313,7 @@ system "fakeroot tar czf $srctar_file rsync-$version; rm -rf rsync-$version";
 print "Updating files in \"rsync-$version/patches\" dir ...\n";
 mkdir("rsync-$version", 0755);
 mkdir("rsync-$version/patches", 0755);
-system "packaging/patch-update --skip-check --gen=rsync-$version/patches";
+system "packaging/patch-update --skip-check --branch=$master_branch --gen=rsync-$version/patches";
 
 print "Creating $pattar_file ...\n";
 system "fakeroot tar chzf $pattar_file rsync-$version/patches; rm -rf rsync-$version";
@@ -343,3 +351,15 @@ Local changes are done.  When you're satisfied, push the git repository
 and rsync the release files.  Remember to announce the release on *BOTH*
 rsync-announce@lists.samba.org and rsync@lists.samba.org (and the web)!
 EOT
+
+exit;
+
+sub usage
+{
+    die <<EOT;
+Usage: release-rsync [OPTIONS]
+
+-b, --branch=BRANCH   The branch to release (default: master)
+-h, --help            Display this help message
+EOT
+}