diff --git a/clingo/spec_info.json b/clingo/spec_info.json deleted file mode 100644 index ec49bae..0000000 --- a/clingo/spec_info.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "centos7-x86_64": "clingo-bootstrap%gcc platform=linux target=x86_64", - "centos7-aarch64": "clingo-bootstrap%gcc platform=linux target=aarch64", - "centos7-ppc64le": "clingo-bootstrap%gcc platform=linux target=ppc64le", - "highsierra-x86_64": "clingo-bootstrap%apple-clang platform=darwin target=x86_64", - "bigsur-aarch64": "clingo-bootstrap%apple-clang platform=darwin target=aarch64" -} \ No newline at end of file diff --git a/generate_bootstrap_json.py b/generate_bootstrap_json.py index 6b1cf11..e804603 100755 --- a/generate_bootstrap_json.py +++ b/generate_bootstrap_json.py @@ -16,9 +16,6 @@ # # "spec": root spec to be matched # "binaries": list of tuples (pkg name, dag hash, sha256 sum) -# optionally "python": constraints on the python interpreter (could've been part of `spec` but -# for unknown reasons it is not) - def sha256(path): fn = hashlib.sha256() @@ -33,7 +30,7 @@ def tarball_hash(path: str): return name.split("-")[-1] -def run(pkg: str, arch_to_spec: Dict[str, str], deps=dt.NONE, python: bool = False): +def run(pkg: str, deps=dt.NONE, python: bool = False): name = "clingo-bootstrap" if pkg == "clingo" else pkg shas = { tarball_hash(tarball): sha256(tarball) @@ -46,15 +43,16 @@ def run(pkg: str, arch_to_spec: Dict[str, str], deps=dt.NONE, python: bool = Fal assert len(specs) > 0, f"No specs found for {name}" + fmt = "{name}{@version}{%compiler.name} platform={platform} target={target}" + if python: - with_python = lambda s: {"python": f"python@{s.dependencies('python')[0].version}"} + fmt_spec = lambda s: f"{s.format(fmt)} ^python@{s.dependencies('python')[0].version}" else: - with_python = lambda _: {} + fmt_spec = lambda s: s.format(fmt) mirror_info = [ { - "spec": arch_to_spec[f"{s.architecture.os}-{s.architecture.target}"], - **with_python(s), + "spec": fmt_spec(s), "binaries": [ (s.name, s.dag_hash(), shas[s.dag_hash()]) for s in reversed(list(s.traverse(order="topo", deptype=deps))) @@ -64,8 +62,8 @@ def run(pkg: str, arch_to_spec: Dict[str, str], deps=dt.NONE, python: bool = Fal for s in specs ] - if python: - mirror_info.sort(key=lambda x: spack.spec.Spec(x["python"])) + # sort as strings, cause Spec instances with deps don't sort properly + mirror_info.sort(key=lambda x: x["spec"]) with open(f"./{pkg}.json", "w") as f: json.dump({"verified": mirror_info}, f, sort_keys=True, indent=2) @@ -76,10 +74,8 @@ def run(pkg: str, arch_to_spec: Dict[str, str], deps=dt.NONE, python: bool = Fal pkg = sys.argv[1] # unfortunately we refer to clingo-bootstrap by alias "clingo" assert pkg in ("clingo", "gnupg", "patchelf") - file = f"{os.path.dirname(__file__)}/{pkg}/spec_info.json" run( pkg, - arch_to_spec=json.load(open(file)), # clingo is special: statically links libstdc++ and other deps are loaded by interpreter deps=dt.NONE if pkg == "clingo" else dt.LINK | dt.RUN, python=pkg == "clingo", diff --git a/gnupg/spec_info.json b/gnupg/spec_info.json deleted file mode 100644 index df34129..0000000 --- a/gnupg/spec_info.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "centos7-x86_64": "gnupg@2.3: %gcc platform=linux target=x86_64", - "centos7-aarch64": "gnupg@2.3: %gcc platform=linux target=aarch64", - "centos7-ppc64le": "gnupg@2.3: %gcc platform=linux target=ppc64le", - "highsierra-x86_64": "gnupg@2.3: %apple-clang platform=darwin target=x86_64", - "bigsur-aarch64": "gnupg@2.3: %apple-clang platform=darwin target=aarch64" -} \ No newline at end of file diff --git a/patchelf/spec_info.json b/patchelf/spec_info.json deleted file mode 100644 index 1feb61b..0000000 --- a/patchelf/spec_info.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "centos7-x86_64": "patchelf@0.13: %gcc platform=linux target=x86_64", - "centos7-aarch64": "patchelf@0.13: %gcc platform=linux target=aarch64", - "centos7-ppc64le": "patchelf@0.13: %gcc platform=linux target=ppc64le" -} \ No newline at end of file