From 6fd2662982a188b03c34df2731c390b55eb333fa Mon Sep 17 00:00:00 2001 From: Wayne Davison Date: Tue, 22 Jul 2008 09:11:34 -0700 Subject: [PATCH] Allow a release from a non-master branch. --- packaging/patch-update | 14 ++++++++++---- packaging/release-rsync | 24 ++++++++++++++++++++++-- 2 files changed, 32 insertions(+), 6 deletions(-) diff --git a/packaging/patch-update b/packaging/patch-update index 62f9980e..f697cd64 100755 --- a/packaging/patch-update +++ b/packaging/patch-update @@ -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 ), @@ -72,7 +73,7 @@ my(%parent, %description); foreach my $patch (@patches) { my $branch = ($local_patch{$patch} ? '' : 'origin/') . "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 () { last if /^@@ /; } @@ -123,7 +124,7 @@ sub update_patch } $parent = "patch/$parent"; } else { - $parent = 'master'; + $parent = $master_branch; } print "======== $patch ========\n"; @@ -174,8 +175,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 () { s#^(diff -up) $tmp_dir/[^/]+/(.*?) $tmp_dir/[^/]+/(.*)#$1 a/$2 b/$3#o; s#^\Q---\E $tmp_dir/[^/]+/([^\t]+)\t.*#--- a/$1#o; diff --git a/packaging/release-rsync b/packaging/release-rsync index 50c940a5..4a141c88 100755 --- a/packaging/release-rsync +++ b/packaging/release-rsync @@ -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('', ); 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, <