From: "Ulrich Mueller" <ulm@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/eselect:master commit in: libs/, /
Date: Sat, 5 Jan 2013 13:47:39 +0000 (UTC) [thread overview]
Message-ID: <1357391458.40f82c2ca4450db7fbc70c3e281361deb8fc8e90.ulm@gentoo> (raw)
commit: 40f82c2ca4450db7fbc70c3e281361deb8fc8e90
Author: Ulrich Müller <ulm <AT> gentoo <DOT> org>
AuthorDate: Sat Jan 5 13:10:58 2013 +0000
Commit: Ulrich Mueller <ulm <AT> gentoo <DOT> org>
CommitDate: Sat Jan 5 13:10:58 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/eselect.git;a=commit;h=40f82c2c
Rewrite arch() fallback code in package-manager lib.
* libs/package-manager.bash.in (arch): Complete rewrite of the
fallback code if there is no make.profile symlink. It now relies
on bash variables HOSTTYPE and OSTYPE which are derived from the
standard GNU triplet. The previous implementation had used uname
which would query the kernel, while we need the userland. This
fixes a problem on ppc with 64 bit kernel and 32 bit userland.
Thanks to Brent Baude <ranger <AT> gentoo.org> and Raúl Porcel
<armin76 <AT> gentoo.org> for the suggestion.
---
ChangeLog | 11 +++++
libs/package-manager.bash.in | 92 +++++++++++++++++++++++++++++-------------
2 files changed, 75 insertions(+), 28 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index af6eb4f..cb0e6b5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2013-01-05 Ulrich Müller <ulm@gentoo.org>
+
+ * libs/package-manager.bash.in (arch): Complete rewrite of the
+ fallback code if there is no make.profile symlink. It now relies
+ on bash variables HOSTTYPE and OSTYPE which are derived from the
+ standard GNU triplet. The previous implementation had used uname
+ which would query the kernel, while we need the userland. This
+ fixes a problem on ppc with 64 bit kernel and 32 bit userland.
+ Thanks to Brent Baude <ranger@gentoo.org> and Raúl Porcel
+ <armin76@gentoo.org> for the suggestion.
+
2012-12-06 Ulrich Müller <ulm@gentoo.org>
* modules/profile.eselect (get_repos, get_repo_path): Use EROOT
diff --git a/libs/package-manager.bash.in b/libs/package-manager.bash.in
index a34575d..886e3b7 100644
--- a/libs/package-manager.bash.in
+++ b/libs/package-manager.bash.in
@@ -42,7 +42,7 @@ run_paludis() {
# arch
# Return the architecture we're running on...
arch() {
- local ret=$(envvar sys-devel/gcc ARCH) suffix
+ local ret=$(envvar sys-devel/gcc ARCH)
# $arch will be null if there's no current make.profile symlink.
# We cannot get a list of valid profiles without it.
@@ -54,39 +54,75 @@ arch() {
return 1
fi
- ret=$(uname -m)
- case ${ret} in
- alpha|amd64|ia64|m68k|ppc|ppc64) ;;
- arm*) ret=arm ;;
- i?86) ret=x86 ;;
- mips*) ret=mips ;;
- parisc*) ret=hppa ;;
- "Power Macintosh") ret=ppc ;;
- s390*) ret=s390 ;;
- sh*) ret=sh ;;
- sparc*) ret=sparc ;;
- x86_64) ret=amd64 ;;
- *) write_warning_msg \
- "Unknown architecture. Please submit a bug including the output of 'uname -m'"
+ # Try to determine arch from HOSTTYPE and OSTYPE, which are
+ # derived from the GNU triplet (at build time of bash)
+ case ${HOSTTYPE} in
+ alpha*) ret=alpha ;;
+ arm*) ret=arm ;;
+ hppa*) ret=hppa ;;
+ i?86) ret=x86 ;;
+ ia64) ret=ia64 ;;
+ m68k) ret=m68k ;;
+ mips*) ret=mips ;;
+ powerpc) ret=ppc ;;
+ powerpc64) ret=ppc64 ;;
+ s390*) ret=s390 ;;
+ sh*) ret=sh ;;
+ sparc) ret=sparc ;;
+ sparc64) ret=sparc64 ;;
+ x86_64) ret=amd64 ;;
+ *)
+ write_warning_msg \
+ "Unknown architecture \"${HOSTTYPE}\"." \
+ "Please submit a bug report."
return 1
;;
esac
- case $(uname -s) in
- Linux) ;;
- FreeBSD) suffix="-fbsd" ;;
- NetBSD) suffix="-nbsd" ;;
- OpenBSD) suffix="-obsd" ;;
- DragonFly) suffix="-dfly" ;;
- Darwin) suffix="-macos" ;;
- *) write_warning_msg \
- "Unknown OS. Please submit a bug including the output of 'uname -s'"
- return 1
- ;;
- esac
+ if [[ -z ${EPREFIX} ]]; then
+ case ${OSTYPE} in
+ linux*) ;;
+ dragonfly*) ret+="-dfly" ;;
+ freebsd*) ret+="-fbsd" ;;
+ netbsd*) ret+="-nbsd" ;;
+ openbsd*) ret+="-obsd" ;;
+ *)
+ write_warning_msg \
+ "Unknown OS \"${OSTYPE}\"." \
+ "Please submit a bug report."
+ return 1
+ ;;
+ esac
+ else
+ # Prefix architectures
+ if [[ ${ret} = amd64 && ${OSTYPE} != linux* ]]; then
+ # amd64 is sometimes called x64 on Prefix
+ ret=x64
+ fi
+ case ${OSTYPE} in
+ aix*) ret+="-aix" ;;
+ cygwin*) ret+="-cygwin" ;;
+ darwin*) ret+="-macos" ;;
+ freebsd*) ret+="-freebsd" ;;
+ hpux*) ret+="-hpux" ;;
+ interix*) ret+="-interix" ;;
+ linux*) ret+="-linux" ;;
+ mint*) ret+="-mint" ;;
+ netbsd*) ret+="-netbsd" ;;
+ openbsd*) ret+="-openbsd" ;;
+ solaris*) ret+="-solaris" ;;
+ winnt*) ret+="-winnt" ;;
+ *)
+ write_warning_msg \
+ "Unknown OS \"${OSTYPE}\"." \
+ "Please submit a bug report."
+ return 1
+ ;;
+ esac
+ fi
fi
- echo ${ret}${suffix}
+ echo "${ret}"
}
# envvar
next reply other threads:[~2013-01-05 13:48 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-05 13:47 Ulrich Mueller [this message]
-- strict thread matches above, loose matches on Subject: below --
2013-06-17 15:26 [gentoo-commits] proj/eselect:master commit in: libs/, / Ulrich Mueller
2013-11-10 20:24 Ulrich Müller
2013-11-19 8:17 Ulrich Müller
2013-11-19 12:54 Ulrich Müller
2014-01-19 16:36 Ulrich Müller
2014-03-14 19:43 Ulrich Müller
2016-06-01 19:43 Ulrich Müller
2016-10-30 9:17 Ulrich Müller
2016-11-01 6:43 Ulrich Müller
2016-12-10 8:18 Ulrich Müller
2017-03-21 6:33 Ulrich Müller
2017-06-18 19:32 Ulrich Müller
2017-12-25 11:00 Ulrich Müller
2023-03-14 16:53 Ulrich Müller
2023-05-12 16:44 Ulrich Müller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1357391458.40f82c2ca4450db7fbc70c3e281361deb8fc8e90.ulm@gentoo \
--to=ulm@gentoo.org \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox