diff options
author | Stefanie Eckner <stefanie@eckner.net> | 2024-12-30 16:46:56 +0100 |
---|---|---|
committer | Stefanie Eckner <stefanie@eckner.net> | 2024-12-30 16:46:56 +0100 |
commit | 312339c949e584d5787b3198101903042a3efd9d (patch) | |
tree | 59b2dee43caa20d2ef11be083f0f981a1889bbcd | |
parent | 22a2eb9adf0d5d4df80e8ced6ef562bc48798865 (diff) | |
download | archlinuxewe-312339c949e584d5787b3198101903042a3efd9d.tar.xz |
pin dependencies for all architectures correctly
-rwxr-xr-x | bumpPkgrel | 49 | ||||
-rwxr-xr-x | checkPinnedDependencies | 85 |
2 files changed, 93 insertions, 41 deletions
diff --git a/bumpPkgrel b/bumpPkgrel index 014c6102d..840119c52 100755 --- a/bumpPkgrel +++ b/bumpPkgrel @@ -20,7 +20,7 @@ eval set -- "$( auto_detect=false commit=true commit_flag='' -provided='' +provided=() while true; do case "$1" in @@ -33,7 +33,7 @@ while true; do ;; '-p') shift - provided="$1" + provided=("${provided[@]}" "$1") ;; '--') shift @@ -50,12 +50,28 @@ if [ $# -eq 0 ] && ! ${auto_detect}; then usage fi -if [ -z "${provided}" ]; then - provided=$("${0%/*}/liste-verfuegbare-Versionen") || exit $? - trap 'rm -f "${provided}"' EXIT +if [ ${#provided[@]} -eq 0 ]; then + provided=( + $( + printf 'arch\n%s\n' 'i486' 'i686' 'pentium4' 'x86_64' \ + | parallel -l2 "${0%/*}/liste-verfuegbare-Versionen" + ) + ) + trap 'rm -f "${provided[@]}"' EXIT fi pin_dependency() { + prov=$( + printf '%s\n' "${provided[@]}" \ + | grep -m1 '\.\(arch\.'"$2"'\|'"$2"'\.x86_64\)$' + ) || prov=$( + printf '%s\n' "${provided[@]}" \ + | grep -m1 '\.arch\.x86_64$' + ) || prov=$( + printf '%s\n' "${provided[@]}" \ + | head -n1 + ) + >&2 echo "'$2' '$prov'" sed ' s/^\(\S\+\)>\?=\(\S\+\)$/\1 \2/ t @@ -64,7 +80,7 @@ pin_dependency() { d ' \ | sort -k1,1 \ - | join -1 1 -2 2 -a 1 -e EMPTY -o 1.1,1.2,2.1 - "${provided}" \ + | join -1 1 -2 2 -a 1 -e EMPTY -o 1.1,1.2,2.1 - "${prov}" \ | sed ' s/ \(\S\+\) EMPTY$/ \1 \1/ ' \ @@ -81,19 +97,23 @@ if [ $# -ne 1 ] || ${auto_detect}; then { printf '%s\n' "$@" if ${auto_detect}; then - "${0%/*}/checkPinnedDependencies" -m "${provided}" + "${0%/*}/checkPinnedDependencies" -m "${provided[@]}" fi } \ | sort -u \ - | xargs -rn1 "$0" ${commit_flag} -p "${provided}" + | xargs -rn1 "$0" ${commit_flag} $(printf ' -p %s' "${provided[@]}") - if ${auto_detect}; then + if ${auto_detect} \ + && prov=$( + printf '%s\n' "${provided[@]}" \ + | grep -m1 '\.arch\.x86_64$' + ); then python_version=$( sed ' s/^\(3\.[0-9]\+\)\(\.[0-9.]\+\)\? python$/\1/ t d - ' "${provided}" + ' "${prov}" ) if cat "${0%/*}"/*/PKGBUILD \ | sed ' @@ -102,7 +122,7 @@ if [ $# -ne 1 ] || ${auto_detect}; then d ' \ | grep -qvxF "python>=${python_version}"; then - "${0%/*}/bumpPython" "${python_version}" "${provided}" + "${0%/*}/bumpPython" "${python_version}" "${provided[@]}" fi fi @@ -121,6 +141,11 @@ else fi if printf '%s\n' "${line}" \ | grep -q '^\s*_pinned_dependencies\([^=[:space:]]*\)=('; then + suffix="${line%%=*}" + suffix="${suffix##*_}" + if [ "${suffix}" = 'dependencies' ]; then + unset suffix + fi space="${line%%_pinned_dependencies*=(*}" printf '%s=(\n' "${line%%=(*}" line="${line#*_pinned_dependencies*=(}" @@ -136,7 +161,7 @@ else /^$/d s/^\(["'"'"']\)\(\S\+\)\1$/\2/ ' \ - | pin_dependency "${space} " + | pin_dependency "${space} " "${suffix}" printf '%s)%s\n' "${space}" "${line#*)}" continue fi diff --git a/checkPinnedDependencies b/checkPinnedDependencies index ecf945822..1f5186ed8 100755 --- a/checkPinnedDependencies +++ b/checkPinnedDependencies @@ -3,14 +3,14 @@ cd "$(dirname "$0")" machineReadable=false -unset provided +provided=() while [ $# -gt 0 ]; do if [ "x$1" = 'x-m' ]; then machineReadable=true elif [ -f "$1" ]; then - provided="$1" + provided=("${provided[@]}" "$1") else >&2 printf 'unknown option "%s"\n' "$1" fi @@ -19,35 +19,62 @@ while [ $# -gt 0 ]; do done -if [ -z "${provided}" ]; then - provided=$("./liste-verfuegbare-Versionen") || exit $? - trap 'rm -f "${provided}"' EXIT +if [ ${#provided[@]} -eq 0 ]; then + provided=( + $( + printf 'arch\n%s\n' 'i486' 'i686' 'pentium4' 'x86_64' \ + | parallel -l2 "${0%/*}/liste-verfuegbare-Versionen" + ) + ) + trap 'rm -f "${provided[@]}"' EXIT fi -join -1 1 -2 2 -v 2 <( - awk '{print $2 "=" $1}' <"${provided}" \ - | sort -u -) <( - for pkgbuild in */PKGBUILD; do - sed -n ' - /^\s*_pinned_dependencies[^[:space:]=]*=([^)]*$/,/)/p - /^\s*_pinned_dependencies[^[:space:]=]*=([^)]*)/p - ' "${pkgbuild}" \ - | sed ' - s/^\s*_pinned_dependencies[^[:space:]=]*=(// - s/).*$// - ' \ - | tr '[:space:]' '\n' \ - | sort -u \ - | grep -vxF '' \ - | sed ' - s@^\(['"'"'"]\)\(\S\+\)\1$@\2@ - /^glibc>=/d - s@^@'"${pkgbuild%/*}"' @ - ' - done \ - | sort -k2,2 -) \ +for provid in "${provided[@]}"; do + arch="${provid##*.}" + dist="${provid%.${arch}}" + dist="${dist##*.}" + if printf '%s\n' "${arch}" | grep -qvxFf <(printf '%s\n' 'i486' 'i686' 'pentium4' 'x86_64'); then + unset arch + unset dist + else + arch="_${arch}" + dist="_${dist}" + fi + join -1 1 -2 2 -v 2 <( + awk '{print $2 "=" $1}' <"${provid}" \ + | sort -u + ) <( + for pkgbuild in */PKGBUILD; do + sed -n ' + /^\s*arch=(.*)/p + /^\s*arch=([^)]*$/,/)/p + ' "${pkgbuild}" \ + | sed ' + s/^\s*arch=(// + s/).*$// + ' \ + | grep -qwF "${arch}" \ + || continue + sed -n ' + /^\s*_pinned_dependencies\('"${arch}"'\|'"${dist}"'\)\?=([^)]*$/,/)/p + /^\s*_pinned_dependencies\('"${arch}"'\|'"${dist}"'\)\?=([^)]*)/p + ' "${pkgbuild}" \ + | sed ' + s/^\s*_pinned_dependencies[^[:space:]=]*=(// + s/).*$// + ' \ + | tr '[:space:]' '\n' \ + | sort -u \ + | grep -vxF '' \ + | sed ' + s@^\(['"'"'"]\)\(\S\+\)\1$@\2@ + /^glibc>=/d + s@^@'"${pkgbuild%/*}"' @ + ' + done \ + | sort -k2,2 + ) +done \ | if ${machineReadable}; then cut -d' ' -f2 else |