commit:     122465d2c507cd4904d940500dcf23eaab93954f
Author:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Thu May 14 09:41:10 2015 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Thu May 14 09:41:10 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=122465d2

ebuild-helpers: avoid `env` indirection by setting the vars before the exec

Setting an env var on the same line as the exec will make bash export the
var to the program it execs.  That means these forms are practically equiv:
        FOO=val exec blah
        exec env FOO=val blah

The difference is that we now avoid execing env entirely.

 bin/ebuild-helpers/doconfd  | 5 +----
 bin/ebuild-helpers/dodoc    | 5 +----
 bin/ebuild-helpers/doenvd   | 5 +----
 bin/ebuild-helpers/doheader | 5 +----
 bin/ebuild-helpers/doinitd  | 5 +----
 bin/ebuild-helpers/dolib.a  | 3 +--
 bin/ebuild-helpers/dolib.so | 3 +--
 7 files changed, 7 insertions(+), 24 deletions(-)

diff --git a/bin/ebuild-helpers/doconfd b/bin/ebuild-helpers/doconfd
index a3c09a5..1baa3ed 100755
--- a/bin/ebuild-helpers/doconfd
+++ b/bin/ebuild-helpers/doconfd
@@ -8,7 +8,4 @@ if [[ $# -lt 1 ]] ; then
        exit 1
 fi
 
-exec \
-env \
-INSDESTTREE="/etc/conf.d/" \
-doins "$@"
+INSDESTTREE='/etc/conf.d/' exec doins "$@"

diff --git a/bin/ebuild-helpers/dodoc b/bin/ebuild-helpers/dodoc
index 99122c4..6ccf0a4 100755
--- a/bin/ebuild-helpers/dodoc
+++ b/bin/ebuild-helpers/dodoc
@@ -5,10 +5,7 @@
 source "${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}"/isolated-functions.sh
 
 if ___eapi_dodoc_supports_-r; then
-       exec \
-       env \
-       __PORTAGE_HELPER="dodoc" \
-       doins "$@"
+       __PORTAGE_HELPER='dodoc' exec doins "$@"
 fi
 
 if [ $# -lt 1 ] ; then

diff --git a/bin/ebuild-helpers/doenvd b/bin/ebuild-helpers/doenvd
index 9287933..67bb934 100755
--- a/bin/ebuild-helpers/doenvd
+++ b/bin/ebuild-helpers/doenvd
@@ -8,7 +8,4 @@ if [[ $# -lt 1 ]] ; then
        exit 1
 fi
 
-exec \
-env \
-INSDESTTREE="/etc/env.d/" \
-doins "$@"
+INSDESTTREE='/etc/env.d/' exec doins "$@"

diff --git a/bin/ebuild-helpers/doheader b/bin/ebuild-helpers/doheader
index 3795365..e4cae6a 100755
--- a/bin/ebuild-helpers/doheader
+++ b/bin/ebuild-helpers/doheader
@@ -13,7 +13,4 @@ if [[ $# -lt 1 ]] || [[ $1 == -r && $# -lt 2 ]] ; then
        exit 1
 fi
 
-exec \
-env \
-INSDESTTREE="/usr/include/" \
-doins "$@"
+INSDESTTREE='/usr/include/' exec doins "$@"

diff --git a/bin/ebuild-helpers/doinitd b/bin/ebuild-helpers/doinitd
index 476b858..aa7b66c 100755
--- a/bin/ebuild-helpers/doinitd
+++ b/bin/ebuild-helpers/doinitd
@@ -8,7 +8,4 @@ if [[ $# -lt 1 ]] ; then
        exit 1
 fi
 
-exec \
-env \
-_E_EXEDESTTREE_="/etc/init.d/" \
-doexe "$@"
+_E_EXEDESTTREE_='/etc/init.d/' exec doexe "$@"

diff --git a/bin/ebuild-helpers/dolib.a b/bin/ebuild-helpers/dolib.a
index d2279dc..61961e4 100755
--- a/bin/ebuild-helpers/dolib.a
+++ b/bin/ebuild-helpers/dolib.a
@@ -2,5 +2,4 @@
 # Copyright 1999-2006 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
-exec env LIBOPTIONS="-m0644" \
-       dolib "$@"
+LIBOPTIONS='-m0644' exec dolib "$@"

diff --git a/bin/ebuild-helpers/dolib.so b/bin/ebuild-helpers/dolib.so
index 4bdbfab..eab8c91 100755
--- a/bin/ebuild-helpers/dolib.so
+++ b/bin/ebuild-helpers/dolib.so
@@ -2,5 +2,4 @@
 # Copyright 1999-2006 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
-exec env LIBOPTIONS="-m0755" \
-       dolib "$@"
+LIBOPTIONS='-m0755' exec dolib "$@"

Reply via email to