FreeBSD Bugzilla – Attachment 178501 Details for
Bug 215761
refactor do-patch
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
v1
patch.diff (text/plain), 7.32 KB, created by
Mathieu Arnold
on 2017-01-04 11:39:45 UTC
(
hide
)
Description:
v1
Filename:
MIME Type:
Creator:
Mathieu Arnold
Created:
2017-01-04 11:39:45 UTC
Size:
7.32 KB
patch
obsolete
>base commit: r430459 >diff --git Mk/Scripts/do-patch.sh Mk/Scripts/do-patch.sh >new file mode 100644 >index 0000000..9f409ef >--- /dev/null >+++ Mk/Scripts/do-patch.sh >@@ -0,0 +1,115 @@ >+#!/bin/sh >+# $FreeBSD$ >+# >+# MAINTAINER: portmgr@FreeBSD.org >+ >+set -e >+ >+. "${dp_SCRIPTSDIR}/functions.sh" >+ >+validate_env dp_BZCAT dp_CAT dp_DISTDIR dp_ECHO_MSG dp_EXTRA_PATCHES \ >+ dp_EXTRA_PATCH_TREE dp_GZCAT dp_OPSYS dp_PATCH dp_PATCHDIR \ >+ dp_PATCHFILES dp_PATCH_ARGS dp_PATCH_DEBUG_TMP dp_PATCH_DIST_ARGS \ >+ dp_PATCH_SILENT dp_PKGNAME dp_PKGORIGIN dp_UNZIP_NATIVE_CMD dp_XZCAT >+ >+[ -n "${DEBUG_MK_SCRIPTS}" -o -n "${DEBUG_MK_SCRIPTS_DO_PATCH}" ] && set -x >+ >+set -u >+ >+apply_one_patch() { >+ local file="$1" >+ local msg="$2" >+ shift 2 >+ local patch_strip="" >+ >+ case ${file} in >+ *:-p[0-9]) >+ patch_strip=${file##*:} >+ file=${file%:-p[0-9]} >+ ;; >+ esac >+ >+ if [ -n "${msg}" ]; then >+ ${dp_ECHO_MSG} "===> ${msg} ${file}${patch_strip:+ with ${patch_strip}}" >+ fi >+ >+ case "${file}" in >+ *.Z|*.gz) >+ ${dp_GZCAT} "${file}" >+ ;; >+ *.bz2) >+ ${dp_BZCAT} "${file}" >+ ;; >+ *.xz) >+ ${dp_XZCAT} "${file}" >+ ;; >+ *.zip) >+ ${dp_UNZIP_NATIVE_CMD} -p "${file}" >+ ;; >+ *) >+ ${dp_CAT} "${file}" >+ ;; >+ esac | "${dp_PATCH}" $@ ${patch_strip} >+} >+ >+patch_from_directory() { >+ local dir="$1" >+ local msg="$2" >+ >+ if [ -d "${dir}" ]; then >+ cd "${dir}" >+ >+ if [ "$(echo patch-*)" != "patch-*" ]; then >+ >+ ${dp_ECHO_MSG} "===> Applying ${msg} patches for ${dp_PKGNAME}" >+ >+ PATCHES_APPLIED="" >+ >+ for i in patch-*; do >+ case ${i} in >+ *.orig|*.rej|*~|*,v) >+ ${dp_ECHO_MSG} "===> Ignoring patchfile ${i}" >+ ;; >+ *) >+ if apply_one_patch ${i} \ >+ "${dp_PATCH_DEBUG_TMP:+ Applying ${msg} patch}" \ >+ ${dp_PATCH_ARGS} ; then >+ PATCHES_APPLIED="${PATCHES_APPLIED} ${i}" >+ else >+ ${dp_ECHO_MSG} "=> ${msg} patch ${i} failed to apply cleanly." >+ if [ -n "${PATCHES_APPLIED}" -a "${dp_PATCH_SILENT}" != "yes" ]; then >+ ${dp_ECHO_MSG} "=> Patch(es) ${PATCHES_APPLIED} applied cleanly." >+ fi >+ false >+ fi >+ ;; >+ esac >+ done >+ fi >+ fi >+} >+ >+if [ -n "${dp_PATCHFILES}" ]; then >+ ${dp_ECHO_MSG} "===> Applying distribution patches for ${dp_PKGNAME}" >+ cd "${dp_DISTDIR}" >+ for i in ${dp_PATCHFILES}; do >+ apply_one_patch "${i}" \ >+ "${dp_PATCH_DEBUG_TMP:+ Applying distribution patch}" \ >+ ${dp_PATCH_DIST_ARGS} >+ done >+fi >+ >+if [ -n "${dp_EXTRA_PATCHES}" ]; then >+ for i in ${dp_EXTRA_PATCHES}; do >+ apply_one_patch "${i}" \ >+ "Applying extra patch" \ >+ ${dp_PATCH_ARGS} >+ done >+fi >+ >+patch_from_directory "${dp_PATCHDIR}" "${dp_OPSYS}" >+ >+if [ -n "${dp_EXTRA_PATCH_TREE}" ]; then >+ patch_from_directory "${dp_EXTRA_PATCH_TREE}/${dp_PKGORIGIN}" "local" >+fi >+ >diff --git Mk/bsd.port.mk Mk/bsd.port.mk >index f67c12b..9c3775f 100644 >--- Mk/bsd.port.mk >+++ Mk/bsd.port.mk >@@ -749,6 +749,11 @@ FreeBSD_MAINTAINER= portmgr@FreeBSD.org > # The patches specified by this variable will be > # applied after the normal distribution patches but > # before those in ${PATCHDIR}. >+# EXTRA_PATCH_TREE - where to find extra 'out-of-tree' patches >+# Points to a directory hierarchy with the same layout >+# as the ports tree, where local patches can be found. >+# This allows a third party to keep their patches in >+# some other source control system if needed. > # PATCH_WRKSRC - Directory to apply patches in. > # Default: ${WRKSRC} > # >@@ -1996,7 +2001,6 @@ PATCH_DEBUG_TMP= yes > PATCH_ARGS?= -d ${PATCH_WRKSRC} -E ${PATCH_STRIP} > PATCH_DIST_ARGS?= --suffix ${DISTORIG} -d ${PATCH_WRKSRC} -E ${PATCH_DIST_STRIP} > .else >-PATCH_DEBUG_TMP= no > PATCH_ARGS?= -d ${PATCH_WRKSRC} --forward --quiet -E ${PATCH_STRIP} > PATCH_DIST_ARGS?= --suffix ${DISTORIG} -d ${PATCH_WRKSRC} --forward --quiet -E ${PATCH_DIST_STRIP} > .endif >@@ -2010,6 +2014,7 @@ PATCH_DIST_ARGS+= --batch > > # Prevent breakage with VERSION_CONTROL=numbered > PATCH_ARGS+= -V simple >+PATCH_DIST_ARGS+= -V simple > > .if defined(PATCH_CHECK_ONLY) > PATCH_ARGS+= -C >@@ -2372,8 +2377,10 @@ _PATCH_SITES_ALL+= ${_PATCH_SITES_${_group}} > . endfor > . endif > _PATCHFILES:= ${_PATCHFILES} ${_P_file} >-. if !empty(_P_strip) >-_PATCH_DIST_STRIP_CASES:= ${_PATCH_DIST_STRIP_CASES} ("${_P_file}") printf %s "${_P_strip}" ;; >+. if empty(_P_strip) >+_PATCHFILES2:= ${_PATCHFILES2} ${_P_file} >+. else >+_PATCHFILES2:= ${_PATCHFILES2} ${_P_file}:${_P_strip} > . endif > .endfor > _P_groups= >@@ -3076,73 +3083,28 @@ do-extract: > > .if !target(do-patch) > do-patch: >-.if defined(PATCHFILES) >- @${ECHO_MSG} "===> Applying distribution patches for ${PKGNAME}" >- @(set -e; \ >- cd ${_DISTDIR}; \ >- patch_dist_strip () { \ >- case "$$1" in \ >- ${_PATCH_DIST_STRIP_CASES} \ >- esac; \ >- }; \ >- for i in ${_PATCHFILES}; do \ >- if [ ${PATCH_DEBUG_TMP} = yes ]; then \ >- ${ECHO_MSG} "===> Applying distribution patch $$i" ; \ >- fi ; \ >- case $$i in \ >- *.Z|*.gz) ${GZCAT} $$i ;; \ >- *.bz2) ${BZCAT} $$i ;; \ >- *.xz) ${XZCAT} $$i ;; \ >- *.zip) ${UNZIP_NATIVE_CMD} -p $$i ;; \ >- *) ${CAT} $$i ;; \ >- esac | ${PATCH} ${PATCH_DIST_ARGS} `patch_dist_strip $$i` ; \ >- done ) >-.endif >-.if defined(EXTRA_PATCHES) >- @set -e ; \ >- for i in ${EXTRA_PATCHES}; do \ >- case $$i in \ >- *:-p[0-9]) patch_file=$${i%:*} ; patch_strip=$${i##*:} ;; \ >- *) patch_file=$$i ;; \ >- esac ; \ >- ${ECHO_MSG} "===> Applying extra patch $$patch_file" ; \ >- case $$patch_file in \ >- *.Z|*.gz) ${GZCAT} $$patch_file ;; \ >- *.bz2) ${BZCAT} $$patch_file ;; \ >- *.xz) ${XZCAT} $$patch_file ;; \ >- *.zip) ${UNZIP_NATIVE_CMD} -p $$patch_file ;; \ >- *) ${CAT} $$patch_file ;; \ >- esac | ${PATCH} ${PATCH_ARGS} $$patch_strip ; \ >- done >-.endif >- @set -e ;\ >- if [ -d ${PATCHDIR} ]; then \ >- if [ "`${ECHO_CMD} ${PATCHDIR}/patch-*`" != "${PATCHDIR}/patch-*" ]; then \ >- ${ECHO_MSG} "===> Applying ${OPSYS} patches for ${PKGNAME}" ; \ >- PATCHES_APPLIED="" ; \ >- for i in ${PATCHDIR}/patch-*; do \ >- case $$i in \ >- *.orig|*.rej|*~|*,v) \ >- ${ECHO_MSG} "===> Ignoring patchfile $$i" ; \ >- ;; \ >- *) \ >- if [ ${PATCH_DEBUG_TMP} = yes ]; then \ >- ${ECHO_MSG} "===> Applying ${OPSYS} patch $$i" ; \ >- fi; \ >- if ${PATCH} ${PATCH_ARGS} < $$i ; then \ >- PATCHES_APPLIED="$$PATCHES_APPLIED $$i" ; \ >- else \ >- ${ECHO_MSG} `${ECHO_CMD} "=> Patch $$i failed to apply cleanly." | ${SED} "s|${PATCHDIR}/||"` ; \ >- if [ x"$$PATCHES_APPLIED" != x"" -a ${PATCH_SILENT} != "yes" ]; then \ >- ${ECHO_MSG} `${ECHO_CMD} "=> Patch(es) $$PATCHES_APPLIED applied cleanly." | ${SED} "s|${PATCHDIR}/||g"` ; \ >- fi; \ >- ${FALSE} ; \ >- fi; \ >- ;; \ >- esac; \ >- done; \ >- fi; \ >- fi >+ @${SETENV} \ >+ dp_BZCAT="${BZCAT}" \ >+ dp_CAT="${CAT}" \ >+ dp_DISTDIR="${_DISTDIR}" \ >+ dp_ECHO_MSG="${ECHO_MSG}" \ >+ dp_EXTRA_PATCHES="${EXTRA_PATCHES}" \ >+ dp_EXTRA_PATCH_TREE="${EXTRA_PATCH_TREE}" \ >+ dp_GZCAT="${GZCAT}" \ >+ dp_OPSYS="${OPSYS}" \ >+ dp_PATCH="${PATCH}" \ >+ dp_PATCHDIR="${PATCHDIR}" \ >+ dp_PATCHFILES="${_PATCHFILES2}" \ >+ dp_PATCH_ARGS="${PATCH_ARGS}" \ >+ dp_PATCH_DEBUG_TMP="${PATCH_DEBUG_TMP}" \ >+ dp_PATCH_DIST_ARGS="${PATCH_DIST_ARGS}" \ >+ dp_PATCH_SILENT="${PATCH_SILENT}" \ >+ dp_PKGNAME="${PKGNAME}" \ >+ dp_PKGORIGIN="${PKGORIGIN}" \ >+ dp_SCRIPTSDIR="${SCRIPTSDIR}" \ >+ dp_UNZIP_NATIVE_CMD="${UNZIP_NATIVE_CMD}" \ >+ dp_XZCAT="${XZCAT}" \ >+ ${SH} ${SCRIPTSDIR}/do-patch.sh > .endif > > .if !target(run-autotools-fixup)
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 215761
:
178501
|
178702
|
178747
|
178749