build scripts: separate txt inventory; official naming for sysexts

Signed-off-by: Thilo Fromm <thilofromm@microsoft.com>
This commit is contained in:
Thilo Fromm 2023-10-13 16:41:31 +02:00
parent e85ca4984c
commit 6f651a298c
5 changed files with 29 additions and 32 deletions

View File

@ -33,8 +33,8 @@ DEFINE_string base_pkg "coreos-base/coreos" \
"The base portage package to base the build off of (only applies to prod images)" "The base portage package to base the build off of (only applies to prod images)"
DEFINE_string base_dev_pkg "coreos-base/coreos-dev" \ DEFINE_string base_dev_pkg "coreos-base/coreos-dev" \
"The base portage package to base the build off of (only applies to dev containers)" "The base portage package to base the build off of (only applies to dev containers)"
DEFINE_string base_sysexts "app-containers/containerd,app-containers/docker" \ DEFINE_string base_sysexts "containerd-flatcar:app-containers/containerd,docker-flatcar:app-containers/docker" \
"Comma-separated list of packages to build into sysexts and include with OS image and update payload. Must be in order of dependencies, base sysexts come first." "Comma-separated list of name:package - build 'package' into sysext 'name', and include with OS image and update payload. Must be in order of dependencies, base sysexts come first."
DEFINE_string output_root "${DEFAULT_BUILD_ROOT}/images" \ DEFINE_string output_root "${DEFAULT_BUILD_ROOT}/images" \
"Directory in which to place image result directories (named by version)" "Directory in which to place image result directories (named by version)"
DEFINE_string disk_layout "" \ DEFINE_string disk_layout "" \

View File

@ -179,30 +179,6 @@ EOF
"${image_initrd_contents_wtd}" \ "${image_initrd_contents_wtd}" \
"${image_disk_usage}" "${image_disk_usage}"
# append sysext inventories to image contents files.
if [[ -n "${base_sysexts}" ]] ; then
local inventory_file="" image_basename="${image_name%.bin}"
for inventory_file in "${image_contents}" "${image_contents_wtd}" "${image_disk_usage}" "${image_packages}" ; do
local suffix="${inventory_file/${image_basename}/}" sysext=""
info "Processing '${inventory_file}'"
for sysext in ${base_sysexts//,/ }; do
local name="${sysext//\//_}"
local sysext_inventory="${root_fs_sysexts_output_dir}/${name}${suffix}"
if [[ ! -f "${sysext_inventory}" ]] ; then
die "Sysext inventory file '${sysext//\//_}${suffix}' for '${inventory_file}' not found in '${root_fs_sysexts_output_dir}'"
fi
info "Adding sysext inventory '${name}${suffix}' to '${inventory_file}'"
{
echo -e "\n\n### Sysext ${name}.raw\n"
cat "${sysext_inventory}"
} >> "${BUILD_DIR}/${inventory_file}"
done
done
fi
# Upload # Upload
local to_upload=( local to_upload=(
"${BUILD_DIR}/${image_contents}" "${BUILD_DIR}/${image_contents}"
@ -220,6 +196,24 @@ EOF
"${BUILD_DIR}/${image_sysext_base}" "${BUILD_DIR}/${image_sysext_base}"
) )
# append sysext inventories to uploads
if [[ -n "${base_sysexts}" ]] ; then
local inventory_file="" image_basename="${image_name%.bin}"
for inventory_file in "${image_contents}" "${image_contents_wtd}" "${image_disk_usage}" "${image_packages}" ; do
local suffix="${inventory_file/${image_basename}/}" sysext=""
for sysext in ${base_sysexts//,/ }; do
local name="${sysext%:*}"
local sysext_inventory="${root_fs_sysexts_output_dir}/${name}${suffix}"
if [[ ! -f "${sysext_inventory}" ]] ; then
die "Sysext inventory file '${name}${suffix}' for '${inventory_file}' not found in '${root_fs_sysexts_output_dir}'"
fi
to_upload+=( "${sysext_inventory}" )
done
done
fi
local files_to_evaluate=( "${BUILD_DIR}/${image_name}" ) local files_to_evaluate=( "${BUILD_DIR}/${image_name}" )
declare -a compressed_images declare -a compressed_images
declare -a extra_files declare -a extra_files

View File

@ -29,14 +29,14 @@ create_prod_sysext() {
local workdir="$3" local workdir="$3"
local base_sysext="$4" local base_sysext="$4"
local install_root="$5" local install_root="$5"
local grp_pkg="$6" local name="$6"
local pkginfo="${7:-}" local grp_pkg="$7"
local pkginfo="${8:-}"
local name="${grp_pkg//\//_}" # some-group/some-package => some-group_some-package
local pkginfo_opt="" local pkginfo_opt=""
local manglefs_opt="" local manglefs_opt=""
local msg="Creating sysext '${grp_pkg}' ==> ${name}.raw" local msg="Installing ${grp_pkg}' in sysext ${name}.raw"
# Include previous sysexts' pkginfo if supplied # Include previous sysexts' pkginfo if supplied
if [[ -n "${pkginfo}" ]] ; then if [[ -n "${pkginfo}" ]] ; then
@ -107,15 +107,18 @@ sudo mksquashfs "${root_fs_dir}" "${sysext_base}" -noappend
# for combined overlay later. # for combined overlay later.
prev_pkginfo="" prev_pkginfo=""
sysext_lowerdirs="${sysext_mountdir}/rootfs-lower" sysext_lowerdirs="${sysext_mountdir}/rootfs-lower"
for grp_pkg in ${sysexts_list//,/ }; do for sysext in ${sysexts_list//,/ }; do
# format is "<name>:<group>/<package>"
name="${sysext%:*}"
grp_pkg="${sysext#*:}"
create_prod_sysext "${BOARD}" \ create_prod_sysext "${BOARD}" \
"${sysext_output_dir}" \ "${sysext_output_dir}" \
"${sysext_workdir}" \ "${sysext_workdir}" \
"${sysext_base}" \ "${sysext_base}" \
"${root_fs_dir}"\ "${root_fs_dir}"\
"${name}" \
"${grp_pkg}" \ "${grp_pkg}" \
"${prev_pkginfo}" "${prev_pkginfo}"
name="${grp_pkg//\//_}"
mkdir -p "${sysext_mountdir}/${name}" \ mkdir -p "${sysext_mountdir}/${name}" \
"${sysext_mountdir}/${name}_pkginfo" "${sysext_mountdir}/${name}_pkginfo"