tags 372130 patch
thanks

On Fri, Jun 09, 2006 at 06:41:52PM +0200, Ola Lundqvist wrote:
<snip>
> In any case I made this as a wishlist bug and if someone can point me
> to a good solution or even provide a patch for it, than I'm more than
> happy.

Ok, I tried to make US happy. I attached a small patch that seems to do
the work. I do not know whether it works in any case, but it worked for
all of my tests.

Please note, that I have virtually no experience with Perl, so there is
probably a much more elegant/efficient way to do this.


HTH,

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-10 13:53:43.871757480 +0200
@@ -1611,9 +1611,31 @@
                  "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 *.dsc files
+                       my @dscfiles = <$inputdir/${pkgname}_$upver*.dsc>;
+
+                       # check whether any of the *.dsc files does not match 
the current package
+                       foreach my $dscfile (@dscfiles) {
+                               if ($dscfile ne 
"$inputdir/${pkgname}_$ver.dsc") {
+                                       pdebug(4, "Found additional package 
using the source tarball of the package. Will not delete it now!");
+                                       $killfile = 0;
+                               }
+                       }
+               }
+    
+               if ($killfile) {
+                               cmdaction("$rmcmd $file",
+                "Removing $file after it has been installed.",
+                2);
+               }
 }
 
 ###############################################################################

Attachment: signature.asc
Description: Digital signature

Reply via email to