Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH] apply-patches.sh: detect missing patches
@ 2013-08-13 16:00 Ralph Siemsen
  2013-08-23 10:31 ` Thomas De Schampheleire
  0 siblings, 1 reply; 25+ messages in thread
From: Ralph Siemsen @ 2013-08-13 16:00 UTC (permalink / raw)
  To: buildroot

apply-patches.sh: detect missing patches

The current patch logic does not detect missing patch files,
particularly when using a series file. If the series file
refers to non-existent patches, a minor warning appears,
but the build continues.

The root cause is the "cat <patchfile> | patch ..." pipleline.
When patchfile does not exist, the "cat" command prints a
warning, however, the pipeline status is determined by the
final "patch" command. And since patch has not received any
input, it returns success.

There are two possible solutions that I can see:
  1. set -o pipefail, then pipeline will return error from 'cat'
  2. check for patch existence explicitly
I've opted for 2nd choice, it seems less risky.

The following patch adds the check. It also fixes the indentation
of an adjacent line (TAB versus spaces) making it consistent.

diff --git a/support/scripts/apply-patches.sh b/support/scripts/apply-patches.sh
index 7d5856c..a3f7153 100755
--- a/support/scripts/apply-patches.sh
+++ b/support/scripts/apply-patches.sh
@@ -76,7 +76,11 @@ function apply_patch {
     esac
     echo ""
     echo "Applying $patch using ${type}: "
-	echo $patch >> ${builddir}/.applied_patches_list
+    if ! test -e "${path}/$patch" ; then
+	echo "Error: missing patch file ${path}/$patch"
+	return 1
+    fi
+    echo $patch >> ${builddir}/.applied_patches_list
     ${uncomp} "${path}/$patch" | patch -g0 -p1 -E -d "${builddir}"
     if [ $? != 0 ] ; then
         echo "Patch failed!  Please fix ${patch}!"

^ permalink raw reply related	[flat|nested] 25+ messages in thread

end of thread, other threads:[~2013-09-16 20:57 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-13 16:00 [Buildroot] [PATCH] apply-patches.sh: detect missing patches Ralph Siemsen
2013-08-23 10:31 ` Thomas De Schampheleire
2013-09-05  7:03   ` Thomas De Schampheleire
2013-09-05  8:04     ` Thomas Petazzoni
2013-09-05  8:35       ` Luca Ceresoli
2013-09-05 14:01         ` Yann E. MORIN
2013-09-05 19:20           ` Thomas De Schampheleire
2013-09-11 12:06             ` Ralph Siemsen
2013-09-12  8:08               ` Thomas De Schampheleire
2013-09-13 18:15                 ` [Buildroot] [PATCH v2] " Ralph Siemsen
2013-09-13 18:27                   ` Yann E. MORIN
2013-09-15 13:37                     ` Ralph Siemsen
2013-09-15 14:13                       ` [Buildroot] [PATCH v3] " Ralph Siemsen
2013-09-15 20:09                         ` Peter Korsgaard
2013-09-16  7:11                           ` Peter Korsgaard
2013-09-16 12:46                             ` Ralph Siemsen
2013-09-16 20:50                               ` Peter Korsgaard
2013-09-16 15:24                             ` Thomas Petazzoni
2013-09-16 19:45                               ` Ralph Siemsen
2013-09-16 20:07                                 ` Arnout Vandecappelle
2013-09-16 20:49                               ` Peter Korsgaard
2013-09-16 20:51                                 ` Yann E. MORIN
2013-09-16 20:57                                   ` Peter Korsgaard
2013-09-16 12:36                           ` Ralph Siemsen
2013-09-16 13:42                             ` Peter Korsgaard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox