Commit bc591d36 authored by Lorenz Huedepohl's avatar Lorenz Huedepohl
Browse files

mpcdf_refresh_aggregates: only for active repos

parent d83d34ae
Pipeline #67019 passed with stage
in 11 seconds
......@@ -41,6 +41,11 @@ mpi_parallel_studio = {value["impi"]: dict({"ps": key}, **value) for key, value
compiler_parallel_studio = {value["compiler"]: dict({"ps": key}, **value) for key, value in intel_parallel_studio.items()}
# For the autogenerated software/software:*:* project 'prjconf' sections
prjconf_start_marker = "# Autogenerated by osc mpcdf_setup_repos, do not edit till end of section\n"
prjconf_end_marker = "# End of autogenerated section\n"
def valid_pgi_mpi(pgi, mpi):
if "impi" not in mpi:
return False
......@@ -409,19 +414,17 @@ def mpcdf_setup_repositories(api_url, project, microarchitecture=None, distribut
root = project_meta(api_url, project)
prjconf = list(map(decode_it, osc.core.show_project_conf(api_url, project)))
start_marker = "# Autogenerated by osc mpcdf_setup_repos, do not edit till end of section\n"
end_marker = "# End of autogenerated section\n"
try:
start = prjconf.index(start_marker)
end = prjconf.index(end_marker)
start = prjconf.index(prjconf_start_marker)
end = prjconf.index(prjconf_end_marker)
except ValueError:
start = None
end = len(prjconf)
prjconf_head = "".join(prjconf[:start])
prjconf_tail = "".join(prjconf[end + 1:])
prjconf = [start_marker]
prjconf = [prjconf_start_marker]
prjconf.append("Constraint: hostlabel {0}".format(microarchitecture))
prjconf.append(
......@@ -553,7 +556,7 @@ Macros:
root.getchildren()[-1].tail = "\n"
prj = ElementTree.tostring(root, encoding=osc.core.ET_ENCODING)
prjconf.append(end_marker)
prjconf.append(prjconf_end_marker)
prjconf = prjconf_head + "\n".join(prjconf) + prjconf_tail
if dry_run:
......
......@@ -80,9 +80,19 @@ def do_mpcdf_refresh_aggregates(self, subcmd, opts, *args):
projects = [p for p in osc.core.meta_get_project_list(apiurl)
if p.startswith("software") and not (p == "software:dist" or p == "software:images")]
def active_repos(project):
lines = map(mpcdf_common.decode_it, osc.core.show_project_conf(apiurl, project))
for line in lines:
if line == mpcdf_common.prjconf_start_marker:
break
for line in lines:
if line == mpcdf_common.prjconf_end_marker:
break
if line.startswith("%if %_repository == "):
yield line.split(" == ")[1].rstrip()
macros = {}
for project in projects:
repos = osc.core.get_repositories_of_project(apiurl, project)
if project == "software":
# Stupid special case
target = "SLE_12_SP3-sandybridge"
......@@ -95,7 +105,7 @@ def do_mpcdf_refresh_aggregates(self, subcmd, opts, *args):
values = mpcdf_common.get_attribute_values(apiurl, project, None, attribute)
macros[target].append("%available_{0} {1}".format(name, ",".join(sorted(values))))
for repo in repos:
for repo in active_repos(project):
aggregatename = "zz_aggregate_" + project.replace(":", "-") + "_" + repo
refresh_aggregate(aggregatename, project, repo, target)
......
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