diff options
author | marino <marino@FreeBSD.org> | 2015-11-15 23:25:12 +0800 |
---|---|---|
committer | marino <marino@FreeBSD.org> | 2015-11-15 23:25:12 +0800 |
commit | 1a35d9723fe52e36cde5793d610dc8636be06d3f (patch) | |
tree | a33bf429b5d1b17137be56e35ce8fbdb41d738b3 /Mk/bsd.port.mk | |
parent | 112934f5eab626f5928a42dbb5616e691e42b262 (diff) | |
download | freebsd-ports-gnome-1a35d9723fe52e36cde5793d610dc8636be06d3f.tar.gz freebsd-ports-gnome-1a35d9723fe52e36cde5793d610dc8636be06d3f.tar.zst freebsd-ports-gnome-1a35d9723fe52e36cde5793d610dc8636be06d3f.zip |
Enhance "make makepatch" to address two major deficiencies
This update to the "makepatch" target adds the following enhancements:
1) Conserves comments
If the existing patch has comments, they will be transferred to the
regenerated patch.
2) Supports multiple patches per file
If the patch file contains concatenated patches, the makepatch
target will keep these patches together. It may change the order
of the patches the first time, but every time after the multi-patch
will be assembled in the same order.
Behavioral changes:
A) The "old" patches are not overwritten, but rather archived at:
${WRKDIR}/makepatch-tmp/archived-patches
B) Any patch that was not replaced or renamed is deleted by makepatch
(but it is archived first, see paragraph above)
C) There regeneration messages for the user will show them which patches
are using "legacy" names formats.
D) Makepatch will do a great job at "cleaning" git patches; it removes
lines starting with "diff" and "index" in the comments section.
Notes:
E) Should a source file be modified by multiple patches (e.g. two separate
multi-patches), a composite patch will be generated. In the above
example of two multi-patches, one would get the full patch and the
other no longer patch the source file.
Approved by: portmgr (mat)
Differential Revision: D4136
Diffstat (limited to 'Mk/bsd.port.mk')
-rw-r--r-- | Mk/bsd.port.mk | 40 |
1 files changed, 4 insertions, 36 deletions
diff --git a/Mk/bsd.port.mk b/Mk/bsd.port.mk index c27f12bec82e..1ed4f64b6ed9 100644 --- a/Mk/bsd.port.mk +++ b/Mk/bsd.port.mk @@ -1114,44 +1114,12 @@ STRIPBIN= ${STRIP_CMD} .else -# Look for files named "*.orig" under ${PATCH_WRKSRC} and (re-)generate -# ${PATCHDIR}/patch-* files from them. By popular demand, we currently -# use '_' (underscore) to replace path separators in patch file names. -# -# If a file name happens to contain character which is also a separator -# replacement character, it will be doubled in the resulting patch name. -# -# To minimize gratuitous patch renames, newly generated patches will be -# written under existing file names when they use any of the previously -# common path separators ([-+_]) or legacy double underscore (__). - .if !target(makepatch) -PATCH_PATH_SEPARATOR= _ makepatch: - @${MKDIR} ${PATCHDIR} - @(cd ${PATCH_WRKSRC}; \ - for f in `${FIND} -s . -type f -name '*.orig'`; do \ - ORIG=$${f#./}; \ - NEW=$${ORIG%.orig}; \ - cmp -s $${ORIG} $${NEW} && continue; \ - ! for _lps in `${ECHO} _ - + | ${SED} -e \ - 's|${PATCH_PATH_SEPARATOR}|__|'`; do \ - PATCH=`${ECHO} $${NEW} | ${SED} -e "s|/|$${_lps}|g"`; \ - test -f "${PATCHDIR}/patch-$${PATCH}" && break; \ - done || ${ECHO} $${_SEEN} | ${GREP} -q /$${PATCH} && { \ - PATCH=`${ECHO} $${NEW} | ${SED} -e \ - 's|${PATCH_PATH_SEPARATOR}|&&|g' -e \ - 's|/|${PATCH_PATH_SEPARATOR}|g'`; \ - _SEEN=$${_SEEN}/$${PATCH}; \ - }; \ - OUT=${PATCHDIR}/patch-$${PATCH}; \ - ${ECHO} ${DIFF} -udp $${ORIG} $${NEW} '>' $${OUT}; \ - TZ=UTC ${DIFF} -udp $${ORIG} $${NEW} | ${SED} -e \ - '/^---/s|\.[0-9]* +0000$$| UTC|' -e \ - '/^+++/s|\([[:blank:]][-0-9:.+]*\)*$$||' \ - > $${OUT} || ${TRUE}; \ - done \ - ) + @${SETENV} WRKDIR=${WRKDIR} PATCHDIR=${PATCHDIR} \ + PATCH_WRKSRC=${PATCH_WRKSRC} \ + STRIP_COMPONENTS="${PATCH_STRIP:S/-p//}" \ + ${SH} ${SCRIPTSDIR}/smart_makepatch.sh .endif |