* implement the much requested safety switch feature :)
* SpecFile: define component dependencies
This commit is contained in:
+15
-1
@@ -285,9 +285,23 @@ class Builder:
|
|||||||
def check_build_dependencies(self):
|
def check_build_dependencies(self):
|
||||||
"""fail if dependencies not satisfied"""
|
"""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...
|
# find out the build dependencies that are not satisfied...
|
||||||
dep_unsatis = []
|
dep_unsatis = []
|
||||||
for dep in self.spec.source.buildDependencies:
|
for dep in build_deps:
|
||||||
if not dependency.installed_satisfies_dep(dep):
|
if not dependency.installed_satisfies_dep(dep):
|
||||||
dep_unsatis.append(dep)
|
dep_unsatis.append(dep)
|
||||||
|
|
||||||
|
|||||||
@@ -361,6 +361,8 @@ 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("-S", "--bypass-safety", action="store_true",
|
||||||
|
default=False, help=_("bypass safety switch"))
|
||||||
ignoredep_opt(self)
|
ignoredep_opt(self)
|
||||||
|
|
||||||
def init(self):
|
def init(self):
|
||||||
|
|||||||
+11
-1
@@ -180,7 +180,7 @@ def expand_components(A):
|
|||||||
if ctx.componentdb.has_component(x):
|
if ctx.componentdb.has_component(x):
|
||||||
Ap = Ap.union(ctx.componentdb.get_component(x).packages)
|
Ap = Ap.union(ctx.componentdb.get_component(x).packages)
|
||||||
else:
|
else:
|
||||||
Ap.append(x)
|
Ap.add(x)
|
||||||
return Ap
|
return Ap
|
||||||
|
|
||||||
def install_pkg_names(A):
|
def install_pkg_names(A):
|
||||||
@@ -379,6 +379,16 @@ def remove(A):
|
|||||||
|
|
||||||
# filter packages that are not installed
|
# filter packages that are not installed
|
||||||
A_0 = A = expand_components(set(A))
|
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 = []
|
Ap = []
|
||||||
for x in A:
|
for x in A:
|
||||||
if ctx.installdb.is_installed(x):
|
if ctx.installdb.is_installed(x):
|
||||||
|
|||||||
+2
-1
@@ -168,7 +168,8 @@ class Package:
|
|||||||
t_License = [ [autoxml.String], autoxml.optional]
|
t_License = [ [autoxml.String], autoxml.optional]
|
||||||
t_Icon = [ autoxml.String, autoxml.optional]
|
t_Icon = [ autoxml.String, autoxml.optional]
|
||||||
t_RuntimeDependencies = [ [Dependency], 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_Conflicts = [ [autoxml.String], autoxml.optional, "Conflicts/Package"]
|
||||||
t_ProvidesComar = [ [ComarProvide], autoxml.optional, "Provides/COMAR"]
|
t_ProvidesComar = [ [ComarProvide], autoxml.optional, "Provides/COMAR"]
|
||||||
#t_RequiresComar = [ [autoxml.String], autoxml.mandatory, "Requires/COMAR"]
|
#t_RequiresComar = [ [autoxml.String], autoxml.mandatory, "Requires/COMAR"]
|
||||||
|
|||||||
Reference in New Issue
Block a user