Skip to contentSkip to conversation

support: enforce '--binary' when applying patches

PATCH New James Knight 2 participants 4 messages Sep 29, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 support: enforce '--binary' when applying patches

The following commit enforces the patch operation to "disable the heuristic for transforming CRLF line endings into LF line endings" [1]. This is to help packages, which source files have been generated on non- POSIX systems, to apply compatible non-POSIX generated patches. The addition of this option should have no effect on existing patches [2].

[1]: http://git.savannah.gnu.org/cgit/patch.git/tree/patch.man#n306
[2]: https://www.gnu.org/software/diffutils/manual/html_node/Binary.html

---
 support/scripts/apply-patches.sh | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
support/scripts/apply-patches.sh +2 -1
index 7ccb39d..a71a51a 100755
@@ -114,7 +114,8 @@ function apply_patch {
         exit 1
     fi
     echo "${path}/${patch}" >> ${builddir}/.applied_patches_list
-    ${uncomp} "${path}/$patch" | patch -g0 -p1 -E -d "${builddir}" -t -N $silent
+    ${uncomp} "${path}/$patch" | \
+            patch --binary -g0 -p1 -E -d "${builddir}" -t -N $silent
     if [ $? != 0 ] ; then
         echo "Patch failed!  Please fix ${patch}!"
         exit 1
Signature · 1 line
2.8.4.windows.1
#1 lore raw

PATCH 2/2 rapidxml: add patch to fix usage with gcc 4.7+

The official rapidxml package release only supports up to GCC 4.6.x for all capabilities. Implementers attempting to include the file "rapidxml_print.hpp" will all result in a complilation failure when using a currently supported Buildroot GCC version (all 4.7+ at this time). With the provided patch, dependent packages will be able to use all of rapidxml's capabilities using a generated toolchain from Buildroot (let alone external toolchains).

This commit also enforces rapidxml-provided patches to using CRLF line endings. Since official rapidxml sources package in a CRLF-based environment, patches need to following the same line endings or issues arise:

patching file rapidxml_print.hpp
Hunk #1 FAILED at 101 (different line endings).

While this may not be required, it should mitigate maintences woes when dealing with this package's patches [1].

[1]: https://github.com/git/git/commit/8d8140843501107c92e2f9a5acb60ee136352c1f

---
 package/rapidxml/.gitattributes                    |  2 +
 ...rnal-print-operations-are-declared-before.patch | 45 ++++++++++++++++++++++
 2 files changed, 47 insertions(+)
 create mode 100644 package/rapidxml/.gitattributes
 create mode 100644 package/rapidxml/0001-ensure-internal-print-operations-are-declared-before.patch
package/rapidxml/.gitattributes new file +2 -0
new file mode 100644
index 0000000..ebf512d
@@ -0,0 +1,2 @@
+# rapidxml's sources are crlf; enforce crlf on patches to prevent apply issues.
+*.patch text eol=crlf
package/rapidxml/0001-ensure-internal-print-operations-are-declared-before.patch new file +45 -0

45 lines not on this page · raw message

Signature · 1 line
2.8.4.windows.1
#2 lore raw

PATCH 1/2 support: enforce '--binary' when applying patches

In reply to James Knight

James,

This change can have issues with old distros, see below. Currently buildroot does not enforce a minimal version of 'patch'.

----- Original Message -----

Quoted 8 lines

From: "James Knight" <[email protected]>
To: buildroot at busybox.net
Cc: "James Knight" <[email protected]>
Sent: Thursday, September 29, 2016 11:57:00 AM
Subject: [Buildroot] [RCF 1/2] support: enforce '--binary' when applying patches

The following commit enforces the patch operation to "disable the heuristic for transforming CRLF line endings into LF line endings" [1].

[snip]

So I think you need a version of the tool 'patch' that contains [3] that was merged in patch v2.6
RHEL5 and RHEL4 use patch v2.5.4.

Quoted 2 lines

[1]: http://git.savannah.gnu.org/cgit/patch.git/tree/patch.man#n306
[2]: https://www.gnu.org/software/diffutils/manual/html_node/Binary.html

[snip]

[3] http://git.savannah.gnu.org/cgit/patch.git/commit/?id=b7687446d1e7673a39fd66bc6043f4a78961f675

Regards,
Ricardo Martincoski

#3 lore raw

PATCH 1/2 support: enforce '--binary' when applying patches

Ricardo,

Quoted 3 lines · Ricardo Martincoski

This change can have issues with old distros, see below. Currently buildroot does not enforce a minimal version of 'patch'.

Good to know; thanks for the information. I'll try an alternative solution for my current situation [1].

[1]: https://patchwork.ozlabs.org/patch/676644/