From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 652591382DD for ; Sat, 5 Jan 2013 13:48:00 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id E161AE0675; Sat, 5 Jan 2013 13:47:42 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 37F7721C02F for ; Sat, 5 Jan 2013 13:47:42 +0000 (UTC) Received: from hornbill.gentoo.org (hornbill.gentoo.org [94.100.119.163]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 1F3D833DA28 for ; Sat, 5 Jan 2013 13:47:41 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id 0CDB5E544A for ; Sat, 5 Jan 2013 13:47:39 +0000 (UTC) From: "Ulrich Mueller" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Ulrich Mueller" Message-ID: <1357391458.40f82c2ca4450db7fbc70c3e281361deb8fc8e90.ulm@gentoo> Subject: [gentoo-commits] proj/eselect:master commit in: libs/, / X-VCS-Repository: proj/eselect X-VCS-Files: ChangeLog libs/package-manager.bash.in X-VCS-Directories: libs/ / X-VCS-Committer: ulm X-VCS-Committer-Name: Ulrich Mueller X-VCS-Revision: 40f82c2ca4450db7fbc70c3e281361deb8fc8e90 X-VCS-Branch: master Date: Sat, 5 Jan 2013 13:47:39 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 018695d6-b038-4f46-8178-556ceb317a9a X-Archives-Hash: 1843eb88b4ec17594d9d7854d1c914f8 commit: 40f82c2ca4450db7fbc70c3e281361deb8fc8e90 Author: Ulrich Müller gentoo org> AuthorDate: Sat Jan 5 13:10:58 2013 +0000 Commit: Ulrich Mueller gentoo 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 gentoo.org> and Raúl Porcel 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 + + * 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 and Raúl Porcel + for the suggestion. + 2012-12-06 Ulrich Müller * 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