[Treepkg-commits] r468 - in trunk: bin treepkg/info

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Fri Nov 5 11:52:07 CET 2010


Author: bricks
Date: 2010-11-05 11:52:06 +0100 (Fri, 05 Nov 2010)
New Revision: 468

Modified:
   trunk/bin/publishdebianpackages.py
   trunk/treepkg/info/data.py
Log:
don't remove packages if a track is deactivated


Modified: trunk/bin/publishdebianpackages.py
===================================================================
--- trunk/bin/publishdebianpackages.py	2010-10-25 14:30:08 UTC (rev 467)
+++ trunk/bin/publishdebianpackages.py	2010-11-05 10:52:06 UTC (rev 468)
@@ -122,8 +122,7 @@
                         scp_flags=scp_flags, cachedir=destdir))
 
 def remove_old_packages(cachedb, newpackages, quiet):
-    newfiles = [package.filename for package in newpackages]
-    oldpackages = cachedb.get_old_packages(newfiles)
+    oldpackages = cachedb.get_old_packages(newpackages)
     for package in oldpackages:
         # better check if the file really exists
         if os.path.isfile(package.filename):

Modified: trunk/treepkg/info/data.py
===================================================================
--- trunk/treepkg/info/data.py	2010-10-25 14:30:08 UTC (rev 467)
+++ trunk/treepkg/info/data.py	2010-11-05 10:52:06 UTC (rev 468)
@@ -78,11 +78,20 @@
             return None
         return Package(*row) 
 
-    def get_old_packages(self, newfiles):
+    def get_old_packages(self, newpackages):
+        '''
+        Returns a list of all packages that are not in
+        newpackages and have a valid track. Therefore packages
+        from a not provided track aren't listed.
+        '''
         SELECT_TMPL = """SELECT * FROM packages 
-                      WHERE filename not in (%s)"""
-        tmp = ", ".join(['?'] * len(newfiles))
-        self.cursor.execute(SELECT_TMPL % tmp, newfiles)
+                      WHERE filename not in (%s) and trackname in (%s)"""
+        newfiles = [p.filename for p in newpackages]
+        tracknames = list(set([p.tackname for p in newpackages]))
+        tmp1 = ", ".join(['?'] * len(newfiles))
+        tmp2 = ", ".join(['?'] * len(tracknames))
+
+        self.cursor.execute(SELECT_TMPL % (tmp1, tmp2), newfiles + tracknames)
         return [Package(*row) for row in self.cursor.fetchall()]
 
     def remove_packages(self, packages):



More information about the Treepkg-commits mailing list