From 741c029a1b2c7b529eaab6a9fe4760265487f089 Mon Sep 17 00:00:00 2001 From: Yvan Janssens Date: Tue, 5 May 2026 09:57:44 +0200 Subject: [PATCH] Fix CI package helper path handling --- scripts/ci/build-package.sh | 43 ++++++++++++++++++++++++++++++------- 1 file changed, 35 insertions(+), 8 deletions(-) diff --git a/scripts/ci/build-package.sh b/scripts/ci/build-package.sh index 385d065..64f6f20 100755 --- a/scripts/ci/build-package.sh +++ b/scripts/ci/build-package.sh @@ -13,10 +13,7 @@ load_build_config work_root="$(ci_work_root)" helper_dir="$work_root/hercules-helper" artifacts_dir="$work_root/artifacts" -helper_entrypoint="$helper_dir/create-package-hyperion.sh" -compat_template_dir="$helper_dir/packagers/debian/hyperion-4.4" build_path="/home/bill/hyperion-build-package" -raw_package_path="$build_path/hyperion-4.4.deb" metadata_file="$artifacts_dir/package.env" log "Preparing CI work root at $work_root" @@ -26,11 +23,17 @@ mkdir -p "$artifacts_dir" log "Cloning helper repo $REPO (branch: $BRANCH)" git clone --depth 1 --branch "$BRANCH" "$REPO" "$helper_dir" -if [[ ! -e "$helper_entrypoint" ]]; then - ln -s "packagers/debian/create-package-hyperion.sh" "$helper_entrypoint" +helper_entrypoint="" +if [[ -f "$helper_dir/packagers/debian/create-package-hyperion.sh" ]]; then + helper_entrypoint="$helper_dir/packagers/debian/create-package-hyperion.sh" +elif [[ -f "$helper_dir/create-package-hyperion.sh" ]]; then + helper_entrypoint="$helper_dir/create-package-hyperion.sh" +else + die "No Hyperion package entrypoint found in $helper_dir" fi -if [[ ! -e "$compat_template_dir" ]]; then +compat_template_dir="$helper_dir/packagers/debian/hyperion-4.4" +if [[ -d "$helper_dir/packagers/debian/hercules-hyperion" ]] && [[ ! -e "$compat_template_dir" ]]; then ln -s "hercules-hyperion" "$compat_template_dir" fi @@ -46,17 +49,41 @@ log "Invoking helper repo Debian package script" opt_beeps=false \ opt_verbose=true \ TRACE=false \ + build_path="$build_path" \ + OUTPUT_DIR="$artifacts_dir" \ bash "$helper_entrypoint" ) -[[ -f "$raw_package_path" ]] || die "Expected package was not created: $raw_package_path" +artifact_candidates=() +while IFS= read -r candidate; do + artifact_candidates+=("$candidate") +done < <( + find "$artifacts_dir" -maxdepth 1 -type f -name '*.deb' 2>/dev/null | sort +) + +if (( ${#artifact_candidates[@]} == 0 )); then + while IFS= read -r candidate; do + artifact_candidates+=("$candidate") + done < <( + find "$build_path" -maxdepth 1 -type f -name '*.deb' 2>/dev/null | sort + ) +fi + +(( ${#artifact_candidates[@]} > 0 )) || die "Expected package was not created under $artifacts_dir or $build_path" + +raw_package_path="${artifact_candidates[0]}" +if (( ${#artifact_candidates[@]} > 1 )); then + raw_package_path="${artifact_candidates[-1]}" +fi package_name="$(dpkg-deb -f "$raw_package_path" Package)" package_version="$(dpkg-deb -f "$raw_package_path" Version)" package_arch="$(dpkg-deb -f "$raw_package_path" Architecture)" artifact_path="$artifacts_dir/${package_name}_${package_version}_${package_arch}.deb" -cp "$raw_package_path" "$artifact_path" +if [[ "$raw_package_path" != "$artifact_path" ]]; then + cp "$raw_package_path" "$artifact_path" +fi cat >"$metadata_file" <