summaryrefslogtreecommitdiff
path: root/pkgtools/tinderbox-dragonfly/patches/patch-ai
blob: 719a6d37434da16d754224b94055a3654d24e3ce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
$NetBSD: patch-ai,v 1.2 2011/11/14 02:00:20 marino Exp $

--- ../FreeBSD/lib/portbuild	2011-10-16 00:52:55.000000000 +0000
+++ lib/portbuild
@@ -5,7 +5,7 @@
 . ${pb}/scripts/lib/tinderlib.sh
 
 usage () {
-    echo "usage: $0 <build name> <jail name> <portstree name> [-noclean] [-plistcheck] [-nullfs] [-fetch-original] [-nolog] ED PD FD BD RD TD pkgname dirname"
+    echo "usage: $0 <build name> <jail name> <portstree name> [-noclean] [-plistcheck] [-fetch-original] [-nolog] ED PD FD BD RD TD pkgname dirname"
     exit 1
 }
 
@@ -17,9 +17,10 @@ cleanup()
     cleandirs=$4
     pkgname=$5
     build=$6
-    nullfs=$7
 
-    umount ${chroot}/compat/linux/proc >/dev/null
+    if [ ${ARCH} = "i386" ]; then
+	umount ${chroot}/compat/linux/proc >/dev/null
+    fi
     umount ${chroot}/proc >/dev/null
 
     if [ $noclean -eq 0 ]; then
@@ -31,11 +32,8 @@ cleanup()
 	    rm -rf ${chroot}/tmp/*
 
 	    chroot ${chroot} /sbin/ldconfig -R
-	    if [ ${ARCH} = "i386" ]; then
-	        chroot ${chroot} /sbin/ldconfig -aout -R
-	    fi
 	else
-	    ${tc} resetBuild -b ${build} ${nullfs}
+	    ${tc} resetBuild -b ${build}
 	fi
     fi
 
@@ -56,7 +54,12 @@ mark_failed() {
 	return
     fi
 
-    dependents=$(grep ${pkgname} ${mf} | grep '^[[:space:]]\{1,\}@' | awk '{print $NF}' | sed -e 's|^/usr/ports/||' | grep -v ${portdir})
+    dependents=$(grep ${pkgname} ${mf} | \
+    	grep '^[[:space:]]\{1,\}@' | \
+    	awk '{print $NF}' | \
+    	sed -e 's|^/usr/pkgsrc/||' | \
+    	sed -e 's|^../../||' | \
+    	grep -v ${portdir})
     if [ $? -ne 0 ]; then
 	return
     fi
@@ -71,7 +74,6 @@ mark_failed() {
 error=0
 init=0
 noclean=0
-nullfs=""
 fetchorig=0
 nolog=0
 plistcheck=""
@@ -107,9 +109,6 @@ while [ $# -gt 0 -a ${doneargs} -eq 0 ];
     x-plistcheck)	plistcheck="plistcheck"
 			shift;;
 
-    x-nullfs)		nullfs="-n"
-			shift;;
-
     x-fetch-original)	fetchorig=1
 			shift;;
 
@@ -151,7 +150,7 @@ echo ${dirname}
 tc=$(tinderLoc scripts tc)
 chroot=$(tinderLoc buildroot ${build})
 echo "chroot is: ${chroot}"
-portdir=$(echo ${dirname} | sed -e 's|^/usr/ports/||')
+portdir=$(echo ${dirname} | sed -e 's|^/usr/pkgsrc/||')
 
 total_size=$(${tc} getPortTotalSize -d ${portdir} -b ${build})
 execute_hook "prePortBuild" "PACKAGE_NAME=${pkgname} BUILD=${build} JAIL=${jail} PORTSTREE=${portstree} CHROOT=${chroot} PORTDIR=${portdir} PB=${pb} TOTAL_SIZE=${total_size}"
@@ -167,7 +166,7 @@ if [ -f ${dudsfile} ]; then
     if grep -qxF ${pkgname} ${dudsfile}; then
         echo "skipping ${pkgname} (found in duds)"
 	${tc} updatePortStatus -d ${portdir} -b ${build} \
-		-L -s DUD -v ${pkgname}
+		-L -s DUD -v ${pkgname} -r arch
 	mark_failed ${tc} ${build} ${pkgname} ${portdir}
 	execute_hook "postPortBuild" "PACKAGE_NAME=${pkgname} BUILD=${build} JAIL=${jail} PORTSTREE=${portstree} CHROOT=${chroot} STATUS=DUD PORTDIR=${portdir} PB=${pb} FAIL_REASON=dud TOTAL_SIZE=0"
         exit 1
@@ -175,12 +174,12 @@ if [ -f ${dudsfile} ]; then
 fi
 
 # directories to clean
+# These are created/recreated after blowing the directories away
 cleandirs="${LOCALBASE} /compat /var/db/pkg"
 
 for dir in ${cleandirs}; do
     cleanDirs ${build} ${chroot}${dir}
 done
-rm -rf ${chroot}/var/db/pkg/*
 
 # reset mtrees for plist checking
 mtree -deU -f ${chroot}/etc/mtree/BSD.root.dist \
@@ -190,17 +189,48 @@ mtree -deU -f ${chroot}/etc/mtree/BSD.va
 mtree -deU -f ${chroot}/etc/mtree/BSD.usr.dist \
       -p ${chroot}/usr >/dev/null 2>&1
 
-mkdir -p ${chroot}${LOCALBASE}
-if [ -f ${chroot}/a/ports/Templates/BSD.local.dist ]; then
-    mtree -deU -f ${chroot}/a/ports/Templates/BSD.local.dist -p ${chroot}${LOCALBASE} \
+if [ -f ${chroot}/a/pkgsrc/Templates/BSD.local.dist ]; then
+    mtree -deU -f ${chroot}/a/pkgsrc/Templates/BSD.local.dist -p ${chroot}${LOCALBASE} \
     	>/dev/null 2>&1
 else
     mtree -deU -f ${chroot}/etc/mtree/BSD.local.dist -p ${chroot}${LOCALBASE} \
     	>/dev/null 2>&1
 fi
 
-# mount linprocfs if required
-if [ "${ARCH}" = "i386" -o "${ARCH}" = "amd64" ]; then
+# pkgsrc is "helpful" that it removes directories that result empty after
+# as the plist removes files of a package.  This includes standard mtree
+# directories such as man/man1, so we need to touch a file in every directory
+# of pkgsrc to prevent this side-effect which often fails the fs state check.
+
+find ${chroot}${LOCALBASE}/ -type d -exec touch {}/.keep \;
+
+# copy over pkgsrc bootstrap tools, ${LOCALBASE}/bin & /etc exist now
+cp    ${chroot}/usr/4bootstrap/bmake   ${chroot}${LOCALBASE}/bin/
+cp    ${chroot}/usr/4bootstrap/pkg_*   ${chroot}${LOCALBASE}/sbin/
+cp    ${chroot}/usr/4bootstrap/mk.conf ${chroot}${LOCALBASE}/etc/
+cp -R ${chroot}/usr/4bootstrap/mk      ${chroot}${LOCALBASE}/share/
+
+# By default, Tinderbox/pkgsrc will build all vulnerable software and
+# accept all licenses. The next file will add these directives to the mk.conf.
+# If this is unwanted on a per-build bases, use the more_make.conf file
+# to override it.
+
+cat ${pb}/scripts/lib/boilerplate_mk.conf >> ${chroot}${LOCALBASE}/etc/mk.conf
+
+# Add per-build custom make options to etc/mk.conf
+# Intended to default versions e.g. PYTHON_VERSION_DEFAULT
+# During catenation, comments, blank lines, MAKE_JOBS= and PKG_OPTIONS.xxxx
+# variables are stripped out. The latter is handled by pkg_options, and it's
+# better not to have two sources.
+
+more_mkconf=$(tinderLoc options ${build})/more_mk.conf
+if [ -f ${more_mkconf} ]; then
+    cat ${more_mkconf} | awk "!/^[ \t]*($|#|PKG_OPTIONS\.|MAKE_JOBS=)/" \
+    >> ${chroot}${LOCALBASE}/etc/mk.conf
+fi
+
+# mount linprocfs if available
+if [ ${ARCH} = "i386" ]; then
     mkdir -p ${chroot}/compat/linux/proc
     mount -t linprocfs linprocfs ${chroot}/compat/linux/proc
 fi
@@ -251,8 +281,10 @@ if [ x"${CCACHE_ENABLED}" = x"1" ]; then
     export PATH=/opt:${PATH}
 fi
 
-if [ x"${OPTIONS_ENABLED}" = x"1" ]; then
-    export PORT_DBDIR=/var/db/ports
+export PKG_OPTIONS_FILE=
+original_options=$(tinderLoc options ${build})/pkg_options
+if [ x"${OPTIONS_ENABLED}" = x"1" -a -f ${original_options} ]; then
+    export PKG_OPTIONS_FILE=/var/db/options/pkg_options
 fi
 
 echo "building $pkgname in $chroot"
@@ -264,11 +296,7 @@ packages=$(tinderLoc packages ${build})
 major_version=$(echo ${jail} | sed -E -e 's|(^[[:digit:]]+).*$|\1|')
 
 if [ -n "${DISTFILE_CACHE}" ]; then
-    export DISTCACHE=/distcache
-    if [ ${fetchorig} -eq 0 ]; then
-        _MSO='file:///distcache/${DIST_SUBDIR}/'
-        export MASTER_SITE_OVERRIDE="${_MSO} ${MASTER_SITE_OVERRIDE}"
-    fi
+    export DISTDIR=/distcache
 fi
 
 if [ -n "${DISTFILE_URI}" ]; then
@@ -282,7 +310,7 @@ mkdir -p ${chroot}/tmp/depends ${chroot}
 echo "building ${pkgname} in directory ${chroot}" | \
     tee ${chroot}/tmp/${pkgname}.log
 
-trap  "cleanup ${chroot} ${noclean} ${error} \"${cleandirs}\" ${pkgname} ${build} ${nullfs}" 1 2 3 9 10 11 15
+trap  "cleanup ${chroot} ${noclean} ${error} \"${cleandirs}\" ${pkgname} ${build}" 1 2 3 9 10 11 15
 
 # Don't build in a world-writable standard directory because some ports
 # hardcode this path and try to load things from it at runtime, which is
@@ -294,7 +322,7 @@ if [ x"${CCACHE_ENABLED}" ]; then
     unset CCACHE_DISABLE
 fi
 
-_ldconfig_dirs="/lib /usr/lib /usr/lib/compat"
+_ldconfig_dirs="/usr/lib"
 ldconfig_dirs=""
 for i in ${_ldconfig_dirs}; do
     if [ -d ${chroot}/${i} ]; then
@@ -302,9 +330,6 @@ for i in ${_ldconfig_dirs}; do
     fi
 done
 chroot ${chroot} /sbin/ldconfig ${ldconfig_dirs}
-if [ ${ARCH} = "i386" ]; then
-    chroot ${chroot} /sbin/ldconfig -aout /usr/lib/aout /usr/lib/compat/aout
-fi
 
 set x $ED $FD $PD $BD $RD $TD
 shift 1
@@ -337,7 +362,7 @@ if [ $? -ne 0 ]; then
     exit 1
 fi
 
-chroot ${chroot} /buildscript ${dirname} 1 "$ED" "$PD" "$FD" "$BD" "$RD" "$TD" "${plistcheck}" 2>&1 | tee -a ${chroot}/tmp/${pkgname}.log
+chroot ${chroot} /buildscript ${dirname} 1 "$ED" "$PD" "$FD" "$BD" "$RD" "$TD" "${pkgname}" "${plistcheck}" 2>&1 | tee -a ${chroot}/tmp/${pkgname}.log
 if [ -f ${chroot}/tmp/status ]; then
     error=$(cat ${chroot}/tmp/status)
 else
@@ -351,14 +376,7 @@ errorsDir=$(tinderLoc builderrors ${buil
 
 if [ "${error}" = "0" ]; then
     ln -sf ${pkgname}.log2 ${chroot}/tmp/make.log
-    # Cache the distfiles if requested.  We will wait a maximum of
-    # ten minutes before giving up on the lock.
-    if [ -n "${DISTFILE_CACHE}" ]; then
-	lockf -t 600 ${chroot}${DISTCACHE}/.lock tar -C ${chroot}/${DISTDIR} \
-	    -cf - . | tar --unlink -C ${chroot}${DISTCACHE} -xvf -
-    fi
-
-    chroot ${chroot} /usr/bin/nice -n $nice /buildscript ${dirname} 2  "$ED" "$PD" "$FD" "$BD" "$RD" "$TD" "${plistcheck}" > ${chroot}/tmp/${pkgname}.log2 2>&1
+    chroot ${chroot} /usr/bin/nice -n $nice /buildscript ${dirname} 2  "$ED" "$PD" "$FD" "$BD" "$RD" "$TD" "${pkgname}" "${plistcheck}" > ${chroot}/tmp/${pkgname}.log2 2>&1
 
     grep pnohang ${chroot}/tmp/${pkgname}.log2
     cat ${chroot}/tmp/${pkgname}.log2 >> ${chroot}/tmp/${pkgname}.log
@@ -372,6 +390,7 @@ if [ "${error}" = "0" ]; then
         cp ${chroot}/tmp/${pkgname}.log ${logsDir}/${pkgname}.log
     fi
     if [ -n "${logdir}" ]; then
+        rm -f ${logdir}/${pkgname}.log${lext}
 	if [ ${docopy} -eq 1 ]; then
 	    cp ${logsDir}/${pkgname}.log${lext} ${logdir}/${pkgname}.log${lext}
 	else
@@ -388,6 +407,7 @@ if [ "${error}" = "0" ]; then
 	cp ${chroot}/tmp/work.tbz ${workDir}/${pkgname}.tbz
     fi
 
+    rm -f ${errorsDir}/${pkgname}.log*
     if [ "${error}" = "0" ]; then
         if [ ! -z "${last_version}" ]; then
 	    oldpkgs=$(find ${packages} -name "${last_version}${PKGSUFFIX}")
@@ -400,8 +420,8 @@ if [ "${error}" = "0" ]; then
 		tar --unlink -C ${packages} -xvf -
 	[ -f ${packages}/All/${pkgname}${PKGSUFFIX} ] && \
 		touch ${packages}/All/${pkgname}${PKGSUFFIX}
-	rm -f ${errorsDir}/${pkgname}.log*
-	if bzgrep -q "${pkgname} is marked as broken: " ${logsDir}/${pkgname}.log${lext} ; then
+	BROKE=`zgrep -q "${pkgname} is marked as broken: " ${logsDir}/${pkgname}.log${lext}`
+	if [ "${BROKE}" != "" ] ; then
 	    status="BROKEN"
 	elif [ -f ${chroot}/tmp/leftovers ]; then
 	    status="LEFTOVERS"
@@ -476,5 +496,5 @@ else
     execute_hook "postPortBuild" "PACKAGE_NAME=${pkgname} BUILD=${build} JAIL=${jail} PORTSTREE=${portstree} CHROOT=${chroot} STATUS=FAIL PORTDIR=${portdir} PB=${pb} ${reasonenv} TOTAL_SIZE=${total_size}"
 fi
 
-cleanup ${chroot} ${noclean} ${error} "${cleandirs}" ${pkgname} ${build} ${nullfs}
+cleanup ${chroot} ${noclean} ${error} "${cleandirs}" ${pkgname} ${build}
 exit ${error}