* implement the much requested safety switch feature :)

* SpecFile: define component dependencies
This commit is contained in:
Eray Özkural
2005-11-14 17:29:17 +00:00
parent 64c69ecaa1
commit a9ec1b1cb1
4 changed files with 30 additions and 3 deletions
+15 -1
View File
@@ -285,9 +285,23 @@ class Builder:
def check_build_dependencies(self):
"""fail if dependencies not satisfied"""
build_deps = set(self.spec.source.buildDependencies)
if not ctx.get_option('bypass_safety'):
if ctx.componentdb.has_component('system.devel'):
build_deps_names = set([x.package for x in build_deps])
devel_deps_names = set(ctx.componentdb.get_component('system.devel').packages)
extra_names = devel_deps_names - build_deps_names
ctx.ui.warning(_('Safety switch: following extra packages in system.devel will be installed: ') +
util.strlist(extra_names))
extra_deps = [dependency.Dependency(package = x) for x in extra_names]
build_deps = build_deps.union(extra_deps)
else:
ctx.ui.warning(_('Safety switch: the component system.devel cannot be found'))
# find out the build dependencies that are not satisfied...
dep_unsatis = []
for dep in self.spec.source.buildDependencies:
for dep in build_deps:
if not dependency.installed_satisfies_dep(dep):
dep_unsatis.append(dep)
+2
View File
@@ -361,6 +361,8 @@ 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("-S", "--bypass-safety", action="store_true",
default=False, help=_("bypass safety switch"))
ignoredep_opt(self)
def init(self):
+11 -1
View File
@@ -180,7 +180,7 @@ def expand_components(A):
if ctx.componentdb.has_component(x):
Ap = Ap.union(ctx.componentdb.get_component(x).packages)
else:
Ap.append(x)
Ap.add(x)
return Ap
def install_pkg_names(A):
@@ -379,6 +379,16 @@ def remove(A):
# filter packages that are not installed
A_0 = A = expand_components(set(A))
if not ctx.get_option('bypass_safety'):
if ctx.componentdb.has_component('system.base'):
refused = A.intersection(set(ctx.componentdb.get_component('system.base').packages))
ctx.ui.warning(_('Safety switch: cannot remove the following packages in system.base: ' +
util.strlist(list(refused))))
A = A - set(ctx.componentdb.get_component('system.base').packages)
else:
ctx.ui.warning(_('Safety switch: the component system.base cannot be found'))
Ap = []
for x in A:
if ctx.installdb.is_installed(x):
+2 -1
View File
@@ -168,7 +168,8 @@ class Package:
t_License = [ [autoxml.String], autoxml.optional]
t_Icon = [ autoxml.String, autoxml.optional]
t_RuntimeDependencies = [ [Dependency], autoxml.optional]
t_Files = [ [Path], autoxml.optional]
t_ComponentDependencies = [ [autoxml.String], autoxml.optional, "RuntimeDependencies/Component"]
t_Files = [ [Path], autoxml.optional]
t_Conflicts = [ [autoxml.String], autoxml.optional, "Conflicts/Package"]
t_ProvidesComar = [ [ComarProvide], autoxml.optional, "Provides/COMAR"]
#t_RequiresComar = [ [autoxml.String], autoxml.mandatory, "Requires/COMAR"]