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
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
|
# rpmquery.at: test rpmquery
#
# Copyright (C) 2007 Ralf Corsépius <corsepiu@fedoraproject.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
AT_BANNER([RPM queries])
# ------------------------------
AT_SETUP([rpm --qf -p *.i386.rpm])
AT_KEYWORDS([query])
AT_CHECK([
runroot rpm \
-q --qf "%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n" \
-p /data/RPMS/hello-1.0-1.i386.rpm
],
[0],
[hello-1.0-1.i386
],
[ignore])
AT_CLEANUP
# ------------------------------
AT_SETUP([rpm --qf -p *.src.rpm])
AT_KEYWORDS([query])
AT_CHECK([
runroot rpm \
-q --qf "%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n" \
-p /data/SRPMS/hello-1.0-1.src.rpm
],
[0],
[hello-1.0-1.i386
],
[ignore])
AT_CLEANUP
# ------------------------------
AT_SETUP([rpm -ql -p *.src.rpm])
AT_KEYWORDS([query])
AT_CHECK([
runroot rpm \
-ql \
-p /data/SRPMS/hello-1.0-1.src.rpm
],
[0],
[hello-1.0.tar.gz
hello.spec
],
[ignore])
AT_CLEANUP
# ------------------------------
AT_SETUP([rpmspec -q])
AT_KEYWORDS([query])
AT_CHECK([
runroot rpmspec \
-q --qf "%{name}" /data/SPECS/hello.spec
],
[0],
[hello],
[])
AT_CLEANUP
# ------------------------------
AT_SETUP([rpm -ql -p *.i386.rpm])
AT_KEYWORDS([query])
AT_CHECK([
runroot rpm \
-ql \
-p /data/RPMS/hello-1.0-1.i386.rpm
],
[0],
[/usr/local/bin/hello
/usr/share/doc/hello-1.0
/usr/share/doc/hello-1.0/FAQ
],
[ignore])
AT_CLEANUP
# ------------------------------
# Test query on manifest
AT_SETUP([rpm -qp <manifest>])
AT_KEYWORDS([query])
AT_CHECK([
cat << EOF > ${RPMTEST}/query.mft
/data/RPMS/hello-1.0-1.i386.rpm
/data/RPMS/hello-1.0-1.ppc64.rpm
/data/RPMS/foo-1.0-1.noarch.rpm
EOF
runroot rpm -qp --qf "%{nvr}\n" /query.mft
],
[0],
[hello-1.0-1
hello-1.0-1
foo-1.0-1
],
[])
AT_CLEANUP
# ------------------------------
# Try to check "scripts"
# * Gets rpmpopt-$(VERSION) involved
AT_SETUP([rpm -q --scripts -p *.i386.rpm])
AT_KEYWORDS([query])
AT_CHECK([
runroot rpm \
-q --scripts \
-p /data/RPMS/hello-1.0-1.i386.rpm
],
[0],
[preinstall program: /bin/sh
postinstall program: /bin/sh
preuninstall program: /bin/sh
postuninstall program: /bin/sh
],
[ignore])
AT_CLEANUP
# ------------------------------
# install a package into a local rpmdb
# * Shall only work with relocation
# * Use --ignorearch because we don't know the arch
AT_SETUP([rpm -q on installed package])
AT_KEYWORDS([rpmdb install query])
AT_CHECK([
RPMDB_CLEAR
RPMDB_INIT
runroot rpm \
--noscripts --nodeps --ignorearch --relocate=/usr=/check \
-i /data/RPMS/hello-1.0-1.ppc64.rpm
],
[0])
# check common NVRA combinations
AT_CHECK([
runroot rpm \
-q hello hello-1.0 hello-1.0-1 \
hello.ppc64 hello-1.0.ppc64 hello-1.0-1.ppc64
],
[0],
[hello-1.0-1.ppc64
hello-1.0-1.ppc64
hello-1.0-1.ppc64
hello-1.0-1.ppc64
hello-1.0-1.ppc64
hello-1.0-1.ppc64
],
[ignore])
AT_CHECK([
runroot rpm \
-ql hello
],
[0],
[/check/local/bin/hello
/check/share/doc/hello-1.0
/check/share/doc/hello-1.0/FAQ
],
[ignore])
AT_CLEANUP
# ------------------------------
AT_SETUP([integer array query])
AT_KEYWORDS([query])
AT_CHECK([
runroot rpm \
--queryformat="[[%{filemodes}\n]]" \
-qp /data/RPMS/hello-1.0-1.i386.rpm
],
[0],
[33257
16877
33188
],
[])
AT_CLEANUP
# ------------------------------
AT_SETUP([formatted filesbypkg query])
AT_KEYWORDS([query])
AT_CHECK([
runroot rpm \
--queryformat="[[%-10{=NAME} %{FILENAMES}\n]]" \
-qp /data/RPMS/hello-1.0-1.i386.rpm
],
[0],
[hello /usr/local/bin/hello
hello /usr/share/doc/hello-1.0
hello /usr/share/doc/hello-1.0/FAQ
],
[])
AT_CLEANUP
# ------------------------------
AT_SETUP([hex formatted integer array extension query])
AT_KEYWORDS([query])
AT_CHECK([
runroot rpm \
--queryformat="[[%5{longfilesizes:hex}\n]]" \
-qp /data/RPMS/hello-1.0-1.i386.rpm
],
[0],
[ b40
1000
24
],
[])
AT_CLEANUP
# ------------------------------
AT_SETUP([base64 extension query])
AT_KEYWORDS([query])
AT_CHECK([
runroot rpm \
--queryformat="%{pkgid:base64}" \
-qp /data/RPMS/foo-1.0-1.noarch.rpm
],
[0],
[qt8W635v5FKy1pILrW+0uw==
],
[])
AT_CLEANUP
# ------------------------------
AT_SETUP([integer array perms format query])
AT_KEYWORDS([query])
AT_CHECK([
runroot rpm \
--queryformat="[[%{filemodes:perms}\n]]" \
-qp /data/RPMS/hello-1.0-1.i386.rpm
],
[0],
[-rwxr-x--x
drwxr-xr-x
-rw-r--r--
],
[])
AT_CLEANUP
# ------------------------------
AT_SETUP([string array query])
AT_KEYWORDS([query])
AT_CHECK([
runroot rpm \
--queryformat="[[%{basenames} ]]" \
-qp /data/RPMS/hello-1.0-1.i386.rpm
],
[0],
[hello hello-1.0 FAQ ],
[])
AT_CLEANUP
# ------------------------------
AT_SETUP([empty string array query])
AT_KEYWORDS([query])
AT_CHECK([
runroot rpm \
--queryformat="[[%{basenames}]]" \
-qp /data/RPMS/foo-1.0-1.noarch.rpm
],
[0],
[],
[])
AT_CLEANUP
# ------------------------------
AT_SETUP([empty string array extension array format])
AT_KEYWORDS([query])
AT_CHECK([
runroot rpm \
--queryformat="[[%{filenames}]]" \
-qp /data/RPMS/foo-1.0-1.noarch.rpm
],
[0],
[],
[])
AT_CLEANUP
# ------------------------------
AT_SETUP([empty string array extension query])
AT_KEYWORDS([query])
AT_CHECK([
runroot rpm \
--queryformat="%{filenames}" \
-qp /data/RPMS/foo-1.0-1.noarch.rpm
],
[0],
[(none)],
[])
AT_CLEANUP
# ------------------------------
AT_SETUP([different sizes arrays query])
AT_KEYWORDS([query])
AT_CHECK([
runroot rpm \
--queryformat="[[%{basenames} %{changelogname}]]" \
-qp /data/RPMS/hello-1.0-1.i386.rpm
],
[0],
[],
[error: incorrect format: array iterator used with different sized arrays
])
AT_CLEANUP
# ------------------------------
AT_SETUP([non-existent string tag])
AT_KEYWORDS([query])
AT_CHECK([
runroot rpm \
--queryformat="%{vendor}" \
-qp /data/RPMS/foo-1.0-1.noarch.rpm
],
[0],
[(none)],
[])
AT_CLEANUP
# ------------------------------
AT_SETUP([non-existent integer tag query])
AT_KEYWORDS([query])
AT_CHECK([
runroot rpm \
--queryformat="%{installcolor}" \
-qp /data/RPMS/foo-1.0-1.noarch.rpm
],
[0],
[(none)],
[])
AT_CLEANUP
# ------------------------------
AT_SETUP([conditional queryformat])
AT_KEYWORDS([query])
AT_CHECK([
runroot rpm \
--queryformat="%|name?{%{name}}:{no}| %|installtime?{%{installtime}}:{(not installed)}|" \
-qp /data/RPMS/foo-1.0-1.noarch.rpm
],
[0],
[foo (not installed)],
[])
AT_CLEANUP
# ------------------------------
AT_SETUP([invalid tag query])
AT_KEYWORDS([query])
AT_CHECK([
runroot rpm \
--queryformat="%{notag}" \
-qp /data/RPMS/foo-1.0-1.noarch.rpm
],
[0],
[],
[error: incorrect format: unknown tag: "notag"
])
AT_CLEANUP
# ------------------------------
AT_SETUP([invalid data for format query])
AT_KEYWORDS([query])
AT_CHECK([
runroot rpm \
--queryformat="%{name:depflags}" \
-qp /data/RPMS/foo-1.0-1.noarch.rpm
],
[0],
[(not a number)],
[])
AT_CLEANUP
# ------------------------------
AT_SETUP([invalid format width query])
AT_KEYWORDS([query])
AT_CHECK([
runroot rpm \
--queryformat="%ss{size}" \
-qp /data/RPMS/foo-1.0-1.noarch.rpm
],
[0],
[],
[error: incorrect format: invalid field width
])
AT_CLEANUP
AT_SETUP([xml format])
AT_KEYWORDS([query])
AT_CHECK([
AT_XFAIL_IF([test $RPM_XFAIL -ne 0])
runroot rpm -qp --xml data/RPMS/hello-2.0-1.x86_64.rpm
],
[0],
[<rpmHeader>
<rpmTag name="Headeri18ntable">
<string>C</string>
</rpmTag>
<rpmTag name="Sigsize">
<integer>5411</integer>
</rpmTag>
<rpmTag name="Sigmd5">
<base64>E3yh2LNcygKhhUujAcVDLg==
</base64>
</rpmTag>
<rpmTag name="Sha1header">
<string>5cd9874c510b67b44483f9e382a1649ef7743bac</string>
</rpmTag>
<rpmTag name="Sha256header">
<string>ef920781af3bf072ae9888eec3de1c589143101dff9cc0b561468d395fb766d9</string>
</rpmTag>
<rpmTag name="Name">
<string>hello</string>
</rpmTag>
<rpmTag name="Version">
<string>2.0</string>
</rpmTag>
<rpmTag name="Release">
<string>1</string>
</rpmTag>
<rpmTag name="Summary">
<string>hello -- hello, world rpm</string>
</rpmTag>
<rpmTag name="Description">
<string>Simple rpm demonstration.</string>
</rpmTag>
<rpmTag name="Buildtime">
<integer>1227355200</integer>
</rpmTag>
<rpmTag name="Buildhost">
<string>localhost</string>
</rpmTag>
<rpmTag name="Size">
<integer>7243</integer>
</rpmTag>
<rpmTag name="License">
<string>GPL</string>
</rpmTag>
<rpmTag name="Group">
<string>Testing</string>
</rpmTag>
<rpmTag name="Os">
<string>linux</string>
</rpmTag>
<rpmTag name="Arch">
<string>x86_64</string>
</rpmTag>
<rpmTag name="Filesizes">
<integer>7120</integer>
<integer>4096</integer>
<integer>48</integer>
<integer>36</integer>
<integer>39</integer>
</rpmTag>
<rpmTag name="Filemodes">
<integer>33257</integer>
<integer>16877</integer>
<integer>33188</integer>
<integer>33188</integer>
<integer>33188</integer>
</rpmTag>
<rpmTag name="Filerdevs">
<integer>0</integer>
<integer>0</integer>
<integer>0</integer>
<integer>0</integer>
<integer>0</integer>
</rpmTag>
<rpmTag name="Filemtimes">
<integer>1489670606</integer>
<integer>1489670606</integer>
<integer>908894882</integer>
<integer>908895030</integer>
<integer>908884468</integer>
</rpmTag>
<rpmTag name="Filedigests">
<string>c89fa87aeb1143969c0b6be9334b21d932f77f74e8f60120b5de316406369cf0</string>
<string/>
<string>fac3b28492ecdc16da172a6f1a432ceed356ca4d9248157b2a962b395e37b3b0</string>
<string>678b87e217a415f05e43460e2c7b668245b412e2b4f18a75aa7399d9774ed0b4</string>
<string>d63fdc6c986106f57230f217d36b2395d83ecf491d2b7187af714dc8db9629e9</string>
</rpmTag>
<rpmTag name="Filelinktos">
<string/>
<string/>
<string/>
<string/>
<string/>
</rpmTag>
<rpmTag name="Fileflags">
<integer>0</integer>
<integer>0</integer>
<integer>2</integer>
<integer>2</integer>
<integer>2</integer>
</rpmTag>
<rpmTag name="Fileusername">
<string>root</string>
<string>root</string>
<string>root</string>
<string>root</string>
<string>root</string>
</rpmTag>
<rpmTag name="Filegroupname">
<string>root</string>
<string>root</string>
<string>root</string>
<string>root</string>
<string>root</string>
</rpmTag>
<rpmTag name="Sourcerpm">
<string>hello-2.0-1.src.rpm</string>
</rpmTag>
<rpmTag name="Fileverifyflags">
<integer>4294967295</integer>
<integer>0</integer>
<integer>4294967295</integer>
<integer>4294967295</integer>
<integer>4294967295</integer>
</rpmTag>
<rpmTag name="Archivesize">
<integer>8060</integer>
</rpmTag>
<rpmTag name="Providename">
<string>hello</string>
<string>hello(x86-64)</string>
</rpmTag>
<rpmTag name="Requireflags">
<integer>16384</integer>
<integer>16384</integer>
<integer>16777226</integer>
<integer>16777226</integer>
<integer>16777226</integer>
<integer>16384</integer>
</rpmTag>
<rpmTag name="Requirename">
<string>libc.so.6()(64bit)</string>
<string>libc.so.6(GLIBC_2.2.5)(64bit)</string>
<string>rpmlib(CompressedFileNames)</string>
<string>rpmlib(FileDigests)</string>
<string>rpmlib(PayloadFilesHavePrefix)</string>
<string>rtld(GNU_HASH)</string>
</rpmTag>
<rpmTag name="Requireversion">
<string/>
<string/>
<string>3.0.4-1</string>
<string>4.6.0-1</string>
<string>4.0-1</string>
<string/>
</rpmTag>
<rpmTag name="Rpmversion">
<string>4.13.90</string>
</rpmTag>
<rpmTag name="Changelogtime">
<integer>1227355200</integer>
<integer>908884800</integer>
</rpmTag>
<rpmTag name="Changelogname">
<string>Panu Matilainen <pmatilai@redhat.com></string>
<string>Jeff Johnson <jbj@redhat.com></string>
</rpmTag>
<rpmTag name="Changelogtext">
<string>- updated version</string>
<string>- create.</string>
</rpmTag>
<rpmTag name="Filedevices">
<integer>1</integer>
<integer>1</integer>
<integer>1</integer>
<integer>1</integer>
<integer>1</integer>
</rpmTag>
<rpmTag name="Fileinodes">
<integer>1</integer>
<integer>2</integer>
<integer>3</integer>
<integer>4</integer>
<integer>5</integer>
</rpmTag>
<rpmTag name="Filelangs">
<string/>
<string/>
<string/>
<string/>
<string/>
</rpmTag>
<rpmTag name="Prefixes">
<string>/usr</string>
</rpmTag>
<rpmTag name="Provideflags">
<integer>8</integer>
<integer>8</integer>
</rpmTag>
<rpmTag name="Provideversion">
<string>2.0-1</string>
<string>2.0-1</string>
</rpmTag>
<rpmTag name="Dirindexes">
<integer>0</integer>
<integer>1</integer>
<integer>2</integer>
<integer>2</integer>
<integer>2</integer>
</rpmTag>
<rpmTag name="Basenames">
<string>hello</string>
<string>hello-2.0</string>
<string>COPYING</string>
<string>FAQ</string>
<string>README</string>
</rpmTag>
<rpmTag name="Dirnames">
<string>/usr/bin/</string>
<string>/usr/share/doc/</string>
<string>/usr/share/doc/hello-2.0/</string>
</rpmTag>
<rpmTag name="Optflags">
<string>-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic</string>
</rpmTag>
<rpmTag name="Payloadformat">
<string>cpio</string>
</rpmTag>
<rpmTag name="Payloadcompressor">
<string>gzip</string>
</rpmTag>
<rpmTag name="Payloadflags">
<string>9</string>
</rpmTag>
<rpmTag name="Platform">
<string>x86_64-redhat-linux-gnu</string>
</rpmTag>
<rpmTag name="Filecolors">
<integer>2</integer>
<integer>0</integer>
<integer>0</integer>
<integer>0</integer>
<integer>0</integer>
</rpmTag>
<rpmTag name="Fileclass">
<integer>0</integer>
<integer>1</integer>
<integer>2</integer>
<integer>2</integer>
<integer>2</integer>
</rpmTag>
<rpmTag name="Classdict">
<string>ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, BuildID[[sha1]]=775fdcb927e4300adbe83cfacec3cfeb1f63fe17, stripped</string>
<string>directory</string>
<string>ASCII text</string>
</rpmTag>
<rpmTag name="Filedependsx">
<integer>0</integer>
<integer>0</integer>
<integer>0</integer>
<integer>0</integer>
<integer>0</integer>
</rpmTag>
<rpmTag name="Filedependsn">
<integer>3</integer>
<integer>0</integer>
<integer>0</integer>
<integer>0</integer>
<integer>0</integer>
</rpmTag>
<rpmTag name="Dependsdict">
<integer>1375731713</integer>
<integer>1375731712</integer>
<integer>1375731717</integer>
</rpmTag>
<rpmTag name="Filedigestalgo">
<integer>8</integer>
</rpmTag>
<rpmTag name="Encoding">
<string>utf-8</string>
</rpmTag>
<rpmTag name="Payloaddigest">
<string>84a7338287bf19715c4eed0243f5cdb447eeb0ade37b2af718d4060aefca2f7c</string>
</rpmTag>
<rpmTag name="Payloaddigestalgo">
<integer>8</integer>
</rpmTag>
</rpmHeader>
],
[])
AT_CLEANUP
|