Commit 09e14fe9 authored by Lorenz Hüdepohl's avatar Lorenz Hüdepohl

Make it possible to disable packages again

Previously, the logic decided that it didn't need to look at the
sub-projects, as the main package is disabled. However, if it was
previously enabled the --disable didn't touch the branched packages in
the sub-projects and those stayed enabled.
parent bfcc3444
Pipeline #72314 passed with stage
in 14 seconds
......@@ -880,21 +880,15 @@ def sync_projects(api_url, package=None, from_project="software", to_projects=No
else:
from_packages = [package]
def non_system_package(package):
enable_repos = get_attribute_values(api_url, from_project, package, "MPCDF:enable_repositories")
if len(enable_repos) == 0:
print("Not branching package {0}, is disabled".format(package))
return False
elif enable_repos == ["system"]:
print("Not branching package {0}, is only enabled for 'system'".format(package))
return False
else:
return True
from_packages = list(filter(non_system_package, from_packages))
for orig_package in from_packages:
enable_repos = get_attribute_values(api_url, from_project, orig_package, "MPCDF:enable_repositories")
if orig_package not in to_packages:
if len(enable_repos) == 0:
print("Not branching package {0}, is disabled".format(package))
continue
elif enable_repos == ["system"]:
print("Not branching package {0}, is only enabled for 'system'".format(package))
continue
filelist = osc.core.meta_get_filelist(api_url, from_project, orig_package)
if "_link" in filelist:
print("Not branching package {0}, is a link".format(orig_package))
......@@ -928,7 +922,6 @@ def sync_projects(api_url, package=None, from_project="software", to_projects=No
to_meta.insert(2, person)
osc.core.edit_meta("pkg", (to_project, orig_package), data=ElementTree.tostring(to_meta), apiurl=api_url)
for orig_package in from_packages:
try:
mpcdf_enable_repositories(api_url, to_project, orig_package, verbose=verbose)
except UnmanagedPackageException:
......
......@@ -92,7 +92,7 @@ def do_mpcdf_enable_repositories(self, subcmd, opts, *args):
if opts.recreate or opts.set or opts.disable:
mpcdf_common.mpcdf_enable_repositories(api_url, project, package, verbose=True, dry_run=opts.dry_run)
enabled = mpcdf_common.get_attribute_values(api_url, project, package, "MPCDF:enable_repositories")
if project == "software" and enabled != ["system"] and len(enabled) > 0 and not opts.dry_run:
if project == "software" and enabled != ["system"] and (len(enabled) > 0 or opts.disable) and not opts.dry_run:
mpcdf_common.sync_projects(api_url, package, verbose=True)
elif (opts.compiler_modules or opts.mpi_modules or opts.cuda_modules):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment