Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F111011982
D582.id1044.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D582.id1044.diff
View Options
Index: bsd.port.mk
===================================================================
--- bsd.port.mk
+++ bsd.port.mk
@@ -1176,22 +1176,48 @@
.else
-# Look for ${PATCH_WRKSRC}/.../*.orig files, and (re-)create
-# ${FILEDIR}/patch-* files from them.
+# Look for files named "*.orig" under ${PATCH_WRKSRC} and (re-)generate
+# ${FILESDIR}/patch-* files from them. By default, '_' (underscore) is
+# used to replace path separators in patch file names; it can be set to
+# something else via PATCH_PATH_SEPARATOR variable (note that only [-+_]
+# characters are allowed).
+#
+# 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 if they use any of the allowed path
+# separators ([-+_]) or legacy double underscore (__).
.if !target(makepatch)
+PATCH_PATH_SEPARATOR?= _
makepatch:
+.if empty(PATCH_PATH_SEPARATOR) || ${PATCH_PATH_SEPARATOR:C/[-+_]//}
+ @${ECHO_MSG} "Error (${.TARGET}): PATCH_PATH_SEPARATOR must be one of the [-+_] characters."
+ @${FALSE}
+.endif
@${MKDIR} ${FILESDIR}
@(cd ${PATCH_WRKSRC}; \
- for i in `find . -type f -name '*.orig'`; do \
- ORG=$$i; \
- NEW=$${i%.orig}; \
- cmp -s $${ORG} $${NEW} && continue; \
- OUT=${FILESDIR}`${ECHO} $${NEW} | \
- ${SED} -e 's|/|__|g' \
- -e 's|^\.__|/patch-|'`; \
- ${ECHO} ${DIFF} -ud $${ORG} $${NEW} '>' $${OUT}; \
- ${DIFF} -ud $${ORG} $${NEW} > $${OUT} || ${TRUE}; \
+ 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 "${FILESDIR}/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=${FILESDIR}/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 \
)
.endif
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Feb 27, 4:55 AM (15 h, 46 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
16862747
Default Alt Text
D582.id1044.diff (2 KB)
Attached To
Mode
D582: Improved logic to generate a set of patches from *.orig files under ${PATCH_WRKSRC}
Attached
Detach File
Event Timeline
Log In to Comment