5 use POSIX qw(&strftime);
6 use Getopt::Long qw(:config no_ignore_case);
10 my $sourcewaregdbgit="git://sourceware.org/git/binutils-gdb.git";
11 #my $sourcewaregdbgit="https://gitorious.org/gdb/gdb.git";
12 my $gdbgitmaster=$ENV{"HOME"}."/redhat/gdb-master";
13 my $fedoragitroot=q{git://pkgs.fedoraproject.org};
14 my $rhelgitroot=q{git://pkgs.devel.redhat.com/rpms};
15 my $sourcewaregit=q{git://pkgs.devel.redhat.com/rpms};
16 my $arch_i386=qr{(?:x86|i\d86|ia32)}io;
17 my $arch_x86_64=qr{(?:x8664|x86_64|em64t)}io;
18 my $resultdir=$ENV{"HOME"}."/.hammock-result";
19 my @arches=qw(i386 x86_64);
20 #$ENV{"CCACHE_DISABLE"}="1";delete $ENV{"CCACHE_NODISABLE"};
43 # FIXME: Connect make paralellization to the children.
47 # FIXME: 20100911servpatched-f14:
48 # readchar: Connection reset by peer
49 # Remote side has terminated connection. GDBserver will reopen the connection.
50 # Can't bind address: Address already in use.
51 # <last 2 lines repearing>
58 # Use --dwarf=X0 for: --dwarf=X -fno-debug-types-section
59 # Use --dwarf=X1 for: --dwarf=X -fdebug-types-section
62 my $debug_types_section;
67 "i|userid=s"=>\$userid,
69 "serial"=>sub { $parallel=0; },
70 "parallel"=>sub { $parallel=1; },
71 "d|distro=s{,}"=>\@distro,
72 "cd|componentdistro=s{,}"=>\@componentdistro,
73 "p|path=s{,}"=>\@path,
74 "P|prefixpath=s{,}"=>\@prefixpath,
75 "a|arch=s{,}"=>\@arch,
76 "c|component=s"=>\$component,
77 "s|srcrpm=s"=>\$srcrpm,
79 "target=s{,}"=>\@target,
80 "D|distrojobs=s"=>\$distrojobs,
81 "configure=s"=>\$configure,
83 "gdbgitpie"=>\$gdbgitpie,
85 "gdbserver"=>\$gdbserver,
86 "valgrind"=>\$valgrind,
88 "gdbindex"=>\$gdbindex,
93 "orphanripper!"=>\$orphanripper,
94 "options=s"=>\$options,
97 $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/*");
98 $component and $component=~m{^/home/} and (-f "$component/gdb/gdbtypes.c" or die "$component/gdb/gdbtypes.c not found");
99 $component and $srcrpm and die "-c|--component excludes -s|--srcrpm";
100 $component or $srcrpm or die "-c|--component or -s|--srcrpm required";
101 $component||=""; # Make `eq' not complaining.
102 if ($component ne "gdbgit") {
103 # $gitbranch=(!$branch?"":"-r $branch"); # "-A" is broken with new sourceware.org
104 die "--branch currently unsupported for non-GIT sources" if $branch;
107 !$gdbgitpie or $component eq "gdbgit" or die "--gdbgitpie requires -c gdbgit";
108 @target and ($srcrpm or $component=~/^(?:fedora|rhel)/) and die "--target is available only for baretestsuite modes";
109 $strip and ($srcrpm or $component=~/^(?:fedora|rhel)/) and die "--strip is available only for baretestsuite modes";
110 $options and ($srcrpm or $component=~/^(?:fedora|rhel)/) and die "--options is available only for baretestsuite modes";
111 $gdbserver and $component!~m{^(?:gdbgit|/home/.*)$} and die "--gdbserver is available only for gdbgit||/home/*";
112 $valgrind and $component!~m{^(?:gdbgit|/home/.*)$} and die "--valgrind is available only for gdbgit||/home/*";
113 $asan and $component!~m{^(?:gdbgit|/home/.*)$} and die "--asan is available only for gdbgit||/home/*";
114 $gdbserver and $valgrind and die "--gdbserver and --valgrind are mutually exclusive";
115 ($gdbserver || $valgrind) and ($gdbindex || $dwz) and die "--gdbserver|--valgrind and --gdbindex|--dwz are mutually exclusive";
116 do { $debug_types_section=$dwarf%10; $dwarf=int($dwarf/10); } if ($dwarf||0)>=40;
117 !defined $dwarf or ($dwarf>=2 && $dwarf<=5) or die "--dwarf requires DWARF version number";
118 !defined $stabs or ($stabs>=0 && $stabs<=2) or die "--stabs is 0=off or 1=-gstabs or 2=-gstabs+";
119 ($gdbserver || $valgrind || $gdbindex || $dwz) and ($dwarf || $stabs) and die "--gdbserver|--valgrind|--gdbindex and --dwarf|--stabs are mutually exclusive";
120 $orphanripper=($orphanripper?"orphanripper":"");
122 do { error "Duplicate target: $_\n" if $target{$_}++; } for @target;
123 @arch="x86_64" if @target&&!@arch;
124 for my $file (@file) {
125 -f $file and -r $file or error "-f|--file $file not readable: $!";
127 ###push @file,"/home/jkratoch/redhat/fedora/gdb/master/gdb-index-assert.patch" if $component eq "gdbgit";
128 ###push @file,"/home/jkratoch/redhat/fedora/gdb/master/gdb-dejagnu-go.patch" if $component eq "gdbgit";
129 ###push @file,"/home/jkratoch/t/signed32.patch" if $component eq "gdbgit";
130 $distrojobs=(@target?1:2) if !defined $distrojobs;
131 ###$distrojobs=1; # FIXME
132 $distrojobs=~/^\d+$/ or die "-D|distrojobs must be a number: $distrojobs";
133 $distrojobs>=1 or die "-D|distrojobs must be positive: $distrojobs";
134 error "Excessive arguments: @ARGV" if @ARGV;
135 @arch=@arches if !@arch;
136 my $path=join(":",@path) if @path;
137 @componentdistro and @componentdistro!=@distro and die "--cd|--componentdistro must have the same elements count as -d|--distro";
139 #FIXME:push @file,"/home/jkratoch/t/gdbserverasyncnonstop.patch" if $component eq "gdbgit";
140 push @file,"/home/jkratoch/t/watchpointfork2.patch" if $component eq "gdbgit";
141 #push @file,"/home/jkratoch/t/or1k-m32.patch" if $component eq "gdbgit";
142 #push @file,"/home/jkratoch/t/gdb-breakpointchanged.patch" if $component eq "gdbgit";
144 sub distro_normalize($;$)
149 s{^/var/lib/mock/+}{};
152 s/^(?:devel|rawhide)\b/fedora-rawhide/;
153 s/^(?:epel|centos)-?(\d)/epel-$1/;
154 s/^(?:rhel)-?(\d)/rhel-$1/;
155 s/^(?:f|fedora)-?(\d)/fedora-$1/;
157 @archuse="" if -d "/var/lib/mock/$_";
158 @archuse="i386" if s/-$arch_i386$//o;
159 @archuse="x86_64" if s/-$arch_x86_64$//o;
161 for my $arch (@archuse?@archuse:@arch) {
162 my $dir="/var/lib/mock/$_".(!$arch?"":"-$arch");
163 $force or -d $dir or error "No distro: $dir";
166 return ($_,@archuse);
169 # epel-\d-i386|fedora-\d-i386|fedora-rawhide-i386
171 for my $distroi (0..$#distro) {
172 my $distro=$distro[$distroi];
173 my $componentdistro=$componentdistro[$distroi];
175 if ($componentdistro) {
176 my $force=($componentdistro=~s/!$//);
177 ($componentdistro,@archuse)=distro_normalize $componentdistro,$force;
178 @archuse and die "--cd|--componentdistro must have no arch: ".join(" ",@archuse);
180 ($distro,@archuse)=distro_normalize $distro;
181 $componentdistro||=$distro;
182 @archuse=@arch if !@archuse;
183 for my $archuse (@archuse) {
184 for my $target (@target?@target:undef()) {
185 push @distrouse,{"distro"=>$distro.(!$archuse?"":"-$archuse"),"componentdistro"=>$componentdistro,"target"=>$target};
195 my %opt=map(($_=>1),@opt);
196 warn "+ mkdir".($opt{"-p"} ? " -p" : "")." $dir\n";
197 mkdir $dir or ($opt{"mayexist"} && $!{EEXIST}) or die "mkdir $dir: $!";
206 my %opt=map(($_=>1),@opt);
209 $cmd="set -ex; $cmd";
210 $ok="$log.ok" if $log;
211 $cmd="($cmd; touch $ok) 2>&1|tee -a $log; test -f $ok" if $log;
217 system $cmd and die "$cmd: $!";
221 my $basedir=$ENV{"HOME"}."/hammock";
222 newdir $basedir,"mayexist";
223 my $idbase=strftime("%Y%m%d",localtime());
226 for my $seq (defined $userid ? $userid : (0..99)) {
227 $id=$idbase.(defined $userid ? $seq : sprintf("%02d",$seq));
231 spawn "chmod -R u+w $dir; rm -rf $dir" if -d $dir && $force && defined $userid;
232 error "Directory not free: $dir" if !$id || !$dir || -e $dir;
233 print STDERR "ID = $id | dir = $dir\n";
234 error "No distros specified" if !@distrouse;
235 die "$error errors seen, aborted" if $error;
239 my($fname,$content)=@_;
242 open F,">$fname" or die $fname;
243 print F $content or die $fname;
244 close F or die $fname;
252 open F,"$fname" or die $fname;
254 defined(my $r=<F>) or die $fname;
255 close F or die $fname;
262 link $old,$new or spawn "cp -p '$old' '$new'";
266 spawn "cgclassify -g '*':hammock $$ || :";
268 #spawn "renice +19 -p $$";
269 spawn "renice +5 -p $$||:";
270 spawn "ionice -c3 -p $$";
273 my $resultid="$resultdir/$id";
274 my $resultidxz="$resultid.tar.xz";
275 newdir $resultdir,"mayexist";
276 spawn "rm -rf $resultid" if -d $resultid && $force;
278 unlink $resultidxz or $!{ENOENT} or die "unlink $resultidxz: $!";
279 spawn "uname -r >$dir/kernel";
282 "prefixpath"=>join(":",@prefixpath),
283 "component"=>$component,
286 "file"=>join("\n",@file),
287 "configure"=>$configure,
288 "gdbgitpie"=>$gdbgitpie,
289 "gdbserver"=>$gdbserver,
290 "valgrind"=>$valgrind,
292 "gdbindex"=>$gdbindex,
297 "debug_types_section"=>$debug_types_section,
298 "orphanripper"=>$orphanripper,
301 while (my($name,$val)=each(%dump)) {
303 writefile "$dir/$name","$val\n";
304 ln "$dir/$name","$resultid/$name";
306 for my $file (@file) {
307 newdir "$dir/file.d","mayexist";
308 (my $base=$file)=~s{^.*/}{};
309 my $d="$dir/file.d/$base";
311 newdir "$resultid/file.d","mayexist";
312 ln $d,"$resultid/file.d/$base";
317 my($sub,$in,$out)=@_;
322 open F,$in or die $in;
323 local $_=do { local $/; <F>; } or die $in;
326 &{$sub}() or die $_."\nError substituting $in";
335 for my $file (@file) {
337 $filebase=~s{^.*/}{};
338 my $target="$targetdir/$filebase";
339 # Some *.patch files may be new.
340 # -f $target or die "File $file does not exist at $target";
341 spawn "rm -f $target; cp -p $file $target";
347 while (@distrouse || keys(%child)) {
348 while (keys(%child)<$distrojobs && @distrouse) {
349 my $distrouse=shift @distrouse;
350 my $distro=$distrouse->{"distro"};
351 my $componentdistro=$distrouse->{"componentdistro"};
352 my $target=$distrouse->{"target"};
353 my $rpmbuild="rpmbuild --with buildisa";
359 if ($component=~/^fedora(.*)$/) {
361 $gitbranch="f$1" if $componentdistro=~/^fedora-(\d+)/;
362 $gitbranch="master" if $componentdistro=~/^fedora-rawhide/;
363 die "$component vs. $componentdistro" if !$gitbranch;
364 $gitroot=$fedoragitroot;
367 if ($component=~/^rhel(.*)$/) {
370 $gitroot=$rhelgitroot;
371 $gitpkg="https_proxy= rhpkg";
372 #$gitpkg="https_proxy= fedpkg --dist master";
373 # EPEL still uses Berkeley DB version 8 while F-11+ (F-10?) uses version 9.
374 # Using db_dump and db_load would no longer make it mock compatible.
375 $rpmbuild.=q{ --dbpath $PWD --nodeps};
378 my $distrodirbase=$distro;
379 $distrodirbase.="-$target" if $target;
380 my $distrodir="$dir/$distrodirbase";
382 $log="$distrodir/log";
383 my $out="$distrodir/out";
388 die if !defined $pid;
390 $child{$pid}=$distrodirbase;
395 my $builddir="$distrodir/build";
398 # Do not use mockrun as the rpm database may be in a different version.
399 spawn "rpm -r /var/lib/mock/$distro/root -qa|sort >$out/rpm-qa";
406 $c="export PATH=\"$path:\$PATH\"; $c" if $path;
407 for my $prefixpath (@prefixpath) {
408 $c="export PATH=\"$prefixpath/bin:\$PATH\"; $c";
409 $c="export LD_LIBRARY_PATH=\"$prefixpath/lib64:$prefixpath/lib\${LD_LIBRARY_PATH:+:\$LD_LIBRARY_PATH}\"; $c";
411 $c="export PATH=\"\$HOME/bin:\$PATH\"; $c";
412 # $c="export MAKEFLAGS=\"-j\$[`getconf _NPROCESSORS_ONLN`*3/2]\"; $c";
413 # gdbgit: 16=6m5s 32=5m49s(seen OOM) 64=5m42s
414 $c="export MAKEFLAGS=\"-j24\"; $c";
415 $c="export http_proxy=http://127.0.0.1:3128/; $c";
416 # gdb compile failed, Python runtime initialized with LC_CTYPE=C (a locale with default ASCII encoding), which may cause Unicode compatibility problems. Using C.UTF-8, C.utf8, or UTF-8 (if available) as alternative Unicode-compatible locales is recommended.
417 $c="export PYTHONCOERCECLOCALE=0; $c";
418 $c="set -ex; cd $builddir; $c";
419 die "found ': $c" if $c=~/'/;
420 spawn "mockrun $::distro '$c'";
428 spawn "cd $distrodir; git clone ".($gitbranch eq "auto"?"":"-b $gitbranch")." $gitroot/$gitrepo $component";
429 my $componentdir="$distrodir/$component";
430 -d $componentdir or die "Failed checkout to: $componentdir";
431 if ($gitbranch eq "auto") {
432 $componentdistro=~/^(?:rhel|epel)-(\d+)$/ or die $componentdistro;
434 my @l=grep { m{^\s*origin/rhel-$major\.\d+\s*$} } split /\n/,readfile "cd $componentdir; git branch -r |";
438 s{^\s*origin/rhel-\d+\.(\d+)\s*$}{$1} or die;
441 @l=sort { minor($b) <=> minor($a); } @l;
442 $gitbranch=($l[0]=~m{^\s*origin/(.*?)\s*$})[0] or die;
443 spawn "cd $componentdir; git checkout $gitbranch";
445 copyfiles $componentdir;
446 spawn "cd $componentdir; $gitpkg verrel >$out/verrel";
447 my $glob="$componentdir/*.src.rpm";
448 @{[glob $glob]}==0 or die "Found some before test-srpm: $glob";
449 # No `spawn' as we could get:
450 # error: unpacking of archive failed on file X;4a56efef: cpio: MD5 sum mismatch
451 mockrun "cd $componentdir; $gitpkg srpm";
452 my @srcrpm=(glob $glob);
453 @srcrpm==1 or die "Did not find 1 srcrpm: @srcrpm";
458 my $srcrpmbasename=$srcrpm;
459 $srcrpmbasename=~s{^.*/}{};
460 spawn "cp -p $srcrpm $builddir/$srcrpmbasename";
462 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"};
463 # $rpmbuildlocal="$orphanripper $rpmbuildlocal" if $gitrepo && $gitrepo eq "glibc";
464 mockrun $rpmbuildlocal." --rebuild --with testsuite $srcrpmbasename";
469 if ($component eq "gdbgit") {
470 spawn "git clone ".(!-d $gdbgitmaster ? "" : "--reference $gdbgitmaster")." -b $branch $sourcewaregdbgit $builddir/$component";
471 #spawn "cd $builddir/$component; git fetch";
472 spawn "cd $builddir/$component; git pull";
473 ### spawn "cd $builddir/$component; git checkout -b $component origin/$component; [ \"`git status`\" = \"# On branch $component\nnothing to commit (working directory clean)\" ]";
474 $baretestsuite="$builddir/$component";
477 if ($component=~m{^/home/}) {
478 # 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 || :";
479 spawn "git clone $component $builddir/src; cd $builddir/src";
480 $baretestsuite="$builddir/src";
483 if ($baretestsuite) {
484 for my $file (@file) {
485 my $target="$baretestsuite/$file";
486 if ($file=~m{[.](R?)patch$}) {
489 $fileabs=$ENV{"PWD"}."/$fileabs" if $fileabs!~m{^/};
490 spawn "cd $baretestsuite; patch -${R}p1 <$fileabs";
492 -f $target or $file=~m{/testsuite/} or die "File $file does not exist at $target";
493 spawn "rm -f $target; cp -p $file $target";
495 spawn "rm -f $baretestsuite/gdb/testsuite/dg-extract-results.py"; ### Fedora gdb-no-dg-extract-results-py.patch
499 $errs12.=" --noasan" if !$asan;
500 $errs12.=" -s" if $strip;
501 $errs12.=" --target=$target" if $target;
502 #$errs12.=" --disable-binutils --disable-gas --disable-gold --disable-gprof --disable-ld";
503 #$errs12.=" --binutils" if $gdbindex; # for objcopy but that is needed only for cross-targets
504 $errs12.=" $options" if $options;
505 $errs12.=" $configure" if $configure;
507 # if ($component eq "binutilsgit") {
508 # 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;};
513 do { unlink $_ or warn "$_: $!"; } for "$baretestsuite/gdb/testsuite/gdb.base/break-interp.exp";
515 my @check=($distro=~/-x86_64/ ? qw(-m64 -m32) : -m32);
516 @check=map("check//unix/$_",@check);
517 @check=map({($_,"$_/-fPIE/-pie");} @check) if $gdbgitpie;
518 my %flags=("CC_FOR_TARGET" =>"gcc",
519 "CXX_FOR_TARGET" =>"g++",
520 "GO_FOR_TARGET" =>"gccgo",
521 "GO_LD_FOR_TARGET"=>"gccgo",
523 # for i in ".join(" ",@check).";do $orphanripper make -k \$i || :;done
527 (my $q1=$q0)=~s/ /\\ /g;
528 (my $q2=$q1)=~s/ /\\ /g;
529 return ' RUNTESTFLAGS="'.join(' ',map($_.'='.$flags{$_}.'\ '.$q1,keys(%flags))).' GNATMAKE_FOR_TARGET=gnatmake\ --GCC=gcc\\ '.$q2.'"';
531 die "FIXME" if $valgrind;
532 # .(!$valgrind?"":' RUNTESTFLAGS=--target_board=valgrind')
533 # .(!$valgrind?"":' HAMMOCK_VALGRIND=1')
534 # .(!$valgrind?"":' --without-python') # FIXME: Fix valgrind --suppressions
535 if ($gdbindex||$dwz) {
536 for my $key (keys(%flags)) {
537 writefile "$baretestsuite/hammock-$key",''
538 .' GDB="'.$baretestsuite.'/gdb/gdb -data-directory '.$baretestsuite.'/gdb/data-directory"'
539 .' GDB_ADD_INDEX='.$baretestsuite.'/gdb/contrib/gdb-add-index.sh'
540 .' '.$baretestsuite.'/gdb/contrib/cc-with-tweaks.sh '
541 .(!$gdbindex?'':' -i')
543 .' '.$flags{$key}.' "$@"'
547 mockrun "cd $baretestsuite;"
549 .(!$bfd32?"":' --disable-64-bit-bfd')
550 ."; cd gdb; ulimit -c unlimited; DEJAGNU=$baretestsuite/site.exp "
551 ."$orphanripper make -k ".join(" ",@check)
552 # Ensure serial run if FORCE_PARALLEL=1 is not present
553 ." RUNTESTFLAGS=DUMMY=dummy"
554 .(!$gdbserver?"":' RUNTESTFLAGS=--target_board=native-gdbserver')
555 # Missing GNATMAKE_FOR_TARGET!
556 .(!($gdbindex||$dwz)?"":' RUNTESTFLAGS="'.join(' ',map("$_=/bin/sh\\ $baretestsuite/hammock-$_",keys(%flags))).'"')
557 .(!$dwarf?"":runtestcc "-gdwarf-$dwarf".(!defined $debug_types_section?"":'\ '.($debug_types_section?"-fdebug-types-section":"-fno-debug-types-section"))." -g0")
558 .(!$optimg?"":runtestcc "-Og -g0")
559 .(!$stabs?"":runtestcc(($stabs==1?"-gstabs":"-gstabs+")." -g0"))
560 .(!$parallel?"":' FORCE_PARALLEL=1')
561 ." || :; ".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;};
564 # perl -i -pe 's{\Q'"$HOME"'\E/.*?/build/[^/]*/}{}g' "$base"/*
565 my $HOME=$ENV{"HOME"};
566 for my $file (glob("$out/*.sum"),glob("$out/*.log")) {
567 subst sub { s{\Q$HOME\E/.*?/build/[^/]*/}{}g; },$file;
570 die "internal error" if @target;
573 # Call gdbunpack only if no direct $out directory will be created.
574 # It is needed only for .src.rpm-built testsuites, no matter how .src.rpm
577 if ($component=~/^(?:fedora|rhel)glibc$/) {
578 @testinlog=(qr/={20}TESTING DETAILS={17}/,qr/={20}PLT RELOCS END={18}/);
581 subst sub { s{^.*?\n($testinlog[0]\n.*\n$testinlog[1]\n).*$}{$1}s; },$log,$out;
583 # Applies both to gdb and binutils.
584 spawn "mv $out $out.x; gdbunpack $log; mv $out.x/* $out/; rmdir $out.x";
588 for my $from (glob "$out/*.log") {
589 (my $to=$from).="filt";
590 spawn q{sed -n 's/^==[0-9]*== \([A-Z]\)/\1/p' <}.$from.q{|grep -v '^\(Conditional jump \|Invalid read \|Use of uninitialised value \|Syscall param .* uninitialised byte\)' >}.$to;
594 my $resultout="$resultdir/$id/$distrodirbase";
598 for my $fname (glob "$out/*") {
599 (my $base=$fname)=~s{^.*/}{};
600 my $d="$resultout/$base";
601 warn "+ link $fname $d\n";
608 print STDERR "waiting for ".scalar(keys(%child))." children, ".scalar(@distrouse)." distros to go...\n";
610 next if $pid==-1 && $!==10; # 10==No child processes
611 die "wait()==-1: $!" if $pid==-1;
612 die "not found pid $pid" if !$child{$pid};
613 error "weird status $? for pid $pid: ".$child{$pid} if $?;
614 print STDERR "finished: $pid ".$child{$pid}."\n";
620 spawn "(set -e -o pipefail;cd $resultdir;tar cf - $id|xz -9e >$resultidxz;rm -rf $id)&","bare";
628 $r.=int($sec/(60*60))."h";
631 if ($r || $sec>=60) {
632 $r.=int($sec/60)."m";
640 print STDERR "ID = $id | dir = $dir\n";
641 my $time=timestr(time()-$start);
642 print STDERR "total time=$time\n";
643 writefile "$dir/time","$time\n";
644 die "$error errors seen, aborted" if $error;
645 print STDERR "done\n";