From 826197e906047f747dfcd00054958d96d9f75591 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eray=20=C3=96zkural?= Date: Thu, 23 Mar 2006 02:11:23 +0000 Subject: [PATCH] * fix: invalidate build number if reinstalled package is coming from another distribution (and just what is a distribution here?) pending fix: we need a global id for repositories (not user specified) * fix: invalidate everything. goddamn it. (kidding) * fix: itembyrepodb: has_key when repo given, needs guard statement, and fix typo in method name... --- pisi/atomicoperations.py | 20 ++++++++++++-------- pisi/installdb.py | 1 + pisi/itembyrepodb.py | 5 +++-- pisi/packagedb.py | 5 ++++- 4 files changed, 20 insertions(+), 11 deletions(-) diff --git a/pisi/atomicoperations.py b/pisi/atomicoperations.py index d3c2b759..d1c76959 100644 --- a/pisi/atomicoperations.py +++ b/pisi/atomicoperations.py @@ -168,12 +168,18 @@ class Install(AtomicOperation): self.reinstall = False self.upgrade = False if ctx.installdb.is_installed(pkg.name): # is this a reinstallation? + + #FIXME: consider REPOSITORY instead of DISTRIBUTION -- exa + #ipackage = ctx.packagedb.get_package(pkg.name, pisi.itembyrepodb.installed) + ipkg = ctx.installdb.get_info(pkg.name) + repomismatch = ipkg.distribution != pkg.distribution + (iversion, irelease, ibuild) = ctx.installdb.get_version(pkg.name) # determine if same version self.same_ver = False ignore_build = ctx.config.options and ctx.config.options.ignore_build_no - if (not ibuild) or (not pkg.build) or ignore_build: + if repomismatch or (not ibuild) or (not pkg.build) or ignore_build: # we don't look at builds to compare two package versions if pkg.release == irelease: self.same_ver = True @@ -296,9 +302,8 @@ class Install(AtomicOperation): self.metadata.package.release, self.metadata.package.build, self.metadata.package.distribution, - self.config_later, - False, - txn) + config_later = self.config_later, + txn = txn) # filesdb ctx.filesdb.add_files(self.metadata.package.name, self.files, txn=txn) @@ -427,7 +432,7 @@ class Remove(AtomicOperation): def remove_db(self, txn): ctx.installdb.remove(self.package_name, txn) ctx.filesdb.remove_files(self.files, txn) - ctx.packagedb.remove_tracking_package(self.package_name, txn) + pisi.packagedb.remove_tracking_package(self.package_name, txn) def remove_single(package_name): Remove(package_name).run() @@ -476,9 +481,8 @@ def virtual_install(metadata, files, txn): metadata.package.release, metadata.package.build, metadata.package.distribution, - False, - True, - txn) + rebuild=True, + txn=txn) # filesdb if files: diff --git a/pisi/installdb.py b/pisi/installdb.py index 806b6fb3..078b5dbb 100644 --- a/pisi/installdb.py +++ b/pisi/installdb.py @@ -162,6 +162,7 @@ class InstallDB: # FIXME: it might be more appropriate to pass date # as an argument, or installation data afterwards # to do this -- exa + # dailywtf. this does not look good -- exa if not rebuild: import time ctime = time.localtime() diff --git a/pisi/itembyrepodb.py b/pisi/itembyrepodb.py index 8424a150..45c4472d 100644 --- a/pisi/itembyrepodb.py +++ b/pisi/itembyrepodb.py @@ -89,10 +89,11 @@ class ItemByRepoDB(object): def has_key(self, name, repo = None, txn = None): name = str(name) + haskey = self.d.has_key(name, txn) if not repo: - return self.d.has_key(name, txn) + return haskey else: - return self.d.has_key(name, txn).has_key(repo) + return haskey and self.d.get(name, txn).has_key(repo) def get_item_repo(self, name, repo = None, txn = None): name = str(name) diff --git a/pisi/packagedb.py b/pisi/packagedb.py index 99dd6841..fb33c61d 100644 --- a/pisi/packagedb.py +++ b/pisi/packagedb.py @@ -19,7 +19,9 @@ # we basically store everything in PackageInfo class # yes, we are cheap -import os, fcntl +import os +import fcntl +import types import gettext __trans = gettext.translation('pisi', fallback=True) @@ -30,6 +32,7 @@ import pisi.util as util import pisi.context as ctx import pisi.lockeddbshelve as shelve from pisi.itembyrepodb import ItemByRepoDB +import pisi.itembyrepodb as itembyrepodb class Error(pisi.Error): pass