- remove redundant option postpone_postinstall
- make configure-pending work!
This commit is contained in:
+17
-9
@@ -146,24 +146,17 @@ def package_graph(A, ignore_installed = False):
|
|||||||
B = Bp
|
B = Bp
|
||||||
return G_f
|
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():
|
def configure_pending():
|
||||||
# start with pending packages
|
# start with pending packages
|
||||||
# configure them in reverse topological order of dependency
|
# configure them in reverse topological order of dependency
|
||||||
A = ctx.installdb.list_pending()
|
A = ctx.installdb.list_pending()
|
||||||
G_f = pgraph.PGraph(packagedb) # construct G_f
|
G_f = pgraph.PGraph(packagedb) # construct G_f
|
||||||
for x in A:
|
for x in A.keys():
|
||||||
G_f.add_package(x)
|
G_f.add_package(x)
|
||||||
B = A
|
B = A
|
||||||
while len(B) > 0:
|
while len(B) > 0:
|
||||||
Bp = set()
|
Bp = set()
|
||||||
for x in B:
|
for x in B.keys():
|
||||||
pkg = packagedb.get_package(x)
|
pkg = packagedb.get_package(x)
|
||||||
for dep in pkg.runtimeDependencies:
|
for dep in pkg.runtimeDependencies:
|
||||||
if dep.package in G_f.vertices():
|
if dep.package in G_f.vertices():
|
||||||
@@ -176,6 +169,21 @@ def configure_pending():
|
|||||||
try:
|
try:
|
||||||
import pisi.comariface as comariface
|
import pisi.comariface as comariface
|
||||||
for x in order:
|
for x in order:
|
||||||
|
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)
|
comariface.run_postinstall(x)
|
||||||
ctx.installdb.clear_pending(x)
|
ctx.installdb.clear_pending(x)
|
||||||
except ImportError:
|
except ImportError:
|
||||||
|
|||||||
@@ -87,7 +87,6 @@ class Install(AtomicOperation):
|
|||||||
if ctx.comar:
|
if ctx.comar:
|
||||||
import pisi.comariface as comariface
|
import pisi.comariface as comariface
|
||||||
self.register_comar_scripts()
|
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_databases()
|
||||||
self.update_environment()
|
self.update_environment()
|
||||||
|
|||||||
@@ -361,8 +361,6 @@ class PackageOp(Command):
|
|||||||
p = self.parser
|
p = self.parser
|
||||||
p.add_option("-B", "--ignore-comar", action="store_true",
|
p.add_option("-B", "--ignore-comar", action="store_true",
|
||||||
default=False, help=_("bypass comar configuration agent"))
|
default=False, help=_("bypass comar configuration agent"))
|
||||||
p.add_option("", "--postpone-postinstall", action="store_true",
|
|
||||||
default=False, help=_("Postpone postinstall script"))
|
|
||||||
ignoredep_opt(self)
|
ignoredep_opt(self)
|
||||||
|
|
||||||
def init(self):
|
def init(self):
|
||||||
@@ -871,8 +869,7 @@ class ListPending(Command):
|
|||||||
self.init(True)
|
self.init(True)
|
||||||
|
|
||||||
list = ctx.installdb.list_pending()
|
list = ctx.installdb.list_pending()
|
||||||
list.sort()
|
for p in list.keys():
|
||||||
for p in list:
|
|
||||||
print p
|
print p
|
||||||
|
|
||||||
self.finalize()
|
self.finalize()
|
||||||
|
|||||||
+5
-5
@@ -113,10 +113,11 @@ class InstallDB:
|
|||||||
return list
|
return list
|
||||||
|
|
||||||
def list_pending(self):
|
def list_pending(self):
|
||||||
list = []
|
dict = {}
|
||||||
for (pkg, x) in self.dp.iteritems():
|
for (pkg, x) in self.dp.iteritems():
|
||||||
list.append(pkg)
|
pkginfo = self.d[pkg]
|
||||||
return list
|
dict[pkg] = pkginfo
|
||||||
|
return dict
|
||||||
|
|
||||||
def get_info(self, pkg):
|
def get_info(self, pkg):
|
||||||
pkg = str(pkg)
|
pkg = str(pkg)
|
||||||
@@ -140,8 +141,7 @@ class InstallDB:
|
|||||||
pkg = str(pkg)
|
pkg = str(pkg)
|
||||||
if self.is_installed(pkg):
|
if self.is_installed(pkg):
|
||||||
raise InstallDBError(_("Already installed"))
|
raise InstallDBError(_("Already installed"))
|
||||||
if ctx.config.get_option('ignore_comar') or \
|
if ctx.config.get_option('ignore_comar'):
|
||||||
ctx.config.get_option('postpone_postinstall'):
|
|
||||||
state = 'ip'
|
state = 'ip'
|
||||||
self.dp[pkg] = True
|
self.dp[pkg] = True
|
||||||
else:
|
else:
|
||||||
|
|||||||
+2
-1
@@ -486,10 +486,11 @@ def clean_locks(top = '.'):
|
|||||||
# Package/Repository Related Functions #
|
# Package/Repository Related Functions #
|
||||||
########################################
|
########################################
|
||||||
|
|
||||||
def package_name(name, version, release, build):
|
def package_name(name, version, release, build, prependSuffix=True):
|
||||||
fn = name + '-' + version + '-' + release
|
fn = name + '-' + version + '-' + release
|
||||||
if build:
|
if build:
|
||||||
fn += '-' + str(build)
|
fn += '-' + str(build)
|
||||||
|
if prependSuffix:
|
||||||
fn += ctx.const.package_suffix
|
fn += ctx.const.package_suffix
|
||||||
return fn
|
return fn
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user