From 846515d019a9f5f1c36cd52c7b88bdcb3f63e8be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vin=C3=ADcius=20Ferr=C3=A3o?= <2031761+viniciusferrao@users.noreply.github.com> Date: Mon, 12 Oct 2026 18:15:17 -0300 Subject: [PATCH] refactor(genesis): share deploy artifact resolution --- xCAT-genesis-base/oe/export | 9 ++------- xCAT-genesis-base/oe/export-extension | 8 +------- xCAT-genesis-base/oe/scripts/export-functions | 7 +++++++ 3 files changed, 10 insertions(+), 14 deletions(-) create mode 100644 xCAT-genesis-base/oe/scripts/export-functions diff --git a/xCAT-genesis-base/oe/export b/xCAT-genesis-base/oe/export index bcc3f164f..292056480 100755 --- a/xCAT-genesis-base/oe/export +++ b/xCAT-genesis-base/oe/export @@ -37,13 +37,8 @@ machine_dir=$deploy_dir/images/$machine image_name=xcat-genesis-image-$machine.rootfs license_machine=${machine//-/_} -resolve_artifact() { - local path=$1 resolved - - resolved=$(readlink -f -- "$path") - [[ -f $resolved && ! -L $resolved ]] || fail "missing artifact: $path" - printf '%s\n' "$resolved" -} +script_dir=$(CDPATH='' cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd) +source "$script_dir/scripts/export-functions" kernel=$(resolve_artifact "$machine_dir/$kernel_name") initramfs=$(resolve_artifact "$machine_dir/$image_name.cpio.gz") diff --git a/xCAT-genesis-base/oe/export-extension b/xCAT-genesis-base/oe/export-extension index 0c36915b9..3b535cf00 100755 --- a/xCAT-genesis-base/oe/export-extension +++ b/xCAT-genesis-base/oe/export-extension @@ -40,13 +40,7 @@ machine_dir=$deploy_dir/images/$machine stem=$extension-$machine artifact_stem=$stem.sysext -resolve_artifact() { - local path=$1 resolved - - resolved=$(readlink -f -- "$path") - [[ -f $resolved && ! -L $resolved ]] || fail "missing artifact: $path" - printf '%s\n' "$resolved" -} +source "$script_dir/scripts/export-functions" image=$(resolve_artifact "$machine_dir/$artifact_stem.squashfs-zst") manifest=$(resolve_artifact "$machine_dir/$artifact_stem.manifest.json") diff --git a/xCAT-genesis-base/oe/scripts/export-functions b/xCAT-genesis-base/oe/scripts/export-functions new file mode 100644 index 000000000..80eecca59 --- /dev/null +++ b/xCAT-genesis-base/oe/scripts/export-functions @@ -0,0 +1,7 @@ +resolve_artifact() { + local path=$1 resolved + + resolved=$(readlink -f -- "$path") + [[ -f $resolved && ! -L $resolved ]] || fail "missing artifact: $path" + printf '%s\n' "$resolved" +}