Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/pkg
Path: blob/main/tests/frontend/create.sh
2645 views
1
#! /usr/bin/env atf-sh
2
3
. $(atf_get_srcdir)/test_environment.sh
4
5
tests_init \
6
create_from_plist \
7
create_from_plist_with_variables \
8
create_from_plist_set_owner \
9
create_from_plist_set_group_space \
10
create_from_plist_gather_mode \
11
create_from_plist_set_mode \
12
create_from_plist_mini \
13
create_from_plist_fflags create_from_plist_bad_fflags \
14
create_from_plist_with_keyword_arguments \
15
create_from_plist_missing_file \
16
create_from_manifest_and_plist \
17
create_from_manifest \
18
create_from_manifest_dir \
19
create_from_plist_pkg_descr \
20
create_from_plist_hash \
21
create_from_plist_with_keyword_and_message \
22
create_from_plist_include \
23
create_with_hardlink \
24
create_no_clobber \
25
time \
26
create_from_plist_keyword_validation \
27
create_from_plist_keyword_real_args \
28
create_from_plist_keyword_lua_actions \
29
create_from_plist_keyword_deprecated \
30
create_from_plist_keyword_override_prefix
31
32
genmanifest() {
33
cat << EOF >> +MANIFEST
34
name: test
35
origin: test
36
version: 1
37
maintainer: test
38
categories: [test]
39
comment: a test
40
www: http://test
41
prefix: /
42
abi = "*";
43
desc: <<EOD
44
Yet another test
45
EOD
46
EOF
47
}
48
49
genprefixmanifest() {
50
cat << EOF >> +MANIFEST
51
name: test
52
origin: test
53
version: 1
54
maintainer: test
55
categories: [test]
56
comment: a test
57
www: http://test
58
prefix: /prefix
59
abi = "*";
60
desc: <<EOD
61
Yet another test
62
EOD
63
EOF
64
}
65
66
genplist() {
67
cat << EOF >> test.plist
68
$@
69
EOF
70
}
71
72
preparetestcredentials() {
73
touch file1
74
75
genmanifest
76
genplist "@$1 file1"
77
}
78
79
basic_validation() {
80
test -f test-1.pkg || atf_fail "Package not created"
81
}
82
83
create_with_hardlink_body() {
84
atf_check -s exit:0 sh ${RESOURCEDIR}/test_subr.sh new_pkg "test" "test" "1.0"
85
echo "blah" >> foo
86
ln foo bar
87
echo "@(root,wheel,0555,) /foo" >> test.plist
88
echo "@config(root,wheel,0644,) /bar" >> test.plist
89
90
atf_check \
91
-o ignore \
92
-e ignore \
93
pkg create -M test.ucl -p test.plist -r .
94
}
95
96
create_from_plist_body() {
97
touch file1
98
genmanifest
99
genplist "file1"
100
101
atf_check \
102
-o empty \
103
-e empty \
104
-s exit:0 \
105
pkg create -o ${TMPDIR} -m . -p test.plist -r .
106
107
basic_validation
108
atf_check \
109
-o match:"-rw-r--r-- .*root[ /]+wheel.* /file1$" \
110
-e ignore \
111
-s exit:0 \
112
bsdtar tvf test-1.pkg
113
}
114
115
create_from_plist_missing_file_body() {
116
# touch file1
117
genmanifest
118
genplist "file1"
119
120
atf_check \
121
-o empty \
122
-e match:"Unable to access file .*file1:" \
123
-s exit:1 \
124
pkg create -o ${TMPDIR} -m . -p test.plist -r .
125
}
126
127
create_from_plist_set_owner_body() {
128
129
preparetestcredentials "(plop,,)"
130
131
atf_check \
132
-o empty \
133
-e empty \
134
-s exit:0 \
135
pkg create -o ${TMPDIR} -m . -p test.plist -r .
136
137
basic_validation
138
atf_check \
139
-o match:"-rw-r--r-- .*plop[ /]+wheel.* /file1$" \
140
-e ignore \
141
-s exit:0 \
142
bsdtar tvf test-1.pkg
143
}
144
145
create_from_plist_set_group_body() {
146
147
preparetestcredentials "(,bla,)"
148
149
atf_check \
150
-o empty \
151
-e empty \
152
-s exit:0 \
153
pkg create -o ${TMPDIR} -m . -p test.plist -r .
154
155
basic_validation
156
atf_check \
157
-o match:"-rw-r--r-- .*root[ /]+bla.* /file1$" \
158
-e ignore \
159
-s exit:0 \
160
bsdtar tvf test-1.pkg
161
}
162
163
164
create_from_plist_set_group_space_body() {
165
166
preparetestcredentials "(, bla,)"
167
168
atf_check \
169
-o empty \
170
-e empty \
171
-s exit:0 \
172
pkg create -o ${TMPDIR} -m . -p test.plist -r .
173
174
basic_validation
175
atf_check \
176
-o match:"-rw-r--r-- .*root[ /]+bla.* /file1$" \
177
-e ignore \
178
-s exit:0 \
179
bsdtar tvf test-1.pkg
180
}
181
182
create_from_plist_gather_mode_body() {
183
184
preparetestcredentials "(plop,bla,)"
185
186
chmod 777 file1 || atf_fail "Impossible to change mode"
187
188
atf_check \
189
-o empty \
190
-e empty \
191
-s exit:0 \
192
pkg create -o ${TMPDIR} -m . -p test.plist -r .
193
194
basic_validation
195
atf_check \
196
-o match:"-rwxrwxrwx .*plop[ /]+bla.* /file1$" \
197
-e ignore \
198
-s exit:0 \
199
bsdtar tvf test-1.pkg
200
}
201
202
create_from_plist_set_mode_body() {
203
204
preparetestcredentials "(,,2755)"
205
206
atf_check \
207
-o empty \
208
-e empty \
209
-s exit:0 \
210
pkg create -o ${TMPDIR} -m . -p test.plist -r .
211
212
basic_validation
213
atf_check \
214
-o match:"-rwxr-sr-x .*root[ /]+wheel.* /file1$" \
215
-e ignore \
216
-s exit:0 \
217
bsdtar tvf test-1.pkg
218
}
219
220
create_from_plist_mini_body() {
221
222
preparetestcredentials "(plop,)"
223
224
atf_check \
225
-o empty \
226
-e empty \
227
-s exit:0 \
228
pkg create -o ${TMPDIR} -m . -p test.plist -r .
229
230
basic_validation
231
atf_check \
232
-o match:"-rw-r--r-- .*plop[ /]+wheel.* /file1$" \
233
-e ignore \
234
-s exit:0 \
235
bsdtar tvf test-1.pkg
236
}
237
238
create_from_plist_fflags_body() {
239
atf_skip_on Linux does not support fflags
240
preparetestcredentials "(,,,schg)"
241
242
atf_check \
243
-o empty \
244
-e empty \
245
-s exit:0 \
246
pkg create -o ${TMPDIR} -m . -p test.plist -r .
247
}
248
249
create_from_plist_bad_fflags_body() {
250
atf_skip_on Linux does not support fflags
251
preparetestcredentials "(,,,schg,bad)"
252
253
atf_check \
254
-o empty \
255
-e inline:"${PROGNAME}: Malformed keyword '', wrong fflags\n${PROGNAME}: Malformed keyword @(,,,schg,bad) file1, expecting @keyword or @keyword(owner,group,mode)\n" \
256
-s exit:1 \
257
pkg create -o ${TMPDIR} -m . -p test.plist -r .
258
}
259
260
create_from_plist_keyword_real_args_body() {
261
preparetestcredentials "test"
262
263
cat << EOF > test.ucl
264
actions: []
265
arguments: true
266
post-install-lua: <<EOS
267
if arg ~= nil then
268
print("yes")
269
end
270
for i = 1, #arg do
271
print(arg[i])
272
end
273
EOS
274
EOF
275
276
genplist "@test A B C D"
277
278
mkdir target
279
280
atf_check \
281
pkg -o PLIST_KEYWORDS_DIR=. create -o ${TMPDIR} -m . -p test.plist -r .
282
283
atf_check \
284
-o inline:"yes\nfile1\nyes\nA\nB\nC\nD\n" \
285
pkg -o REPOS_DIR=/dev/null -r ${TMPDIR}/target install -qfy ${TMPDIR}/test-1.pkg
286
}
287
288
create_from_plist_keyword_validation_body() {
289
preparetestcredentials "test"
290
291
cat << EOF > test.ucl
292
actions: []
293
prepackaging: <<EOS
294
io.stderr:write("meh\n")
295
return 1
296
EOS
297
EOF
298
atf_check \
299
-o empty \
300
-e inline:"meh\n${PROGNAME}: Fail to apply keyword 'test'\n" \
301
-s exit:1 \
302
pkg -o PLIST_KEYWORDS_DIR=. create -o ${TMPDIR} -m . -p test.plist -r .
303
304
cat << EOF > test.ucl
305
actions: []
306
prepackaging: <<EOS
307
print(line)
308
io.stderr:write("meh\n")
309
return 1
310
EOS
311
EOF
312
atf_check \
313
-o inline:"file1\n" \
314
-e inline:"meh\n${PROGNAME}: Fail to apply keyword 'test'\n" \
315
-s exit:1 \
316
pkg -o PLIST_KEYWORDS_DIR=. create -o ${TMPDIR} -m . -p test.plist -r .
317
318
cat << EOF > test.ucl
319
actions: []
320
prepackaging: <<EOS
321
print(#arg)
322
io.stderr:write("meh\n")
323
return 1
324
EOS
325
EOF
326
atf_check \
327
-o inline:"0\n" \
328
-e inline:"meh\n${PROGNAME}: Fail to apply keyword 'test'\n" \
329
-s exit:1 \
330
pkg -o PLIST_KEYWORDS_DIR=. create -o ${TMPDIR} -m . -p test.plist -r .
331
332
cat << EOF > test.ucl
333
actions: []
334
arguments: true
335
prepackaging: <<EOS
336
print(#arg)
337
io.stderr:write("meh\n")
338
return 1
339
EOS
340
EOF
341
atf_check \
342
-o inline:"1\n" \
343
-e inline:"meh\n${PROGNAME}: Fail to apply keyword 'test'\n" \
344
-s exit:1 \
345
pkg -o PLIST_KEYWORDS_DIR=. create -o ${TMPDIR} -m . -p test.plist -r .
346
347
genplist "@test A B"
348
genplist "@test A A"
349
genplist "@test A B C"
350
cat << EOF > test.ucl
351
actions: []
352
arguments: true
353
prepackaging: <<EOS
354
if #arg == 1 then
355
return 0
356
end
357
if #arg == 2 then
358
if arg[1] == arg[2] then
359
io.stderr:write("The first and the second argument are identical\n")
360
return 1
361
end
362
return 1
363
end
364
io.stderr:write("Invalid number of arguments '".. #arg .. "' expecting 1 or 2\n")
365
return 1
366
EOS
367
EOF
368
output="${PROGNAME}: Fail to apply keyword 'test'
369
The first and the second argument are identical
370
${PROGNAME}: Fail to apply keyword 'test'
371
Invalid number of arguments '3' expecting 1 or 2
372
${PROGNAME}: Fail to apply keyword 'test'
373
"
374
atf_check \
375
-e inline:"${output}" \
376
-s exit:1 \
377
pkg -o PLIST_KEYWORDS_DIR=. create -o ${TMPDIR} -m . -p test.plist -r .
378
}
379
380
create_from_plist_with_keyword_arguments_body() {
381
preparetestcredentials "testkeyword"
382
383
atf_check \
384
-o empty \
385
-e inline:"${PROGNAME}: cannot load keyword from ./testkeyword.ucl: No such file or directory\n${PROGNAME}: unknown keyword testkeyword: @testkeyword\n" \
386
-s exit:1 \
387
pkg -o PLIST_KEYWORDS_DIR=. create -o ${TMPDIR} -m . -p test.plist -r .
388
389
cat << EOF >> testkeyword.ucl
390
actions: []
391
arguments: true
392
post-install:
393
echo %1 %2
394
EOF
395
396
atf_check \
397
-o empty \
398
-e inline:"${PROGNAME}: Requesting argument %2 while only 1 arguments are available\n${PROGNAME}: Fail to apply keyword 'testkeyword'\n" \
399
-s exit:1 \
400
pkg -o PLIST_KEYWORDS_DIR=. create -o ${TMPDIR} -m . -p test.plist -r .
401
402
cat << EOF > testkeyword.ucl
403
actions: [file(%1)]
404
arguments: true
405
post-install:
406
echo %1 %2
407
EOF
408
409
echo "@testkeyword A B" > test.plist
410
411
atf_check \
412
-o empty \
413
-e inline:"${PROGNAME}: Invalid argument: expecting a number got (%1)\n${PROGNAME}: Fail to apply keyword 'testkeyword'\n" \
414
-s exit:1 \
415
pkg -o PLIST_KEYWORDS_DIR=. create -o ${TMPDIR} -m . -p test.plist -r .
416
417
cat << EOF > testkeyword.ucl
418
actions: [file(1), dir(2)]
419
arguments: true
420
post-install:
421
echo %1 %2
422
EOF
423
touch A
424
mkdir B
425
A_mtime=$(q_mtime A)
426
427
atf_check \
428
-o empty \
429
-e empty \
430
-s exit:0 \
431
pkg -o PLIST_KEYWORDS_DIR=. create -o ${TMPDIR} -m . -p test.plist -r .
432
433
atf_check \
434
-o empty \
435
-e empty \
436
-s exit:0 \
437
pkg -o PLIST_KEYWORDS_DIR=. create -o ${TMPDIR} -m . -p test.plist -r .
438
439
cat << EOF >> output.ucl
440
name = "test";
441
origin = "test";
442
version = "1";
443
comment = "a test";
444
maintainer = "test";
445
www = "http://test";
446
abi = "*";
447
arch = "*";
448
prefix = "/";
449
flatsize = 0;
450
desc = "Yet another test";
451
categories [
452
"test",
453
]
454
files {
455
/A {
456
sum = "1\$e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";
457
uname = "root";
458
gname = "wheel";
459
perm = "0644";
460
fflags = 0;
461
mtime = ${A_mtime};
462
}
463
}
464
directories {
465
/B {
466
uname = "root";
467
gname = "wheel";
468
perm = "0755";
469
fflags = 0;
470
}
471
}
472
scripts {
473
post-install = "# args: A B\necho A B";
474
}
475
EOF
476
477
atf_check \
478
-o file:output.ucl \
479
-e empty \
480
-s exit:0 \
481
pkg info -R --raw-format=ucl -F test-1.pkg
482
}
483
484
create_from_manifest_and_plist_body() {
485
genmanifest
486
touch testfile
487
testfile_mtime=$(q_mtime testfile)
488
genplist "testfile"
489
atf_check \
490
-o empty \
491
-e empty \
492
-s exit:0 \
493
pkg create -M ./+MANIFEST -p test.plist -r ${TMPDIR}
494
495
cat << EOF > output.ucl
496
name = "test";
497
origin = "test";
498
version = "1";
499
comment = "a test";
500
maintainer = "test";
501
www = "http://test";
502
abi = "*";
503
arch = "*";
504
prefix = "/";
505
flatsize = 0;
506
desc = "Yet another test";
507
categories [
508
"test",
509
]
510
files {
511
/testfile {
512
sum = "1\$e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";
513
uname = "root";
514
gname = "wheel";
515
perm = "0644";
516
fflags = 0;
517
mtime = ${testfile_mtime};
518
}
519
}
520
EOF
521
522
atf_check \
523
-o file:output.ucl \
524
-e empty \
525
-s exit:0 \
526
pkg info -R --raw-format=ucl -F test-1.pkg
527
}
528
529
create_from_manifest_body() {
530
genmanifest
531
cat <<EOF >> +MANIFEST
532
files: {
533
/testfile: {perm: 0644}
534
/sym-file: {perm: 0644}
535
}
536
EOF
537
touch testfile
538
ln -s sym-target sym-file
539
test_file_mtime=$(q_mtime testfile)
540
sym_file_mtime=$(q_mtime sym-file)
541
atf_check \
542
-o empty \
543
-e empty \
544
-s exit:0 \
545
pkg create -M ./+MANIFEST -r ${TMPDIR}
546
cp test-1.pkg /tmp
547
548
cat << EOF > output.ucl
549
name = "test";
550
origin = "test";
551
version = "1";
552
comment = "a test";
553
maintainer = "test";
554
www = "http://test";
555
abi = "*";
556
arch = "*";
557
prefix = "/";
558
flatsize = 10;
559
desc = "Yet another test";
560
categories [
561
"test",
562
]
563
files {
564
/testfile {
565
sum = "1\$e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";
566
uname = "root";
567
gname = "wheel";
568
perm = "0644";
569
fflags = 0;
570
mtime = ${test_file_mtime};
571
}
572
/sym-file {
573
sum = "1\$a83552cc4e1e92707178239c630b7f05d51124ff2afa7c5595ff4e76cb96cfa4";
574
uname = "root";
575
gname = "wheel";
576
perm = "0644";
577
fflags = 0;
578
symlink_target = "sym-target";
579
mtime = ${sym_file_mtime};
580
}
581
}
582
EOF
583
584
atf_check \
585
-o file:output.ucl \
586
-e empty \
587
-s exit:0 \
588
pkg info -R --raw-format=ucl -F test-1.pkg
589
}
590
591
create_from_manifest_dir_body() {
592
genmanifest
593
cat <<EOF >> +MANIFEST
594
files: {
595
/testfile: {perm: 0644}
596
/testdir: {perm: 0644}
597
}
598
EOF
599
touch testfile
600
mkdir testdir
601
atf_check \
602
-o empty \
603
-e not-empty \
604
-s not-exit:0 \
605
pkg create -M ./+MANIFEST -r ${TMPDIR}
606
607
}
608
609
create_from_plist_pkg_descr_body() {
610
genmanifest
611
cat << EOF > ./+DISPLAY
612
Message
613
EOF
614
615
OUTPUT="test-1:
616
Always:
617
Message
618
619
"
620
atf_check pkg create -m . -r ${TMPDIR}
621
atf_check -o inline:"${OUTPUT}" pkg info -D -F ./test-1.pkg
622
623
cat << EOF > ./+DISPLAY
624
[
625
{ message: "message" },
626
{ message: "message upgrade", type = "upgrade" },
627
]
628
EOF
629
630
OUTPUT='test-1:
631
Always:
632
message
633
634
On upgrade:
635
message upgrade
636
637
'
638
639
atf_check pkg create -m . -r ${TMPDIR}
640
atf_check -o inline:"${OUTPUT}" pkg info -D -F ./test-1.pkg
641
642
}
643
644
create_from_plist_hash_body() {
645
touch file1
646
genmanifest
647
genplist "file1"
648
649
atf_check \
650
-o empty \
651
-e empty \
652
-s exit:0 \
653
pkg create -h -o ${TMPDIR} -m . -p test.plist -r .
654
655
atf_check \
656
-o ignore \
657
-e empty \
658
-s exit:0 \
659
ls test-1-*.pkg
660
}
661
662
create_from_plist_with_keyword_and_message_body() {
663
genmanifest
664
genplist "@showmsg plop"
665
cat << EOF > showmsg.ucl
666
actions: []
667
messages: [
668
{ message: "always" },
669
{ message: "on upgrade";type = "upgrade" },
670
{ message: "on install"; type = "install" },
671
]
672
EOF
673
cat << EOF > +DISPLAY
674
old message
675
EOF
676
677
OUTPUT='test-1:
678
Always:
679
old message
680
681
Always:
682
always
683
684
On upgrade:
685
on upgrade
686
687
On install:
688
on install
689
690
'
691
atf_check pkg -o PLIST_KEYWORDS_DIR=. create -m . -r ${TMPDIR} -p test.plist
692
atf_check -o inline:"${OUTPUT}" pkg info -D -F ./test-1.pkg
693
694
}
695
696
time_body() {
697
atf_check sh ${RESOURCEDIR}/test_subr.sh new_pkg "test" "test" "1"
698
cat << EOF >> test.ucl
699
files: {
700
"${TMPDIR}/a" = "";
701
}
702
EOF
703
touch a
704
pattern=$(ls -l ${TMPDIR}/a | awk '{print $6" +"$7" +"$8".*/a"}')
705
atf_check pkg create -M test.ucl
706
atf_check env SOURCE_DATE_EPOCH=86400 pkg create -M test.ucl
707
atf_check \
708
-o match:"0 Jan +2 +1970.*/a" \
709
bsdtar tvf test-1.pkg
710
atf_check -e match:"Invalid" -s exit:1 pkg create -t meh -M test.ucl
711
atf_check pkg create -t 172800 -M test.ucl
712
atf_check \
713
-o match:"0 Jan +3 +1970.*/a" \
714
bsdtar tvf test-1.pkg
715
atf_check env SOURCE_DATE_EPOCH=86400 pkg create -t 172800 -M test.ucl
716
atf_check \
717
-o match:"0 Jan +3 +1970.*/a" \
718
bsdtar tvf test-1.pkg
719
atf_check pkg create -M test.ucl
720
atf_check \
721
-o match:"${pattern}" \
722
bsdtar tvf test-1.pkg
723
724
mkdir target
725
atf_check -o empty \
726
pkg -o REPOS_DIR=/dev/null -r ${TMPDIR}/target install -qfy ${TMPDIR}/test-1.pkg
727
atf_check \
728
-o match:"${pattern}" \
729
ls -l ${TMPDIR}/target/${TMPDIR}/a
730
}
731
732
create_no_clobber_body()
733
{
734
atf_check sh ${RESOURCEDIR}/test_subr.sh new_pkg "test" "test" "1"
735
736
touch test-1.pkg
737
before=$(ls -l test-1.pkg)
738
atf_check pkg create -nM test.ucl
739
after=$(ls -l test-1.pkg)
740
[ "$before" = "$after" ] || atf_fail "Package was recreated \"$before\" vs \"$after\""
741
}
742
743
create_from_plist_include_body()
744
{
745
genmanifest
746
cat << EOF >> test.plist
747
file1
748
@include other-plist
749
file2
750
EOF
751
cat <<EOF >> other-plist
752
file3
753
EOF
754
755
touch file1
756
touch file2
757
touch file3
758
759
atf_check \
760
-s exit:0 \
761
pkg create -o ${TMPDIR} -m . -p test.plist -r .
762
763
atf_check -o inline:"/file1\n/file3\n/file2\n" pkg info -ql -F test*.pkg
764
cat << EOF >> other-plist
765
@include test.plist
766
EOF
767
atf_check \
768
-e inline:"pkg: Inside in @include it is not allowed to reuse @include\n" \
769
-s exit:1 \
770
pkg create -o ${TMPDIR} -m . -p test.plist -r .
771
}
772
773
create_from_plist_keyword_lua_actions_body()
774
{
775
genmanifest
776
genplist "@test(plop,,) A B C D"
777
778
cat << EOF > test.ucl
779
arguments: true
780
prepackaging: <<EOS
781
ok = true
782
for i = 1, #arg do
783
if not pkg.file(arg[i]) then
784
ok = false
785
end
786
end
787
if not ok then
788
return 1
789
end
790
EOS
791
arguments: true
792
EOF
793
794
touch C
795
touch D
796
797
output="${PROGNAME}: Unable to access file ./A:No such file or directory
798
${PROGNAME}: Unable to access file ./B:No such file or directory
799
${PROGNAME}: Fail to apply keyword 'test'
800
"
801
802
atf_check \
803
-e inline:"${output}" \
804
-s exit:1 \
805
pkg -o PLIST_KEYWORDS_DIR=. create -o ${TMPDIR} -m . -p test.plist -r .
806
807
touch A B
808
atf_check \
809
-s exit:0 \
810
pkg -o PLIST_KEYWORDS_DIR=. create -o ${TMPDIR} -m . -p test.plist -r .
811
atf_check \
812
-o match:"-rw-r--r-- .*plop[ /]+wheel.* /A$" \
813
bsdtar tvf test-1.pkg
814
}
815
816
create_from_plist_keyword_deprecated_body()
817
{
818
genmanifest
819
genplist "@test A B C D"
820
821
cat << EOF > test.ucl
822
arguments: true
823
deprecated: true
824
EOF
825
826
atf_check \
827
-e inline:"${PROGNAME}: Use of '@test' is deprecated\n" \
828
-s exit:0 \
829
pkg -o PLIST_KEYWORDS_DIR=. create -o ${TMPDIR} -m . -p test.plist -r .
830
831
cat << EOF > test.ucl
832
arguments: true
833
deprecated: true
834
deprecation_message: <<EOM
835
we don't like it anymore
836
EOM
837
EOF
838
839
atf_check \
840
-e inline:"${PROGNAME}: Use of '@test' is deprecated: we don't like it anymore\n" \
841
-s exit:0 \
842
pkg -o PLIST_KEYWORDS_DIR=. create -o ${TMPDIR} -m . -p test.plist -r .
843
844
}
845
846
create_from_plist_keyword_override_prefix_body()
847
{
848
genmanifest
849
genplist "@override_prefix /plop
850
file"
851
touch file
852
atf_check pkg create -o ${TMPDIR} -m . -p test.plist -r .
853
atf_check -o match:".*/plop/file$" -e ignore tar tf test-1.pkg
854
atf_check -o inline:"/plop/file\n" pkg info -F test-1.pkg -ql
855
856
genprefixmanifest
857
858
mkdir "prefix"
859
touch prefix/file
860
atf_check pkg create -o ${TMPDIR} -m . -p test.plist -r .
861
atf_check -o match:".*/plop/file$" -e ignore tar tf test-1.pkg
862
atf_check -o inline:"/plop/file\n" pkg info -F test-1.pkg -ql
863
}
864
865
866
create_from_plist_with_variables_body() {
867
touch file1 file2 plop file3
868
genmanifest
869
genplist "
870
@var key1
871
@var key2
872
@var key3 plop
873
%%key1%%file1
874
%%key2%%file2
875
%%key3%%
876
@var key3 @comment
877
%%key3%% file3"
878
879
atf_check \
880
-o empty \
881
-e empty \
882
-s exit:0 \
883
pkg create -o ${TMPDIR} -m . -p test.plist -r .
884
885
basic_validation
886
atf_check \
887
-o inline:"/file1\n/file2\n/plop\n" \
888
pkg info -F test-1.pkg -ql
889
rm test-1.pkg
890
echo "
891
%%plop%%
892
" >> test.plist
893
atf_check \
894
-e match:"%%plop%%" \
895
-s exit:1 \
896
pkg create -o ${TMPDIR} -m . -p test.plist -r .
897
}
898
899