blob: 4b7c15a4fcb2dc1eac900eb0f0c4d2c008a653a4 (
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
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
|
# file : tests/rep-info.testscript
# license : MIT; see accompanying LICENSE file
.include common.testscript \
auth.testscript \
remote.testscript \
remote-git.testscript
# Source repository:
#
# rep-info
# |-- testing -> stable (complement), ../foo/testing (prerequisite)
# | |-- foo-1.tar.gz
# | `-- repositories.manifest
# |
# |-- t15 (see pkg-build for details)
# |
# `-- git
# |-- libbar.git -> style-basic.git (prerequisite)
# `-- style-basic.git
# Prepare repositories used by tests if running in the local mode.
#
+if! $remote
rc = [cmdline] $rep_create 2>!
# Create the unsigned 'testing' repository.
#
cp -r $src/testing $out/testing
$rc $out/testing &$out/testing/packages.manifest
# Create the signed 'testing' repository.
#
cp -r $src/testing $out/signed
cat <<<$cert_manifest >+$out/signed/repositories.manifest
$rc --key $key $out/signed &$out/signed/packages.manifest \
&$out/signed/signature.manifest
# Create the compatibility repository.
#
cp -r $src/t15 $out/compatibility
$rc $out/compatibility &$out/compatibility/packages.manifest --ignore-unknown
# Create git repositories.
#
$git_extract $src/git/libbar.tar
$git_extract $src/git/style-basic.tar &$out_git/state0/***
end
test.options += --auth all --trust-yes
posix = ($cxx.target.class != 'windows')
: no-location
:
$* 2>>EOE != 0
error: repository location argument expected
info: run 'bpkg help rep-info' for more information
EOE
: default
:
{
: unsigned
:
$* $rep/testing >>"EOO"
pkg:build2.org/rep-info/testing ($rep/testing)
prerequisite pkg:build2.org/foo/testing ($rep_root/foo/testing)
complement pkg:build2.org/rep-info/stable ($rep/stable)
foo/1
EOO
: signed
:
$* $rep/signed >>"EOO"
pkg:build2.org/rep-info/signed ($rep/signed)
CN=build2.org/O=Code Synthesis/info@build2.org
$cert_fp
prerequisite pkg:build2.org/foo/testing ($rep_root/foo/testing)
complement pkg:build2.org/rep-info/stable ($rep/stable)
foo/1
EOO
}
: name
:
$* --name $rep/testing >"pkg:build2.org/rep-info/testing ($rep/testing)"
: packages
:
{
test.arguments += --packages # Should go after the rep-info command argument.
: list
:
$* $rep/testing >>EOO
foo/1
EOO
: manifest
:
{
test.arguments += --manifest
: basic
:
$* $rep/testing >>EOO
: 1
name: foo
version: 1
summary: The "Foo" utility
license: MIT
url: http://www.example.org/foo
email: foo-users@example.org
bootstrap-build:
\
project = foo
\
location: foo-1.tar.gz
sha256sum: 1d88df336611286cdbd84f5c1d87bedc774bc833e200de675e34d9b219c66cfc
EOO
: deep
:
{
test.arguments += --deep
: dir
:
{
# Note that on Windows we still use tar rather than bsdtar here, since
# the later fails for dangling symlinks and we have such symlinks in
# this repository archive.
#
tar ($posix ? : --force-local) -xf $src/git/libbar.tar &state0/***;
$* --type dir "state0/libbar.git" >>~%EOO%d;
: 1
name: libbar
version: 1.0.0+1
summary: libbar
license: MIT
description:
\
TODO
\
description-type: text/plain
%.+
bootstrap-build:
\
project = libbar
using config
using version
using dist
\
%.+
EOO
rm state0/libbar.git/libbar/README;
$* --type dir "state0/libbar.git" 2>>/~%EOE% != 0
%error: unable to read from libbar/README referenced by description-file manifest value in libbar/manifest: .+%
% info: repository .+%
EOE
}
: git
:
: Enable on Windows if/when we make *-file values expansion to properly
: work for symlinks on Windows (see rep_fetch_git() for details).
:
if ($git_supported && $posix)
{
$* "$rep_git/state0/libbar.git#master" >>~%EOO%d 2>!
: 1
name: libbar
version: 1.0.0+1
summary: libbar
license: MIT
description:
\
TODO
\
description-type: text/plain
%.+
bootstrap-build:
\
project = libbar
using config
using version
using dist
\
%.+
:
name: libmbar
version: 1.0.0
summary: libmbar
license: MIT
description:
\
TODO
\
description-type: text/plain
%.+
bootstrap-build:
\
project = libmbar
using config
using version
using dist
\
%.+
EOO
}
}
}
: to-file
:
{
: no-manifest
:
$* --packages-file m $rep/testing 2>>EOE != 0
error: --packages-file specified without --manifest
info: run 'bpkg help rep-info' for more information
EOE
: manifest
:
{
$* --manifest --packages-file m $rep/testing &m;
cat m >>EOO
: 1
name: foo
version: 1
summary: The "Foo" utility
license: MIT
url: http://www.example.org/foo
email: foo-users@example.org
bootstrap-build:
\
project = foo
\
location: foo-1.tar.gz
sha256sum: 1d88df336611286cdbd84f5c1d87bedc774bc833e200de675e34d9b219c66cfc
EOO
}
}
}
: repositories
:
{
# Should go after the rep-info command argument.
#
test.arguments += --repositories
: list
:
$* $rep/testing >>"EOO"
prerequisite pkg:build2.org/foo/testing ($rep_root/foo/testing)
complement pkg:build2.org/rep-info/stable ($rep/stable)
EOO
: manifest
:
$* --manifest $rep/testing >>EOO
: 1
location: ../../foo/testing
type: pkg
role: prerequisite
:
location: ../stable
type: pkg
role: complement
:
EOO
: to-file
:
{
: no-manifest
:
$* --repositories-file m $rep/testing 2>>EOE != 0
error: --repositories-file specified without --manifest
info: run 'bpkg help rep-info' for more information
EOE
: manifest
:
{
$* --manifest --repositories-file m $rep/testing &m;
cat m >>EOO
: 1
location: ../../foo/testing
type: pkg
role: prerequisite
:
location: ../stable
type: pkg
role: complement
:
EOO
}
}
}
: cert
:
{
test.arguments += $rep/signed
$* --cert-fingerprint >"$cert_fp" : fingerprint
$* --cert-name >'name:build2.org' : name
$* --cert-organization >'Code Synthesis' : organization
$* --cert-email >'info@build2.org' : email
}
: git-rep
:
if! $git_supported
{
# Skip git repository tests.
#
}
else
{
rep = "$rep_git/state0"
test.redirects += 2>!
: version-module
:
: Version module is enabled for the project.
:
$* "$rep/style-basic.git#master" >>~%EOO%
%git:.+style-basic#master .+style-basic.git#master%
%style-basic/1\.1\.0-a\.0\.\d+\..+%
EOO
: manifest-lists
:
: The packages.manifest and repositories.manifest files are present in the
: repository root.
:
$* "$rep/libbar.git#master" >>~%EOO%
%git:.+libbar#master .+libbar.git#master%
%prerequisite git:.+style-basic#stable .+style-basic.git#stable%
libbar/1.0.0+1
libmbar/1.0.0
EOO
: repository-manifests
:
: Here we test that the base repository manifest that comes from the stable
: branch is printed because the stable head commit is newer that of the
: master branch.
:
$* -r --manifest "$rep/style-basic.git#stable,master" >>~%EOO%
: 1
email: user@example.com
EOO
: complete-dependency
:
$* -p --manifest "$rep/libbar.git#master" >>~%EOO%d
: 1
name: libbar
version: 1.0.0+1
summary: libbar
license: MIT
description-file: README
url: http://example.org/libbar
email: pkg@example.org
depends: style-basic >= 1.0.0
location: libbar
%fragment: \.+%
:
name: libmbar
version: 1.0.0
summary: libmbar
license: MIT
description-file: README
url: http://example.org/libmbar
email: pkg@example.org
depends: style-basic >= 1.0.0
location: libmbar
%fragment: \.+%
EOO
}
: default-options-files
:
{
: specified-dir
:
{
$cfg_create -d cfg 2>! &cfg/***;
mkdir cfg/.build2;
echo '--directory .' >= cfg/.build2/bpkg-rep-info.options;
$* $rep/testing -d cfg 2>>/~%EOE%d != 0;
%\.+/specified-dir/cfg/.build2/bpkg-rep-info.options: error: --directory\|-d in default options file%
EOE
# Disable default options files loading.
#
$* --no-default-options --name $rep/testing -d cfg >>"EOO"
pkg:build2.org/rep-info/testing ($rep/testing)
EOO
}
: current-dir
:
{
mkdir .bpkg; # Pretend we are in the configuration directory.
mkdir .build2;
echo '--directory .' >= .build2/bpkg-rep-info.options;
# Load options from the current (configuration) directory.
#
$* $rep/testing 2>>/~%EOE%d != 0;
%\.+/current-dir/.build2/bpkg-rep-info.options: error: --directory\|-d in default options file%
EOE
# Disable loading options from the current (configuration) directory.
#
$* --name -d '' $rep/testing >>"EOO"
pkg:build2.org/rep-info/testing ($rep/testing)
EOO
}
}
: compatibility
:
{
: packages
:
{
$* --packages $rep/compatibility >>EOO
libbar/1.0.0
libbaz/1.0.0
libbiz/1.0.0
libfoo/1.0.0
EOO
}
: package-manifests-ignore-toolchain
:
{
$* --packages --manifest --ignore-unknown $rep/compatibility >>~%EOO%
: 1
name: libbar
version: 1.0.0
%.+
depends: * build2 >= 0.16.0
depends: * bpkg >= 0.16.0
%.+
:
name: libbaz
version: 1.0.0
summary: libbaz
%.+
depends: * build2 >= 65536.0.0
depends: * bpkg >= 65536.0.0
%.+
:
name: libbiz
version: 1.0.0
summary: libbiz
%.+
:
name: libfoo
version: 1.0.0
summary: libfoo
%.+
EOO
}
: package-manifests-fail
:
{
$* --packages --manifest $rep/compatibility 2>>~%EOE% != 0
error: unable to satisfy constraint (build2 >= 65536.0.0) for package libbaz
% info: available build2 version is .+%
EOE
}
}
|