From e5f29b7a198c9a567eb0f022a487ba88c162582b Mon Sep 17 00:00:00 2001 From: James Le Cuirot Date: Thu, 19 Feb 2026 11:57:38 +0000 Subject: [PATCH] build_sysext: Populate SYSEXT_ID/NAME/VERSION_ID/HOME_URL/BUG_REPORT_URL These extension-release.d fields are equivalent to their non-SYSEXT os-release counterparts. SYSEXT_ID is taken from the sysext's name as given to build_sysext. SYSEXT_NAME, SYSEXT_VERSION_ID, and SYSEXT_HOME_URL are taken from the package if only one is given. SYSEXT_NAME is the new name for the OEM_NAME variable. Signed-off-by: James Le Cuirot --- build_sysext | 38 ++++++++++++------- .../common-oem-files-0-r11.ebuild | 4 +- .../oem-akamai/oem-akamai-0.ebuild | 2 +- .../oem-ami/oem-ami-3.3.2299.0.ebuild | 2 +- .../oem-azure/oem-azure-2.12.0.4-r2.ebuild | 2 +- .../oem-digitalocean-0.1.1-r2.ebuild | 2 +- .../oem-gce/oem-gce-20180823-r7.ebuild | 2 +- .../oem-hetzner/oem-hetzner-0.ebuild | 2 +- .../oem-hyperv/oem-hyperv-0.2.0.ebuild | 2 +- .../oem-kubevirt/oem-kubevirt-0.ebuild | 2 +- .../oem-nutanix/oem-nutanix-0.0.1.ebuild | 2 +- .../oem-openstack/oem-openstack-0.ebuild | 2 +- .../oem-packet/oem-packet-0.2.2-r2.ebuild | 2 +- .../oem-proxmoxve/oem-proxmoxve-0.ebuild | 2 +- .../oem-qemu/oem-qemu-0.0.2.ebuild | 2 +- .../oem-scaleway/oem-scaleway-0.ebuild | 2 +- .../oem-stackit/oem-stackit-0.ebuild | 2 +- .../oem-vmware/oem-vmware-13.0.10.ebuild | 2 +- 18 files changed, 43 insertions(+), 31 deletions(-) diff --git a/build_sysext b/build_sysext index 6bd6066147..b53a209566 100755 --- a/build_sysext +++ b/build_sysext @@ -93,8 +93,8 @@ switch_to_strict_mode -uo pipefail # Validate command line parameters -SYSEXTNAME="${1:-}" -if [[ -z "${SYSEXTNAME}" ]]; then +SYSEXT_ID="${1:-}" +if [[ -z "${SYSEXT_ID}" ]]; then die "No sysext name provided." fi shift @@ -216,7 +216,7 @@ if [[ ${#} -lt 1 ]]; then show_help_if_requested -h fi -info "Building '${SYSEXTNAME}' sysext with (meta-)packages '${@}' in '${BUILD_DIR}' using '${FLAGS_compression}' compression". +info "Building '${SYSEXT_ID}' sysext with (meta-)packages '${@}' in '${BUILD_DIR}' using '${FLAGS_compression}' compression". for package; do echo "Installing package into sysext image: $package" @@ -232,6 +232,13 @@ for package; do "${package}" done +# If there's only one package, grab its metadata for the sysext. +unset PVR HOMEPAGE SYSEXT_NAME +if [[ ${#} -eq 1 ]]; then + CPV=$(portageq best_version "${BUILD_DIR}/${FLAGS_install_root_basename}" "$1") + IFS=$'\n' read -r -d '' PVR HOMEPAGE SYSEXT_NAME < <(portageq metadata "${BUILD_DIR}/${FLAGS_install_root_basename}" installed "${CPV}" PVR HOMEPAGE SYSEXT_NAME; printf '\0') +fi + # Make squashfs generation more reproducible. export SOURCE_DATE_EPOCH=$(stat -c '%Y' "${BUILD_DIR}/fs-root/usr/lib/os-release") @@ -240,16 +247,16 @@ umount "${BUILD_DIR}/${FLAGS_install_root_basename}" umount "${BUILD_DIR}/fs-root" if [[ "$FLAGS_generate_pkginfo" = "${FLAGS_TRUE}" ]] ; then - info " Creating pkginfo squashfs '${BUILD_DIR}/${SYSEXTNAME}_pkginfo.raw'" + info " Creating pkginfo squashfs '${BUILD_DIR}/${SYSEXT_ID}_pkginfo.raw'" mkdir -p "${BUILD_DIR}/img-pkginfo/var/db" cp -R "${BUILD_DIR}/${FLAGS_install_root_basename}/var/db/pkg" "${BUILD_DIR}/img-pkginfo/var/db/" - mksquashfs "${BUILD_DIR}/img-pkginfo" "${BUILD_DIR}/${SYSEXTNAME}_pkginfo.raw" \ + mksquashfs "${BUILD_DIR}/img-pkginfo" "${BUILD_DIR}/${SYSEXT_ID}_pkginfo.raw" \ -noappend -xattrs-exclude '^btrfs.' -comp zstd -Xcompression-level 22 -b 512k fi -info "Writing ${SYSEXTNAME}_packages.txt" +info "Writing ${SYSEXT_ID}_packages.txt" ROOT="${BUILD_DIR}/${FLAGS_install_root_basename}" PORTAGE_CONFIGROOT="/build/${FLAGS_board}" \ - equery --no-color list --format '$cpv::$repo' '*' > "${BUILD_DIR}/${SYSEXTNAME}_packages.txt" + equery --no-color list --format '$cpv::$repo' '*' > "${BUILD_DIR}/${SYSEXT_ID}_packages.txt" if [[ "${FLAGS_strip_binaries}" = "${FLAGS_TRUE}" ]]; then @@ -283,11 +290,16 @@ for entry in "${BUILD_DIR}/${FLAGS_install_root_basename}"/*; do rm -rf "${entry}" done -grep . <