# HG changeset patch # User Bjoern Ricks # Date 1288954326 0 # Node ID b7aad4cb58bbb241b5749d95ee787d4da194970f # Parent dcec034fed9784b95960e09082be5483d340fbf5 don't remove packages if a track is deactivated diff -r dcec034fed97 -r b7aad4cb58bb bin/publishdebianpackages.py --- a/bin/publishdebianpackages.py Mon Oct 25 14:30:08 2010 +0000 +++ b/bin/publishdebianpackages.py Fri Nov 05 10:52:06 2010 +0000 @@ -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): diff -r dcec034fed97 -r b7aad4cb58bb treepkg/info/data.py --- a/treepkg/info/data.py Mon Oct 25 14:30:08 2010 +0000 +++ b/treepkg/info/data.py Fri Nov 05 10:52:06 2010 +0000 @@ -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):