Publish only intended package artifacts

This commit is contained in:
Ryan Hughes committed 2026-09-05 00:07:11 -04:00
1 parent 520dd5c3bb
commit de57b5dfc2
2 files changed
+50 -13

No files matched your search

+19 -8
View File
@@ -149,11 +149,16 @@ fi
# leave nvidia-580xx-dkms and opencl-nvidia-580xx behind. An output's own name # leave nvidia-580xx-dkms and opencl-nvidia-580xx behind. An output's own name
# still matches, for pushing just one of them on purpose. # still matches, for pushing just one of them on purpose.
# #
# pkgbase comes from .PKGINFO rather than the PKGBUILD: it is what makepkg # Package identity comes from .PKGINFO rather than the filename or PKGBUILD: it
# actually recorded, and it needs no guessing about which directory built what. # is what makepkg actually recorded, and it handles epochs and split packages.
pkgbase_of() { package_identity_of() {
bsdtar -xOf "$1" .PKGINFO 2>/dev/null | bsdtar -xOf "$1" .PKGINFO 2>/dev/null |
awk -F ' = ' '$1 == "pkgbase" { print $2; exit }' awk -F ' = ' '
$1 == "pkgname" { name = $2 }
$1 == "pkgbase" { base = $2 }
$1 == "pkgver" { version = $2 }
END { print name "\t" base "\t" version }
'
} }
FILES=() FILES=()
@@ -161,14 +166,18 @@ if [[ -z "$PACKAGES" ]]; then
FILES=("${ALL_FILES[@]}") FILES=("${ALL_FILES[@]}")
else else
declare -A MATCHED=() declare -A MATCHED=()
declare -A LATEST_FILE=()
declare -A LATEST_VERSION=()
for file in "${ALL_FILES[@]}"; do for file in "${ALL_FILES[@]}"; do
# name-version-release-arch.pkg.tar.zst -> name IFS=$'\t' read -r pkgname pkgbase pkgver < <(package_identity_of "$BUILD_OUTPUT_DIR/$file")
pkgname="${file%-*-*-*.pkg.tar.*}"
pkgbase=$(pkgbase_of "$BUILD_OUTPUT_DIR/$file")
for wanted in $PACKAGES; do for wanted in $PACKAGES; do
if [[ "$pkgname" == "$wanted" || "$pkgbase" == "$wanted" ]]; then if [[ "$pkgname" == "$wanted" || "$pkgbase" == "$wanted" ]]; then
FILES+=("$file")
MATCHED["$wanted"]=1 MATCHED["$wanted"]=1
if [[ -z "${LATEST_FILE[$pkgname]:-}" ]] ||
[[ $(vercmp "$pkgver" "${LATEST_VERSION[$pkgname]}") -gt 0 ]]; then
LATEST_FILE["$pkgname"]="$file"
LATEST_VERSION["$pkgname"]="$pkgver"
fi
break break
fi fi
done done
@@ -181,6 +190,8 @@ else
exit 1 exit 1
fi fi
done done
mapfile -t FILES < <(printf '%s\n' "${LATEST_FILE[@]}" | sort)
fi fi
if [[ ${#FILES[@]} -eq 0 ]]; then if [[ ${#FILES[@]} -eq 0 ]]; then
+31 -5
View File
@@ -332,10 +332,38 @@ build_package() {
# Ensure output directory exists # Ensure output directory exists
mkdir -p "$BUILD_OUTPUT_DIR" mkdir -p "$BUILD_OUTPUT_DIR"
# Copy only the artifacts makepkg declares as outputs. A PKGBUILD may use
# another pacman package as a source (schist-bin does); a *.pkg.tar.* glob
# would mistake that source archive for one of our freshly built packages.
local -a package_files=()
mapfile -t package_files < <(makepkg --packagelist)
if [[ ${#package_files[@]} -eq 0 ]]; then
echo " Makepkg produced no package files for $pkg"
FAILED_PACKAGES="$FAILED_PACKAGES $pkg"
return 1
fi
local dependency_pkg_file="" local dependency_pkg_file=""
for pkg_file in *.pkg.tar.*; do local -a new_pkgs=()
[[ -f "$pkg_file" && "$pkg_file" != *.sig ]] || continue local pkg_path pkg_file
for pkg_path in "${package_files[@]}"; do
pkg_file=${pkg_path##*/}
if [[ ! -f "$pkg_file" ]]; then
# makepkg predicts an automatic -debug output whenever debug is
# enabled, but data-only packages may contain no symbols and therefore
# legitimately produce no debug archive.
if [[ "$pkg_file" == *-debug-*.pkg.tar.* ]]; then
continue
fi
echo " Expected package file was not produced: $pkg_file"
FAILED_PACKAGES="$FAILED_PACKAGES $pkg"
return 1
fi
cp "$pkg_file" "$BUILD_OUTPUT_DIR/" cp "$pkg_file" "$BUILD_OUTPUT_DIR/"
new_pkgs+=("$pkg_file")
if [[ "$(bsdtar -xOf "$pkg_file" .PKGINFO 2>/dev/null | sed -n 's/^pkgname = //p')" == "$pkg" ]]; then if [[ "$(bsdtar -xOf "$pkg_file" .PKGINFO 2>/dev/null | sed -n 's/^pkgname = //p')" == "$pkg" ]]; then
dependency_pkg_file="$BUILD_OUTPUT_DIR/$pkg_file" dependency_pkg_file="$BUILD_OUTPUT_DIR/$pkg_file"
@@ -344,9 +372,7 @@ build_package() {
cd "$BUILD_OUTPUT_DIR" cd "$BUILD_OUTPUT_DIR"
# Find ALL package files (handles split packages) # Add every output from this build, including split packages.
local new_pkgs=($(ls -t ${pkg}-*.pkg.tar.* 2>/dev/null | grep -v '\.sig$' | grep -v 'omarchy-build\.db'))
if [[ ${#new_pkgs[@]} -gt 0 ]]; then if [[ ${#new_pkgs[@]} -gt 0 ]]; then
repo-add omarchy-build.db.tar.zst "${new_pkgs[@]}" >/dev/null 2>&1 repo-add omarchy-build.db.tar.zst "${new_pkgs[@]}" >/dev/null 2>&1
ln -sf omarchy-build.db.tar.zst omarchy-build.db ln -sf omarchy-build.db.tar.zst omarchy-build.db