hammock: Update.
authorJan Kratochvil <jan.kratochvil@redhat.com>
Sun, 19 Feb 2017 21:00:21 +0000 (22:00 +0100)
committerJan Kratochvil <jan.kratochvil@redhat.com>
Sun, 19 Feb 2017 21:00:21 +0000 (22:00 +0100)
bin/hammock

index d3851e7..b4e440d 100755 (executable)
@@ -7,15 +7,17 @@ use Getopt::Long qw(:config no_ignore_case);
 use Carp qw(&carp);
 my $start=time();
 
-my $gdbcvsmaster=$ENV{"HOME"}."/redhat/gdb-cvs-master";
-my $binutilscvsmaster=$ENV{"HOME"}."/redhat/binutils-cvs-master";
-my $archermaster=$ENV{"HOME"}."/redhat/gdb-master";
+my $sourcewaregdbgit="git://sourceware.org/git/binutils-gdb.git";
+#my $sourcewaregdbgit="https://gitorious.org/gdb/gdb.git";
+my $gdbgitmaster=$ENV{"HOME"}."/redhat/gdb-master";
 my $fedoragitroot=q{git://pkgs.fedoraproject.org};
 my $rhelgitroot=q{git://pkgs.devel.redhat.com/rpms};
+my $sourcewaregit=q{git://pkgs.devel.redhat.com/rpms};
 my $arch_i386=qr{(?:x86|i\d86|ia32)}io;
 my $arch_x86_64=qr{(?:x8664|x86_64|em64t)}io;
 my $resultdir=$ENV{"HOME"}."/.hammock-result";
 my @arches=qw(i386 x86_64);
+#$ENV{"CCACHE_DISABLE"}="1";delete $ENV{"CCACHE_NODISABLE"};
 
 my $error=0;
 sub error
@@ -40,7 +42,7 @@ my $configure;
 my $branch;
 # FIXME: Connect make paralellization to the children.
 my $distrojobs;
-my $gdbcvspie;
+my $gdbgitpie;
 my $strip;
 # FIXME: 20100911servpatched-f14:
 # readchar: Connection reset by peer
@@ -53,13 +55,14 @@ my $bfd32;
 my $gdbindex;
 my $dwz;
 my $dwarf;
-# Use --dwarf=40 for: --dwarf=4 -fno-debug-types-section
-# Use --dwarf=41 for: --dwarf=4    -fdebug-types-section
+# Use --dwarf=X0 for: --dwarf=X -fno-debug-types-section
+# Use --dwarf=X1 for: --dwarf=X    -fdebug-types-section
 my $optimg;
 my $stabs;
 my $debug_types_section;
 my $orphanripper=1;
 my $options;
+my $asan;
 die if !GetOptions(
   "i|userid=s"=>\$userid,
     "force"=>\$force,
@@ -77,7 +80,7 @@ die if !GetOptions(
   "D|distrojobs=s"=>\$distrojobs,
     "configure=s"=>\$configure,
     "branch=s"=>\$branch,
-    "gdbcvspie"=>\$gdbcvspie,
+    "gdbgitpie"=>\$gdbgitpie,
     "strip"=>\$strip,
     "gdbserver"=>\$gdbserver,
     "valgrind"=>\$valgrind,
@@ -89,30 +92,29 @@ die if !GetOptions(
     "stabs=i"=>\$stabs,
     "orphanripper!"=>\$orphanripper,
     "options=s"=>\$options,
+    "asan"=>\$asan,
 );
-$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{^(?:(?:fedora|rhel)(?:gdb|binutils|glibc)|gdbgit|/home/.*)$} or die "-c|--component required to be: fedoragdb|rhelgdb|fedorabinutils|rhelbinutils|fedoraglibc|rhelglibc|gdbgit|/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?"":"-r $branch"); # "-A" is broken with new sourceware.org
-  $gdbcvsmaster=$ENV{"HOME"}."/redhat/gdb-cvs-master74" if ($branch||"") eq "gdb_7_4-branch";
-} else {
-  die "--branch currently unsupported for non-CVS sources" if $branch;
+if ($component ne "gdbgit") {
+#  $gitbranch=(!$branch?"":"-r $branch"); # "-A" is broken with new sourceware.org
+  die "--branch currently unsupported for non-GIT sources" if $branch;
 }
-!$gdbcvspie or $component eq "gdbcvs" or die "--gdbcvspie requires -c gdbcvs";
+$branch||="master";
+!$gdbgitpie or $component eq "gdbgit" or die "--gdbgitpie requires -c gdbgit";
 @target and ($srcrpm or $component=~/^(?:fedora|rhel)/) and die "--target is available only for baretestsuite modes";
 $strip and ($srcrpm or $component=~/^(?:fedora|rhel)/) and die "--strip is available only for baretestsuite modes";
 $options and ($srcrpm or $component=~/^(?:fedora|rhel)/) and die "--options is available only for baretestsuite modes";
-$gdbserver and $component!~/^(?:gdbcvs|archer-.*)$/ and die "--gdbserver is available only for gdbcvs or archer-*";
-$valgrind and $component!~/^(?:gdbcvs|archer-.*)$/ and die "--valgrind is available only for gdbcvs or archer-*";
+$gdbserver and $component!~m{^(?:gdbgit|/home/.*)$} and die "--gdbserver is available only for gdbgit||/home/*";
+$valgrind and $component!~m{^(?:gdbgit|/home/.*)$} and die "--valgrind is available only for gdbgit||/home/*";
+$asan and $component!~m{^(?:gdbgit|/home/.*)$} and die "--asan is available only for gdbgit||/home/*";
 $gdbserver and $valgrind and die "--gdbserver and --valgrind are mutually exclusive";
 ($gdbserver || $valgrind) and ($gdbindex || $dwz) and die "--gdbserver|--valgrind and --gdbindex|--dwz are mutually exclusive";
-do { $debug_types_section=0; $dwarf=4; } if ($dwarf||0)==40;
-do { $debug_types_section=1; $dwarf=4; } if ($dwarf||0)==41;
-!defined $dwarf or ($dwarf>=2 && $dwarf<=4) or die "--dwarf requires DWARF version number";
+do { $debug_types_section=$dwarf%10; $dwarf=int($dwarf/10); } if ($dwarf||0)>=40;
+!defined $dwarf or ($dwarf>=2 && $dwarf<=5) or die "--dwarf requires DWARF version number";
 !defined $stabs or ($stabs>=0 && $stabs<=2) or die "--stabs is 0=off or 1=-gstabs or 2=-gstabs+";
 ($gdbserver || $valgrind || $gdbindex || $dwz) and ($dwarf || $stabs) and die "--gdbserver|--valgrind|--gdbindex and --dwarf|--stabs are mutually exclusive";
 $orphanripper=($orphanripper?"orphanripper":"");
@@ -122,9 +124,11 @@ do { error "Duplicate target: $_\n" if $target{$_}++; } for @target;
 for my $file (@file) {
   -f $file and -r $file or error "-f|--file $file not readable: $!";
 }
-###push @file,"/home/jkratoch/redhat/fedora/gdb/master/gdb-index-assert.patch" if $component=~/^(?:gdbcvs|archer-)/;
-###push @file,"/home/jkratoch/redhat/fedora/gdb/master/gdb-dejagnu-go.patch"   if $component=~/^(?:gdbcvs|archer-)/;
+###push @file,"/home/jkratoch/redhat/fedora/gdb/master/gdb-index-assert.patch" if $component eq "gdbgit";
+###push @file,"/home/jkratoch/redhat/fedora/gdb/master/gdb-dejagnu-go.patch"   if $component eq "gdbgit";
+###push @file,"/home/jkratoch/t/signed32.patch"   if $component eq "gdbgit";
 $distrojobs=(@target?1:2) if !defined $distrojobs;
+###$distrojobs=1; # FIXME
 $distrojobs=~/^\d+$/ or die "-D|distrojobs must be a number: $distrojobs";
 $distrojobs>=1 or die "-D|distrojobs must be positive: $distrojobs";
 error "Excessive arguments: @ARGV" if @ARGV;
@@ -132,9 +136,10 @@ error "Excessive arguments: @ARGV" if @ARGV;
 my $path=join(":",@path) if @path;
 @componentdistro and @componentdistro!=@distro and die "--cd|--componentdistro must have the same elements count as -d|--distro";
 
-#FIXME:push @file,"/home/jkratoch/t/gdbserverasyncnonstop.patch" if $component=~/^(?:gdbcvs|archer-)/;
-push @file,"/home/jkratoch/t/watchpointfork2.patch" if $component=~/^(?:gdbcvs|archer-)/;
-#push @file,"/home/jkratoch/t/gdb-breakpointchanged.patch" if $component=~/^(?:gdbcvs|archer-)/;
+#FIXME:push @file,"/home/jkratoch/t/gdbserverasyncnonstop.patch" if $component eq "gdbgit";
+push @file,"/home/jkratoch/t/watchpointfork2.patch" if $component eq "gdbgit";
+#push @file,"/home/jkratoch/t/or1k-m32.patch" if $component eq "gdbgit";
+#push @file,"/home/jkratoch/t/gdb-breakpointchanged.patch" if $component eq "gdbgit";
 
 sub distro_normalize($;$)
 {
@@ -260,7 +265,8 @@ sub ln($$)
 # /etc/cgconfig.conf
 spawn "cgclassify -g '*':hammock $$ || :";
 
-spawn "renice +19 -p $$";
+#spawn "renice +19 -p $$";
+spawn "renice +5 -p $$||:";
 spawn "ionice -c3 -p $$";
 newdir $dir;
 $log="$dir/log";
@@ -279,7 +285,7 @@ my %dump=(
   "srcrpm"=>$srcrpm,
   "file"=>join("\n",@file),
   "configure"=>$configure,
-  "gdbcvspie"=>$gdbcvspie,
+  "gdbgitpie"=>$gdbgitpie,
   "gdbserver"=>$gdbserver,
   "valgrind"=>$valgrind,
   "bfd32"=>$bfd32,
@@ -344,14 +350,11 @@ while (@distrouse || keys(%child)) {
     my $distro=$distrouse->{"distro"};
     my $componentdistro=$distrouse->{"componentdistro"};
     my $target=$distrouse->{"target"};
-    my $rpmbuild="rpmbuild";
+    my $rpmbuild="rpmbuild --with buildisa";
 
-    my $cvsbasedir;
     my $gitbranch;
     my $gitpkg;
-    my $cvsroot;
     my $gitroot;
-    my $cvsrepo;
     my $gitrepo;
     if ($component=~/^fedora(.*)$/) {
       $gitrepo=$1;
@@ -366,6 +369,7 @@ while (@distrouse || keys(%child)) {
       $gitbranch="auto";
       $gitroot=$rhelgitroot;
       $gitpkg="https_proxy= rhpkg";
+      #$gitpkg="https_proxy= fedpkg --dist master";
       # EPEL still uses Berkeley DB version 8 while F-11+ (F-10?) uses version 9.
       # Using db_dump and db_load would no longer make it mock compatible.
       $rpmbuild.=q{ --dbpath $PWD --nodeps};
@@ -405,7 +409,9 @@ while (@distrouse || keys(%child)) {
        $c="export LD_LIBRARY_PATH=\"$prefixpath/lib64:$prefixpath/lib\${LD_LIBRARY_PATH:+:\$LD_LIBRARY_PATH}\"; $c";
       }
       $c="export PATH=\"\$HOME/bin:\$PATH\"; $c";
-      $c="export MAKEFLAGS=\"-j\$[`getconf _NPROCESSORS_ONLN`*3/2]\"; $c";
+      # $c="export MAKEFLAGS=\"-j\$[`getconf _NPROCESSORS_ONLN`*3/2]\"; $c";
+      # gdbgit: 16=6m5s 32=5m49s(seen OOM) 64=5m42s
+      $c="export MAKEFLAGS=\"-j24\"; $c";
       $c="export http_proxy=http://127.0.0.1:3128/; $c";
       $c="set -ex; cd $builddir; $c";
       die "found ': $c" if $c=~/'/;
@@ -446,62 +452,29 @@ while (@distrouse || keys(%child)) {
       $srcrpm=$srcrpm[0];
     }
 
-    if ($cvsbasedir) {
-      die if !$cvsroot;
-      die if !$cvsrepo;
-      die if !$cvsbasedir;
-      spawn "cd $distrodir; cvs -q -z3 -d $cvsroot co rpms/$cvsrepo/$cvsbasedir";
-      my $componentdir="$distrodir/rpms/$cvsrepo/$cvsbasedir";
-      -d $componentdir or die "Failed checkout to: $componentdir";
-      # Required for RHEL; Fedora does so automatically.
-      spawn "cd $componentdir/..; cvs -q -z3 -d $cvsroot co common";
-      # Workaround (RHEL-5?) curl which uses `Pragma: nocache' on $http_proxy.
-      subst sub { s{echo "curl }{$&-H 'Pragma: cache' }; },"$componentdir/../common/Makefile.common";
-      copyfiles $componentdir;
-      spawn "cd $componentdir; make verrel >$out/verrel";
-      my $glob="$componentdir/*.src.rpm";
-      @{[glob $glob]}==0 or die "Found some before test-srpm: $glob";
-      # No `spawn' as we could get:
-      # error: unpacking of archive failed on file X;4a56efef: cpio: MD5 sum mismatch
-      mockrun "cd $componentdir; make test-srpm";
-      my @srcrpm=(glob $glob);
-      @srcrpm==1 or die "Did not find 1 srcrpm: @srcrpm";
-      $srcrpm=$srcrpm[0];
-    }
-
     if ($srcrpm) {
       my $srcrpmbasename=$srcrpm;
       $srcrpmbasename=~s{^.*/}{};
       spawn "cp -p $srcrpm $builddir/$srcrpmbasename";
 
       my $rpmbuildlocal=$rpmbuild.q{ --define "_topdir $PWD" --define "_builddir $PWD" --define "_rpmdir $PWD" --define "_sourcedir $PWD" --define "_specdir $PWD" --define "_srcrpmdir $PWD" --define "_build_name_fmt %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm"};
-      $rpmbuildlocal="$orphanripper $rpmbuildlocal" if $cvsrepo && $cvsrepo eq "glibc";
+      # $rpmbuildlocal="$orphanripper $rpmbuildlocal" if $gitrepo && $gitrepo eq "glibc";
       mockrun $rpmbuildlocal." --rebuild --with testsuite $srcrpmbasename";
     }
 
     my $baretestsuite;
 
-    if ($component=~/^(gdb|binutils)cvs$/) {
-      my $which=$1;
-      my $cvsmaster=$which eq "gdb" ? $gdbcvsmaster : $binutilscvsmaster;
-      if (-d $cvsmaster) {
-       spawn "cp -a $cvsmaster $builddir/src; cd $builddir/src; cvs update $cvsbranch";
-      } else {
-       spawn "cd $builddir; cvs -q -z3 -d :pserver:anoncvs:\@sourceware.org:/cvs/src co $cvsbranch $which";
-      }
-      spawn "cd $builddir/src; test -z \"\$(cvs update $cvsbranch)\"";
-      $baretestsuite="$builddir/src";
-    }
-
-    if ($component=~/^archer-/) {
-      spawn "git clone ".(!-d $archermaster ? "" : "--reference $archermaster")." git://sourceware.org/git/archer.git $builddir/$component";
-      spawn "cd $builddir/$component; git fetch";
-      spawn "cd $builddir/$component; git checkout -b $component origin/$component; [ \"`git status`\" = \"# On branch $component\nnothing to commit (working directory clean)\" ]";
+    if ($component eq "gdbgit") {
+      spawn "git clone ".(!-d $gdbgitmaster ? "" : "--reference $gdbgitmaster")." -b $branch $sourcewaregdbgit $builddir/$component";
+      #spawn "cd $builddir/$component; git fetch";
+      spawn "cd $builddir/$component; git pull";
+###      spawn "cd $builddir/$component; git checkout -b $component origin/$component; [ \"`git status`\" = \"# On branch $component\nnothing to commit (working directory clean)\" ]";
       $baretestsuite="$builddir/$component";
     }
 
     if ($component=~m{^/home/}) {
-      spawn "cp -a $component $builddir/src; cd $builddir/src; find -name \"*.[oa]\" -o -name \"*.l[oa]\" -o -name gdb.sum -o -name gdb.log|xargs rm -f; make clean || :";
+      # spawn "cp -a $component $builddir/src; cd $builddir/src; find -name \"*.[oa]\" -o -name \"*.l[oa]\" -o -name gdb.sum -o -name gdb.log|xargs rm -f; make clean || :";
+      spawn "git clone $component $builddir/src; cd $builddir/src";
       $baretestsuite="$builddir/src";
     }
 
@@ -517,24 +490,28 @@ while (@distrouse || keys(%child)) {
          -f $target or $file=~m{/testsuite/} or die "File $file does not exist at $target";
          spawn "rm -f $target; cp -p $file $target";
        }
+       spawn "rm -f $baretestsuite/gdb/testsuite/dg-extract-results.py"; ### Fedora gdb-no-dg-extract-results-py.patch
       }
 
       my $errs12="errs12";
+      $errs12.=" --noasan" if !$asan;
       $errs12.=" -s" if $strip;
       $errs12.=" --target=$target" if $target;
+      #$errs12.=" --disable-binutils --disable-gas --disable-gold --disable-gprof --disable-ld";
       $errs12.=" $options" if $options;
       $errs12.=" $configure" if $configure;
 
-      if ($component eq "binutilscvs") {
-       mockrun "cd $baretestsuite; $errs12; ulimit -c unlimited; $orphanripper make -k check || :; ".q{for file in {gas/testsuite/gas,ld/ld,binutils/binutils}.{sum,log};do ln $file}." $out/binutils-$distro-".q{$(basename $file) || :; done;};
-      } else {
+#      if ($component eq "binutilsgit") {
+#      mockrun "cd $baretestsuite; $errs12; ulimit -c unlimited; $orphanripper make -k check || :; ".q{for file in {gas/testsuite/gas,ld/ld,binutils/binutils}.{sum,log};do ln $file}." $out/binutils-$distro-".q{$(basename $file) || :; done;};
+#      }
+      {
        if ($valgrind) {
          # FIXME
          do { unlink $_ or warn "$_: $!"; } for "$baretestsuite/gdb/testsuite/gdb.base/break-interp.exp";
        }
        my @check=($distro=~/-x86_64/ ? qw(-m64 -m32) : -m32);
        @check=map("check//unix/$_",@check);
-       @check=map({($_,"$_/-fPIE/-pie");} @check) if $gdbcvspie;
+       @check=map({($_,"$_/-fPIE/-pie");} @check) if $gdbgitpie;
        my %flags=("CC_FOR_TARGET"   =>"gcc",
                   "CXX_FOR_TARGET"  =>"g++",
                   "GO_FOR_TARGET"   =>"gccgo",
@@ -591,7 +568,7 @@ while (@distrouse || keys(%child)) {
     }
     if (@testinlog) {
       subst sub { s{^.*?\n($testinlog[0]\n.*\n$testinlog[1]\n).*$}{$1}s; },$log,$out;
-    } elsif ($cvsbasedir || $srcrpm) {
+    } elsif ($srcrpm) {
       # Applies both to gdb and binutils.
       spawn "mv $out $out.x; gdbunpack $log; mv $out.x/* $out/; rmdir $out.x";
     }