public inbox for gentoo-portage-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-portage-dev] [PATCH] prepstrip: use debugedit from rpm if necessary (bug 634378)
@ 2017-10-16  8:17 Zac Medico
  2017-10-16 15:03 ` Brian Dolbec
  0 siblings, 1 reply; 2+ messages in thread
From: Zac Medico @ 2017-10-16  8:17 UTC (permalink / raw
  To: gentoo-portage-dev; +Cc: Zac Medico

If debugedit is not found in PATH, then use debugedit
installed by app-arch/rpm (if available).

Suggested-by: Francesco Riosa <vivo75@gmail.com>
Bug: https://bugs.gentoo.org/634378
---
 bin/ebuild-helpers/prepstrip | 20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)

diff --git a/bin/ebuild-helpers/prepstrip b/bin/ebuild-helpers/prepstrip
index 43caa29c7..ea5c0dc09 100755
--- a/bin/ebuild-helpers/prepstrip
+++ b/bin/ebuild-helpers/prepstrip
@@ -84,7 +84,19 @@ esac
 
 prepstrip_sources_dir=${EPREFIX}/usr/src/debug/${CATEGORY}/${PF}
 
-type -P debugedit >/dev/null && debugedit_found=true || debugedit_found=false
+debugedit=$(type -P debugedit)
+if [[ -z ${debugedit} ]]; then
+	debugedit_paths=(
+		"${EPREFIX}/usr/libexec/rpm/debugedit"
+	)
+	for x in "${debugedit_paths[@]}"; do
+		if [[ -x ${x} ]]; then
+			debugedit=${x}
+			break
+		fi
+	done
+fi
+[[ ${debugedit} ]] && debugedit_found=true || debugedit_found=false
 debugedit_warned=false
 
 __multijob_init
@@ -101,8 +113,8 @@ save_elf_sources() {
 	if ! ${debugedit_found} ; then
 		if ! ${debugedit_warned} ; then
 			debugedit_warned=true
-			ewarn "FEATURES=installsources is enabled but the debugedit binary could not"
-			ewarn "be found. This feature will not work unless debugedit is installed!"
+			ewarn "FEATURES=installsources is enabled but the debugedit binary could not be"
+			ewarn "found. This feature will not work unless debugedit or rpm is installed!"
 		fi
 		return 0
 	fi
@@ -112,7 +124,7 @@ save_elf_sources() {
 	# since we're editing the ELF here, we should recompute the build-id
 	# (the -i flag below).  save that output so we don't need to recompute
 	# it later on in the save_elf_debug step.
-	buildid=$(debugedit -i \
+	buildid=$("${debugedit}" -i \
 		-b "${WORKDIR}" \
 		-d "${prepstrip_sources_dir}" \
 		-l "${tmpdir}/sources/${x##*/}.${BASHPID:-$(__bashpid)}" \
-- 
2.13.5



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [gentoo-portage-dev] [PATCH] prepstrip: use debugedit from rpm if necessary (bug 634378)
  2017-10-16  8:17 [gentoo-portage-dev] [PATCH] prepstrip: use debugedit from rpm if necessary (bug 634378) Zac Medico
@ 2017-10-16 15:03 ` Brian Dolbec
  0 siblings, 0 replies; 2+ messages in thread
From: Brian Dolbec @ 2017-10-16 15:03 UTC (permalink / raw
  To: gentoo-portage-dev

On Mon, 16 Oct 2017 01:17:23 -0700
Zac Medico <zmedico@gentoo.org> wrote:

> If debugedit is not found in PATH, then use debugedit
> installed by app-arch/rpm (if available).
> 
> Suggested-by: Francesco Riosa <vivo75@gmail.com>
> Bug: https://bugs.gentoo.org/634378
> ---
>  bin/ebuild-helpers/prepstrip | 20 ++++++++++++++++----
>  1 file changed, 16 insertions(+), 4 deletions(-)
> 
> diff --git a/bin/ebuild-helpers/prepstrip
> b/bin/ebuild-helpers/prepstrip index 43caa29c7..ea5c0dc09 100755
> --- a/bin/ebuild-helpers/prepstrip
> +++ b/bin/ebuild-helpers/prepstrip
> @@ -84,7 +84,19 @@ esac
>  
>  prepstrip_sources_dir=${EPREFIX}/usr/src/debug/${CATEGORY}/${PF}
>  
> -type -P debugedit >/dev/null && debugedit_found=true ||
> debugedit_found=false +debugedit=$(type -P debugedit)
> +if [[ -z ${debugedit} ]]; then
> +	debugedit_paths=(
> +		"${EPREFIX}/usr/libexec/rpm/debugedit"
> +	)
> +	for x in "${debugedit_paths[@]}"; do
> +		if [[ -x ${x} ]]; then
> +			debugedit=${x}
> +			break
> +		fi
> +	done
> +fi
> +[[ ${debugedit} ]] && debugedit_found=true || debugedit_found=false
>  debugedit_warned=false
>  
>  __multijob_init
> @@ -101,8 +113,8 @@ save_elf_sources() {
>  	if ! ${debugedit_found} ; then
>  		if ! ${debugedit_warned} ; then
>  			debugedit_warned=true
> -			ewarn "FEATURES=installsources is enabled
> but the debugedit binary could not"
> -			ewarn "be found. This feature will not work
> unless debugedit is installed!"
> +			ewarn "FEATURES=installsources is enabled
> but the debugedit binary could not be"
> +			ewarn "found. This feature will not work
> unless debugedit or rpm is installed!" fi
>  		return 0
>  	fi
> @@ -112,7 +124,7 @@ save_elf_sources() {
>  	# since we're editing the ELF here, we should recompute the
> build-id # (the -i flag below).  save that output so we don't need to
> recompute # it later on in the save_elf_debug step.
> -	buildid=$(debugedit -i \
> +	buildid=$("${debugedit}" -i \
>  		-b "${WORKDIR}" \
>  		-d "${prepstrip_sources_dir}" \
>  		-l
> "${tmpdir}/sources/${x##*/}.${BASHPID:-$(__bashpid)}" \

Looks fine to me

-- 
Brian Dolbec <dolsen>



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-10-16 15:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-16  8:17 [gentoo-portage-dev] [PATCH] prepstrip: use debugedit from rpm if necessary (bug 634378) Zac Medico
2017-10-16 15:03 ` Brian Dolbec

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox