Skip to content

Commit

Permalink
build scripts: separate txt inventory and official naming for sysexts
Browse files Browse the repository at this point in the history
Signed-off-by: Thilo Fromm <[email protected]>
  • Loading branch information
t-lo committed Oct 13, 2023
1 parent 4f382a0 commit 892ea57
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 32 deletions.
4 changes: 2 additions & 2 deletions build_image
Original file line number Diff line number Diff line change
Expand Up @@ -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)"
DEFINE_string base_dev_pkg "coreos-base/coreos-dev" \
"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" \
"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."
DEFINE_string base_sysexts "containerd-flatcar:app-containers/containerd,docker-flatcar:app-containers/docker" \
"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" \
"Directory in which to place image result directories (named by version)"
DEFINE_string disk_layout "" \
Expand Down
42 changes: 18 additions & 24 deletions build_library/prod_image_util.sh
Original file line number Diff line number Diff line change
Expand Up @@ -179,30 +179,6 @@ EOF
"${image_initrd_contents_wtd}" \
"${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
local to_upload=(
"${BUILD_DIR}/${image_contents}"
Expand All @@ -220,6 +196,24 @@ EOF
"${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}" )
declare -a compressed_images
declare -a extra_files
Expand Down
15 changes: 9 additions & 6 deletions build_library/sysext_prod_builder
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ create_prod_sysext() {
local workdir="$3"
local base_sysext="$4"
local install_root="$5"
local grp_pkg="$6"
local pkginfo="${7:-}"
local name="$6"
local grp_pkg="$7"
local pkginfo="${8:-}"

local name="${grp_pkg//\//_}" # some-group/some-package => some-group_some-package
local pkginfo_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
if [[ -n "${pkginfo}" ]] ; then
Expand Down Expand Up @@ -107,15 +107,18 @@ sudo mksquashfs "${root_fs_dir}" "${sysext_base}" -noappend
# for combined overlay later.
prev_pkginfo=""
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}" \
"${sysext_output_dir}" \
"${sysext_workdir}" \
"${sysext_base}" \
"${root_fs_dir}"\
"${name}" \
"${grp_pkg}" \
"${prev_pkginfo}"
name="${grp_pkg//\//_}"

mkdir -p "${sysext_mountdir}/${name}" \
"${sysext_mountdir}/${name}_pkginfo"
Expand Down

0 comments on commit 892ea57

Please sign in to comment.