Fix bug caused by set -e

Empty results cause grep/egrep to return a non-zero status.

Bug: 145347092
Bug: 141258651
Bug: 69058154
Bug: 143285996

Test: manual run for notice files

Change-Id: I25d54ae307b97a07a98e99c54f283437718fe657
This commit is contained in:
Bob Badour
2020-03-18 17:45:19 -07:00
parent 45feb06174
commit 455b3cb38f

View File

@@ -377,7 +377,9 @@ while [ $(wc -l < "${newDeps}") -gt 0 ]; do
depth=$(expr ${depth} + 1)
fi
( # recalculate dependencies by combining unique inputs of new deps w. old
set +e
sh -c "${filter}" < "${newDeps}" | cut -d\ -f3- | getDeps
set -e
cat "${oldDeps}"
) | sort -u > "${allDeps}"
# recalculate new dependencies as net additions to old dependencies
@@ -433,7 +435,9 @@ if [ -n "${projects_out}" ] \
|| [ -n "${notices_out}" ]
then
readonly allProj="${tmpFiles}/projects"
set +e
egrep -v '^out[/]' "${allDirs}" | getProjects > "${allProj}"
set -e
if ${showProgress}; then
echo $(wc -l < "${allProj}")" projects" >&2
fi
@@ -450,7 +454,9 @@ case "${notices_out}" in
'') : do nothing;;
*)
readonly allNotice="${tmpFiles}/notices"
set +e
egrep '^1' "${allDeps}" | cut -d\ -f3- | egrep -v '^out/' > "${allNotice}"
set -e
cat "${allProj}" | while read proj; do
for f in LICENSE LICENCE NOTICE license.txt notice.txt; do
if [ -f "${proj}/${f}" ]; then