From 71eed26ee0633bbec766f8c10fe327ee166a2592 Mon Sep 17 00:00:00 2001 From: Krzesimir Nowak Date: Thu, 2 Nov 2023 09:50:35 +0100 Subject: [PATCH] overlay, ci-automation: Try making common-oem-files a valid ebuild Assignment of EAPI must be the first non-comment, non-blank line in the ebuild, otherwise portage masks it as corrupted. --- ci-automation/image_changes.sh | 7 ++- .../common-oem-files-0-r4.ebuild | 46 +++++++++---------- 2 files changed, 28 insertions(+), 25 deletions(-) diff --git a/ci-automation/image_changes.sh b/ci-automation/image_changes.sh index bc93b0d27a..8fdba9d18f 100644 --- a/ci-automation/image_changes.sh +++ b/ci-automation/image_changes.sh @@ -216,8 +216,11 @@ function get_oem_id_list() { exit 1 fi - # This defines COMMON_OEMIDS, AMD64_ONLY_OEMIDS, ARM64_ONLY_OEMIDS - # and OEMIDS variable. We don't use the last one. + # This defines local COMMON_OEMIDS, AMD64_ONLY_OEMIDS, + # ARM64_ONLY_OEMIDS and OEMIDS variable. We don't use the last + # one. Also defines global-by-default EAPI, which we make local + # here to avoid making it global. + local EAPI source "${ebuilds[0]}" flatcar-local-variables local -n arch_oemids_ref="${arch^^}_ONLY_OEMIDS" diff --git a/sdk_container/src/third_party/coreos-overlay/coreos-base/common-oem-files/common-oem-files-0-r4.ebuild b/sdk_container/src/third_party/coreos-overlay/coreos-base/common-oem-files/common-oem-files-0-r4.ebuild index 2ec181eefd..67336f3219 100644 --- a/sdk_container/src/third_party/coreos-overlay/coreos-base/common-oem-files/common-oem-files-0-r4.ebuild +++ b/sdk_container/src/third_party/coreos-overlay/coreos-base/common-oem-files/common-oem-files-0-r4.ebuild @@ -1,14 +1,33 @@ # Copyright (c) 2023 The Flatcar Maintainers. # Distributed under the terms of the GNU General Public License v2 -# Hack description below. +EAPI=8 + +# The hack below is there in order to avoid excessive duplication of +# OEM IDs around the place. This ebuild serves as a Gentoo ebuild 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'. Due to the requirements imposed by the +# section 7.3.1 in Package Manager Specification (that says that EAPI +# assignment must be the first non-comment, non-blank line in the +# file), shell scripts wanting to source this ebuild for geting OEM +# IDs, may need to declare EAPI as local, if it finds it suitable. The +# role of sourced script is used by our image-changes job. All this +# fluff needs to happen before we define or invoke any other +# Gentoo-specific variables or functions like "DEPEND" or "inherit" +# that may mess up sourcing. +# +# This can't be done with a separate shell file in FILESDIR, because +# portage moves the ebuild into some temporary directory where +# FILESDIR, although defined, does not even exist at first - it shows +# up during the invocation of any src_ functions. Probably a security +# measure or something. if [[ ${1:-} = 'flatcar-local-variables' ]]; then - local -a EAPI COMMON_OEMIDS ARM64_ONLY_OEMIDS AMD64_ONLY_OEMIDS OEMIDS + local -a COMMON_OEMIDS ARM64_ONLY_OEMIDS AMD64_ONLY_OEMIDS OEMIDS fi -EAPI=8 - COMMON_OEMIDS=( ami azure @@ -32,30 +51,11 @@ OEMIDS=( ) if [[ ${1:-} = 'flatcar-local-variables' ]]; then - unset EAPI return 0 else unset COMMON_OEMIDS ARM64_ONLY_OEMIDS AMD64_ONLY_OEMIDS fi -# The hack above was done in order to avoid excessive duplication of -# OEM IDs around the place. This ebuild serves as a Gentoo ebuild 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 "DEPEND" or "inherit" -# that may mess up sourcing. The only exception is EAPI, which must -# happen in first 24 lines of the ebuild - this is defined in Package -# Manager Specification and is enforced by portage. -# -# This can't be done with a separate shell file in FILESDIR, because -# portage moves the ebuild into some temporary directory where -# FILESDIR, although defined, does not even exist at first - it shows -# up during the invocation of any src_ functions. Probably a security -# measure or something. - DESCRIPTION='Common OEM files' HOMEPAGE='https://www.flatcar.org/'