summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Orgis2020-04-08 16:54:12 +0200
committerThomas Orgis2021-02-26 12:25:51 +0100
commit155d8c0362a10f3fe67a8fc9ff0924ab45415fff (patch)
treed3970ab470dd2c523498818419f09fef4c01a987
parent1b679999e2cc426054e35a406367c455d519c985 (diff)
Revert "libmisc: Implement one-shot specfile selection"
This reverts commit 615b00c28da7e62b0b31098b0229b0f9a04de0d2. This broke things by not setting specdir appropriately, causing later attempts to fix that. Those attempts break for differing arch selections as they are not all in the same path depth. We shall never guess specdir after the fact. Use the values we know!
-rwxr-xr-xvar/lib/sorcery/modules/libmisc36
1 files changed, 15 insertions, 21 deletions
diff --git a/var/lib/sorcery/modules/libmisc b/var/lib/sorcery/modules/libmisc
index b2bc2c06..cbc09cd3 100755
--- a/var/lib/sorcery/modules/libmisc
+++ b/var/lib/sorcery/modules/libmisc
@@ -1485,29 +1485,23 @@ set_architecture() {
: ${arch:=${TARGET:-$ARCHITECTURE}}
# Find the specfile to use
- SPECFILE=$(find -L "${ARCH_SPECS[@]}" \( -name "$arch" -o -name null \) \
- -perm -400 -type f 2>/dev/null |
- awk '! /[/]null$/ { exit } END { print }')
- case "$SPECFILE" in
- */null)
- message "${PROBLEM_COLOR}Cannot find arch spec for $arch!"
- message "Reverting to null!"
- message "Please run sorcery afterwards and pick another architecture!$DEFAULT_COLOR"
- echo
- sleep 2
- esac
+ for specdir in ${ARCH_SPECS[@]} ; do
+ SPECFILE=$(find -L ${specdir} -perm -400 -type f -name "$arch" 2>/dev/null | sed q)
+ [ $SPECFILE ] && break
+ done
+ if [[ ! $SPECFILE ]] ; then
+ message "${PROBLEM_COLOR}Cannot find arch spec for $arch!"
+ message "Reverting to null!"
+ message "Please run sorcery afterwards and pick another architecture!$DEFAULT_COLOR"
+ echo
+ sleep 2
+ SPECFILE=$(find -L ${specdir} -perm -400 -type f -name "null" 2>/dev/null | sed q)
+ fi
debug "libmisc" "set_architecture: SPECFILE=$SPECFILE"
- # turn the path into an array, removing the spec dir prefix
- SMGL_COMPAT_ARCHS=($(awk -F/ -vdirs="^${ARCH_SPECS[*]}/" -vf="$SPECFILE" '
- BEGIN {
- sub(/[/]* +/, "/|^", dirs) # convert to regex
- match(f, dirs)
- f = substr(f, RLENGTH) # remove prefix
- gsub(/[/]+/, " ", f) # split
- print f
- }'))
- debug "libmisc" "set_architecture: SMGL_COMPAT_ARCHS[${#SMGL_COMPAT_ARCHS[@]}]=(${SMGL_COMPAT_ARCHS[*]})"
+ # turn the path into an array, but remove $specdir from the start first
+ unset SMGL_COMPAT_ARCHS
+ explode "${SPECFILE#$specdir/}" '/' SMGL_COMPAT_ARCHS
# Reverse the array so that the most specific arch is first
ARCHITECTURE=($(awk 'BEGIN { while (--ARGC > 0) print ARGV[ARGC] }' \