Update of /cvsroot/fink/experimental/dmacks/perlmod/Fink In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29059
Modified Files: Engine-buildlock.pm PkgVersion-buildlock.pm Log Message: ARGH! Whole mainloop is an eval{} so cannot use SIG{__DIE__} to clean up if we crash b/c cannot determine whether SIGDIE was from an eval{} (normal fink occurrence) vs. a failed script or other fatal programmed die(). So... Move buildlock handling from Engine loop into PkgVersion::phase_*(). *Do* keep buildlock info in Config, and have do lock cleanup if bad return from main eval{}. Index: Engine-buildlock.pm =================================================================== RCS file: /cvsroot/fink/experimental/dmacks/perlmod/Fink/Engine-buildlock.pm,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- Engine-buildlock.pm 8 Nov 2004 07:18:20 -0000 1.8 +++ Engine-buildlock.pm 8 Nov 2004 07:47:21 -0000 1.9 @@ -204,6 +204,8 @@ } eval { &$proc(@_); }; if ($@) { + my $locker = Fink::Config::get_option("Buildlock_PkgVersion"); + $locker->clear_buildlock() if ref $locker; print "Failed: $@"; return $? || 1; } @@ -1754,20 +1756,11 @@ ### Double check it didn't already get ### installed in an other loop if (!$package->is_installed() || $op == $OP_REBUILD) { - $package->set_buildlock(); - $SIG{__DIE__} = - sub { - $^S # skip parser errors and die() in eval{} - && - $package->clear_buildlock(); - }; # clear buildlock if we crash while building $package->phase_unpack(); $package->phase_patch(); $package->phase_compile(); $package->phase_install(); $package->phase_build(); - $SIG{__DIE__} = 'DEFAULT'; - $package->clear_buildlock(); } else { &real_install($OP_BUILD, 0, 1, $package->get_name()); } Index: PkgVersion-buildlock.pm =================================================================== RCS file: /cvsroot/fink/experimental/dmacks/perlmod/Fink/PkgVersion-buildlock.pm,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- PkgVersion-buildlock.pm 8 Nov 2004 07:22:13 -0000 1.14 +++ PkgVersion-buildlock.pm 8 Nov 2004 07:47:21 -0000 1.15 @@ -2700,14 +2700,19 @@ Fink::Status->invalidate(); } +# create an exclusive lock for the %f of the parent using dpkg sub set_buildlock { my $self = shift; + # lock is always for parent of family if (exists $self->{parent}) { ($self->{parent})->set_buildlock(); return; } + # bootstrapping occurs before we have package-management tools needed for buildlock + return if $self->{_bootstrap}; + my $lockpkg_minor = 'fink-buildlock-' . $self->get_fullname(); my $lockpkg = $lockpkg_minor . '-' . strftime "%Y.%m.%d-%H.%M.%S", localtime; $self->{_lockpkg} = $lockpkg; @@ -2776,7 +2781,7 @@ "the directory manually to save disk space. ". "Continuing with normal procedure."); - # install $lockpkg (== set lockfile for building $self) + # install lockpkg (== set lockfile for building ourself) print "Setting build lock...\n"; my $debfile = $buildpath.'/'.$lockpkg.'_0-0_'.$debarch.'.deb'; my $lock_failed = &execute("dpkg -i $debfile"); @@ -2784,28 +2789,44 @@ &print_breaking("WARNING: Can't remove binary package file ". "$debfile. ". "This is not fatal, but you may want to remove ". - "the directory manually to save disk space. ". + "the file manually to save disk space. ". "Continuing with normal procedure."); if ($lock_failed) { die "Can't set build lock for " . $self->get_fullname() . "\n"; } + + # save ref to ourself in global config so can remove lock if build dies + Fink::Config::set_options( { "Buildlock_PkgVersion" => $self } ); } +# remove the lock created by set_buildlock sub clear_buildlock { my $self = shift; + # lock is always for parent of family if (exists $self->{parent}) { ($self->{parent})->clear_buildlock(); return; } + # bootstrapping occurs before we have package-management tools needed for buildlock + return if $self->{_bootstrap}; + my $lockpkg = $self->{_lockpkg}; # remove $lockpkg (== clear lock for building $self) print "Removing build lock...\n"; if (&execute("dpkg -r $lockpkg")) { - die "Can't remove build lock for " . $self->get_fullname() . "\n"; + &print_breaking("WARNING: Can't remove package ". + "$lockpkg. ". + "This is not fatal, but you may want to remove ". + "the package manually as it may interfere with ". + "further fink operations. ". + "Continuing with normal procedure."); } + + # we're gone + Fink::Config::set_options( { "Buildlock_PkgVersion" => undef } ); } # returns hashref for the ENV to be used while running package scripts ------------------------------------------------------- This SF.Net email is sponsored by: Sybase ASE Linux Express Edition - download now for FREE LinuxWorld Reader's Choice Award Winner for best database on Linux. http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click _______________________________________________ Fink-commits mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/fink-commits