[Pkg-debile-commits] [debile-master] 16/28: Handle multiple runs by deleting the previous version

Léo Cavaillé leo.cavaille-guest at alioth.debian.org
Wed Aug 21 13:36:51 UTC 2013


This is an automated email from the git hooks/post-receive script.

leo.cavaille-guest pushed a commit to branch master
in repository debile-master.

commit 538f5a94724ba858169f92899346e31b1572fe0b
Author: Léo Cavaillé <leo at cavaille.net>
Date:   Sat Aug 17 10:20:08 2013 +0200

    Handle multiple runs by deleting the previous version
---
 lucy/archive.py  |   21 ++++++++++++---------
 lucy/incoming.py |    6 +++++-
 2 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/lucy/archive.py b/lucy/archive.py
index 5546ce8..e758c84 100644
--- a/lucy/archive.py
+++ b/lucy/archive.py
@@ -64,16 +64,19 @@ class UserRepository:
     def get_apt_entry(self):
         return
 
-    def add_source(self, source):
-        dsc = os.path.join(self.incoming_path, 'source', source.dsc)
-        print ([
-            'reprepro',
-            '-b', os.path.join(self.pool_path, 'source'),
-            'includedsc',
-            'sid',
-            dsc
-            ])
+    def add_source(self, source, remove_before=False):
+        # FIXME: suite, hardcoded everywhere here
+        if remove_before:
+            out, err, ret = run_command([
+                'reprepro',
+                '-b', os.path.join(self.pool_path, 'source'),
+                'removesrc',
+                'sid',
+                source.name,
+                source.version
+                ])
 
+        dsc = os.path.join(self.incoming_path, 'source', source.dsc)
         out, err, ret = run_command([
             'reprepro',
             '-b', os.path.join(self.pool_path, 'source'),
diff --git a/lucy/incoming.py b/lucy/incoming.py
index 377706e..9827d54 100644
--- a/lucy/incoming.py
+++ b/lucy/incoming.py
@@ -94,8 +94,12 @@ def accept_source(changes, user):
     if previous_runs:
         run_nb = max(previous_runs) + 1
         print "Source acceptance : previous uploads of this package were made, this is run %s" % str(run_nb)
+        # We will replace in the user repository the old source (previous run)
+        # with this one so we need to remove the old one
+        remove_before = True
     else:
         run_nb = 1
+        remove_before = False
 
     s = Source( name=changes['source'],
                 version=changes['version'],
@@ -107,7 +111,7 @@ def accept_source(changes, user):
 
     try:
         ur = UserRepository(owner)
-        ur.add_source(s)
+        ur.add_source(s, remove_before)
 #           path = move_to_pool_source(s, changes)
         # Cleaning up !
         for entry in changes.get_files():

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-debile/debile-master.git



More information about the Pkg-debile-commits mailing list