properly detect no changed objects

The current solution doesn't work because "$?" will always be 0, even if
there were no "CC" lines in the build log.  Instead, just make sure the
changed_objs file isn't empty.
This commit is contained in:
Josh Poimboeuf 2014-03-13 12:18:40 -05:00
parent 3acf30c0c8
commit c4ea0ea4ef

View File

@ -184,11 +184,8 @@ patch -p1 < "$APPLIEDPATCHFILE" >> "$LOGFILE" 2>&1 || die
make "-j$CPUS" vmlinux "O=$OBJDIR" > "$TEMPDIR/patched_build.log" 2>&1 || die make "-j$CPUS" vmlinux "O=$OBJDIR" > "$TEMPDIR/patched_build.log" 2>&1 || die
echo "Detecting changed objects" echo "Detecting changed objects"
grep CC "$TEMPDIR/patched_build.log" | grep -v init/version.o | awk '{print $2}' >> "$TEMPDIR/changed_objs" grep CC "$TEMPDIR/patched_build.log" | grep -v init/version.o | awk '{print $2}' > "$TEMPDIR/changed_objs"
if [[ $? -ne 0 ]]; then [[ ! -s "$TEMPDIR/changed_objs" ]] && die "no changed objects were detected"
echo "No changed objects"
exit 1
fi
echo "Rebuilding changed objects" echo "Rebuilding changed objects"
rm -rf "$OBJDIR2" rm -rf "$OBJDIR2"