From: Mike Frysinger Date: Thu, 29 Sep 2011 20:26:56 +0000 (+0000) Subject: Make linker switching more general, and add a `die` helper. X-Git-Url: http://git.tremily.us/gitweb.cgi?a=commitdiff_plain;h=2b11f5cff5247de27680ce2113d509f6ffe77637;p=gentoo.git Make linker switching more general, and add a `die` helper. Package-Manager: portage-2.2.0_alpha59/cvs/Linux x86_64 --- diff --git a/sys-devel/binutils-config/ChangeLog b/sys-devel/binutils-config/ChangeLog index 6e07f87515e6..46b678fbf65d 100644 --- a/sys-devel/binutils-config/ChangeLog +++ b/sys-devel/binutils-config/ChangeLog @@ -1,6 +1,12 @@ # ChangeLog for sys-devel/binutils-config # Copyright 1999-2011 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/sys-devel/binutils-config/ChangeLog,v 1.49 2011/08/29 00:56:45 vapier Exp $ +# $Header: /var/cvsroot/gentoo-x86/sys-devel/binutils-config/ChangeLog,v 1.50 2011/09/29 20:26:56 vapier Exp $ + +*binutils-config-3-r1 (29 Sep 2011) + + 29 Sep 2011; Mike Frysinger files/binutils-config-3, + -binutils-config-3.ebuild, +binutils-config-3-r1.ebuild: + Make linker switching more general, and add a `die` helper. 29 Aug 2011; Mike Frysinger files/binutils-config-3: Make profile switching more atomic #380759. diff --git a/sys-devel/binutils-config/Manifest b/sys-devel/binutils-config/Manifest index e9ab9f8dfb40..4b77789d2e69 100644 --- a/sys-devel/binutils-config/Manifest +++ b/sys-devel/binutils-config/Manifest @@ -3,17 +3,17 @@ Hash: SHA256 AUX binutils-config-1.9 11043 RMD160 6f7f95d0c4719d747acb939441e9247e9705d98d SHA1 2f801cb2f4bf167207407d0a3e6481e01a1317b8 SHA256 20becd27cd1161d3afcd079ebff883b8eba3e698171937d82a9575dfa19a2373 AUX binutils-config-2 11440 RMD160 fdb4906f1a9d0fc3f18d450583ce7a5bd72f6068 SHA1 38d11d772da3aeef242d3c67d8b41e2e71d8544b SHA256 5e923d1445910b9b9d1e455e52313087098689359846db0dc3fa52d33b63b192 -AUX binutils-config-3 13820 RMD160 65ae330994fb66b1da0413c399b5f8de28717fec SHA1 35677db03178e471d8620e2618423214e412de5f SHA256 bd0cd956b74434081ce5ce2738a7cc301a0f80e4fa6fe957414496771c6cb365 +AUX binutils-config-3 13567 RMD160 ba6934e98f2cf3c0acbff390429e85b8b37b4f89 SHA1 03a8e2ae0e9bd6c4c43b7bcbbad44493bacfe940 SHA256 fab5db1cee1b7bf979ddc36bd535d6cc3ef0e1d461817d064e6e5ff858605267 AUX binutils-config.8 4113 RMD160 7eea52f777b889b08b58e6d836de187e9505be8b SHA1 e97d7ca363524bbfb3c8cf8e17c5775dc6236be7 SHA256 ec7cb82331c80e15581e0936a5bf5edb3cde78bec3c3ede647926821086a1e6f EBUILD binutils-config-1.9-r4.ebuild 626 RMD160 e3018b7b6f690abddde9e2a25ce8a727dfcf14d0 SHA1 dd3547d1bbe52d600e3f59b9a45e806a327ea070 SHA256 4445f3282acda5b7c96146974adefc47315c437b5eb008daab9ac5f87a18d99d EBUILD binutils-config-2-r1.ebuild 627 RMD160 aa041873d7910e368022522fe1281af8cc16d2ad SHA1 2469140bb41e5ba03e85d4326194587e83701644 SHA256 06d97c5306e671ccf55fcad8eec8dcd20e1c6c3bb8e4646771d62af5f1e1754f -EBUILD binutils-config-3.ebuild 636 RMD160 9c8011de431f2b997aa1d4e181d4232b09c1c860 SHA1 bf31e1b75bad413cba7957324d44fab2a22ea157 SHA256 e6b4c164d4b751353321ca257a13017d538bb14c4031e9dc82db4ac87b1f3317 -MISC ChangeLog 8347 RMD160 a5db20e9c4fc55104c79ff63df1acd310723a5ae SHA1 a1e3df029600af9cf9b95624ffcfe6372b0737a9 SHA256 1a63758fa37a2aeef62003dd75eebfd5aeeb8097ddeef3ea4caf1cbd876f0bfc +EBUILD binutils-config-3-r1.ebuild 638 RMD160 2b06351721bd2e0c93960de29c75f4f666215e6d SHA1 d38e2bad3d635c66afeda762512fc63b1c82b251 SHA256 0034eff4b6389bc7dd6986b08153f13e3da2a511c6669ff8c33b0c0a9807f7ee +MISC ChangeLog 8581 RMD160 75165e2f41cc919cdd02e5dc3de02ef06b8ed5f7 SHA1 5081bc1fa3e857a32531f346cc56c04a5c1ea596 SHA256 1482225f803d2c9c22755f89de23672ffe8e2db41aa046fc9dcc860ffc4c688e MISC metadata.xml 162 RMD160 d002486a43522f2116b1d9d59828c484956d66e2 SHA1 d6b4923897f6ae673b4f93646f5b4ba61d5a2c3c SHA256 65a915d44de1f01d4b7f72d313b4192c38374a9835d24988c00c1e73dca5805a -----BEGIN PGP SIGNATURE----- -Version: GnuPG v2.0.17 (GNU/Linux) +Version: GnuPG v2.0.18 (GNU/Linux) -iF4EAREIAAYFAk5a48UACgkQaC/OocHi7JZujgD+KngejZKZLgTOn5PGlBGsJNs8 -Brng0rb9CmyNywgcIuoA+wbrT0hK3CyFR7Ev//gduicWCT61aqJJ354G9Gwi2a8W -=qAj+ +iF4EAREIAAYFAk6E1JcACgkQaC/OocHi7Ja17wD7B81WkgnIcLyBMlKc6IGQ4eOM +Cv+R2XZ5yVyDAeErkXoA/ArETnu4pp8VFTOdOY3d6lyl41tN63wWzf835krjDAhJ +=heSi -----END PGP SIGNATURE----- diff --git a/sys-devel/binutils-config/binutils-config-3.ebuild b/sys-devel/binutils-config/binutils-config-3-r1.ebuild similarity index 72% rename from sys-devel/binutils-config/binutils-config-3.ebuild rename to sys-devel/binutils-config/binutils-config-3-r1.ebuild index 6ebaa6da466a..f8be46294cf0 100644 --- a/sys-devel/binutils-config/binutils-config-3.ebuild +++ b/sys-devel/binutils-config/binutils-config-3-r1.ebuild @@ -1,6 +1,6 @@ # Copyright 1999-2011 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/sys-devel/binutils-config/binutils-config-3.ebuild,v 1.1 2011/08/12 20:26:09 vapier Exp $ +# $Header: /var/cvsroot/gentoo-x86/sys-devel/binutils-config/binutils-config-3-r1.ebuild,v 1.1 2011/09/29 20:26:56 vapier Exp $ DESCRIPTION="Utility to change the binutils version being used" HOMEPAGE="http://www.gentoo.org/" @@ -8,7 +8,7 @@ SRC_URI="" LICENSE="GPL-2" SLOT="0" -#KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~sparc-fbsd ~x86-fbsd" +KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~sparc-fbsd ~x86-fbsd" IUSE="" RDEPEND="userland_GNU? ( >=sys-apps/findutils-4.2 )" diff --git a/sys-devel/binutils-config/files/binutils-config-3 b/sys-devel/binutils-config/files/binutils-config-3 index 725ae43aa6f3..3705371ef711 100755 --- a/sys-devel/binutils-config/files/binutils-config-3 +++ b/sys-devel/binutils-config/files/binutils-config-3 @@ -1,7 +1,7 @@ #!/bin/bash # Copyright 1999-2011 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/sys-devel/binutils-config/files/binutils-config-3,v 1.5 2011/08/29 00:56:46 vapier Exp $ +# $Header: /var/cvsroot/gentoo-x86/sys-devel/binutils-config/files/binutils-config-3,v 1.6 2011/09/29 20:26:56 vapier Exp $ # Format of /etc/env.d/binutils/: # config-TARGET: CURRENT=version for TARGET @@ -21,6 +21,7 @@ source /etc/init.d/functions.sh || { exit 1 } esyslog() { :; } +die() { eerror "${argv0}: $*"; exit 1; } umask 022 usage() { @@ -34,8 +35,7 @@ ${HILITE}General Options:${NORMAL} ${GOOD}-d, --debug${NORMAL} Execute with debug output ${HILITE}General Cruft:${NORMAL} - ${GOOD}--gold${NORMAL} Switch linker to gold (if supported) - ${GOOD}--bfd${NORMAL} Switch linker to [older] bfd (if supported) + ${GOOD}--linker${NORMAL} Switch to specified linker (if supported) ${HILITE}Arch Specific Cruft:${NORMAL} ${GOOD}--amd64${NORMAL} Install extra amd64 links (x86_64) @@ -241,8 +241,7 @@ switch_profile() { uninstall_target() { if [[ ${TARGET} == ${HOST} ]] ; then - eerror "${argv0}: Refusing to uninstall native binutils" - exit 1 + die "refusing to uninstall native binutils" fi shopt -s nullglob @@ -253,8 +252,7 @@ uninstall_target() { rm -f "${ENV_D}"/${PROFILE} done if [[ -z ${PROFILE} ]] && [[ ! -e ${ENV_D}/config-${TARGET} ]] ; then - eerror "${argv0}: No profiles exist for '${TARGET}'" - exit 1 + die "no profiles exist for '${TARGET}'" fi rm -f "${ENV_D}"/config-${TARGET} "${ROOT}"/etc/ld.so.conf.d/05binutils.conf @@ -352,23 +350,26 @@ list_profiles() { } switch_linker() { - local ld=$1 + local bpath ld=$1 + + case ${ld} in + ld.*) ;; + *) die "not supported: linker must start with 'ld.'" ;; + esac setup_env || return 1 + bpath="${ROOT}/${BINPATH}" # does this binutils even support the requested linker ? - if [[ ! -e ${ROOT}/${BINPATH}/ld.${ld} ]] ; then - eerror "${argv0}: sorry, but ${PROFILE} doesn't support the ${ld} linker" - exit 1 + if [[ ! -e ${bpath}/${ld} ]] ; then + die "sorry, but ${PROFILE} doesn't support the ${ld} linker" fi # switch it up ebegin "Setting default linker to ${ld} for ${PROFILE}" - atomic_ln ld.${ld} "${ROOT}/${BINPATH}" ld + atomic_ln ${ld} "${bpath}" ld eend $? } -switch_linker_gold() { switch_linker gold ; } -switch_linker_bfd() { switch_linker bfd ; } set_HOST() { # Set HOST to CHOST if it isn't already set @@ -391,8 +392,7 @@ select_action() { NEED_ACTION="no" DOIT=$1 else - eerror "${argv0}: one action at a time!" - exit 1 + die "one action at a time!" fi } @@ -401,15 +401,14 @@ while [[ $# -gt 0 ]] ; do shift case ${x} in -c|--get-current-profile) select_action get_current_profile ;; - -l|--list-profiles) select_action list_profiles ;; + -l|--list|--list-profiles) select_action list_profiles ;; -u|--uninstall) select_action uninstall_target ;; - --gold) select_action switch_linker_gold ;; - --bfd) select_action switch_linker_bfd ;; + --linker) select_action "switch_linker $1"; shift ;; -d|--debug) DEBUG="yes" ;; -h|--help) usage 0 ;; -V|--version) unset Header - cvsver="$Header: /var/cvsroot/gentoo-x86/sys-devel/binutils-config/files/binutils-config-3,v 1.5 2011/08/29 00:56:46 vapier Exp $" + cvsver="$Header: /var/cvsroot/gentoo-x86/sys-devel/binutils-config/files/binutils-config-3,v 1.6 2011/09/29 20:26:56 vapier Exp $" cvsver=${cvsver##*binutils-config-} bver=${cvsver%%,v *} cvsver=${cvsver#* } @@ -429,13 +428,11 @@ while [[ $# -gt 0 ]] ; do fi ;; -*) - eerror "${0##*/}: Invalid switch! Try '--help'." - exit 1 + die "invalid switch! Try '--help'." ;; *) if [[ ${UARG+set} == "set" ]] ; then - eerror "${argv0}: only one profile/target at a time please" - exit 1 + die "only one profile/target at a time please" fi NEED_ACTION="maybe" UARG=${x} @@ -483,8 +480,7 @@ switch_profile|switch_linker_*) if [[ -f ${ENV_D}/${HOST}-${x} ]] ; then x=${HOST}-${x} else - eerror "${argv0}: Could not locate '$x' in '${ENV_D}/'!" - exit 1 + die "could not locate '$x' in '${ENV_D}/'!" fi PROFILE=${x} else