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); + } } ###############################################################################
signature.asc
Description: Digital signature