make shebang check a bit more strict by not blindly believing all shebangs that start...
authorFabian Groffen <grobian@gentoo.org>
Sat, 20 Mar 2010 18:57:51 +0000 (18:57 -0000)
committerFabian Groffen <grobian@gentoo.org>
Sat, 20 Mar 2010 18:57:51 +0000 (18:57 -0000)
svn path=/main/branches/prefix/; revision=15838

bin/misc-functions.sh

index d4ee2bb4a8b1eba98efe18fb947f60f92ef723ae..2997ddbcc98f39ccfaa4f44ff2e48348124ee17b 100644 (file)
@@ -628,10 +628,14 @@ install_qa_check_prefix() {
                line=( ${line#"#!"} )
                IFS=${oldIFS}
                [[ ${WHITELIST} == *" ${line[0]} "* ]] && continue
-               # does the shebang start with ${EPREFIX}?
-               [[ ${line[0]} == ${EPREFIX}* ]] && continue
-               # can we just fix it(tm)?
-               if [[ -e ${EPREFIX}${line[0]} || -e ${ED}${line[0]} ]] ; then
+               if [[ ${line[0]} == ${EPREFIX}/* ]] ; then
+                       # does the shebang start with ${EPREFIX}, and does it exist?
+                       if [[ -e ${ROOT}${line[0]} || -e ${D}${line[0]} ]] ; then
+                               continue
+                       fi
+               elif [[ -e ${EROOT}${line[0]} || -e ${ED}${line[0]} ]] ; then
+                       # is it unprefixed, but we can just fix it because a
+                       # prefixed variant exists
                        eqawarn "prefixing shebang of ${fn#${D}}"
                        sed -i -e '1s:^#! \?:#!'"${EPREFIX}"':' "${fn}"
                        continue
@@ -649,8 +653,8 @@ install_qa_check_prefix() {
        if [[ -e "${T}"/non-prefix-shebangs-errs ]] ; then
                eqawarn "QA Notice: the following files use invalid (possible non-prefixed) shebangs:"
                eqawarn "$(<"${T}"/non-prefix-shebangs-errs)"
-               die "Aborting due to QA concerns: invalid shebangs found"
                rm -f "${T}"/non-prefix-shebangs-errs
+               die "Aborting due to QA concerns: invalid shebangs found"
        fi
 }