From c4ea0ea4efe429c9e547bab80096c2c8dbf5cd92 Mon Sep 17 00:00:00 2001 From: Josh Poimboeuf Date: Thu, 13 Mar 2014 12:18:40 -0500 Subject: [PATCH] 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. --- kpatch-build/kpatch-build | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/kpatch-build/kpatch-build b/kpatch-build/kpatch-build index e5013b712..9b253e0d4 100755 --- a/kpatch-build/kpatch-build +++ b/kpatch-build/kpatch-build @@ -184,11 +184,8 @@ patch -p1 < "$APPLIEDPATCHFILE" >> "$LOGFILE" 2>&1 || die make "-j$CPUS" vmlinux "O=$OBJDIR" > "$TEMPDIR/patched_build.log" 2>&1 || die echo "Detecting changed objects" -grep CC "$TEMPDIR/patched_build.log" | grep -v init/version.o | awk '{print $2}' >> "$TEMPDIR/changed_objs" -if [[ $? -ne 0 ]]; then - echo "No changed objects" - exit 1 -fi +grep CC "$TEMPDIR/patched_build.log" | grep -v init/version.o | awk '{print $2}' > "$TEMPDIR/changed_objs" +[[ ! -s "$TEMPDIR/changed_objs" ]] && die "no changed objects were detected" echo "Rebuilding changed objects" rm -rf "$OBJDIR2"