--target-arch: introduce aliases for some archs

Bug #1674752 reported by Paolo Pisati
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Snapcraft
Fix Released
Wishlist
Paolo Pisati

Bug Description

Instead of forcing the outside world to think of architectures as the 'deb world' expect it, introduce a new field called 'target' in the _ARCH_TRANSLATIONS data struct, and moves _find_machine() to use that field - that let me introduce aliases for some arches and simplify some scripts used to build kernels using snapcraft.

With this patch i'm able to trim down that much shell code that was in place just to mimic a deb arch (instead of just passing down the arch the kernel was building for):

-set_snaparch() {
- # Attempt to find the correct architecture
- case "$UTS_MACHINE" in
- i386|ia64|alpha)
- snaparch="$UTS_MACHINE" ;;
- x86_64)
- snaparch=amd64 ;;
- sparc*)
- snaparch=sparc ;;
- s390*)
- snaparch=s390$(grep -q CONFIG_64BIT=y $KCONFIG_CONFIG && echo x || true) ;;
- ppc*)
- snaparch=$(grep -q CPU_LITTLE_ENDIAN=y $KCONFIG_CONFIG && echo ppc64el || echo powerpc) ;;
- parisc*)
- snaparch=hppa ;;
- mips*)
- snaparch=mips$(grep -q CPU_LITTLE_ENDIAN=y $KCONFIG_CONFIG && echo el || true) ;;
- aarch64)
- snaparch=arm64 ;;
- arm*)
- if grep -q CONFIG_AEABI=y $KCONFIG_CONFIG; then
- if grep -q CONFIG_VFP=y $KCONFIG_CONFIG; then
- snaparch=armhf
- else
- snaparch=armel
- fi
- else
- snaparch=arm
- fi
- ;;
- *)
- snaparch=$(dpkg --print-architecture)
- echo "" >&2
- echo "** ** ** WARNING ** ** **" >&2
- echo "" >&2
- echo "Your architecture doesn't have it's equivalent" >&2
- echo "Debian userspace architecture defined!" >&2
- echo "Falling back to using your current userspace instead!" >&2
- echo "Please add support for $UTS_MACHINE to ${0} ..." >&2
- echo "" >&2
- esac
- forcearch="--target-arch=$snaparch"
-}
-

Revision history for this message
Paolo Pisati (p-pisati) wrote :
Revision history for this message
Sergio Schvezov (sergiusens) wrote :
Changed in snapcraft:
status: New → Fix Committed
importance: Undecided → Wishlist
assignee: nobody → Paolo Pisati (p-pisati)
milestone: none → 2.30
Changed in snapcraft:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.