Commit 6bb1d774 authored by Lorenz Hüdepohl's avatar Lorenz Hüdepohl
Browse files

Add CentOS-specific macros and Tags

parent 645d0030
......@@ -6,6 +6,7 @@ import osc
import osc.conf
import osc.core
import osc.oscerr
import textwrap
from functools import partial
from xml.etree import ElementTree
......@@ -47,6 +48,23 @@ compiler_parallel_studio = {value["compiler"]: dict({"ps": key}, **value) for ke
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"
centos_prjconf_tags = textwrap.dedent(
"""
Prefer: perl-Error
Substitute: c_compiler gcc
Substitute: c++_compiler gcc-c++
Substitute: ca-certificates-mozilla ca-certificates
""").strip()
centos_macros = textwrap.dedent(
"""
# Disable all problematic automatic RPM stuff
# like byte-compiling (with the wrong Python version)
# or debug packages that fail for many binary-only packages
%__no_python_bytecompile 1
%debug_package %{nil}
""").strip()
def check_for_update():
import os
......@@ -555,10 +573,18 @@ def mpcdf_setup_subproject(api_url, project, distribution, microarchitecture,
prjconf_ours.append("Constraint: hostlabel {0}".format(microarchitecture))
prjconf_ours.append("PublishFilter: ^mpcdf_.*$")
if "CentOS" in distribution:
prjconf_ours.append(centos_prjconf_tags)
extra_macros = centos_macros
else:
extra_macros = ""
prjconf_ours.append("""
Macros:
%microarchitecture {0}
:Macros""".format(microarchitecture))
{1}
:Macros""".format(microarchitecture, extra_macros))
prjconf_ours.append("")
# Remove existing repositories
......
......@@ -9,6 +9,8 @@ import osc.cmdln
import mpcdf_common
@osc.cmdln.option('-n', '--dry-run', action="store_true",
help="Do not actually run anything but output the resulting XML configuration")
@osc.cmdln.option('-i', '--ignore-repo', action="append", default=[], metavar="REPO",
help="Do not enable for repository REPO")
@osc.cmdln.alias("mpcdf_setup_software")
......@@ -55,13 +57,30 @@ def do_mpcdf_setup_software_project(self, subcmd, opts, *args):
prjconf.append("Preinstall: mpcdf_modules")
prjconf.append("Preinstall: brp_mpcdf_modules")
software_meta = mpcdf_common.project_meta(api_url, "software")
distributions = (repo.get("name") for repo in software_meta.findall('./repository'))
centos_distributions = list(distro for distro in distributions if "CentOS" in distro)
if centos_distributions:
prjconf.append("")
prjconf.append("%if {0}".format(" || ".join('"%_repository" == "{0}"'.format(c) for c in centos_distributions)))
prjconf.append(mpcdf_common.centos_prjconf_tags)
prjconf.append("")
prjconf.append("Macros:")
prjconf.append(mpcdf_common.centos_macros)
prjconf.append(":Macros")
prjconf.append("%endif")
prjconf.append(end_marker)
prjconf = prjconf_head + "\n".join(prjconf) + prjconf_tail
osc.core.edit_meta("prjconf", "software", data=prjconf)
if opts.ignore_repo:
ignore_repos = opts.ignore_repo
if opts.dry_run:
print("osc meta prjconf software -F - <<EOF\n{0}\nEOF\n".format(prjconf))
else:
ignore_repos = ()
osc.core.edit_meta("prjconf", "software", data=prjconf)
if opts.ignore_repo:
ignore_repos = opts.ignore_repo
else:
ignore_repos = ()
mpcdf_common.mpcdf_enable_repositories_for_all_packages(api_url, "software", ignore_repos=ignore_repos)
mpcdf_common.mpcdf_enable_repositories_for_all_packages(api_url, "software", ignore_repos=ignore_repos)
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