Thanks a lot! Regards,
// Ola On Sun, Jun 11, 2006 at 08:00:54PM +0200, Michael Hanke wrote: > tags 372130 patch > thanks > > Hmm, you're obviously correct, sorry about this. I modified the patch to check > whether a source tarball is still needed by parsing the remaining > changes-files > of a particular upstream version. > > I had to modifiy the argument list of the handlePackageFile() function > to include the name of the current changes files. The previous $action > parameter seemed obsolete to me, so I replaced it. I hope I got this right > and > it does not have any unwanted side effects. > > I tested with multiple packages with or without source tarballs listed > in the changes files and it seems to work. > > > Cheers, > > Michael > > > > -- > GPG key: 1024D/3144BE0F Michael Hanke > http://apsy.gse.uni-magdeburg.de/hanke > ICQ: 48230050 > --- /usr/bin/debarchiver 2006-06-10 13:57:07.000000000 +0200 > +++ /home/hanke/bin/my-debarchiver 2006-06-11 19:47:07.914210264 +0200 > @@ -1464,7 +1464,7 @@ > > my $file; > foreach $file (keys %CFiles) { > - handlePackageFile($file); > + handlePackageFile($file, $cfile); > } > installChangesFile($cfile); > mailSuccess(); > @@ -1547,7 +1547,7 @@ > > ############################################################################### > > sub handlePackageFile ($) { > - my ($file, $action) = @_; > + my ($file, $cfile) = @_; > my $distrd = $CConf{Distribution}; > > pdebug(5, "File $_: $CFiles{$file}"); > @@ -1610,10 +1610,43 @@ > cmdaction("$copycmd $file $installto", > "Installing $file to $installto.", > 2); > - } > - cmdaction("$rmcmd $file", > - "Removing $file after it has been installed.", > - 2); > + } > + # flag whether file should get deleted > + my $killfile = 1; > + > + # only do checks of processing source tarballs > + if ($file =~ m/.tar.gz$/) { > + my @upstream_version = split(/-/, $ver); > + $upstream_version = $upstream_version[0]; > + > + # get list of remaining *.changes files of this package > upstream > + # version > + my @otherchangesfiles = <$inputdir/${pkgname}_$upver*.changes>; > + > + # check whether any of the remaining *.changes files does not > match the > + # current package > + CHGSPARSER: foreach my $otherchangesfile (@otherchangesfiles) { > + if (!($otherchangesfile =~ $cfile)) { > + open ( otherchangesfilehandle, > $otherchangesfile); > + > + while ($line = <otherchangesfilehandle>) { > + if ($line =~ > m/${pkgname}_$upver.*\.tar\.gz/) { > + pdebug(4, "Found additional > package using the source tarball of the package. Will not delete it now!"); > + $killfile = 0; > + close(otherchangesfilehandle); > + last CHGSPARSER; > + } > + } > + > + close(otherchangesfilehandle) > + } > + } > + } > + > + if ($killfile) { > + cmdaction("$rmcmd $file", > + "Removing $file after it has been installed.", 2); > + } > } > > > ############################################################################### -- --------------------- Ola Lundqvist --------------------------- / [EMAIL PROTECTED] Annebergsslingan 37 \ | [EMAIL PROTECTED] 654 65 KARLSTAD | | +46 (0)54-10 14 30 +46 (0)70-332 1551 | | http://www.opal.dhs.org UIN/icq: 4912500 | \ gpg/f.p.: 7090 A92B 18FE 7994 0C36 4FE4 18A1 B1CF 0FE5 3DD9 / --------------------------------------------------------------- -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]