View | Details | Raw Unified | Return to bug 215761 | Differences between
and this patch

Collapse All | Expand All

(-)Mk/Scripts/do-patch.sh (+121 lines)
Added Link Here
1
#!/bin/sh
2
# $FreeBSD$
3
#
4
# MAINTAINER: portmgr@FreeBSD.org
5
6
set -e
7
8
. "${dp_SCRIPTSDIR}/functions.sh"
9
10
validate_env dp_BZCAT dp_CAT dp_DISTDIR dp_ECHO_MSG dp_EXTRA_PATCHES \
11
	dp_EXTRA_PATCH_TREE dp_GZCAT dp_OPSYS dp_PATCH dp_PATCHDIR \
12
	dp_PATCHFILES dp_PATCH_ARGS dp_PATCH_DEBUG_TMP dp_PATCH_DIST_ARGS \
13
	dp_PATCH_SILENT dp_PATCH_WRKSRC dp_PKGNAME dp_PKGORIGIN \
14
	dp_UNZIP_NATIVE_CMD dp_XZCAT
15
16
[ -n "${DEBUG_MK_SCRIPTS}" -o -n "${DEBUG_MK_SCRIPTS_DO_PATCH}" ] && set -x
17
18
set -u
19
20
apply_one_patch() {
21
	local file="$1"
22
	local msg="$2"
23
	shift 2
24
	local patch_strip=""
25
26
	case ${file} in
27
		*:-p[0-9])
28
			patch_strip=${file##*:}
29
			file=${file%:-p[0-9]}
30
			;;
31
	esac
32
33
	if [ -n "${msg}" ]; then
34
		${dp_ECHO_MSG} "===>  ${msg} ${file}${patch_strip:+ with ${patch_strip}}"
35
	fi
36
37
	case "${file}" in
38
		*.Z|*.gz)
39
			${dp_GZCAT} "${file}"
40
			;;
41
		*.bz2)
42
			${dp_BZCAT} "${file}"
43
			;;
44
		*.xz)
45
			${dp_XZCAT} "${file}"
46
			;;
47
		*.zip)
48
			${dp_UNZIP_NATIVE_CMD} -p "${file}"
49
			;;
50
		*)
51
			${dp_CAT} "${file}"
52
			;;
53
	esac | do_patch "$@" ${patch_strip}
54
}
55
56
do_patch() {
57
	"${dp_PATCH}" -d "${dp_PATCH_WRKSRC}" "$@"
58
}
59
60
patch_from_directory() {
61
	local dir="$1"
62
	local msg="$2"
63
64
	if [ -d "${dir}" ]; then
65
		cd "${dir}"
66
67
		if [ "$(echo patch-*)" != "patch-*" ]; then
68
69
			${dp_ECHO_MSG} "===>  Applying ${msg} patches for ${dp_PKGNAME}"
70
71
			PATCHES_APPLIED=""
72
73
			for i in patch-*; do
74
				case ${i} in
75
					*.orig|*.rej|*~|*,v)
76
						${dp_ECHO_MSG} "===>   Ignoring patchfile ${i}"
77
						;;
78
					*)
79
						if [ -n "${dp_PATCH_DEBUG_TMP}" ]; then
80
							${dp_ECHO_MSG} "===>  Applying ${msg} patch ${i}"
81
						fi
82
						if do_patch ${dp_PATCH_ARGS} < ${i}; then
83
							PATCHES_APPLIED="${PATCHES_APPLIED} ${i}"
84
						else
85
							${dp_ECHO_MSG} "=> ${msg} patch ${i} failed to apply cleanly."
86
							if [ -n "${PATCHES_APPLIED}" -a "${dp_PATCH_SILENT}" != "yes" ]; then
87
								${dp_ECHO_MSG} "=> Patch(es) ${PATCHES_APPLIED} applied cleanly."
88
							fi
89
							false
90
						fi
91
						;;
92
				esac
93
			done
94
		fi
95
	fi
96
}
97
98
if [ -n "${dp_PATCHFILES}" ]; then
99
	${dp_ECHO_MSG} "===>  Applying distribution patches for ${dp_PKGNAME}"
100
	cd "${dp_DISTDIR}"
101
	for i in ${dp_PATCHFILES}; do
102
		apply_one_patch "${i}" \
103
			"${dp_PATCH_DEBUG_TMP:+ Applying distribution patch}" \
104
			${dp_PATCH_DIST_ARGS}
105
	done
106
fi
107
108
if [ -n "${dp_EXTRA_PATCHES}" ]; then
109
	for i in ${dp_EXTRA_PATCHES}; do
110
		apply_one_patch "${i}" \
111
			"Applying extra patch" \
112
			${dp_PATCH_ARGS}
113
	done
114
fi
115
116
patch_from_directory "${dp_PATCHDIR}" "${dp_OPSYS}"
117
118
if [ -n "${dp_EXTRA_PATCH_TREE}" ]; then
119
	patch_from_directory "${dp_EXTRA_PATCH_TREE}/${dp_PKGORIGIN}" "local"
120
fi
121
(-)Mk/bsd.port.mk (-74 / +37 lines)
Lines 749-754 FreeBSD_MAINTAINER= portmgr@FreeBSD.org Link Here
749
#				  The patches specified by this variable will be
749
#				  The patches specified by this variable will be
750
#				  applied after the normal distribution patches but
750
#				  applied after the normal distribution patches but
751
#				  before those in ${PATCHDIR}.
751
#				  before those in ${PATCHDIR}.
752
# EXTRA_PATCH_TREE - where to find extra 'out-of-tree' patches
753
#				  Points to a directory hierarchy with the same layout
754
#				  as the ports tree, where local patches can be found.
755
#				  This allows a third party to keep their patches in
756
#				  some other source control system if needed.
752
# PATCH_WRKSRC	- Directory to apply patches in.
757
# PATCH_WRKSRC	- Directory to apply patches in.
753
#				  Default: ${WRKSRC}
758
#				  Default: ${WRKSRC}
754
#
759
#
Lines 1993-2004 PATCH_STRIP?= -p0 Link Here
1993
PATCH_DIST_STRIP?=	-p0
1998
PATCH_DIST_STRIP?=	-p0
1994
.if defined(PATCH_DEBUG)
1999
.if defined(PATCH_DEBUG)
1995
PATCH_DEBUG_TMP=	yes
2000
PATCH_DEBUG_TMP=	yes
1996
PATCH_ARGS?=	-d ${PATCH_WRKSRC} -E ${PATCH_STRIP}
2001
PATCH_ARGS?=	-E ${PATCH_STRIP}
1997
PATCH_DIST_ARGS?=	--suffix ${DISTORIG} -d ${PATCH_WRKSRC} -E ${PATCH_DIST_STRIP}
2002
PATCH_DIST_ARGS?=	--suffix ${DISTORIG} -E ${PATCH_DIST_STRIP}
1998
.else
2003
.else
1999
PATCH_DEBUG_TMP=	no
2004
PATCH_ARGS?=	--forward --quiet -E ${PATCH_STRIP}
2000
PATCH_ARGS?=	-d ${PATCH_WRKSRC} --forward --quiet -E ${PATCH_STRIP}
2005
PATCH_DIST_ARGS?=	--suffix ${DISTORIG} --forward --quiet -E ${PATCH_DIST_STRIP}
2001
PATCH_DIST_ARGS?=	--suffix ${DISTORIG} -d ${PATCH_WRKSRC} --forward --quiet -E ${PATCH_DIST_STRIP}
2002
.endif
2006
.endif
2003
.if !defined(QUIET)
2007
.if !defined(QUIET)
2004
PATCH_SILENT=		PATCH_SILENT=yes
2008
PATCH_SILENT=		PATCH_SILENT=yes
Lines 2010-2015 PATCH_DIST_ARGS+= --batch Link Here
2010
2014
2011
# Prevent breakage with VERSION_CONTROL=numbered
2015
# Prevent breakage with VERSION_CONTROL=numbered
2012
PATCH_ARGS+=	-V simple
2016
PATCH_ARGS+=	-V simple
2017
PATCH_DIST_ARGS+=		-V simple
2013
2018
2014
.if defined(PATCH_CHECK_ONLY)
2019
.if defined(PATCH_CHECK_ONLY)
2015
PATCH_ARGS+=	-C
2020
PATCH_ARGS+=	-C
Lines 2372-2379 _PATCH_SITES_ALL+= ${_PATCH_SITES_${_group}} Link Here
2372
.		endfor
2377
.		endfor
2373
.	endif
2378
.	endif
2374
_PATCHFILES:=	${_PATCHFILES} ${_P_file}
2379
_PATCHFILES:=	${_PATCHFILES} ${_P_file}
2375
.	if !empty(_P_strip)
2380
.	if empty(_P_strip)
2376
_PATCH_DIST_STRIP_CASES:=	${_PATCH_DIST_STRIP_CASES} ("${_P_file}") printf %s "${_P_strip}" ;;
2381
_PATCHFILES2:=	${_PATCHFILES2} ${_P_file}
2382
.	else
2383
_PATCHFILES2:=	${_PATCHFILES2} ${_P_file}:${_P_strip}
2377
.	endif
2384
.	endif
2378
.endfor
2385
.endfor
2379
_P_groups=
2386
_P_groups=
Lines 3076-3148 do-extract: Link Here
3076
3083
3077
.if !target(do-patch)
3084
.if !target(do-patch)
3078
do-patch:
3085
do-patch:
3079
.if defined(PATCHFILES)
3086
	@${SETENV} \
3080
	@${ECHO_MSG} "===>  Applying distribution patches for ${PKGNAME}"
3087
			dp_BZCAT="${BZCAT}" \
3081
	@(set -e; \
3088
			dp_CAT="${CAT}" \
3082
	cd ${_DISTDIR}; \
3089
			dp_DISTDIR="${_DISTDIR}" \
3083
	patch_dist_strip () { \
3090
			dp_ECHO_MSG="${ECHO_MSG}" \
3084
		case "$$1" in \
3091
			dp_EXTRA_PATCHES="${EXTRA_PATCHES}" \
3085
		${_PATCH_DIST_STRIP_CASES} \
3092
			dp_EXTRA_PATCH_TREE="${EXTRA_PATCH_TREE}" \
3086
		esac; \
3093
			dp_GZCAT="${GZCAT}" \
3087
	}; \
3094
			dp_OPSYS="${OPSYS}" \
3088
	for i in ${_PATCHFILES}; do \
3095
			dp_PATCH="${PATCH}" \
3089
		if [ ${PATCH_DEBUG_TMP} = yes ]; then \
3096
			dp_PATCHDIR="${PATCHDIR}" \
3090
			${ECHO_MSG} "===>   Applying distribution patch $$i" ; \
3097
			dp_PATCHFILES="${_PATCHFILES2}" \
3091
		fi ; \
3098
			dp_PATCH_ARGS=${PATCH_ARGS:Q} \
3092
		case $$i in \
3099
			dp_PATCH_DEBUG_TMP="${PATCH_DEBUG_TMP}" \
3093
		*.Z|*.gz) ${GZCAT} $$i ;; \
3100
			dp_PATCH_DIST_ARGS="${PATCH_DIST_ARGS}" \
3094
		*.bz2) ${BZCAT} $$i ;; \
3101
			dp_PATCH_SILENT="${PATCH_SILENT}" \
3095
		*.xz) ${XZCAT} $$i ;; \
3102
			dp_PATCH_WRKSRC=${PATCH_WRKSRC} \
3096
		*.zip) ${UNZIP_NATIVE_CMD} -p $$i ;; \
3103
			dp_PKGNAME="${PKGNAME}" \
3097
		*) ${CAT} $$i ;; \
3104
			dp_PKGORIGIN="${PKGORIGIN}" \
3098
		esac | ${PATCH} ${PATCH_DIST_ARGS} `patch_dist_strip $$i` ; \
3105
			dp_SCRIPTSDIR="${SCRIPTSDIR}" \
3099
	done )
3106
			dp_UNZIP_NATIVE_CMD="${UNZIP_NATIVE_CMD}" \
3100
.endif
3107
			dp_XZCAT="${XZCAT}" \
3101
.if defined(EXTRA_PATCHES)
3108
			${SH} ${SCRIPTSDIR}/do-patch.sh
3102
	@set -e ; \
3103
	for i in ${EXTRA_PATCHES}; do \
3104
		case $$i in \
3105
		*:-p[0-9]) patch_file=$${i%:*} ; patch_strip=$${i##*:} ;; \
3106
		*) patch_file=$$i ;; \
3107
		esac ; \
3108
		${ECHO_MSG} "===>  Applying extra patch $$patch_file" ; \
3109
		case $$patch_file in \
3110
		*.Z|*.gz) ${GZCAT} $$patch_file ;; \
3111
		*.bz2) ${BZCAT} $$patch_file ;; \
3112
		*.xz) ${XZCAT} $$patch_file ;; \
3113
		*.zip) ${UNZIP_NATIVE_CMD} -p $$patch_file ;; \
3114
		*) ${CAT} $$patch_file ;; \
3115
		esac | ${PATCH} ${PATCH_ARGS} $$patch_strip ; \
3116
	done
3117
.endif
3118
	@set -e ;\
3119
	if [ -d ${PATCHDIR} ]; then \
3120
		if [ "`${ECHO_CMD} ${PATCHDIR}/patch-*`" != "${PATCHDIR}/patch-*" ]; then \
3121
			${ECHO_MSG} "===>  Applying ${OPSYS} patches for ${PKGNAME}" ; \
3122
			PATCHES_APPLIED="" ; \
3123
			for i in ${PATCHDIR}/patch-*; do \
3124
				case $$i in \
3125
					*.orig|*.rej|*~|*,v) \
3126
						${ECHO_MSG} "===>   Ignoring patchfile $$i" ; \
3127
						;; \
3128
					*) \
3129
						if [ ${PATCH_DEBUG_TMP} = yes ]; then \
3130
							${ECHO_MSG} "===>   Applying ${OPSYS} patch $$i" ; \
3131
						fi; \
3132
						if ${PATCH} ${PATCH_ARGS} < $$i ; then \
3133
							PATCHES_APPLIED="$$PATCHES_APPLIED $$i" ; \
3134
						else \
3135
							${ECHO_MSG} `${ECHO_CMD} "=> Patch $$i failed to apply cleanly." | ${SED} "s|${PATCHDIR}/||"` ; \
3136
							if [ x"$$PATCHES_APPLIED" != x"" -a ${PATCH_SILENT} != "yes" ]; then \
3137
								${ECHO_MSG} `${ECHO_CMD} "=> Patch(es) $$PATCHES_APPLIED applied cleanly." | ${SED} "s|${PATCHDIR}/||g"` ; \
3138
							fi; \
3139
							${FALSE} ; \
3140
						fi; \
3141
						;; \
3142
				esac; \
3143
			done; \
3144
		fi; \
3145
	fi
3146
.endif
3109
.endif
3147
3110
3148
.if !target(run-autotools-fixup)
3111
.if !target(run-autotools-fixup)
(-)emulators/xen-kernel/Makefile (-8 / +8 lines)
Lines 40-53 PLIST_FILES= /boot/xen \ Link Here
40
EXTRA_PATCHES=	${FILESDIR}/0001-xen-logdirty-prevent-preemption-if-finished.patch:-p1 \
40
EXTRA_PATCHES=	${FILESDIR}/0001-xen-logdirty-prevent-preemption-if-finished.patch:-p1 \
41
		${FILESDIR}/0002-xen-rework-paging_log_dirty_op-to-work-with-hvm-gues.patch:-p1 \
41
		${FILESDIR}/0002-xen-rework-paging_log_dirty_op-to-work-with-hvm-gues.patch:-p1 \
42
		${FILESDIR}/kconf_arch.patch:-p1 \
42
		${FILESDIR}/kconf_arch.patch:-p1 \
43
		${FILESDIR}/xsa191.patch \
43
		${FILESDIR}/xsa191.patch:-p1 \
44
		${FILESDIR}/xsa192.patch \
44
		${FILESDIR}/xsa192.patch:-p1 \
45
		${FILESDIR}/xsa193-4.7.patch \
45
		${FILESDIR}/xsa193-4.7.patch:-p1 \
46
		${FILESDIR}/xsa194.patch \
46
		${FILESDIR}/xsa194.patch:-p1 \
47
		${FILESDIR}/xsa195.patch \
47
		${FILESDIR}/xsa195.patch:-p1 \
48
		${FILESDIR}/xsa200-4.7.patch \
48
		${FILESDIR}/xsa200-4.7.patch:-p1 \
49
		${FILESDIR}/xsa204-4.7.patch \
49
		${FILESDIR}/xsa204-4.7.patch:-p1 \
50
		${FILESDIR}/xsa202.patch
50
		${FILESDIR}/xsa202.patch:-p1
51
51
52
.include <bsd.port.options.mk>
52
.include <bsd.port.options.mk>
53
53
(-)sysutils/xen-tools/Makefile (-3 / +3 lines)
Lines 45-53 QEMU_ARGS= --disable-gtk \ Link Here
45
45
46
EXTRA_PATCHES=	${FILESDIR}/var_paths.patch:-p1 \
46
EXTRA_PATCHES=	${FILESDIR}/var_paths.patch:-p1 \
47
		${FILESDIR}/xsa198.patch:-p1 \
47
		${FILESDIR}/xsa198.patch:-p1 \
48
		${FILESDIR}/0001-libxl-fix-creation-of-pkgconf-install-dir.patch \
48
		${FILESDIR}/0001-libxl-fix-creation-of-pkgconf-install-dir.patch:-p1 \
49
		${FILESDIR}/0001-tools-configure-fix-pkg-config-install-path-for-Free.patch \
49
		${FILESDIR}/0001-tools-configure-fix-pkg-config-install-path-for-Free.patch:-p1 \
50
		${FILESDIR}/0001-libs-xenstore-set-correct-FreeBSD-device.patch
50
		${FILESDIR}/0001-libs-xenstore-set-correct-FreeBSD-device.patch:-p1
51
51
52
CONFIGURE_ARGS+=	--with-extra-qemuu-configure-args="${QEMU_ARGS}" \
52
CONFIGURE_ARGS+=	--with-extra-qemuu-configure-args="${QEMU_ARGS}" \
53
			--with-system-seabios=${LOCALBASE}/share/seabios/bios.bin
53
			--with-system-seabios=${LOCALBASE}/share/seabios/bios.bin

Return to bug 215761