Sophie

Sophie

distrib > Mageia > 7 > aarch64 > by-pkgid > 4f298dad17ddfd62a1b6219e00318ed4 > files > 32

rpm-4.14.2.1-12.1.mga7.src.rpm

--- ./scripts/script.req	2014-09-10 14:18:23.978949876 +0200
+++ ./scripts/script.req	2014-09-10 14:24:42.450938935 +0200
@@ -15,10 +15,15 @@
 
 BLACKLIST="bin/(bash|libsafe|libfakeroot|ocamlrun|perl|python|ruby|sh)" 
 
-# TODO: handle "#!/usr/bin/env foo" somehow
 while read filename; do
     # common cases 
     INTERP=$(sed -n -e '1s:^#![[:space:]]*\(/[^[:space:]]\{1,\}\).*:\1:p' "$filename")
+    # "resolve" /bin/env foo interpreter to actual path, rather than generating
+    # dependencies on coreutils, should trim off ~800 dependencies more
+    if [[ "$INTERP" == *bin/env ]]; then
+	   arg=`head -n 1 $filename | grep '^#!' | sed -e 's/^\#\![   ]*//' | cut -d" " -f2`
+	   INTERP="`which $arg 2>/dev/null || echo $INTERP`"
+    fi
     if echo $INTERP|grep bin/perl >/dev/null; then
 	    ouput_perl_base
     elif  echo $INTERP|grep -E "$BLACKLIST" >/dev/null; then
@@ -58,4 +57,2 @@
     fi
-    #!/usr/bin/env /foo/bar
-    sed -n -e '1s:^#![[:space:]]*[^[:space:]]*/bin/env[[:space:]]\{1,\}\(/[^[:space:]]\{1,\}\):\1:p' "$filename"
 done