revert. we need thirdparty afterall

This commit is contained in:
Mehmet D. Akın
2007-03-19 12:56:55 +00:00
parent c7047759a6
commit b5ff8f8d3f
3 changed files with 29 additions and 9 deletions
+5
View File
@@ -155,6 +155,11 @@ class Install(AtomicOperation):
raise Error(_("%s package cannot be installed unless the dependencies are satisfied") % raise Error(_("%s package cannot be installed unless the dependencies are satisfied") %
self.pkginfo.name) 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 # check file conflicts
file_conflicts = [] file_conflicts = []
for file in self.files.list: for file in self.files.list:
+21 -8
View File
@@ -25,8 +25,8 @@ import pisi.db.lockeddbshelve as shelve
installed, thirdparty, repos, all = range(1, 5) installed, thirdparty, repos, all = range(1, 5)
"""installed is a special database to keep track """installed and thirdparty are special databases to keep track
of already installed stuff not in any real repository. of already installed stuff and third party stuff not in any real repository.
repos means search in repositories only, and all means search in repos means search in repositories only, and all means search in
repositories and special databases (called tracking databases) repositories and special databases (called tracking databases)
""" """
@@ -41,6 +41,7 @@ class ItemByRepoDB(object):
def __init__(self, name): def __init__(self, name):
self.d = shelve.LockedDBShelf(name) self.d = shelve.LockedDBShelf(name)
#self.dbyrepo = shelve.LockedDBShelf(name + '-byrepo')
def close(self): def close(self):
self.d.close() self.d.close()
@@ -57,10 +58,18 @@ class ItemByRepoDB(object):
@staticmethod @staticmethod
def not_just_tracking(data): def not_just_tracking(data):
keys = data.keys() keys = data.keys()
for x in data.keys(): if len(keys)==1:
if x.startsWith('repo-'): if 'trdparty' in keys or 'inst' in keys:
return True return False
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): def list_if(self, pred):
return [ k for k,data in self.d.items() if pred(k, data)] 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] assert repo in [all, repos]
order = [ 'repo-' + x for x in ctx.repodb.list() ] order = [ 'repo-' + x for x in ctx.repodb.list() ]
if repo == all: if repo == all:
order += ['inst'] order += ['trdparty', 'inst']
return order return order
# def list_repo(self, repo): # def list_repo(self, repo):
# return self.dbyrepo[repo] # return self.dbyrepo[repo]
def repo_str(self, repo): def repo_str(self, repo):
if repo==installed: if repo==thirdparty:
repo='trdparty'
elif repo==installed:
repo='inst' repo='inst'
else: else:
assert type(repo) == type("") assert type(repo) == type("")
@@ -100,6 +111,8 @@ class ItemByRepoDB(object):
def str_repo(self, str): def str_repo(self, str):
if str.startswith('repo-'): if str.startswith('repo-'):
return str[5:] return str[5:]
elif str=='trdparty':
return thirdparty
elif str=='inst': elif str=='inst':
return installed return installed
else: else:
+3 -1
View File
@@ -157,4 +157,6 @@ class PackageDB(object):
def remove_tracking_package(name, txn = None): def remove_tracking_package(name, txn = None):
# remove the guy from the tracking databases # remove the guy from the tracking databases
if pkgdb.has_package(name, itembyrepodb.installed, txn=txn): if pkgdb.has_package(name, itembyrepodb.installed, txn=txn):
pkgdb.remove_package(name, itembyrepodb.installed, txn=txn) 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)