Here's an updated patch, one line was indented wrongly.

Christoph
Allow to delete the uploaded files. Nice for building a local delayed queue in
a cronjob.

Index: dput-0.9.2.21debconf1/dput
===================================================================
--- dput-0.9.2.21debconf1.orig/dput     2006-05-10 13:38:43.000000000 -0500
+++ dput-0.9.2.21debconf1/dput  2006-05-12 13:58:46.000000000 -0500
@@ -31,7 +31,7 @@ config = None
 upload_methods = {}
 files_to_upload = []
 simulate = unsigned_upload = delay_upload = 0
-debug = dinstall = check_only = 0
+debug = dinstall = check_only = unlink_files = 0
 config_file = ''
 
 dput_modules = ('')
@@ -93,6 +93,7 @@ def read_configs(extra_config, debug):
     config.set('DEFAULT', 'allow_unsigned_uploads', '0')
     config.set('DEFAULT', 'run_lintian', '0')
     config.set('DEFAULT', 'run_dinstall', '0')
+    config.set('DEFAULT', 'unlink_files', '0')
     config.set('DEFAULT', 'check_version', '0')
     config.set('DEFAULT', 'scp_compress', '0')
     config.set('DEFAULT', 'default_host_main', '')
@@ -591,6 +592,7 @@ USAGE = """Usage: dput [host] <package(s
    -P: Use passive mode for ftp uploads.
    -s: Simulate the upload only.
    -u: Don't check GnuPG signature.
+   -U: Delete files after uploading.
    -v: Display version information.
    -V: Check the package version and then upload it.
 """
@@ -602,6 +604,7 @@ def main():
     global check_only
     global dinstall
     global unsigned_upload
+    global unlink_files
     global config_file
     global delay_upload
 
@@ -613,11 +616,11 @@ def main():
     # Parse Command Line Options.
     try:
         (opts, args) = getopt.getopt(sys.argv[1:],
-                            'c:dDe:fhHlopPsuvV',
+                            'c:dDe:fhHlopPsuUvV',
                             ['debug', 'dinstall', 'check-only',
                             'check-version', 'config', 'force', 'help',
                             'host-list', 'lintian', 'passive', 'print', 
'simulate',
-                            'unchecked', 'delayed=', 'version'])
+                            'unchecked', 'unlink', 'delayed=', 'version'])
     except getopt.error, msg:
         print msg
         sys.exit(1)
@@ -651,6 +654,8 @@ def main():
             simulate = 1
         elif option in ('-u', '--unchecked'):
             unsigned_upload = 1
+        elif option in ('-U', '--unlink'):
+            unlink_files = 1
         elif option in ('-e', '--delayed'):
             if arg in map(str, range(16)):
                 delay_upload = arg
@@ -883,6 +888,12 @@ def main():
             create_upload_file(name_of_package, host, path, \
                 files_to_upload, debug)
             print "Successfully uploaded packages."
+
+            # Optionally delete the files just uploaded
+            if unlink_files:
+                for file in files_to_upload:
+                    os.unlink(file)
+                print "Deleted uploaded files."
         else:
             print "Simulated upload."
     
Index: dput-0.9.2.21debconf1/dput.1
===================================================================
--- dput-0.9.2.21debconf1.orig/dput.1   2006-05-10 13:38:42.000000000 -0500
+++ dput-0.9.2.21debconf1/dput.1        2006-05-10 13:38:43.000000000 -0500
@@ -73,6 +73,10 @@ unless specified otherwise in the config
 .B --unchecked
 \- don't check GnuPG signature on the changes file.
 .P
+.BR "-U",
+.B --unlink
+\- delete files after uploading them.
+.P
 .BR "-e",
 .B --delayed
 \- Upload to a DELAYED queue, rather than the usual Incoming. This

Attachment: signature.asc
Description: Digital signature

Reply via email to