From 0eb5a5fd06e9d9bcdb0374fd9f8151606c2ac07a Mon Sep 17 00:00:00 2001 From: Jan Kratochvil Date: Sun, 10 Jun 2012 10:36:50 +0200 Subject: [PATCH] Many unlisted updates. --- bin/hammock | 105 +++++++++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 82 insertions(+), 23 deletions(-) diff --git a/bin/hammock b/bin/hammock index 2e6fd32..f742304 100755 --- a/bin/hammock +++ b/bin/hammock @@ -11,9 +11,7 @@ my $gdbcvsmaster=$ENV{"HOME"}."/redhat/gdb-cvs-master"; my $binutilscvsmaster=$ENV{"HOME"}."/redhat/binutils-cvs-master"; my $archermaster=$ENV{"HOME"}."/redhat/gdb-master"; my $fedoragitroot=q{git://pkgs.fedoraproject.org}; -#Unknown host cvs.devel.redhat.com. -#my $rhelcvsroot=q{:pserver:anonymous:@cvs.devel.redhat.com:/cvs/dist}; -my $rhelcvsroot=q{:ext:cvs.devel.redhat.com:/cvs/dist}; +my $rhelgitroot=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"; @@ -50,12 +48,15 @@ my $strip; # my $gdbserver; my $valgrind; +my $bfd32; my $gdbindex; my $dwarf; # Use --dwarf=40 for: --dwarf=4 -fno-debug-types-section # Use --dwarf=41 for: --dwarf=4 -fdebug-types-section +my $stabs; my $debug_types_section; my $orphanripper=1; +my $options; die if !GetOptions( "i|userid=s"=>\$userid, "force"=>\$force, @@ -76,9 +77,12 @@ die if !GetOptions( "strip"=>\$strip, "gdbserver"=>\$gdbserver, "valgrind"=>\$valgrind, + "bfd32"=>\$bfd32, "gdbindex"=>\$gdbindex, "dwarf=i"=>\$dwarf, + "stabs=i"=>\$stabs, "orphanripper!"=>\$orphanripper, + "options=s"=>\$options, ); $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"); @@ -94,14 +98,16 @@ if ($component=~/^(gdb|binutils)cvs$/) { !$gdbcvspie or $component eq "gdbcvs" or die "--gdbcvspie requires -c gdbcvs"; @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"; -$gdbserver and $component ne "gdbcvs" and die "--gdbserver is available only for gdbcvs"; -$valgrind and $component ne "gdbcvs" and die "--valgrind is available only for gdbcvs"; +$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 $valgrind and die "--gdbserver and --valgrind are mutually exclusive"; ($gdbserver || $valgrind) and $gdbindex and die "--gdbserver|--valgrind and --gdbindex 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"; -($gdbserver || $valgrind || $gdbindex) and $dwarf and die "--gdbserver|--valgrind|--gdbindex and --dwarf are mutually exclusive"; +!defined $stabs or ($stabs>=0 && $stabs<=2) or die "--stabs is 0=off or 1=-gstabs or 2=-gstabs+"; +($gdbserver || $valgrind || $gdbindex) and ($dwarf || $stabs) and die "--gdbserver|--valgrind|--gdbindex and --dwarf|--stabs are mutually exclusive"; $orphanripper=($orphanripper?"orphanripper":""); my %target; do { error "Duplicate target: $_\n" if $target{$_}++; } for @target; @@ -109,6 +115,8 @@ 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-)/; $distrojobs=(@target?1:2) if !defined $distrojobs; $distrojobs=~/^\d+$/ or die "-D|distrojobs must be a number: $distrojobs"; $distrojobs>=1 or die "-D|distrojobs must be positive: $distrojobs"; @@ -117,6 +125,8 @@ 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"; +###unshift @file,"/home/jkratoch/t/gdbservergnulib.patch" if $component eq "gdbcvs"; + sub distro_normalize($;$) { my($name,$force)=@_; @@ -220,6 +230,24 @@ sub writefile close F or die $fname; } +sub readfile +{ + my($fname)=@_; + + local *F; + open F,"$fname" or die $fname; + local $/=undef(); + defined(my $r=) or die $fname; + close F or die $fname; + return $r; +} + +sub ln($$) +{ + my($old,$new)=@_; + link $old,$new or spawn "cp -p '$old' '$new'"; +} + # /etc/cgconfig.conf spawn "cgclassify -g '*':hammock $$ || :"; @@ -244,23 +272,26 @@ my %dump=( "gdbcvspie"=>$gdbcvspie, "gdbserver"=>$gdbserver, "valgrind"=>$valgrind, + "bfd32"=>$bfd32, "gdbindex"=>$gdbindex, "dwarf"=>$dwarf, + "stabs"=>$stabs, "debug_types_section"=>$debug_types_section, "orphanripper"=>$orphanripper, + "options"=>$options, ); while (my($name,$val)=each(%dump)) { next if !$val; writefile "$dir/$name","$val\n"; - link "$dir/$name","$resultid/$name" or warn "link $dir/$name $resultid/$name: $!"; + ln "$dir/$name","$resultid/$name"; } for my $file (@file) { newdir "$dir/file.d","mayexist"; (my $base=$file)=~s{^.*/}{}; my $d="$dir/file.d/$base"; - link $file,$d or spawn "cp -p '$file' '$d'"; + ln $file,$d; newdir "$resultid/file.d","mayexist"; - link $d,"$resultid/file.d/$base" or warn "link $file $resultid/file.d/$base: $!"; + ln $d,"$resultid/file.d/$base"; } sub subst @@ -305,22 +336,24 @@ while (@distrouse || keys(%child)) { my $cvsbasedir; my $gitbranch; + my $gitpkg; my $cvsroot; my $gitroot; my $cvsrepo; my $gitrepo; if ($component=~/^fedora(.*)$/) { $gitrepo=$1; - $gitbranch="f$1" if $componentdistro=~/^fedora-(\d+)$/; - $gitbranch="master" if $componentdistro=~/^fedora-rawhide$/; + $gitbranch="f$1" if $componentdistro=~/^fedora-(\d+)/; + $gitbranch="master" if $componentdistro=~/^fedora-rawhide/; die "$component vs. $componentdistro" if !$gitbranch; $gitroot=$fedoragitroot; + $gitpkg="fedpkg"; } if ($component=~/^rhel(.*)$/) { - $cvsrepo=$1; - $cvsbasedir="RHEL-$1" if $componentdistro=~/^(?:epel|rhel)-(\d+)$/; - die "$component vs. $componentdistro" if !$cvsbasedir; - $cvsroot=$rhelcvsroot; + $gitrepo=$1; + $gitbranch="auto"; + $gitroot=$rhelgitroot; + $gitpkg="https_proxy= rhpkg"; # 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}; @@ -355,6 +388,7 @@ while (@distrouse || keys(%child)) { my($c)=@_; $c="export PATH=\"$path:\$PATH\"; $c" if $path; + $c="export PATH=\"\$HOME/bin:\$PATH\"; $c"; $c="export MAKEFLAGS=\"-j\$[`getconf _NPROCESSORS_ONLN`*3/2]\"; $c"; $c="export http_proxy=http://127.0.0.1:3128/; $c"; $c="set -ex; cd $builddir; $c"; @@ -366,16 +400,31 @@ while (@distrouse || keys(%child)) { die if !$gitroot; die if !$gitrepo; die if !$gitbranch; - spawn "cd $distrodir; git clone -b $gitbranch $gitroot/$gitrepo $component"; + die if !$gitpkg; + spawn "cd $distrodir; git clone ".($gitbranch eq "auto"?"":"-b $gitbranch")." $gitroot/$gitrepo $component"; my $componentdir="$distrodir/$component"; -d $componentdir or die "Failed checkout to: $componentdir"; + if ($gitbranch eq "auto") { + $componentdistro=~/^(?:rhel|epel)-(\d+)$/ or die $componentdistro; + my $major=$1; + my @l=grep { m{^\s*origin/rhel-$major\.\d+\s*$} } split /\n/,readfile "cd $componentdir; git branch -r |"; + sub minor + { + local $_=$_[0]; + s{^\s*origin/rhel-\d+\.(\d+)\s*$}{$1} or die; + return $_; + } + @l=sort { minor($b) <=> minor($a); } @l; + $gitbranch=($l[0]=~m{^\s*origin/(.*?)\s*$})[0] or die; + spawn "cd $componentdir; git checkout $gitbranch"; + } copyfiles $componentdir; - spawn "cd $componentdir; fedpkg verrel >$out/verrel"; + spawn "cd $componentdir; $gitpkg 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; fedpkg srpm"; + mockrun "cd $componentdir; $gitpkg srpm"; my @srcrpm=(glob $glob); @srcrpm==1 or die "Did not find 1 srcrpm: @srcrpm"; $srcrpm=$srcrpm[0]; @@ -457,6 +506,7 @@ while (@distrouse || keys(%child)) { my $errs12="errs12"; $errs12.=" -s" if $strip; $errs12.=" --target=$target" if $target; + $errs12.=" $options" if $options; $errs12.=" $configure" if $configure; if ($component eq "binutilscvs") { @@ -469,17 +519,24 @@ while (@distrouse || keys(%child)) { my @check=($distro=~/-x86_64/ ? qw(-m64 -m32) : -m32); @check=map("check//unix/$_",@check); @check=map({($_,"$_/-fPIE/-pie");} @check) if $gdbcvspie; + my %flags=("CC_FOR_TARGET" =>"gcc", + "CXX_FOR_TARGET" =>"g++", + "GO_FOR_TARGET" =>"gccgo", + "GO_LD_FOR_TARGET"=>"gccgo", + ); # for i in ".join(" ",@check).";do $orphanripper make -k \$i || :;done sub runtestcc($) { - local($_)=@_; - s/ /\\ /g; - return ' RUNTESTFLAGS="CC_FOR_TARGET=gcc\ '.$_.' CXX_FOR_TARGET=g++\ '.$_.'"' + my($q0)=@_; + (my $q1=$q0)=~s/ /\\ /g; + (my $q2=$q1)=~s/ /\\ /g; + return ' RUNTESTFLAGS="'.join(' ',map($_.'='.$flags{$_}.'\ '.$q1,keys(%flags))).' GNATMAKE_FOR_TARGET=gnatmake\ --GCC=gcc\\ '.$q2.'"'; } mockrun "cd $baretestsuite;" .(!$valgrind?"":' HAMMOCK_VALGRIND=1') ." $errs12" .(!$valgrind?"":' --without-python') # FIXME: Fix valgrind --suppressions + .(!$bfd32?"":' --disable-64-bit-bfd') ."; cd gdb; ulimit -c unlimited; " .(!$gdbserver?"":'DEJAGNU=$HOME/src/runtest-gdbserver/site.exp ') .(!$valgrind?"":'DEJAGNU=$HOME/src/runtest-valgrind/site.exp ') @@ -488,8 +545,10 @@ while (@distrouse || keys(%child)) { ." RUNTESTFLAGS=DUMMY=dummy" .(!$gdbserver?"":' RUNTESTFLAGS=--target_board=native-gdbserver') .(!$valgrind?"":' RUNTESTFLAGS=--target_board=valgrind') - .(!$gdbindex?"":' RUNTESTFLAGS="CC_FOR_TARGET=/bin/sh\ $PWD/cc-with-index.sh\ gcc CXX_FOR_TARGET=/bin/sh\ $PWD/cc-with-index.sh\ g++"') + # Missing GNATMAKE_FOR_TARGET! + .(!$gdbindex?"":' RUNTESTFLAGS="'.join(' ',map($_.'=/bin/sh\ $PWD/cc-with-index.sh\ '.$flags{$_},keys(%flags))).'"') .(!$dwarf?"":runtestcc "-gdwarf-$dwarf".(!defined $debug_types_section?"":'\ '.($debug_types_section?"-fdebug-types-section":"-fno-debug-types-section"))." -g0") + .(!$stabs?"":runtestcc(($stabs==1?"-gstabs":"-gstabs+")." -g0")) .(!$parallel?"":' FORCE_PARALLEL=1') ." || :; ".q{for t in sum log;do for file in testsuite*/gdb.$t;do suffix="${file#testsuite.unix.}"; suffix="${suffix%/gdb.$t}"; ln $file}." $out/gdb".q{$suffix.$t || :; done; done;}; } @@ -532,7 +591,7 @@ while (@distrouse || keys(%child)) { (my $base=$fname)=~s{^.*/}{}; my $d="$resultout/$base"; warn "+ link $fname $d\n"; - link $fname,$d or warn $!; + ln $fname,$d; } exit 0 if $parallel; -- 1.8.3.1