Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 531616 - sys-devel/binutils-config: Prefix support
Summary: sys-devel/binutils-config: Prefix support
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: Normal enhancement (vote)
Assignee: Gentoo Toolchain Maintainers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: prefix-gx86 519080
  Show dependency tree
 
Reported: 2014-12-04 04:08 UTC by Benda Xu
Modified: 2018-04-13 04:06 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
binutils-config-3.patch (binutils-config.patch,6.41 KB, patch)
2014-12-04 04:09 UTC, Benda Xu
Details | Diff
Patch for binutils-config-4 (binutils-config-4.patch,6.53 KB, patch)
2014-12-15 23:33 UTC, Ruud Koolen (RETIRED)
Details | Diff
binutils-config-5.patch (binutils-config.patch,5.65 KB, patch)
2016-05-22 07:44 UTC, Benda Xu
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Benda Xu gentoo-dev 2014-12-04 04:08:08 UTC
The prefix support are implemented as

 1. Letting binutils-config-3 be aware of EPREFIX.
 2. Eprefixity binutils-config-3 from the ebuild.

Reproducible: Always
Comment 1 Benda Xu gentoo-dev 2014-12-04 04:09:39 UTC
Created attachment 390898 [details, diff]
binutils-config-3.patch

Patch for binutils-config-3.
Comment 2 Ruud Koolen (RETIRED) archtester gentoo-dev Security 2014-12-15 23:33:32 UTC
Created attachment 391794 [details, diff]
Patch for binutils-config-4

Here's a version for binutils-config-4 with two minor bugs fixed.
Comment 3 Benda Xu gentoo-dev 2014-12-16 03:33:57 UTC
Thanks, two comments:

 
 argv0=${0##*/}
-source /etc/init.d/functions.sh || {
-	echo "${argv0}: Could not source /etc/init.d/functions.sh!" 1>&2
+source "@GENTOO_PORTAGE_EPREFIX@"/etc/init.d/functions.sh || {
+	echo "${argv0}: Could not source @GENTOO_PORTAGE_EPREFIX@/etc/init.d/functions.sh!" 1>&2
 	exit 1
 }
 esyslog() { :; }

EPREFIX has already been defined in the beginning. Let's use EPREFIX in place of @GENTOO_PORTAGE_EPREFIX@ here.

@@ -96,14 +102,14 @@ setup_env() {
 		# Newer paths: /usr/${HOST}/${TARGET}/...
 		# Older paths: /usr/${TARGET}/...
 		#
-		if [[ -d ${ROOT}/usr/${HOST}/${TARGET}/binutils-bin/${VER} ]] ; then
-			BINPATH=/usr/${HOST}/${TARGET}/binutils-bin/${VER}
-			BINPATH_LINKS=/usr/libexec/gcc/${TARGET}
+		if [[ -d ${ROOT}${EPREFIX}/usr/${HOST}/${TARGET}/binutils-bin/${VER} ]] ; then
+			BINPATH="${EPREFIX}"/usr/${HOST}/${TARGET}/binutils-bin/${VER}
+			BINPATH_LINKS="${EPREFIX}"/usr/libexec/gcc/${TARGET}
 		fi

${ROOT}${EPREFIX}, EROOT please.
Comment 4 Ruud Koolen (RETIRED) archtester gentoo-dev Security 2014-12-16 04:44:45 UTC
(In reply to Benda Xu from comment #3)
> Thanks, two comments:
> 
>  argv0=${0##*/}
> -source /etc/init.d/functions.sh || {
> -	echo "${argv0}: Could not source /etc/init.d/functions.sh!" 1>&2
> +source "@GENTOO_PORTAGE_EPREFIX@"/etc/init.d/functions.sh || {
> +	echo "${argv0}: Could not source
> @GENTOO_PORTAGE_EPREFIX@/etc/init.d/functions.sh!" 1>&2
>  	exit 1
>  }
>  esyslog() { :; }
> 
> EPREFIX has already been defined in the beginning. Let's use EPREFIX in
> place of @GENTOO_PORTAGE_EPREFIX@ here.

$EPREFIX is the location binutils-config operates on, which can be set by envvar and need not match the location at which it is installed. Just like you can set ROOT to let binutils-config manage a binutils installation at $ROOT, so can you set EPREFIX to manage a binutils in a different prefix.

The location of functions.sh, however, is based on the location in which binutils-config is installed.

> @@ -96,14 +102,14 @@ setup_env() {
>  		# Newer paths: /usr/${HOST}/${TARGET}/...
>  		# Older paths: /usr/${TARGET}/...
>  		#
> -		if [[ -d ${ROOT}/usr/${HOST}/${TARGET}/binutils-bin/${VER} ]] ; then
> -			BINPATH=/usr/${HOST}/${TARGET}/binutils-bin/${VER}
> -			BINPATH_LINKS=/usr/libexec/gcc/${TARGET}
> +		if [[ -d ${ROOT}${EPREFIX}/usr/${HOST}/${TARGET}/binutils-bin/${VER} ]] ;
> then
> +			BINPATH="${EPREFIX}"/usr/${HOST}/${TARGET}/binutils-bin/${VER}
> +			BINPATH_LINKS="${EPREFIX}"/usr/libexec/gcc/${TARGET}
>  		fi
> 
> ${ROOT}${EPREFIX}, EROOT please.

I prefer the clear relation between the check and the envvar in my version, but whatever floats your boat.
Comment 5 SpanKY gentoo-dev 2015-02-09 15:48:48 UTC
Comment on attachment 391794 [details, diff]
Patch for binutils-config-4

>+: ${EPREFIX:="@GENTOO_PORTAGE_EPREFIX@"}
>+[[ ${EPREFIX} = */ ]] && EPREFIX="${EPREFIX%/}"
>+[[ -n ${EPREFIX} && ${EPREFIX} != /* ]] && EPREFIX="${PWD%/}/${EPREFIX}"

the script should be usable as-is ... it shouldn't need to be installed first

you can look at the header of gcc-config to see how we handle that there
Comment 6 Benda Xu gentoo-dev 2016-05-22 07:44:12 UTC
Created attachment 434942 [details, diff]
binutils-config-5.patch

Hi Mike.  I have updated the patch according to your comments.  Please review.
Comment 7 SpanKY gentoo-dev 2016-05-23 19:42:11 UTC
(In reply to Benda Xu from comment #6)

looks fine; feel free to commit
Comment 8 Benda Xu gentoo-dev 2016-05-25 02:30:39 UTC
Thanks Mike, pushed with eprefixity in the latest ebuild:

  https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=62c75f76eb70
Comment 9 Larry the Git Cow gentoo-dev 2018-04-13 04:06:08 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=35db5bfb5ce3af08ad8181c657a7b4f81c9dfe3b

commit 35db5bfb5ce3af08ad8181c657a7b4f81c9dfe3b
Author:     Benda Xu <heroxbd@gentoo.org>
AuthorDate: 2018-04-13 03:56:34 +0000
Commit:     Benda Xu <heroxbd@gentoo.org>
CommitDate: 2018-04-13 03:59:56 +0000

    sys-devel/binutils-config: revert accidental commit in 62c75f76eb.
    
      I have made a mistake to overwrite changes to binutils-config-5.
    
    Suggested-By: slyfox
    Bug: https://bugs.gentoo.org/531616
    Bug: https://bugs.gentoo.org/562460
    Package-Manager: Portage-2.3.28, Repoman-2.3.9

 sys-devel/binutils-config/files/binutils-config-5   | 15 ++++++++++++---
 sys-devel/binutils-config/files/binutils-config-5.1 | 15 ++++++++++++---
 2 files changed, 24 insertions(+), 6 deletions(-)}