Skip to content

Commit 7fc2016

Browse files
committed
#e01499a Simplify patches generation
1 parent 99337fa commit 7fc2016

File tree

5 files changed

+11
-20
lines changed

5 files changed

+11
-20
lines changed

_charm/src/e01499af7ccefbbce7893af1212765f2d04a659dc9c913c8177d06d232c1b606.cr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@
77
<links>
88
<link name="parent">7bc74cc796c455a46d699ad91f6aca5b7c790f56a6a0968b4ecbce33efce9d25</link>
99
</links>
10-
<cf v="fred322 2025-06-24T17:53:31+02:00"/>
10+
<cf v="fred322 2025-07-03T15:35:07+02:00"/>
1111
</cr>

core/module-srcarchive.mk

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,13 +107,12 @@ $(ARCHSRC_INCLUDESFILES): $(ARCHSRC_EXTRACTED_INFO) $(ARCHSRC_INCLUDES_EXTRACTED
107107
# 1: sources originals directory
108108
# 2: sources modified directory
109109
define generatePatchesFor
110-
for file in `find $(1) -type f`; do \
110+
for file in `find $1 -type f`; do \
111111
relativePath=`echo $$file | sed 's~$(1)/~~g'` && \
112-
if [ `diff -q $$file $(2)/$$relativePath | wc -l` -ne 0 ]; then \
112+
if [ `diff -q $$file $2/$$relativePath | wc -l` -ne 0 ]; then \
113113
$(ABS_PRINT_info) "Generating patch for $$relativePath";\
114114
mkdir -p $(ARCHSRC_GENE_PATCHES_OUT)/`dirname $$relativePath` && \
115-
diff -Naur $$file $(2)/$$relativePath > $(ARCHSRC_GENE_PATCHES_OUT)/$$relativePath.patch; \
116-
sed -i -e 's~$(1)/~~g' -e 's~$(2)/~~g' $(ARCHSRC_GENE_PATCHES_OUT)/$$relativePath.patch; \
115+
diff --label $$relativePath --label $$relativePath -Nau $$file $2/$$relativePath > $(ARCHSRC_GENE_PATCHES_OUT)/$$relativePath.patch || :; \
117116
fi; \
118117
done
119118
endef

sampleprj/T_abs/test/resources/projB/cpplib3/patches/subdir/inc.h.patch

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
--- subdir/inc.h 2025-03-13 09:23:48.012321627 +0100
2-
+++ subdir/inc.h 2025-03-13 09:25:33.896319205 +0100
1+
--- subdir/inc.h
2+
+++ subdir/inc.h
33
@@ -1,6 +1,4 @@
44
#pragma once
55

sampleprj/T_abs/test/resources/projB/cpplib3/patches/subdir2/source2.cpp.patch

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
--- subdir2/source2.cpp 2025-03-13 09:33:38.892308112 +0100
2-
+++ subdir2/source2.cpp 2025-03-13 09:33:54.544307754 +0100
1+
--- subdir2/source2.cpp
2+
+++ subdir2/source2.cpp
33
@@ -1,7 +1,9 @@
44
#include "subdir/inc2.h"
55

sampleprj/T_abs/test/scripts/testPatches.sh

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,9 @@ fi
2828
testFileExists $projBOUtPatchesDir/subdir2/source2.cpp.patch
2929
testFileExists $projBOUtPatchesDir/subdir/inc.h.patch
3030

31-
function removeDateFromPatch {
32-
head -n 2 $1 | sed 's/\t.*//g' > $2
33-
tail -n +3 $1 >> $2
34-
}
3531

36-
removeDateFromPatch cpplib3/patches/subdir2/source2.cpp.patch $projBOUtPatchesDir/subdir2/source2.expected
37-
removeDateFromPatch cpplib3/patches/subdir/inc.h.patch $projBOUtPatchesDir/subdir/inc.expected
38-
removeDateFromPatch $projBOUtPatchesDir/subdir2/source2.cpp.patch $projBOUtPatchesDir/subdir2/source2.generated
39-
removeDateFromPatch $projBOUtPatchesDir/subdir/inc.h.patch $projBOUtPatchesDir/subdir/inc.generated
40-
41-
testFile $projBOUtPatchesDir/subdir2/source2.expected $projBOUtPatchesDir/subdir2/source2.generated
42-
testFile $projBOUtPatchesDir/subdir/inc.expected $projBOUtPatchesDir/subdir/inc.generated
32+
echo "#### Test patches"
33+
testFile $projBOUtPatchesDir/subdir2/source2.cpp.patch $MODROOT/test/resources/projB/cpplib3/patches/subdir2/source2.cpp.patch
34+
testFile $projBOUtPatchesDir/subdir/inc.h.patch $MODROOT/test/resources/projB/cpplib3/patches/subdir/inc.h.patch
4335

4436
doExit 0

0 commit comments

Comments
 (0)