View | Details | Raw Unified | Return to bug 184391
Collapse All | Expand All

(-)tinderbox/Makefile (-2 / +1 lines)
Lines 2-9 Link Here
2
# $FreeBSD$
2
# $FreeBSD$
3
3
4
PORTNAME=	tinderbox
4
PORTNAME=	tinderbox
5
PORTVERSION=	4.0.1
5
PORTVERSION=	4.1.0
6
PORTREVISION=	4
7
CATEGORIES=	ports-mgmt
6
CATEGORIES=	ports-mgmt
8
MASTER_SITES=	http://tinderbox.marcuscom.com/ \
7
MASTER_SITES=	http://tinderbox.marcuscom.com/ \
9
		http://T32.TecNik93.com/FreeBSD/ports/${PORTNAME}/sources/
8
		http://T32.TecNik93.com/FreeBSD/ports/${PORTNAME}/sources/
(-)tinderbox/distinfo (-2 / +2 lines)
Lines 1-2 Link Here
1
SHA256 (tinderbox/tinderbox-4.0.1.tar.gz) = 4d49e62bcfd94438f4dce3481fab7d89c86cc200fc73a9c0744ddd01b36bc92e
1
SHA256 (tinderbox/tinderbox-4.1.0.tar.gz) = b2950034fe66ab36b741b99dc3d59626cef3f75a46b128d77f08e679bf69e5ee
2
SIZE (tinderbox/tinderbox-4.0.1.tar.gz) = 150826
2
SIZE (tinderbox/tinderbox-4.1.0.tar.gz) = 151397
(-)tinderbox/files/patch-chroot (-395 lines)
Lines 1-395 Link Here
1
Calculate dependencies in a chroot
2
3
Index: lib/makemake
4
===================================================================
5
RCS file: /space/cvs/marcuscom-cvs/portstools/tinderbox/lib/makemake,v
6
retrieving revision 1.48
7
diff -u -r1.48 makemake
8
--- lib/makemake	6 Nov 2012 21:55:47 -0000	1.48
9
+++ lib/makemake	5 Oct 2013 16:30:30 -0000
10
@@ -135,11 +135,12 @@
11
 my (
12
         %pkgdir,   %pkgdeps,  %pkgedeps, %pkgpdeps, %pkgfdeps,
13
         %pkgbdeps, %pkgrdeps, @duds,     $portbase, $makecache,
14
-        %pkgtdeps, %pkgpkgdeps,
15
+        %pkgtdeps, %pkgpkgdeps,          $chroot,
16
 );
17
 
18
 $portbase  = $ENV{'PORTSDIR'};
19
-$makecache = new Tinderbox::MakeCache($portbase, $ENV{'PKGSUFFIX'});
20
+$chroot    = $ENV{'CHROOT'};
21
+$makecache = new Tinderbox::MakeCache($portbase, $chroot, $ENV{'PKGSUFFIX'});
22
 
23
 while (scalar(@PORTS)) {
24
         my $port    = shift @PORTS;
25
@@ -148,7 +149,7 @@
26
 
27
         next if (defined($pkgdir{$portdir}));
28
 
29
-        $tportdir = "$portbase/$portdir";
30
+        $tportdir = "$chroot$portbase/$portdir";
31
         if (!-d $tportdir) {
32
                 print STDERR "ERROR: Directory $tportdir does not exist.\n";
33
                 if (defined($pkgdeps{$portdir})
34
Index: lib/tc_command.pl
35
===================================================================
36
RCS file: /space/cvs/marcuscom-cvs/portstools/tinderbox/lib/tc_command.pl,v
37
retrieving revision 1.184
38
diff -u -r1.184 tc_command.pl
39
--- lib/tc_command.pl	28 Apr 2013 20:05:40 -0000	1.184
40
+++ lib/tc_command.pl	5 Oct 2013 16:30:31 -0000
41
@@ -1536,7 +1536,8 @@
42
 sub addPortToOneBuild {
43
         my $build = $ds->getBuildByName($opts->{'b'});
44
         my $makecache =
45
-            new Tinderbox::MakeCache($ENV{'PORTSDIR'}, $ENV{'PKGSUFFIX'});
46
+            new Tinderbox::MakeCache($ENV{'PORTSDIR'}, $ENV{'CHROOT'},
47
+                                     $ENV{'PKGSUFFIX'});
48
         my @bports = ();
49
 
50
         if (!$opts->{'d'}) {
51
@@ -3414,12 +3415,14 @@
52
         my $cache = shift;
53
         my $deps  = shift;
54
 
55
-        my $portdir = $ENV{'PORTSDIR'} . "/" . $port;
56
+        my $portsdir = $ENV{'CHROOT'} . $ENV{'PORTSDIR'};
57
+
58
+        my $portdir = $portsdir . "/" . $port;
59
         return undef if (!-d $portdir);
60
 
61
         # Canonicalize the port directory.
62
         $port = abs_path($portdir);
63
-        $port =~ s|$ENV{'PORTSDIR'}/||;
64
+        $port =~ s|$portsdir/||;
65
 
66
         if (defined($deps)) {
67
                 my @list;
68
Index: lib/tc_command.sh
69
===================================================================
70
RCS file: /space/cvs/marcuscom-cvs/portstools/tinderbox/lib/tc_command.sh,v
71
retrieving revision 1.175
72
diff -u -r1.175 tc_command.sh
73
--- lib/tc_command.sh	7 Aug 2013 18:25:52 -0000	1.175
74
+++ lib/tc_command.sh	5 Oct 2013 16:30:32 -0000
75
@@ -1385,7 +1385,7 @@
76
     cleanDirs ${buildName} ${BUILD_DIR}
77
 
78
     if [ "${MD_FSTYPE}" = "ufs" -o "${MD_FSTYPE}" = "zfs" ]; then
79
-	if [ -n "${MD_SIZE}" -a ${MD_SIZE%[a-zA-Z]} -gt 0 ]; then
80
+	if [ -n "${MD_SIZE}" ] && [ ${MD_SIZE%[a-zA-Z]} -gt 0 ]; then
81
 	    # setup md (ramdisk) backing for the build
82
 	    mdconfig -a -t swap -s ${MD_SIZE} > /tmp/tinderbuild_md.${build}
83
 	    read MD_UNIT </tmp/tinderbuild_md.${build}
84
@@ -1400,7 +1400,7 @@
85
 	    fi
86
 	fi
87
     elif [ "${MD_FSTYPE}" = "tmpfs" ]; then
88
-	if [ -n "${MD_SIZE}" -a ${MD_SIZE%[a-zA-Z]} -gt 0 ]; then
89
+	if [ -n "${MD_SIZE}" ] && [ ${MD_SIZE%[a-zA-Z]} -gt 0 ]; then
90
 	    mount -t tmpfs -o size=${MD_SIZE} tmpfs ${BUILD_DIR}
91
 	else
92
 	    mount -t tmpfs tmpfs ${BUILD_DIR}
93
@@ -1416,7 +1416,7 @@
94
     execute_hook "postBuildExtract" "BUILD=${buildName} DESTDIR=${BUILD_DIR} JAIL=${jailName} PB=${pb} RC=0"
95
 
96
     # Finalize environment
97
-    cp -f /etc/resolv.conf ${BUILD_DIR}/etc
98
+    cp /etc/resolv.conf ${BUILD_DIR}/etc || touch ${BUILD_DIR}/etc/resolv.conf
99
 
100
     return 0
101
 }
102
@@ -1957,7 +1957,16 @@
103
 	${tc} updatePortsTree -p ${portstree}
104
     fi
105
 
106
-    # Create makefile if required
107
+    # Set up the chrooted environment
108
+    osmajor=$(echo ${jail} | sed -E -e 's|(^[[:digit:]]+).*$|\1|')
109
+    if [ ${osmajor} -lt 6 ]; then
110
+	echo "tinderbuild: unhandled OS version: ${osmajor}"
111
+	tinderbuild_cleanup 1
112
+    fi
113
+
114
+    tinderbuild_setup
115
+
116
+    # Create Makefile if required
117
     if [ ${skipmake} -eq 0 ]; then
118
 	echo "tinderbuild: creating makefile..."
119
 
120
@@ -1966,19 +1975,16 @@
121
 	(
122
 	    export PORTBUILD_ARGS="$(echo ${pbargs})"
123
 	    buildenvNoHost ${build}
124
-	    if ! requestMount -t portstree -p ${portstree}; then
125
-		echo "tinderbuild: cannot mount portstree: ${portstree}"
126
-		exit 1
127
-	    fi
128
-	    env PORTSDIR=$(tinderLoc portstree ${portstree})/ports \
129
+	    buildenv ${jail} ${portstree} ${build}
130
+	    HOST_WORKDIR=$(${tc} configGet | \
131
+		awk -F= '/^HOST_WORKDIR/ {print $2}')
132
+	    env PORTSDIR=/a/ports \
133
+		CHROOT=$(tinderLoc buildroot ${build}) \
134
 		$(tinderLoc scripts lib/makemake) ${noduds} ${build} ${ports}
135
 	)
136
 	if [ $? -ne 0 ]; then
137
 	    echo "tinderbuild: failed to generate Makefile for ${build}"
138
-	    cleanupMounts -t portstree -p ${portstree}
139
 	    tinderbuild_cleanup 1
140
-	else
141
-	    cleanupMounts -t portstree -p ${portstree}
142
 	fi
143
     fi
144
 
145
@@ -1987,15 +1993,6 @@
146
 	tinderbuild_cleanup 0
147
     fi
148
 
149
-    # Set up the chrooted environment
150
-    osmajor=$(echo ${jail} | sed -E -e 's|(^[[:digit:]]+).*$|\1|')
151
-    if [ ${osmajor} -lt 6 ]; then
152
-	echo "tinderbuild: unhandled OS version: ${osmajor}"
153
-	tinderbuild_cleanup 1
154
-    fi
155
-
156
-    tinderbuild_setup
157
-
158
     # Seatbelts off.  Away we go.
159
     ${tc} updateBuildStatus -b ${build} -s PORTBUILD
160
     tinderbuild_phase 0 ${jobs} ${pkgDir}
161
@@ -2045,7 +2042,11 @@
162
 addPortToBuild_cleanup () {
163
     jail=$1
164
     portsTree=$2
165
+    build=$3
166
 
167
+    cleanupMounts -t buildports -b ${build}
168
+    cleanupMounts -t buildsrc -b ${build}
169
+    cleanupMounts -t buildoptions -b ${build}
170
     cleanupMounts -t jail -j ${jail}
171
     cleanupMounts -t portstree -p ${portsTree}
172
 }
173
@@ -2070,7 +2071,29 @@
174
 	exit 1
175
     fi
176
 
177
-    trap "addPortToBuild_cleanup ${jail} ${portsTree}" 1 2 3 9 10 11 15
178
+    # Extracting the Jail tarball takes ages on some systems, so we can
179
+    # pretty safely (for these purposes) reuse the extraction as long as
180
+    # resolv.conf is newer than the tarball (resolv.conf is created
181
+    # by makeBuild)
182
+    HOST_WORKDIR=$(${tc} configGet | awk -F= '/^HOST_WORKDIR/ {print $2}')
183
+    if [ $(tinderLoc jailtarball ${jail}) -ot \
184
+	 $(tinderLoc buildroot ${build})/etc/resolv.conf ]; then
185
+	echo "addPortToBuild: recent jail tarball exists; no need to reextract"
186
+    else
187
+	echo "addPortToBuild: extracting jail tarball to calculate dependencies inside"
188
+	makeBuild -b ${build}
189
+    fi
190
+
191
+    if ! requestMount -t buildports -b ${build} -r -n; then
192
+	echo "addPortToBuild: cannot mount ports source inside ${build}"
193
+	exit 1
194
+    fi
195
+    if ! requestMount -t buildsrc -b ${build} -r -n; then
196
+	echo "addPortToBuild: cannot mount base source inside ${build}"
197
+	exit 1
198
+    fi
199
+
200
+    trap "addPortToBuild_cleanup ${jail} ${portsTree} ${build}" 1 2 3 9 10 11 15
201
 
202
     # Save TERM since we need that for OPTIONS
203
     save_TERM=${TERM}
204
@@ -2082,22 +2105,30 @@
205
     buildenv ${jail} ${portsTree} ${build}
206
     buildenvNoHost ${build}
207
 
208
-    export PORTSDIR=$(tinderLoc portstree ${portsTree})/ports
209
-    if [ -z "${portDir}" ]; then
210
-	${tc} addPortToOneBuild -b ${build} ${norecurse}
211
-    else
212
-        if [ ! -d ${PORTSDIR}/${portDir} ]; then
213
-            echo "addPort: Unknown port ${portDir}"
214
-            exit 1
215
-        fi
216
-        ${tc} addPortToOneBuild -b ${build} -d ${portDir} ${norecurse}
217
+    if [ ${options} -eq 1 -a ${OPTIONS_ENABLED} -eq 1 ]; then
218
+	mkdir -p $(tinderLoc options ${build}) \
219
+		 $(tinderLoc buildoptions ${build})
220
+	if ! requestMount -t buildoptions -b ${build} \
221
+		-s $(tinderLoc options ${build}) -n; then
222
+	    echo "addPortToBuild: cannot mount options inside ${build}"
223
+	    exit 1
224
+	fi
225
     fi
226
+
227
+    export PORTSDIR=/a/ports
228
+    export CHROOT=$(tinderLoc buildroot ${build})
229
+
230
+    if [ -n "${portDir}" ] && [ ! -d ${CHROOT}/${PORTSDIR}/${portDir} ]; then
231
+        echo "addPort: Unknown port ${portDir}"
232
+        exit 1
233
+    fi
234
+
235
     if [ ${options} -eq 1 -a ${OPTIONS_ENABLED} -eq 1 ]; then
236
 	pdirs=""
237
 	if [ -z "${portDir}" ]; then
238
 	    pdirs=$(${tc} getPortsForBuild -b ${build} 2>/dev/null)
239
 	else
240
-	    pdirs="${PORTSDIR}/${portDir}"
241
+	    pdirs="${portDir}"
242
 	fi
243
 	rmconfig=true
244
 	if [ ${cleanOptions} -eq 1 ]; then
245
@@ -2108,28 +2139,38 @@
246
 	    fi
247
 	fi
248
 	for pdir in ${pdirs}; do
249
-	    if [ -d ${pdir} ]; then
250
+	    if [ -d ${CHROOT}${PORTSDIR}/${pdir} ]; then
251
 	        export TERM=${save_TERM}
252
+		if ! cp /usr/local/bin/dialog4ports-static ${CHROOT}/; then
253
+		    echo "In order to customise OPTIONS, you must install"
254
+		    echo "ports-mgmt/dialog4ports-static."
255
+		    break
256
+		fi
257
 	        read -p "Generating options for ${build}; hit Enter to continue..." key
258
 	        echo ""
259
 	        if [ -z "${norecurse}" ]; then
260
-		    ( cd ${pdir} && ${rmconfig} \
261
-		      && make -k config-recursive )
262
+		    chroot ${CHROOT} /bin/sh -c \
263
+			"cd ${PORTSDIR}/${pdir} && ${rmconfig} && \
264
+			make -k DIALOG4PORTS=/dialog4ports-static \
265
+			    config-recursive"
266
 	        else
267
-		    ( cd ${pdir} && ${rmconfig} \
268
-		      && make config )
269
+		    chroot ${CHROOT} /bin/sh -c \
270
+			"cd ${PORTSDIR}/${pdir} && ${rmconfig} && \
271
+			make DIALOG4PORTS=/dialog4ports-static config"
272
 	        fi
273
 	    fi
274
 	done
275
     fi
276
 
277
+    ${tc} addPortToOneBuild -b ${build} ${portDir:+-d} ${portDir} ${norecurse}
278
+
279
     if [ -n "${save_SRCBASE}" ]; then
280
 	export SRCBASE=${save_SRCBASE}
281
     else
282
 	unset SRCBASE
283
     fi
284
 
285
-    addPortToBuild_cleanup ${jail} ${portsTree}
286
+    addPortToBuild_cleanup ${jail} ${portsTree} ${build}
287
 }
288
 
289
 addPort () {
290
Index: lib/tinderlib.sh
291
===================================================================
292
RCS file: /space/cvs/marcuscom-cvs/portstools/tinderbox/lib/tinderlib.sh,v
293
retrieving revision 1.83
294
diff -u -r1.83 tinderlib.sh
295
--- lib/tinderlib.sh	10 Jun 2013 16:49:51 -0000	1.83
296
+++ lib/tinderlib.sh	5 Oct 2013 16:30:32 -0000
297
@@ -498,9 +498,7 @@
298
     save_IFS=${IFS}
299
     IFS='
300
 '
301
-    # Allow SRCBASE to be overridden
302
-    eval "export SRCBASE=${SRCBASE:-`realpath $(tinderLoc jail ${jail})/src`}" \
303
-	>/dev/null 2>&1
304
+    # Do not set SRCBASE here-- we use chroots nowadays so /usr/src is there
305
 
306
     # Set ARCH (needed for cross-building)
307
     export ARCH=$(${tc} getJailArch -j ${jail})
308
@@ -524,13 +522,6 @@
309
     eval "export __MAKE_CONF=${jailBase}/make.conf" >/dev/null 2>&1
310
     eval "export LOCALBASE=/nonexistentlocal" >/dev/null 2>&1
311
     eval "export PKG_DBDIR=/nonexistentdb" >/dev/null 2>&1
312
-    if [ x"${OPTIONS_ENABLED}" != x"1" ]; then
313
-        eval "export PORT_DBDIR=/nonexistentportdb" >/dev/null 2>&1
314
-    else
315
-	optionsDir=$(tinderLoc options ${build})
316
-
317
-	eval "export PORT_DBDIR=${optionsDir}" >/dev/null 2>&1
318
-    fi
319
     eval "export LINUXBASE=/nonexistentlinux" >/dev/null 2>&1
320
     eval "unset DISPLAY" >/dev/null 2>&1
321
 }
322
Index: lib/Tinderbox/MakeCache.pm
323
===================================================================
324
RCS file: /space/cvs/marcuscom-cvs/portstools/tinderbox/lib/Tinderbox/MakeCache.pm,v
325
retrieving revision 1.12
326
diff -u -r1.12 MakeCache.pm
327
--- lib/Tinderbox/MakeCache.pm	4 Mar 2012 12:53:08 -0000	1.12
328
+++ lib/Tinderbox/MakeCache.pm	5 Oct 2013 16:30:32 -0000
329
@@ -49,6 +49,7 @@
330
                 CACHE   => undef,
331
                 SEEN    => undef,
332
                 BASEDIR => shift,
333
+                CHROOT  => shift,
334
         }, $name;
335
 
336
         $self;
337
@@ -67,7 +68,10 @@
338
 
339
         $tmp = '-V ' . join(' -V ', @makeTargets);
340
         my $dir = $self->{BASEDIR} . '/' . $port;
341
-        @ret = split("\n", `cd $dir && make $tmp`);
342
+        my $cmd = "cd $dir && make $tmp";
343
+        $cmd = "chroot $self->{CHROOT} /bin/sh -c '$cmd'";
344
+
345
+        @ret = split("\n", `$cmd`);
346
 
347
         foreach $tmp (@makeTargets) {
348
                 $self->{CACHE}->{$port}{$tmp} = shift @ret;
349
? .fslckout
350
? .fslckout-mjFA3F63973
351
Index: lib/tc_command.sh
352
===================================================================
353
RCS file: /space/cvs/marcuscom-cvs/portstools/tinderbox/lib/tc_command.sh,v
354
retrieving revision 1.176
355
diff -u -r1.176 tc_command.sh
356
--- lib/tc_command.sh	7 Oct 2013 16:36:54 -0000	1.176
357
+++ lib/tc_command.sh	7 Oct 2013 18:34:20 -0000
358
@@ -2049,6 +2049,7 @@
359
     cleanupMounts -t buildoptions -b ${build}
360
     cleanupMounts -t jail -j ${jail}
361
     cleanupMounts -t portstree -p ${portsTree}
362
+    cleanenv
363
 }
364
 
365
 addPortToBuild () {
366
 
367
Index: lib/tinderlib.sh
368
===================================================================
369
RCS file: /space/cvs/marcuscom-cvs/portstools/tinderbox/lib/tinderlib.sh,v
370
retrieving revision 1.85
371
diff -u -r1.85 tinderlib.sh
372
--- lib/tinderlib.sh	7 Oct 2013 16:36:54 -0000	1.85
373
+++ lib/tinderlib.sh	13 Oct 2013 12:54:19 -0000
374
@@ -506,7 +506,10 @@
375
     save_IFS=${IFS}
376
     IFS='
377
 '
378
-    # Do not set SRCBASE here-- we use chroots nowadays so /usr/src is there
379
+
380
+    # Allow SRCBASE to be overridden
381
+    eval "export SRCBASE=${SRCBASE:-`realpath $(tinderLoc jail ${jail})/src`}" \
382
+        >/dev/null 2>&1
383
 
384
     # Set ARCH (needed for cross-building)
385
     export ARCH=$(${tc} getJailArch -j ${jail})
386
--- lib/tc_command.wrong	2013-10-19 21:15:58.461836978 +0100
387
+++ lib/tc_command.sh	2013-10-19 21:16:32.105859389 +0100
388
@@ -1967,7 +1967,6 @@
389
 	(
390
 	    export PORTBUILD_ARGS="$(echo ${pbargs})"
391
 	    buildenvNoHost ${build}
392
-	    buildenv ${jail} ${portstree} ${build}
393
 	    HOST_WORKDIR=$(${tc} configGet | \
394
 		awk -F= '/^HOST_WORKDIR/ {print $2}')
395
 	    env PORTSDIR=/a/ports \

Return to bug 184391