From c716e4c1868cc1b853757b8d4a5186f1c9393417 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Metin?= Date: Mon, 14 Nov 2005 00:13:02 +0000 Subject: [PATCH] - remove redundant option postpone_postinstall - make configure-pending work! --- pisi/api.py | 28 ++++++++++++++++++---------- pisi/atomicoperations.py | 3 +-- pisi/cli/commands.py | 5 +---- pisi/installdb.py | 10 +++++----- pisi/util.py | 5 +++-- 5 files changed, 28 insertions(+), 23 deletions(-) diff --git a/pisi/api.py b/pisi/api.py index 47c32c3b..44f03ba5 100644 --- a/pisi/api.py +++ b/pisi/api.py @@ -146,24 +146,17 @@ def package_graph(A, ignore_installed = False): B = Bp return G_f -def postpone_postinstall(package): - try: - import pisi.comariface as comariface - comariface.register(package) - except ImportError: - raise Error(_("COMAR: comard not fully installed")) - def configure_pending(): # start with pending packages # configure them in reverse topological order of dependency A = ctx.installdb.list_pending() G_f = pgraph.PGraph(packagedb) # construct G_f - for x in A: + for x in A.keys(): G_f.add_package(x) B = A while len(B) > 0: Bp = set() - for x in B: + for x in B.keys(): pkg = packagedb.get_package(x) for dep in pkg.runtimeDependencies: if dep.package in G_f.vertices(): @@ -176,7 +169,22 @@ def configure_pending(): try: import pisi.comariface as comariface for x in order: - comariface.run_postinstall(x) + pkginfo = A[x] + pkgname = util.package_name(x, pkginfo.version, + pkginfo.release, + pkginfo.build, + False) + pkg_path = util.join_path(ctx.config.lib_dir(), + pkgname) + m = MetaData() + metadata_path = util.join_path(pkg_path, ctx.const.metadata_xml) + m.read(metadata_path) + for pcomar in m.package.providesComar: + scriptPath = util.join_path(pkg_path, + ctx.const.comar_dir, + pcomar.script) + comariface.register(pcomar, x, scriptPath) + comariface.run_postinstall(x) ctx.installdb.clear_pending(x) except ImportError: raise Error(_("COMAR: comard not fully installed")) diff --git a/pisi/atomicoperations.py b/pisi/atomicoperations.py index 653db021..9d3505ca 100644 --- a/pisi/atomicoperations.py +++ b/pisi/atomicoperations.py @@ -87,8 +87,7 @@ class Install(AtomicOperation): if ctx.comar: import pisi.comariface as comariface self.register_comar_scripts() - if not ctx.config.options.postpone_postinstall: - comariface.run_postinstall(self.pkginfo.name) + comariface.run_postinstall(self.pkginfo.name) self.update_databases() self.update_environment() ctx.ui.status() diff --git a/pisi/cli/commands.py b/pisi/cli/commands.py index ac9705e8..3fb87e23 100644 --- a/pisi/cli/commands.py +++ b/pisi/cli/commands.py @@ -361,8 +361,6 @@ class PackageOp(Command): p = self.parser p.add_option("-B", "--ignore-comar", action="store_true", default=False, help=_("bypass comar configuration agent")) - p.add_option("", "--postpone-postinstall", action="store_true", - default=False, help=_("Postpone postinstall script")) ignoredep_opt(self) def init(self): @@ -871,8 +869,7 @@ class ListPending(Command): self.init(True) list = ctx.installdb.list_pending() - list.sort() - for p in list: + for p in list.keys(): print p self.finalize() diff --git a/pisi/installdb.py b/pisi/installdb.py index f876b818..94282002 100644 --- a/pisi/installdb.py +++ b/pisi/installdb.py @@ -113,10 +113,11 @@ class InstallDB: return list def list_pending(self): - list = [] + dict = {} for (pkg, x) in self.dp.iteritems(): - list.append(pkg) - return list + pkginfo = self.d[pkg] + dict[pkg] = pkginfo + return dict def get_info(self, pkg): pkg = str(pkg) @@ -140,8 +141,7 @@ class InstallDB: pkg = str(pkg) if self.is_installed(pkg): raise InstallDBError(_("Already installed")) - if ctx.config.get_option('ignore_comar') or \ - ctx.config.get_option('postpone_postinstall'): + if ctx.config.get_option('ignore_comar'): state = 'ip' self.dp[pkg] = True else: diff --git a/pisi/util.py b/pisi/util.py index 68e78470..ee30a255 100644 --- a/pisi/util.py +++ b/pisi/util.py @@ -486,11 +486,12 @@ def clean_locks(top = '.'): # Package/Repository Related Functions # ######################################## -def package_name(name, version, release, build): +def package_name(name, version, release, build, prependSuffix=True): fn = name + '-' + version + '-' + release if build: fn += '-' + str(build) - fn += ctx.const.package_suffix + if prependSuffix: + fn += ctx.const.package_suffix return fn def is_package_name(fn, package_name = None):