[next,v2,2/3] batman-adv: Use simple script to patch minor compat problems
Commit Message
Unified diff base patches have the problem that they fix only a single line
and depend on the surrounding. This approach can fail relative often when
the surrounding code will be changed often. Thus semantic patches (like
spatch from coccinelle) or simple find+replace scripts are better for this
approach.
Introduce a simple script file which will store these kind of find+replace
instructions.
Signed-off-by: Sven Eckelmann <sven@narfation.org>
---
v2:
- introduce this patch to support the patch 3
Makefile | 3 ++-
compat-patches/replacements.sh | 3 +++
2 files changed, 5 insertions(+), 1 deletion(-)
create mode 100755 compat-patches/replacements.sh
Comments
On Donnerstag, 15. September 2016 15:52:48 CEST Sven Eckelmann wrote:
> Unified diff base patches have the problem that they fix only a single line
> and depend on the surrounding. This approach can fail relative often when
> the surrounding code will be changed often. Thus semantic patches (like
> spatch from coccinelle) or simple find+replace scripts are better for this
> approach.
>
> Introduce a simple script file which will store these kind of find+replace
> instructions.
>
> Signed-off-by: Sven Eckelmann <sven@narfation.org>
> ---
We could also skip this step and directly use coccinelle. I started a branch
some examples to cleanup our compat hacks [1]. The change for the netlink
const change is also already available [2].
Kind regards,
Sven
[1] https://git.open-mesh.org/batman-adv.git/shortlog/refs/heads/ecsv/buildpatch
[2] https://git.open-mesh.org/batman-adv.git/commitdiff/2895226999760f2f2b34b506d33dc54c3bb43ca4?hp=7582ba83a3c7870dcb00f166259fbbb65600566c
@@ -99,7 +99,7 @@ install: config $(SOURCE_STAMP)
config:
$(PWD)/gen-compat-autoconf.sh $(PWD)/compat-autoconf.h
-$(SOURCE_STAMP): $(SOURCE) compat-patches/*
+$(SOURCE_STAMP): $(SOURCE) compat-patches/* compat-patches/replacements.sh
$(MKDIR) $(BUILD_DIR)/net/batman-adv/
@$(RM) $(SOURCE_BUILD)
@$(CP) $(SOURCE) $(BUILD_DIR)/net/batman-adv/
@@ -111,6 +111,7 @@ $(SOURCE_STAMP): $(SOURCE) compat-patches/*
$(PATCH) ../compat-patches/$${i}; \
cd - > /dev/null; \
done
+ compat-patches/replacements.sh
touch $(SOURCE_STAMP)
.PHONY: all clean install config
new file mode 100755
@@ -0,0 +1,3 @@
+#! /bin/sh
+
+set -e