* 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...
This commit is contained in:
Eray Özkural
2006-03-23 02:11:23 +00:00
parent e46d391783
commit 826197e906
4 changed files with 20 additions and 11 deletions
+12 -8
View File
@@ -168,12 +168,18 @@ class Install(AtomicOperation):
self.reinstall = False self.reinstall = False
self.upgrade = False self.upgrade = False
if ctx.installdb.is_installed(pkg.name): # is this a reinstallation? 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) (iversion, irelease, ibuild) = ctx.installdb.get_version(pkg.name)
# determine if same version # determine if same version
self.same_ver = False self.same_ver = False
ignore_build = ctx.config.options and ctx.config.options.ignore_build_no 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 # we don't look at builds to compare two package versions
if pkg.release == irelease: if pkg.release == irelease:
self.same_ver = True self.same_ver = True
@@ -296,9 +302,8 @@ class Install(AtomicOperation):
self.metadata.package.release, self.metadata.package.release,
self.metadata.package.build, self.metadata.package.build,
self.metadata.package.distribution, self.metadata.package.distribution,
self.config_later, config_later = self.config_later,
False, txn = txn)
txn)
# filesdb # filesdb
ctx.filesdb.add_files(self.metadata.package.name, self.files, txn=txn) ctx.filesdb.add_files(self.metadata.package.name, self.files, txn=txn)
@@ -427,7 +432,7 @@ class Remove(AtomicOperation):
def remove_db(self, txn): def remove_db(self, txn):
ctx.installdb.remove(self.package_name, txn) ctx.installdb.remove(self.package_name, txn)
ctx.filesdb.remove_files(self.files, 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): def remove_single(package_name):
Remove(package_name).run() Remove(package_name).run()
@@ -476,9 +481,8 @@ def virtual_install(metadata, files, txn):
metadata.package.release, metadata.package.release,
metadata.package.build, metadata.package.build,
metadata.package.distribution, metadata.package.distribution,
False, rebuild=True,
True, txn=txn)
txn)
# filesdb # filesdb
if files: if files:
+1
View File
@@ -162,6 +162,7 @@ class InstallDB:
# FIXME: it might be more appropriate to pass date # FIXME: it might be more appropriate to pass date
# as an argument, or installation data afterwards # as an argument, or installation data afterwards
# to do this -- exa # to do this -- exa
# dailywtf. this does not look good -- exa
if not rebuild: if not rebuild:
import time import time
ctime = time.localtime() ctime = time.localtime()
+3 -2
View File
@@ -89,10 +89,11 @@ class ItemByRepoDB(object):
def has_key(self, name, repo = None, txn = None): def has_key(self, name, repo = None, txn = None):
name = str(name) name = str(name)
haskey = self.d.has_key(name, txn)
if not repo: if not repo:
return self.d.has_key(name, txn) return haskey
else: 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): def get_item_repo(self, name, repo = None, txn = None):
name = str(name) name = str(name)
+4 -1
View File
@@ -19,7 +19,9 @@
# we basically store everything in PackageInfo class # we basically store everything in PackageInfo class
# yes, we are cheap # yes, we are cheap
import os, fcntl import os
import fcntl
import types
import gettext import gettext
__trans = gettext.translation('pisi', fallback=True) __trans = gettext.translation('pisi', fallback=True)
@@ -30,6 +32,7 @@ import pisi.util as util
import pisi.context as ctx import pisi.context as ctx
import pisi.lockeddbshelve as shelve import pisi.lockeddbshelve as shelve
from pisi.itembyrepodb import ItemByRepoDB from pisi.itembyrepodb import ItemByRepoDB
import pisi.itembyrepodb as itembyrepodb
class Error(pisi.Error): class Error(pisi.Error):
pass pass