[source] build: drop `trapret` function from non-Linux HOST_TAR variant

LEDE Commits lede-commits at lists.infradead.org
Tue Jan 3 05:32:42 PST 2017


jow pushed a commit to source.git, branch master:
https://git.lede-project.org/15d8d9c271507cd272b264e0bf9deb20030723a2

commit 15d8d9c271507cd272b264e0bf9deb20030723a2
Author: Alexandru Ardelean <ardeleanalex at gmail.com>
AuthorDate: Mon Oct 31 10:14:10 2016 +0200

    build: drop `trapret` function from non-Linux HOST_TAR variant
    
    Looks like this was meant to workaround some limitations with
    non-GNU tar variants (like BSD-tar which are present on Mac os BSD hosts).
    
    Though, I cannot find any use of that `+s` option that's mentioned
    in the comment.
    
    Last hash of this I found was 24faf55360271cd0bfc4751753384f9210d52f7f
    
    In my case, it now this fails for `python-setuptools` on Mac OS X (the host-build with):
    ```
    trapret 2 tar -C <home-dir>/work/sources-work/lede/build_dir/target-i386_pentium4_musl-1.1.15/python-setuptools-27.2.0 --strip-components=1 -xzf <home-dir>/work/sources-work/lede/dl/setuptools-27.2.0.tar.gz
    bash: trapret: command not found
    ```
    
    So, I was thinking maybe it's time to remove this workaround (9 years later).
    I could also fix the `python-setuptools` host build. If that's more preferred.
    
    [ Btw, I just recently transitioned to a Mac machine for dev-ing,
      so a lot of (this Mac) stuff I'm finding out is new to me too. ]
    
    Signed-off-by: Alexandru Ardelean <ardeleanalex at gmail.com>
---
 include/shell.sh  | 15 ---------------
 include/unpack.mk |  7 +------
 2 files changed, 1 insertion(+), 21 deletions(-)

diff --git a/include/shell.sh b/include/shell.sh
index 6389304..8f6f6f0 100644
--- a/include/shell.sh
+++ b/include/shell.sh
@@ -14,21 +14,6 @@ isset() {
 	[ -n "$var" ]
 }
 
-trapret() {(
-	local retvals="$1"; shift
-	local cmd="$1"; shift
-	for retval in $(echo $retvals); do
-		local trap_$retval=1
-	done
-	"$cmd" "$@" || {
-		local retval="$?"
-		eval "trapped=\${trap_$retval}"
-		[ -n "$trapped" ] || {
-			return $retval
-		}
-	}
-)}
-
 md5s() {
 	cat "$@" | (
 		md5sum 2>/dev/null ||
diff --git a/include/unpack.mk b/include/unpack.mk
index 3fabf46..41ff439 100644
--- a/include/unpack.mk
+++ b/include/unpack.mk
@@ -5,12 +5,7 @@
 # See /LICENSE for more information.
 #
 
-# unpacking files with +s may break on some platforms. this typically emits error code 2
-ifneq ($(HOST_OS),Linux)
-  HOST_TAR:=trapret 2 $(TAR)
-else
-  HOST_TAR:=$(TAR)
-endif
+HOST_TAR:=$(TAR)
 TAR_CMD=$(HOST_TAR) -C $(1)/.. $(TAR_OPTIONS)
 UNZIP_CMD=unzip -d $(1)/.. $(DL_DIR)/$(PKG_SOURCE)
 



More information about the lede-commits mailing list