From b5ff8f8d3fd0194309df8b162cdecc472ba0bd83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mehmet=20D=2E=20Ak=C4=B1n?= Date: Mon, 19 Mar 2007 12:56:55 +0000 Subject: [PATCH] revert. we need thirdparty afterall --- pisi/atomicoperations.py | 5 +++++ pisi/db/itembyrepodb.py | 29 +++++++++++++++++++++-------- pisi/db/packagedb.py | 4 +++- 3 files changed, 29 insertions(+), 9 deletions(-) diff --git a/pisi/atomicoperations.py b/pisi/atomicoperations.py index de392eba..579e2130 100644 --- a/pisi/atomicoperations.py +++ b/pisi/atomicoperations.py @@ -155,6 +155,11 @@ class Install(AtomicOperation): raise Error(_("%s package cannot be installed unless the dependencies are satisfied") % self.pkginfo.name) + # check if package is in database + # If it is not, put it into 3rd party packagedb + if not ctx.packagedb.has_package(self.pkginfo.name): + ctx.packagedb.add_package(self.pkginfo, pisi.db.itembyrepodb.thirdparty) + # check file conflicts file_conflicts = [] for file in self.files.list: diff --git a/pisi/db/itembyrepodb.py b/pisi/db/itembyrepodb.py index a3c4dbe5..84d12195 100644 --- a/pisi/db/itembyrepodb.py +++ b/pisi/db/itembyrepodb.py @@ -25,8 +25,8 @@ import pisi.db.lockeddbshelve as shelve installed, thirdparty, repos, all = range(1, 5) -"""installed is a special database to keep track -of already installed stuff not in any real repository. +"""installed and thirdparty are special databases to keep track +of already installed stuff and third party stuff not in any real repository. repos means search in repositories only, and all means search in repositories and special databases (called tracking databases) """ @@ -41,6 +41,7 @@ class ItemByRepoDB(object): def __init__(self, name): self.d = shelve.LockedDBShelf(name) + #self.dbyrepo = shelve.LockedDBShelf(name + '-byrepo') def close(self): self.d.close() @@ -57,10 +58,18 @@ class ItemByRepoDB(object): @staticmethod def not_just_tracking(data): keys = data.keys() - for x in data.keys(): - if x.startsWith('repo-'): - return True - return False + if len(keys)==1: + if 'trdparty' in keys or 'inst' in keys: + return False + elif len(keys)==2: + if 'trdparty' in keys and 'inst' in keys: + return False + return True + #below is a slower way + #for x in data.keys(): + # if x.startsWith('repo-'): + # return True + #return False def list_if(self, pred): return [ k for k,data in self.d.items() if pred(k, data)] @@ -83,14 +92,16 @@ class ItemByRepoDB(object): assert repo in [all, repos] order = [ 'repo-' + x for x in ctx.repodb.list() ] if repo == all: - order += ['inst'] + order += ['trdparty', 'inst'] return order # def list_repo(self, repo): # return self.dbyrepo[repo] def repo_str(self, repo): - if repo==installed: + if repo==thirdparty: + repo='trdparty' + elif repo==installed: repo='inst' else: assert type(repo) == type("") @@ -100,6 +111,8 @@ class ItemByRepoDB(object): def str_repo(self, str): if str.startswith('repo-'): return str[5:] + elif str=='trdparty': + return thirdparty elif str=='inst': return installed else: diff --git a/pisi/db/packagedb.py b/pisi/db/packagedb.py index 3fd3f719..f4f952d9 100644 --- a/pisi/db/packagedb.py +++ b/pisi/db/packagedb.py @@ -157,4 +157,6 @@ class PackageDB(object): def remove_tracking_package(name, txn = None): # remove the guy from the tracking databases if pkgdb.has_package(name, itembyrepodb.installed, txn=txn): - pkgdb.remove_package(name, itembyrepodb.installed, txn=txn) \ No newline at end of file + pkgdb.remove_package(name, itembyrepodb.installed, txn=txn) + if pkgdb.has_package(name, itembyrepodb.thirdparty, txn=txn): + pkgdb.remove_package(name, itembyrepodb.thirdparty, txn=txn)