summaryrefslogtreecommitdiffstats
path: root/support/scripts/apply-patches.sh
Commit message (Collapse)AuthorAgeFilesLines
* support/scripts/apply-patches.sh: do not apply patches with renamesThomas Petazzoni2017-09-191-0/+5
| | | | | | | | | | | | | | | | | | | | | | Patches with renames apply properly with patch >= 2.7, but not with older patch versions. Since "git format-patch" by default generates patches with renames, Buildroot developers often don't realize that their patches will not apply properly on build machines that have patch < 2.7. In order to prevent such a situation from happening again, this commit adds some logic in apply-patches.sh to refuse applying patches that contain renames. Note that just searching for '^rename' is not sufficient, since the patch commit message may contain the words "rename from" or "rename to" as well. Therefore, the grep expression is made as accurate as possible, checking both. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Reviewed-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be> Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr> [Arnout: spaces instead of tabs (suggested by Yann); extend commit message.] Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
* support/apply-patches: re-instate set -eYann E. MORIN2016-07-061-1/+3
| | | | | | | | | | | | | | | | | | | As reported by Sébastien Szymanski [1], the apply-patches script doesn't stop if a tar command can't extract an archive. Use "set -e" to exit immediately if a command return an error. Be sure to ignore any expected error: when we check if a patch to be applied has the same basename as an already applied patch, the grep would fail when no such patch was already applied. We should not fail in this case. Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr> Cc: Sébastien Szymanski <sebastien.szymanski@armadeus.com> Cc: Romain Naour <romain.naour@openwide.fr> Reviewed-by: Romain Naour <romain.naour@gmail.com> Tested-by: Romain Naour <romain.naour@gmail.com> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
* Revert "apply-patches: catch unexpected failure"Thomas Petazzoni2016-07-051-3/+0
| | | | | | | | This reverts commit 9cf1ad6cdb37c5be5772121896f4b13ec42c2b0d. This breaks many packages. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
* apply-patches: catch unexpected failureRomain Naour2016-07-051-0/+3
| | | | | | | | | | | | | As reported by Sébastien Szymanski [1], the apply-patches script doesn't stop if a tar command can't extract an archive. Use "set -e" to exit immediately if a command return an error. [1] http://patchwork.ozlabs.org/patch/626196 Signed-off-by: Romain Naour <romain.naour@gmail.com> Cc: Sébastien Szymanski <sebastien.szymanski@armadeus.com> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
* support/apply-patches: bail-out on duplicate patch basenamesYann E. MORIN2016-06-241-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Patches we save can come from various locations: - bundled with Buildroot - downloaded - from one or more global-patch-dir It is possible that two patches lying into different locations have the same basename, like so (first is bundled, second is from an hypothetical global-patch-dir): package/foo/0001-fix-Makefile.patch /path/to/my/patches/foo/0001-fix-Makefile.patch In that case, when running legal-info, we'd save only the second patch, overwriting the first. That would be problematic, because: - either the second patch depends on the first, and thus would no longer apply (this is easy to detect, though), - or the second patch does not depend on the first, and the compliance delivery will not be complete (this is much harder to detect). We fix that by checking that no two patches have the same same basename. If we find that the basename of the patch to be applied collides with that of a previously applied patch, we error out and report the duplicate. The unfortunate side-effect is that existing setups will now break in that situation, but that's a minor, corner-case issue that is easily fixed. Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr> Cc: Luca Ceresoli <luca@lucaceresoli.net> Cc: Arnout Vandecappelle <arnout@mind.be> Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Reviewed-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be> [Thomas: adjust coding style, fix minor typos in the commit log.] Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
* core/apply-patches: store full path of applied patchesYann E. MORIN2016-06-241-3/+8
| | | | | | | | | | | | | | | | | | | | | | | Currently, we only store the filename of the applied patches. However, we are soon to want to install those patches in the legal-info directory, so we'll have to know where those patches come from. Instead of duplicating the logic to find the patches (bundled, downloaded, from a global patch dir...), just store the full path to each of those patches so we can retrieve them more easily later on. Also always create the list-file, even if empty, so that we need not test for its existence before reading it. Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr> Cc: Luca Ceresoli <luca@lucaceresoli.net> Reviewed-by: Luca Ceresoli <luca@lucaceresoli.net> [Tested only with patches in the Buildroot sources] Tested-by: Luca Ceresoli <luca@lucaceresoli.net> Reviewed-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be> [Thomas: used $PWD instead of $(pwd), as suggested by Arnout.] Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
* support/scripts/apply-patches.sh: fix whitespaceArnout Vandecappelle2016-01-131-25/+25
| | | | | | | | | The apply-patches.sh script was using a mix of tabs and spaces, and some three-space indentation. Normalize everything to four-space indentation. Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be> Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
* apply-patches: only use first field of line for series fileRyan Barnett2015-12-121-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | A series file for quilt has a valid syntax of: fixes/autoconf.diff -p1 fixes/doc-html-local-css.diff -p1 fixes/gnu-inline.diff -p1 However, with the current way that a series file is handled, it will error out because the -p1 is tried as a file. This is because in the for loop that iterates the files, we only look for comment lines. Then each line is used within a bash for loop which uses spaces a delimiter. In order to fix this, we should only use the string that comes before a space in the series file. Note that the format allows for any arbitrary depth to the -pN field. But since we'll have only one package with -pN fields, and all will be -p1, we for now always assume -p1. This will have to be fixed whenever we get a package with other values. Signed-off-by: Ryan Barnett <ryanbarnett3@gmail.com> [yann.morin.1998@free.fr: expand comment about the format of a series file and how we interpret it] Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr> CC: Arnout Vandecappelle <arnout@mind.be> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
* apply-patches.sh: use everything from the series fileArnout Vandecappelle2015-11-171-25/+30
| | | | | | | | | | | | When a series file exists, we should use every file mentioned in it, not just the ones ending with .patch or .diff. Also, there's no need to uncompress anything if it's mentioned in a series file (the tools that manipulate series files don't support compressed patches). Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be> Cc: Doug Kehn <rdkehn@yahoo.com> Tested-by: Doug Kehn <rdkehn@yahoo.com> Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
* Change /bin/bash shebangs into /usr/bin/env bashBjørn Forsman2014-10-251-1/+1
| | | | | | | | | | | | | | | | | Not all systems have /bin/bash (e.g. NixOS[1] doesn't). Buildroot already uses /usr/bin/env shebangs for other interpreters (perl, python), so why not bash? This changes only the shebangs used by Buildroot itself; stuff installed to the target system is left unchanged. With this applied I can run Buildroot unmodified on NixOS. [1]: http://nixos.org/ Signed-off-by: Bjørn Forsman <bjorn.forsman@gmail.com> Acked-by: "Yann E. MORIN" <yann.morin.1998@free.fr> Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
* apply-patches.sh: don't print anything when "make -s" is usedFabio Porcedda2014-10-251-3/+14
| | | | | | | | | | | | The make "-s" option is used to enable the "Silent operation" so if that option is used don't print anything as far as there isn't any error. Add the "-s" option to "apply-patches.sh" to enable silent operation. [Peter: use the existing QUIET variable] Signed-off-by: Fabio Porcedda <fabio.porcedda@gmail.com> Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr> Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
* apply-patches.sh: make scan_patchdir work recursivelyThomas De Schampheleire2014-02-081-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | scan_patchdir is called recursively. For this to work properly, the variable path which is set to $1 at the very beginning must be local not global. A test case is to set BR2_GLOBAL_PATCH_DIR to 'mypatches' and having the following tree in the buildroot root: $ find mypatches/ mypatches/ mypatches/busybox mypatches/busybox/subdir.patch mypatches/busybox/subdir.patch/busybox-0001-abc.patch mypatches/busybox/busybox-0002-def.patch mypatches/busybox/asubdir.patch mypatches/busybox/asubdir.patch/busybox-0003-xyz.patch When running 'make busybox-dirclean busybox-patch' originally, you'd get: Applying busybox-0003-xyz.patch using patch: Applying busybox-0002-def.patch using patch: Error: missing patch file mypatches/busybox/asubdir.patch/busybox-0002-def.patch While with this fix: Applying busybox-0003-xyz.patch using patch: Applying busybox-0002-def.patch using patch: Applying busybox-0001-abc.patch using patch: This fixes bug #6434 (https://bugs.busybox.net/show_bug.cgi?id=6434) Signed-off-by: Daniel Mentz <daniel@exxm.de> [Thomas: update commit message with test case] Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com> Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
* apply-patches.sh: avoid reversed/already applied patchesGustavo Zacarias2013-09-171-1/+1
| | | | | | | | | | Disable reversed/already applied patches fallout from commit 5871b791995ebe295db7dca608afe3f293ce8953 Reverse patches are bad, they may unfix things with version bumps and just sneak under the radar with pure batch mode. Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar> Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
* apply-patches.sh: Go back to only warn about unsupported file typesPeter Korsgaard2013-09-161-2/+2
| | | | | | | | | | | | | | | | | | Fixes http://autobuild.buildroot.net/results/868/8687be8ec029486d9c5e2224cde542134f72884b/ The recent (d245fbb41dc: apply-patches.sh: detect missing patches) change to apply-patches.sh causes a number of regressions with packages using downloadable tarballs of patches (typically from Debian), as those contain additional files besides just the patches (ChangeLog's, debian/rules, ..). This use case is arguably abusing the _PATCH handling, but it used to work so people might rely on it so go back to only warn about this instead of erroring out. At the same time reword the warning message. Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
* apply-patches.sh: detect missing patchesRalph Siemsen2013-09-151-5/+9
| | | | | | | | | | | | | The "patch" command returns an error code only if patches fail to apply. Therefore the pipleline "cat <patchfile> | patch ..." does not fail, even if <patchfile> is missing. Fix this by adding an explicit check for patch file existence. Based on feedback from buildroot mailing list, also change the existing check for unsupported patch format into a fatal error. Signed-off-by: Ralph Siemsen <ralphs@netwinder.org> Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
* apply-patches: run patch in batch modeArnout Vandecappelle2013-08-271-1/+1
| | | | | | | | | | | | | | If the file to be patched is missing, then `patch' will interactively ask for a file to be patched. This is annoying in e.g. the autobuilders because they have to wait for a timeout instead of failing. Giving the '-t' (batch mode) option to patch fixes this: it will skip the missing file, and return a non-zero exit code. So the build cleanly fails. Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be> Acked-by: Luca Ceresoli <luca@lucaceresoli.net> Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
* apply-patches.sh: ensure a fixed (and simple) sorting order is usedPeter Korsgaard2013-06-121-0/+3
| | | | | | So we always apply patches in the samme order. Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
* apply-patches.sh: applying xz-ed patchesJerzy Grzegorek2013-03-261-2/+4
| | | | | | | Signed-off-by: Jerzy Grzegorek <jerzy.grzegorek@trzebnica.net> [yann.morin.1998@free.fr: space-damage] Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr> Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
* apply-patches.sh: add documentationLudovic Desroches2012-05-191-0/+23
| | | | | Signed-off-by: Ludovic Desroches <ludovic.desroches@gmail.com> Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
* apply-patches.sh: patch pattern was expanded prematurelyLudovic Desroches2012-04-161-1/+1
| | | | | | | | The patch pattern was expanded before being into the patch directory so the expansion can add incorrect files. Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com> Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
* apply-patches.sh: add recursivity when scanning patchdirLudovic Desroches2012-03-211-3/+9
| | | | | | | | | | | | | | | | | | | Recursivity is needed with some tarballs containing debian patches: . debian changelog control patches 02-COPYRIGHT.patch [...] Since we can find some files which are not patches in those directories, only consider .patch* and .diff* files as valid patches. Due to recursivity, strip-components option is no more necessary so it has been removed. Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com> Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
* apply-patches.sh: use series file to apply patches in proper orderLudovic Desroches2012-03-211-12/+20
| | | | | | | | | | | | | If a series file is present use it to determine the proper order to apply patches instead of using ls sorting order. Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com> Tested-by: Ludovic Desroches <ludovic.desroches@atmel.com> add a series file with a wrong patch order into an archive containing several patches whose correct order is the alphabetical one Acked-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Tested-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
* apply-patches.sh: change archive managementLudovic Desroches2012-03-211-16/+32
| | | | | | | | | | | | | The way archives were managed was incorrect because the uncompressed archives were sent directly to the patch command. It means that alphabetical patch order was not respected. Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com> Tested-by: Ludovic Desroches <ludovic.desroches@atmel.com> with an armadeus_apf9328_defconfig build Acked-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Tested-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
* apply-patches.sh: directories are no more considered as overlaysLudovic Desroches2012-03-201-4/+1
| | | | | | | | | | | When a directory is found in patchdir, it is skipped. Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com> Tested-by: Ludovic Desroches <ludovic.desroches@atmel.com> with an armadeus_apf9328_defconfig build Acked-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Tested-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
* apply-patches.sh: cleanupLudovic Desroches2012-03-201-2/+2
| | | | | | | | | | | | Add quoting and remove redundant command. Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com> Tested-by: Ludovic Desroches <ludovic.desroches@atmel.com> with an armadeus_apf9328_defconfig build Acked-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Tested-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Acked-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be> Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
* apply-patches.sh: rename targetdir to builddirLudovic Desroches2012-03-201-9/+9
| | | | | | | | | | | | targetdir is not the output/target directory as it can suggest. Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com> Tested-by: Ludovic Desroches <ludovic.desroches@atmel.com> with an armadeus_apf9328_defconfig build Acked-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Tested-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Acked-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be> Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
* apply-patches.sh: remove any rejects before applying patchesLudovic Desroches2012-03-141-1/+7
| | | | | | | | | | | [Peter: .rej files might be in subdirs, so just do find .. | xargs rm] Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com> Tested-by: Ludovic Desroches <ludovic.desroches@atmel.com> with an armadeus_apf9328_defconfig build Reviewed-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be> Acked-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Tested-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
* Prevent patch commands from accessing source controlDanomi Mocelopolis2011-11-261-1/+1
| | | | | | | | Closes #4357 Add -g0 option to patch to ensure it doesn't try to access source control. Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
* support: move patch-kernel.sh and rename itThomas Petazzoni2011-09-171-0/+66
The name "patch-kernel.sh" is a bit stupid, since this script is used to patch everything in Buildroot, not only kernel trees. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
OpenPOWER on IntegriCloud