Package: debmirror
Version: 1:2.3.1
Severity: wishlist

hi,

some years ago I patched 'debmirror' to have a --trash option
(so that packages are moved to a 'trash' dir instead of being deleted);
this is needed for my 'debdelta' project, that computed diffs to update 
binaries (so it needs the
old package around).

Maybe you may add it to the official package.

a.


-- System Information:
Debian Release: 5.0.3
  APT prefers stable
  APT policy: (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.26-2-openvz-amd64 (SMP w/2 CPU cores)
Locale: LANG=it_IT.UTF-8, LC_CTYPE=it_IT.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages debmirror depends on:
ii  bzip2                    1.0.5-1         high-quality block-sorting file co
ii  libcompress-zlib-perl    2.012-1         Perl module for creation and manip
ii  libdigest-sha1-perl      2.11-2+b1       NIST SHA-1 message digest algorith
ii  liblockfile-simple-perl  0.206-1         Simple advisory file locking
ii  libwww-perl              5.813-1         WWW client/server library for Perl
ii  perl [libdigest-md5-perl 5.10.0-19lenny2 Larry Wall's Practical Extraction 
ii  perl-modules [libnet-per 5.10.0-19lenny2 Core Perl modules
ii  rsync                    3.0.3-2         fast remote file copy program (lik

Versions of packages debmirror recommends:
ii  ed                        0.7-3          The classic unix line editor
ii  gnupg                     1.4.9-3+lenny1 GNU privacy guard - a free PGP rep
ii  patch                     2.5.9-5        Apply a diff file to an original

debmirror suggests no packages.

-- no debconf information

-- 
Andrea Mennucc

"The EULA sounds like it was written by a team of lawyers who want to tell 
me what I can't do, and the GPL sounds like it was written by a human 
being who wants me to know what I can do."
Anonymous,    http://www.securityfocus.com/columnists/420
--- debdelta/debmirror-2.3.1/debmirror	2009-10-08 19:30:56.000000000 +0200
+++ /home/debdev/bin/debmirror_2.3.1_mine	2009-12-08 21:36:27.000000000 +0100
@@ -61,8 +61,9 @@
           [--adddir=directory] [--rsync-extra=foo[,bar,..] ...]
           [--di-dist=foo[,bar,..] ...] [--di-arch=foo[,bar,..] ...]
           [--source|--nosource] [--i18n] [--getcontents] [--md5sums]
           [--ignore-missing-release] [--ignore-release-gpg]
+          [--trash=dir]
           [--ignore=regex] [--exclude=regex] [--include=regex]
           [--exclude-deb-section=regex] [--limit-priority=regex]
           [--timeout=seconds] [--max-batch=number]
           [--rsync-batch=number] [--rsync-options=options]
@@ -269,8 +270,12 @@
 =item --ignore-release-gpg
 
 Don't fail if the F<Release.gpg> file is missing.
 
+=item --trash=dir
+
+When cleaning up, instead of deleting, move files in this directory.
+
 =item --ignore=regex
 
 Never delete any files whose filenames match the regex. May be used multiple times.
 
@@ -500,8 +505,10 @@
 use Compress::Zlib;
 use Digest::MD5;
 use Digest::SHA1;
 use LWP::UserAgent;
+use File::Basename;
+use File::Copy;
 
 # Yeah, I use too many global variables in this program.
 our ($debug, $progress, $verbose, $passive, $skippackages, $getcontents, $i18n);
 our ($ua, $proxy);
@@ -513,8 +520,9 @@
 our $check_downloads = 0;
 our $cleanup=0;
 our $post_cleanup=1;
 our $no_cleanup=0;
+our $trash_dir=0;
 our $do_source=1;
 our $host="ftp.debian.org";
 our $user="anonymous";
 our $passwd="anonymous@";
@@ -608,8 +616,9 @@
 	   'di-arch=s'              => \...@di_arches,
 	   'rsync-extra=s'          => \...@rsync_extra,
 	   'cleanup'                => \$cleanup,
 	   'postcleanup'            => \$post_cleanup,
+  	   'trash=s'                => \$trash_dir,
 	   'nocleanup'              => \$no_cleanup,
 	   'ignore=s'               => \...@ignores,
 	   'exclude=s'              => \...@excludes,
 	   'exclude-deb-section=s'  => \...@excludes_deb_section,
@@ -2221,9 +2230,16 @@
       next if (@di_dists && $file =~ m:installer-\w+/current/images/:);
       if ($files{$file} == 2 && -f $file) {
 	say("deleting $file") if ($verbose);
 	if (! $dry_run) {
+         if ( ! $trash_dir ) { 
 	  unlink $file or die "unlink $file: $!";
+	 } else {
+             rename ($file, ($trash_dir . "/" . basename($file) )) or
+	     { copy ($file, ($trash_dir . "/" . basename($file) )) and
+                   unlink $file
+             }  or  die "cannot move or copy $file to trash: $!";
+	 }
 	}
       }
     }
   } else {

Reply via email to