Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automate hash calculation; update sources to alma 8.9 #79

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
ace:
- 8.0.1
alma_version:
- '8.9'
cdt_name:
- cos7
centos_machine:
Expand All @@ -12,6 +16,18 @@ ctng_vendor:
- conda
docker_image:
- quay.io/condaforge/linux-anvil-cos7-x86_64
glib:
- '2'
glibc_build1:
- '236'
glibc_build2:
- '13'
glibc_version:
- '2.28'
kernel_headers_build:
- 513.24.1
kernel_headers_version:
- 4.18.0
target_machine:
- aarch64
zip_keys:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
ace:
- 8.0.1
alma_version:
- '8.9'
cdt_name:
- cos7
centos_machine:
Expand All @@ -12,6 +16,18 @@ ctng_vendor:
- conda
docker_image:
- quay.io/condaforge/linux-anvil-cos7-x86_64
glib:
- '2'
glibc_build1:
- '236'
glibc_build2:
- '13'
glibc_version:
- '2.28'
kernel_headers_build:
- 513.24.1
kernel_headers_version:
- 4.18.0
target_machine:
- powerpc64le
zip_keys:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
ace:
- 8.0.1
alma_version:
- '8.9'
cdt_name:
- cos7
centos_machine:
Expand All @@ -12,6 +16,18 @@ ctng_vendor:
- conda
docker_image:
- quay.io/condaforge/linux-anvil-cos7-x86_64
glib:
- '2'
glibc_build1:
- '236'
glibc_build2:
- '13'
glibc_version:
- '2.28'
kernel_headers_build:
- 513.24.1
kernel_headers_version:
- 4.18.0
target_machine:
- s390x
zip_keys:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
ace:
- 8.0.1
alma_version:
- '8.9'
cdt_name:
- cos7
centos_machine:
Expand All @@ -12,6 +16,18 @@ ctng_vendor:
- conda
docker_image:
- quay.io/condaforge/linux-anvil-cos7-x86_64
glib:
- '2'
glibc_build1:
- '236'
glibc_build2:
- '13'
glibc_version:
- '2.28'
kernel_headers_build:
- 513.24.1
kernel_headers_version:
- 4.18.0
target_machine:
- x86_64
zip_keys:
Expand Down
2 changes: 1 addition & 1 deletion README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions recipe/build-sysroot.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

mkdir -p ${PREFIX}/${target_machine}-${ctng_vendor}-linux-gnu/sysroot
pushd ${PREFIX}/${target_machine}-${ctng_vendor}-linux-gnu/sysroot > /dev/null 2>&1
cp -Rf "${SRC_DIR}"/binary/* .
cp -Rf "${SRC_DIR}"/binary-glibc/* .
mkdir -p usr/include
cp -Rf "${SRC_DIR}"/binary-glibc-headers/include/* usr/include/
cp -Rf "${SRC_DIR}"/binary-glibc-devel/* usr/
Expand All @@ -12,7 +12,7 @@ cp -Rf "${SRC_DIR}"/binary-glibc-nss-devel/* usr/
cp -Rf "${SRC_DIR}"/binary-nss_db/* .
cp -Rf "${SRC_DIR}"/binary-nss_nis/* usr/
cp -Rf "${SRC_DIR}"/binary-glibc-gconv-extra/* usr/
cp -Rf "${SRC_DIR}"/binary-glibc-langpacks/* usr/
cp -Rf "${SRC_DIR}"/binary-glibc-all-langpacks/* usr/

mkdir -p usr/lib64
if [[ $(compgen -G 'usr/lib/*') != "" ]]; then
Expand Down Expand Up @@ -40,7 +40,7 @@ rm -f usr/include/rpcsvc/yp_prot.h
rm -f usr/include/rpcsvc/ypupd.h
rm -f usr/include/rpcsvc/yp.x

cp "${SRC_DIR}"/binary-freebl/lib64/libfreebl3.so ${PWD}/lib64/.
cp "${SRC_DIR}"/binary-nss-softokn-freebl/lib64/libfreebl3.so ${PWD}/lib64/.

if [[ "$target_machine" == "s390x" ]]; then
rm -rf $PWD/lib64/ld64.so.1
Expand Down
19 changes: 19 additions & 0 deletions recipe/conda_build_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,25 @@ cross_target_platform:
- linux-ppc64le
- linux-s390x

alma_version:
- "8.9"
glibc_version:
- "2.28"
kernel_headers_version:
- "4.18.0"
# glibc artefacts have two build numbers plus the alma version, e.g.
# 2.28-236.el8_9.13.x86_64.rpm
# ↑ ↑ ↑ ↑
# └glibc_ver └alma_version
# └build1 └build2
glibc_build1:
- "236"
glibc_build2:
- "13"
kernel_headers_build:
- "513.24.1"
# nss-* versions need to be set in meta.yaml (and/or update.py)

ctng_vendor:
- conda

Expand Down
160 changes: 85 additions & 75 deletions recipe/meta.yaml

Large diffs are not rendered by default.

100 changes: 100 additions & 0 deletions recipe/update.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
"""
run this in recipe/ folder like
python update.py
or
python update.py -log=INFO
"""
import argparse
import hashlib
import logging
import requests
import os
from ruamel_yaml import BaseLoader, load

parser = argparse.ArgumentParser()
parser.add_argument('-log', '--loglevel', default='warning')

args = parser.parse_args()
logging.basicConfig(level=args.loglevel.upper())

cbc = os.path.join(".", "conda_build_config.yaml")
if not os.path.exists(cbc):
raise ValueError("cannot load conda_build_config.yaml; execute script in recipe folder!")

with open(cbc, "r", encoding="utf-8") as f:
cbc_content = "".join(f.readlines())

config = load(cbc_content, Loader=BaseLoader)
rpm_arches = config["centos_machine"]
conda_arches = config["cross_target_platform"]

url_template = (
f"https://repo.almalinux.org/vault/{config['alma_version'][0]}"
# second part intententionally not filled yet
"/{subfolder}/{arch}/os/Packages"
)

el_ver = "el" + config["alma_version"][0].replace(".", "_")
glibc_string = f"{config['glibc_version'][0]}-{config['glibc_build1'][0]}.{el_ver}.{config['glibc_build2'][0]}"
kernel_headers_string = f"{config['kernel_headers_version'][0]}-{config['kernel_headers_build'][0]}.{el_ver}"

out_lines = []

name2string = {
# package name to build string
"glibc": glibc_string,
"glibc-all-langpacks": glibc_string,
"glibc-common": glibc_string,
"glibc-devel": glibc_string,
"glibc-gconv-extra": glibc_string,
"glibc-headers": glibc_string,
"glibc-nss-devel": glibc_string,
"glibc-static": glibc_string,
"kernel-headers": kernel_headers_string,
"nss_db": glibc_string,
# manual versions
"nss_nis": "3.0-8.el8",
"nss-softokn-freebl": "3.90.0-6.el8_9",
}

def get_subfolder(pkg, string):
# find in which subfolder the rpm lives on the alma vault;
# we assume that the layout for x86_64 works for all arches
pkg_template = url_template + f"/{pkg}-{string}.x86_64.rpm"
for sf in ["BaseOS", "PowerTools", "AppStream"]:
url = pkg_template.format(arch="x86_64", subfolder=sf)
logging.info(f"Testing if {url} exists")
if requests.get(url).status_code == 200:
return sf
raise ValueError(f"could not find valid artefact for {pkg}-{string}!")

for pkg, string in name2string.items():
out_lines.append(f" - folder: binary-{pkg}")
subfolder = get_subfolder(pkg, string)
url_jinja = (
"{{ rpm_url }}" if subfolder == "BaseOS" else
"{{ powertools_rpm_url }}" if subfolder == "PowerTools" else
"{{ appstream_rpm_url }}"
)
string_jinja = (
"{{ glibc_string }}" if string == glibc_string else
"{{ kernel_headers_string }}" if string == kernel_headers_string else string
)
# quadruple curly braces to keep {{ }} jinja templates
out_lines.append(f" url: {url_jinja}/{pkg}-{string_jinja}.{{{{ centos_machine }}}}.rpm")

for rpm_arch, conda_arch in zip(rpm_arches, conda_arches):
rpm_url = (
url_template.format(arch=rpm_arch, subfolder=subfolder)
+ f"/{pkg}-{string}.{rpm_arch}.rpm"
)
logging.info(f"Downloading {rpm_url}")
r = requests.get(rpm_url)
if r.status_code != 200:
logging.warning(f"Could not download rpm for {pkg} from {rpm_url}!")
continue
sha = hashlib.sha256(r.content).hexdigest();
out_lines.append(f' sha256: {sha} # [cross_target_platform == "{conda_arch}"]')
out_lines.append("")

print("\n".join(out_lines))
Loading