overlay, ci-automation: Another attempt at providing OEMID info

Please read the comment at the top of the coreos-base/common-oem-files
ebuild for details.
This commit is contained in:
Krzesimir Nowak 2023-11-01 18:28:06 +01:00
parent f542807a9e
commit 8a75eba906
3 changed files with 64 additions and 34 deletions

View File

@ -210,9 +210,15 @@ function get_oem_id_list() {
arch=${1}; shift arch=${1}; shift
list_var_name=${1}; shift list_var_name=${1}; shift
local -a ebuilds=("${scripts_repo}/sdk_container/src/third_party/coreos-overlay/coreos-base/common-oem-files/common-oem-files-"*'.ebuild')
if [[ ${#ebuilds[@]} -eq 0 ]] || [[ ! -e ${ebuilds[0]} ]]; then
echo "No coreos-base/common-oem-files ebuilds?!" >&2
exit 1
fi
# This defines COMMON_OEMIDS, AMD64_ONLY_OEMIDS, ARM64_ONLY_OEMIDS # This defines COMMON_OEMIDS, AMD64_ONLY_OEMIDS, ARM64_ONLY_OEMIDS
# and OEMIDS variable. We don't use the last one. # and OEMIDS variable. We don't use the last one.
source "${scripts_repo}/sdk_container/src/third_party/coreos-overlay/coreos-base/common-oem-files/files/oemids.sh" local source "${ebuilds[0]}" flatcar-local-variables
local -n arch_oemids_ref="${arch^^}_ONLY_OEMIDS" local -n arch_oemids_ref="${arch^^}_ONLY_OEMIDS"
local all_oemids=( local all_oemids=(

View File

@ -1,10 +1,64 @@
# Copyright (c) 2023 The Flatcar Maintainers. # Copyright (c) 2023 The Flatcar Maintainers.
# Distributed under the terms of the GNU General Public License v2 # Distributed under the terms of the GNU General Public License v2
EAPI=8 # This is a terrible hack done in order to avoid excessive duplication
# of OEM IDs around the place. This ebuild basically serves as a
# Gentoo ebuild (duh…) and as a bash file to be sourced in order to
# get arch-specific information about possible OEM IDs. The latter
# role is assumed when the ebuild is sourced with first argument being
# 'flatcar-local-variables'. This role is used by our image-changes
# job. All this fluff needs to happen before we define or invoke any
# Gentoo-specific variables or functions like "EAPI" or "inherit" that
# may mess up sourcing.
#
# This can't be done with a separate shell file in FILESDIR (I tried),
# because portage moves the ebuild into some temporary directory where
# FILESDIR, although defined, does not even exist. Probably a security
# measure or something. So this needs to be done as
# all-in-terrible-one (as opposed to all-in-wonder-one).
# This defines the OEMIDS variable. ##
source "${FILESDIR}/oemids.sh" only-oemids ## BEGIN HACK
##
if [[ ${1:-} = 'flatcar-local-variables' ]]; then
local -a COMMON_OEMIDS ARM64_ONLY_OEMIDS AMD64_ONLY_OEMIDS OEMIDS
fi
COMMON_OEMIDS=(
ami
azure
openstack
packet
qemu
)
ARM64_ONLY_OEMIDS=(
)
AMD64_ONLY_OEMIDS=(
digitalocean
vmware
)
OEMIDS=(
"${COMMON_OEMIDS[@]}"
"${ARM64_ONLY_OEMIDS[@]}"
"${AMD64_ONLY_OEMIDS[@]}"
)
if [[ ${1:-} = 'flatcar-local-variables' ]]; then
# Leave the sourced script here.
return 0
else
unset COMMON_OEMIDS ARM64_ONLY_OEMIDS AMD64_ONLY_OEMIDS
fi
##
## END HACK
##
EAPI=8
DESCRIPTION='Common OEM files' DESCRIPTION='Common OEM files'
HOMEPAGE='https://www.flatcar.org/' HOMEPAGE='https://www.flatcar.org/'

View File

@ -1,30 +0,0 @@
if [[ ${1:-} = 'local' ]]; then
local -a COMMON_OEMIDS ARM64_ONLY_OEMIDS AMD64_ONLY_OEMIDS OEMIDS
shift
fi
COMMON_OEMIDS=(
ami
azure
openstack
packet
qemu
)
ARM64_ONLY_OEMIDS=(
)
AMD64_ONLY_OEMIDS=(
digitalocean
vmware
)
OEMIDS=(
"${COMMON_OEMIDS[@]}"
"${ARM64_ONLY_OEMIDS[@]}"
"${AMD64_ONLY_OEMIDS[@]}"
)
if [[ ${1:-} = 'only-oemids' ]]; then
unset COMMON_OEMIDS ARM64_ONLY_OEMIDS AMD64_ONLY_OEMIDS
fi