Fix CI package helper path handling
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
This commit is contained in:
@@ -13,10 +13,7 @@ load_build_config
|
|||||||
work_root="$(ci_work_root)"
|
work_root="$(ci_work_root)"
|
||||||
helper_dir="$work_root/hercules-helper"
|
helper_dir="$work_root/hercules-helper"
|
||||||
artifacts_dir="$work_root/artifacts"
|
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"
|
build_path="/home/bill/hyperion-build-package"
|
||||||
raw_package_path="$build_path/hyperion-4.4.deb"
|
|
||||||
metadata_file="$artifacts_dir/package.env"
|
metadata_file="$artifacts_dir/package.env"
|
||||||
|
|
||||||
log "Preparing CI work root at $work_root"
|
log "Preparing CI work root at $work_root"
|
||||||
@@ -26,11 +23,17 @@ mkdir -p "$artifacts_dir"
|
|||||||
log "Cloning helper repo $REPO (branch: $BRANCH)"
|
log "Cloning helper repo $REPO (branch: $BRANCH)"
|
||||||
git clone --depth 1 --branch "$BRANCH" "$REPO" "$helper_dir"
|
git clone --depth 1 --branch "$BRANCH" "$REPO" "$helper_dir"
|
||||||
|
|
||||||
if [[ ! -e "$helper_entrypoint" ]]; then
|
helper_entrypoint=""
|
||||||
ln -s "packagers/debian/create-package-hyperion.sh" "$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
|
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"
|
ln -s "hercules-hyperion" "$compat_template_dir"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -46,17 +49,41 @@ log "Invoking helper repo Debian package script"
|
|||||||
opt_beeps=false \
|
opt_beeps=false \
|
||||||
opt_verbose=true \
|
opt_verbose=true \
|
||||||
TRACE=false \
|
TRACE=false \
|
||||||
|
build_path="$build_path" \
|
||||||
|
OUTPUT_DIR="$artifacts_dir" \
|
||||||
bash "$helper_entrypoint"
|
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_name="$(dpkg-deb -f "$raw_package_path" Package)"
|
||||||
package_version="$(dpkg-deb -f "$raw_package_path" Version)"
|
package_version="$(dpkg-deb -f "$raw_package_path" Version)"
|
||||||
package_arch="$(dpkg-deb -f "$raw_package_path" Architecture)"
|
package_arch="$(dpkg-deb -f "$raw_package_path" Architecture)"
|
||||||
artifact_path="$artifacts_dir/${package_name}_${package_version}_${package_arch}.deb"
|
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" <<EOF
|
cat >"$metadata_file" <<EOF
|
||||||
PACKAGE_FILE=$artifact_path
|
PACKAGE_FILE=$artifact_path
|
||||||
|
|||||||
Reference in New Issue
Block a user