gluon/scripts/patch.sh
Linus Lüssing 3275091931 scripts: disable whitespace fixing for patch.sh / "git am"
When a patch Gluon provides is applied via "make update" and if this
patch itself modifies a patch that has DOS line endings then this
currently fails. Patch files with DOS line endings unfortunately seem to
sometimes slip into the OpenWrt repository.

It seems that the "git am" invoked by Gluon's patch.sh interprets the
DOS line endings as belonging to the outter patch and deems them
unnecessary. After automatically "fixing" them the outter patch does not
apply anymore as it does not match the content of the inner patch.

This commit fixes this issue by disabling the whitespace fixing which
"git am" applies by default.

Signed-off-by: Linus Lüssing <linus.luessing@c0d3.blue>

---
The openwrt/lang/node-hid/patches/000-compile.patch file has such DOS
line endings. The nodejs update coming with the next commit would fail
on "make update" for "node-*: node update to v4.4.4", which removes
000-compile.patch, otherwise.
2019-04-20 06:19:26 +02:00

32 lines
771 B
Bash
Executable File

#!/bin/bash
set -e
shopt -s nullglob
. "$GLUONDIR"/scripts/modules.sh
TMPDIR="$GLUON_BUILDDIR"/tmp
mkdir -p "$TMPDIR"
PATCHDIR="$TMPDIR"/patching
trap 'rm -rf "$PATCHDIR"' EXIT
for module in $GLUON_MODULES; do
echo "--- Patching module '$module' ---"
git clone -s -b base --single-branch "$GLUONDIR"/$module "$PATCHDIR" 2>/dev/null
cd "$PATCHDIR"
for patch in "$GLUONDIR"/patches/$module/*.patch; do
git -c user.name='Gluon Patch Manager' -c user.email='gluon@void.example.com' -c commit.gpgsign=false am --ignore-space-change --whitespace=nowarn --committer-date-is-author-date "$patch"
done
cd "$GLUONDIR"/$module
git fetch "$PATCHDIR" 2>/dev/null
git checkout -B patched FETCH_HEAD
git submodule update --init --recursive
rm -rf "$PATCHDIR"
done