+--branch
authorjkratoch <>
Sun, 3 Jan 2010 19:21:57 +0000 (19:21 +0000)
committerjkratoch <>
Sun, 3 Jan 2010 19:21:57 +0000 (19:21 +0000)
bin/hammock

index a25c20e..aeb561b 100755 (executable)
@@ -36,6 +36,7 @@ my $srcrpm;
 my @file;
 my @target;
 my $configure;
+my $branch;
 # FIXME: Connect make paralellization to the children.
 my $distrojobs;
 die if !GetOptions(
@@ -54,12 +55,19 @@ die if !GetOptions(
     "target=s{,}"=>\@target,
   "D|distrojobs=s"=>\$distrojobs,
     "configure=s"=>\$configure,
+    "branch=s"=>\$branch,
 );
 $component and ($component=~m{^(?:(?:fedora|rhel)(?:gdb|binutils|glibc)|gdbcvs|binutilscvs|archer-.*|/home/.*)$} or die "-c|--component required to be: fedoragdb|rhelgdb|fedorabinutils|rhelbinutils|fedoraglibc|rhelglibc|gdbcvs|binutilscvs|archer-*|/home/*");
 $component and $component=~m{^/home/} and (-f "$component/gdb/gdbtypes.c" or die "$component/gdb/gdbtypes.c not found");
 $component and $srcrpm and die "-c|--component excludes -s|--srcrpm";
 $component or $srcrpm or die "-c|--component or -s|--srcrpm required";
 $component||="";  # Make `eq' not complaining.
+my $cvsbranch;
+if ($component=~/^(gdb|binutils)cvs$/) {
+  $cvsbranch=(!$branch?"-A":"-r $branch");
+} else {
+  die "--branch currently unsupported for non-CVS sources" if $branch;
+}
 @target and ($srcrpm or $component=~/^(?:fedora|rhel)/) and die "--target is available only for baretestsuite modes";
 my %target;
 do { error "Duplicate target: $_\n" if $target{$_}++; } for @target;
@@ -313,11 +321,11 @@ while (@distrouse || keys(%child)) {
       my $which=$1;
       my $cvsbare=$which eq "gdb" ? $gdbcvsbare : $binutilscvsbare;
       if (-d $cvsbare) {
-       spawn "cp -a $cvsbare $builddir/src; cd $builddir/src; cvs update -A";
+       spawn "cp -a $cvsbare $builddir/src; cd $builddir/src; cvs update $cvsbranch";
       } else {
-       spawn "cd $builddir; cvs -q -z3 -d :pserver:anoncvs:\@sourceware.org:/cvs/src co $which";
+       spawn "cd $builddir; cvs -q -z3 -d :pserver:anoncvs:\@sourceware.org:/cvs/src co $cvsbranch $which";
       }
-      spawn "cd $builddir/src".q{; test -z "$(cvs update -A)"};
+      spawn "cd $builddir/src; test -z \"\$(cvs update $cvsbranch)\"";
       $baretestsuite="$builddir/src";
     }