Skip to Content.
Sympa Menu

sm-commit - [SM-Commit] GIT changes to master sorcery by Ismael Luceno (f4ef5e8287b1a65aa0f38229af8f2b7b077cd74d)

sm-commit AT lists.ibiblio.org

Subject: Source Mage code commit list

List archive

Chronological Thread  
  • From: Ismael Luceno <scm AT sourcemage.org>
  • To: sm-commit AT lists.ibiblio.org
  • Subject: [SM-Commit] GIT changes to master sorcery by Ismael Luceno (f4ef5e8287b1a65aa0f38229af8f2b7b077cd74d)
  • Date: Thu, 9 Apr 2020 21:20:33 +0000

GIT changes to master sorcery by Ismael Luceno <ismael AT sourcemage.org>:

var/lib/sorcery/modules/libmisc | 41
++++++++++++++++++++++------------------
1 file changed, 23 insertions(+), 18 deletions(-)

New commits:
commit f4ef5e8287b1a65aa0f38229af8f2b7b077cd74d
Author: Ismael Luceno <ismael AT sourcemage.org>
Commit: Ismael Luceno <ismael AT sourcemage.org>

libmisc: Re-implement one-shot specfile selection

This version fixes the composition of SMGL_COMPAT_ARCHS.

Reverts: 112632ce607b ("Revert "libmisc: Implement one-shot specfile
selection"")
Fixes: 615b00c28da7 ("libmisc: Implement one-shot specfile selection")

diff --git a/var/lib/sorcery/modules/libmisc b/var/lib/sorcery/modules/libmisc
index dd5952c..b9e27de 100755
--- a/var/lib/sorcery/modules/libmisc
+++ b/var/lib/sorcery/modules/libmisc
@@ -1478,28 +1478,33 @@ set_architecture() {
: ${arch:=${TARGET:-$ARCHITECTURE}}

# Find the specfile to use
- 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
+ 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
debug "libmisc" "set_architecture: SPECFILE=$SPECFILE"

- # turn the path into an array, but remove $specdir from the start first
- unset SMGL_COMPAT_ARCHS
- explode "${SPECFILE#$specdir/}" '/' SMGL_COMPAT_ARCHS
+ # 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[*]})"

# Reverse the array so that the most specific arch is first
- ARCHITECTURE=(
- $(for i in "${SMGL_COMPAT_ARCHS[@]}"; do echo "$i"; done | tac)
- )
+ ARCHITECTURE=($(awk 'BEGIN { while (--ARGC > 0) print ARGV[ARGC] }' \
+ "${SMGL_COMPAT_ARCHS[@]}"))

# Guess libc ABI; archspecs default to "gnu"
if [ -z "$HOST_LIBC" ]; then



  • [SM-Commit] GIT changes to master sorcery by Ismael Luceno (f4ef5e8287b1a65aa0f38229af8f2b7b077cd74d), Ismael Luceno, 04/09/2020

Archive powered by MHonArc 2.6.24.

Top of Page