2007-08-20 21:28:20 +08:00
|
|
|
# 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
|
|
|
|
|
2008-11-22 19:26:43 +08:00
|
|
|
AT_BANNER([RPM queries])
|
|
|
|
|
2007-08-21 20:52:00 +08:00
|
|
|
# ------------------------------
|
2008-11-21 23:39:39 +08:00
|
|
|
AT_SETUP([rpm --qf -p *.i386.rpm])
|
2008-11-22 20:07:34 +08:00
|
|
|
AT_KEYWORDS([query])
|
2007-08-20 21:28:20 +08:00
|
|
|
AT_CHECK([
|
2011-04-01 20:42:47 +08:00
|
|
|
runroot rpm \
|
2008-11-21 23:39:39 +08:00
|
|
|
-q --qf "%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n" \
|
2011-04-01 20:42:47 +08:00
|
|
|
-p /data/RPMS/hello-1.0-1.i386.rpm
|
2007-08-20 21:28:20 +08:00
|
|
|
],
|
|
|
|
[0],
|
|
|
|
[hello-1.0-1.i386
|
|
|
|
],
|
|
|
|
[ignore])
|
|
|
|
AT_CLEANUP
|
|
|
|
|
2007-08-21 20:52:00 +08:00
|
|
|
# ------------------------------
|
2008-11-21 23:39:39 +08:00
|
|
|
AT_SETUP([rpm --qf -p *.src.rpm])
|
2008-11-22 20:07:34 +08:00
|
|
|
AT_KEYWORDS([query])
|
2007-08-20 21:28:20 +08:00
|
|
|
AT_CHECK([
|
2011-04-01 20:42:47 +08:00
|
|
|
runroot rpm \
|
2008-11-21 23:39:39 +08:00
|
|
|
-q --qf "%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n" \
|
2011-04-01 20:42:47 +08:00
|
|
|
-p /data/SRPMS/hello-1.0-1.src.rpm
|
2007-08-20 21:28:20 +08:00
|
|
|
],
|
|
|
|
[0],
|
|
|
|
[hello-1.0-1.i386
|
|
|
|
],
|
|
|
|
[ignore])
|
|
|
|
AT_CLEANUP
|
2007-08-21 14:51:16 +08:00
|
|
|
|
2007-08-21 20:52:00 +08:00
|
|
|
# ------------------------------
|
2008-11-21 23:39:39 +08:00
|
|
|
AT_SETUP([rpm -ql -p *.src.rpm])
|
2008-11-22 20:07:34 +08:00
|
|
|
AT_KEYWORDS([query])
|
2007-08-21 14:51:16 +08:00
|
|
|
AT_CHECK([
|
2011-04-01 20:42:47 +08:00
|
|
|
runroot rpm \
|
2007-08-21 14:51:16 +08:00
|
|
|
-ql \
|
2011-04-01 20:42:47 +08:00
|
|
|
-p /data/SRPMS/hello-1.0-1.src.rpm
|
2007-08-21 14:51:16 +08:00
|
|
|
],
|
|
|
|
[0],
|
|
|
|
[hello-1.0.tar.gz
|
|
|
|
hello.spec
|
|
|
|
],
|
|
|
|
[ignore])
|
|
|
|
AT_CLEANUP
|
|
|
|
|
2010-08-18 17:32:23 +08:00
|
|
|
# ------------------------------
|
2010-10-04 18:33:18 +08:00
|
|
|
AT_SETUP([rpmspec -q])
|
2010-08-18 17:32:23 +08:00
|
|
|
AT_KEYWORDS([query])
|
|
|
|
AT_CHECK([
|
2011-04-01 20:42:47 +08:00
|
|
|
runroot rpmspec \
|
|
|
|
-q --qf "%{name}" /data/SPECS/hello.spec
|
2010-08-18 17:32:23 +08:00
|
|
|
],
|
|
|
|
[0],
|
|
|
|
[hello],
|
|
|
|
[])
|
|
|
|
AT_CLEANUP
|
|
|
|
|
2007-08-21 20:52:00 +08:00
|
|
|
# ------------------------------
|
2008-11-21 23:39:39 +08:00
|
|
|
AT_SETUP([rpm -ql -p *.i386.rpm])
|
2008-11-22 20:07:34 +08:00
|
|
|
AT_KEYWORDS([query])
|
2007-08-21 14:51:16 +08:00
|
|
|
AT_CHECK([
|
2011-04-01 20:42:47 +08:00
|
|
|
runroot rpm \
|
2007-08-21 14:51:16 +08:00
|
|
|
-ql \
|
2011-04-01 20:42:47 +08:00
|
|
|
-p /data/RPMS/hello-1.0-1.i386.rpm
|
2007-08-21 14:51:16 +08:00
|
|
|
],
|
|
|
|
[0],
|
|
|
|
[/usr/local/bin/hello
|
|
|
|
/usr/share/doc/hello-1.0
|
|
|
|
/usr/share/doc/hello-1.0/FAQ
|
|
|
|
],
|
|
|
|
[ignore])
|
|
|
|
AT_CLEANUP
|
|
|
|
|
2010-09-08 18:52:30 +08:00
|
|
|
# ------------------------------
|
|
|
|
# Test query on manifest
|
|
|
|
AT_SETUP([rpm -qp <manifest>])
|
|
|
|
AT_KEYWORDS([query])
|
|
|
|
AT_CHECK([
|
2011-04-01 20:42:47 +08:00
|
|
|
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
|
2010-09-08 18:52:30 +08:00
|
|
|
EOF
|
2011-04-01 20:42:47 +08:00
|
|
|
runroot rpm -qp --qf "%{nvr}\n" /query.mft
|
2010-09-08 18:52:30 +08:00
|
|
|
],
|
|
|
|
[0],
|
|
|
|
[hello-1.0-1
|
|
|
|
hello-1.0-1
|
|
|
|
foo-1.0-1
|
|
|
|
],
|
|
|
|
[])
|
|
|
|
AT_CLEANUP
|
2007-08-21 20:52:00 +08:00
|
|
|
|
2007-08-24 13:36:24 +08:00
|
|
|
# ------------------------------
|
|
|
|
# Try to check "scripts"
|
|
|
|
# * Gets rpmpopt-$(VERSION) involved
|
|
|
|
AT_SETUP([rpm -q --scripts -p *.i386.rpm])
|
2008-11-22 20:07:34 +08:00
|
|
|
AT_KEYWORDS([query])
|
2007-08-24 13:36:24 +08:00
|
|
|
AT_CHECK([
|
2011-04-01 20:42:47 +08:00
|
|
|
runroot rpm \
|
2007-08-24 13:36:24 +08:00
|
|
|
-q --scripts \
|
2011-04-01 20:42:47 +08:00
|
|
|
-p /data/RPMS/hello-1.0-1.i386.rpm
|
2007-08-24 13:36:24 +08:00
|
|
|
],
|
|
|
|
[0],
|
|
|
|
[preinstall program: /bin/sh
|
|
|
|
postinstall program: /bin/sh
|
|
|
|
preuninstall program: /bin/sh
|
|
|
|
postuninstall program: /bin/sh
|
|
|
|
],
|
|
|
|
[ignore])
|
|
|
|
AT_CLEANUP
|
|
|
|
|
|
|
|
|
2007-08-21 20:52:00 +08:00
|
|
|
# ------------------------------
|
|
|
|
# install a package into a local rpmdb
|
|
|
|
# * Shall only work with relocation
|
|
|
|
# * Use --ignorearch because we don't know the arch
|
|
|
|
AT_SETUP([rpm -qil hello])
|
2008-11-22 20:07:34 +08:00
|
|
|
AT_KEYWORDS([rpmdb install query])
|
2007-08-21 20:52:00 +08:00
|
|
|
|
|
|
|
AT_CHECK([
|
2007-08-30 21:33:15 +08:00
|
|
|
RPMDB_CLEAR
|
|
|
|
RPMDB_INIT
|
|
|
|
|
2008-11-21 23:48:27 +08:00
|
|
|
runroot rpm \
|
2011-04-04 16:27:03 +08:00
|
|
|
--noscripts --nodeps --ignorearch --relocate=/usr=/check \
|
2011-04-04 16:39:25 +08:00
|
|
|
-i /data/RPMS/hello-1.0-1.ppc64.rpm
|
2007-08-21 20:52:00 +08:00
|
|
|
],
|
2007-08-30 21:33:15 +08:00
|
|
|
[0])
|
2007-08-21 20:52:00 +08:00
|
|
|
|
|
|
|
AT_CHECK([
|
2008-11-21 23:48:27 +08:00
|
|
|
runroot rpm \
|
2007-08-21 20:52:00 +08:00
|
|
|
-q hello
|
|
|
|
],
|
|
|
|
[0],
|
|
|
|
[hello-1.0-1.ppc64
|
|
|
|
],
|
|
|
|
[ignore])
|
|
|
|
|
|
|
|
|
|
|
|
AT_CHECK([
|
2008-11-21 23:48:27 +08:00
|
|
|
runroot rpm \
|
2007-08-21 20:52:00 +08:00
|
|
|
-ql hello
|
|
|
|
],
|
|
|
|
[0],
|
2011-04-04 16:27:03 +08:00
|
|
|
[/check/local/bin/hello
|
|
|
|
/check/share/doc/hello-1.0
|
|
|
|
/check/share/doc/hello-1.0/FAQ
|
|
|
|
],
|
2007-08-21 20:52:00 +08:00
|
|
|
[ignore])
|
|
|
|
|
|
|
|
AT_CLEANUP
|
2008-12-05 03:23:06 +08:00
|
|
|
|
|
|
|
# ------------------------------
|
|
|
|
AT_SETUP([integer array query])
|
|
|
|
AT_KEYWORDS([query])
|
|
|
|
AT_CHECK([
|
2011-04-01 20:42:47 +08:00
|
|
|
runroot rpm \
|
2008-12-05 03:23:06 +08:00
|
|
|
--queryformat="[[%{filemodes}\n]]" \
|
2011-04-01 20:42:47 +08:00
|
|
|
-qp /data/RPMS/hello-1.0-1.i386.rpm
|
2008-12-05 03:23:06 +08:00
|
|
|
],
|
|
|
|
[0],
|
|
|
|
[33257
|
|
|
|
16877
|
|
|
|
33188
|
|
|
|
],
|
|
|
|
[])
|
|
|
|
AT_CLEANUP
|
|
|
|
|
|
|
|
# ------------------------------
|
|
|
|
AT_SETUP([formatted filesbypkg query])
|
|
|
|
AT_KEYWORDS([query])
|
|
|
|
AT_CHECK([
|
2011-04-01 20:42:47 +08:00
|
|
|
runroot rpm \
|
2008-12-05 03:23:06 +08:00
|
|
|
--queryformat="[[%-10{=NAME} %{FILENAMES}\n]]" \
|
2011-04-01 20:42:47 +08:00
|
|
|
-qp /data/RPMS/hello-1.0-1.i386.rpm
|
2008-12-05 03:23:06 +08:00
|
|
|
],
|
|
|
|
[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([
|
2011-04-01 20:42:47 +08:00
|
|
|
runroot rpm \
|
2008-12-05 03:23:06 +08:00
|
|
|
--queryformat="[[%5{longfilesizes:hex}\n]]" \
|
2011-04-01 20:42:47 +08:00
|
|
|
-qp /data/RPMS/hello-1.0-1.i386.rpm
|
2008-12-05 03:23:06 +08:00
|
|
|
],
|
|
|
|
[0],
|
|
|
|
[ b40
|
|
|
|
1000
|
|
|
|
24
|
|
|
|
],
|
|
|
|
[])
|
|
|
|
AT_CLEANUP
|
|
|
|
|
|
|
|
# ------------------------------
|
|
|
|
AT_SETUP([base64 extension query])
|
|
|
|
AT_KEYWORDS([query])
|
|
|
|
AT_CHECK([
|
2011-04-01 20:42:47 +08:00
|
|
|
runroot rpm \
|
2008-12-05 03:23:06 +08:00
|
|
|
--queryformat="%{pkgid:base64}" \
|
2011-04-01 20:42:47 +08:00
|
|
|
-qp /data/RPMS/foo-1.0-1.noarch.rpm
|
2008-12-05 03:23:06 +08:00
|
|
|
],
|
|
|
|
[0],
|
|
|
|
[qt8W635v5FKy1pILrW+0uw==
|
|
|
|
],
|
|
|
|
[])
|
|
|
|
AT_CLEANUP
|
|
|
|
|
|
|
|
# ------------------------------
|
|
|
|
AT_SETUP([integer array perms format query])
|
|
|
|
AT_KEYWORDS([query])
|
|
|
|
AT_CHECK([
|
2011-04-01 20:42:47 +08:00
|
|
|
runroot rpm \
|
2008-12-05 03:23:06 +08:00
|
|
|
--queryformat="[[%{filemodes:perms}\n]]" \
|
2011-04-01 20:42:47 +08:00
|
|
|
-qp /data/RPMS/hello-1.0-1.i386.rpm
|
2008-12-05 03:23:06 +08:00
|
|
|
],
|
|
|
|
[0],
|
|
|
|
[-rwxr-x--x
|
|
|
|
drwxr-xr-x
|
|
|
|
-rw-r--r--
|
|
|
|
],
|
|
|
|
[])
|
|
|
|
AT_CLEANUP
|
|
|
|
|
|
|
|
# ------------------------------
|
|
|
|
AT_SETUP([string array query])
|
|
|
|
AT_KEYWORDS([query])
|
|
|
|
AT_CHECK([
|
2011-04-01 20:42:47 +08:00
|
|
|
runroot rpm \
|
2008-12-05 03:23:06 +08:00
|
|
|
--queryformat="[[%{basenames} ]]" \
|
2011-04-01 20:42:47 +08:00
|
|
|
-qp /data/RPMS/hello-1.0-1.i386.rpm
|
2008-12-05 03:23:06 +08:00
|
|
|
],
|
|
|
|
[0],
|
|
|
|
[hello hello-1.0 FAQ ],
|
|
|
|
[])
|
|
|
|
AT_CLEANUP
|
|
|
|
|
|
|
|
# ------------------------------
|
2008-12-09 20:58:43 +08:00
|
|
|
AT_SETUP([empty string array query])
|
|
|
|
AT_KEYWORDS([query])
|
|
|
|
AT_CHECK([
|
2011-04-01 20:42:47 +08:00
|
|
|
runroot rpm \
|
2008-12-09 20:58:43 +08:00
|
|
|
--queryformat="[[%{basenames}]]" \
|
2011-04-01 20:42:47 +08:00
|
|
|
-qp /data/RPMS/foo-1.0-1.noarch.rpm
|
2008-12-09 20:58:43 +08:00
|
|
|
],
|
|
|
|
[0],
|
|
|
|
[],
|
|
|
|
[])
|
|
|
|
AT_CLEANUP
|
|
|
|
|
|
|
|
# ------------------------------
|
|
|
|
AT_SETUP([empty string array extension array format])
|
2008-12-05 03:23:06 +08:00
|
|
|
AT_KEYWORDS([query])
|
|
|
|
AT_CHECK([
|
2011-04-01 20:42:47 +08:00
|
|
|
runroot rpm \
|
2008-12-05 03:23:06 +08:00
|
|
|
--queryformat="[[%{filenames}]]" \
|
2011-04-01 20:42:47 +08:00
|
|
|
-qp /data/RPMS/foo-1.0-1.noarch.rpm
|
2008-12-05 03:23:06 +08:00
|
|
|
],
|
|
|
|
[0],
|
2008-12-09 20:58:43 +08:00
|
|
|
[],
|
2008-12-05 03:23:06 +08:00
|
|
|
[])
|
|
|
|
AT_CLEANUP
|
|
|
|
|
|
|
|
# ------------------------------
|
|
|
|
AT_SETUP([empty string array extension query])
|
|
|
|
AT_KEYWORDS([query])
|
|
|
|
AT_CHECK([
|
2011-04-01 20:42:47 +08:00
|
|
|
runroot rpm \
|
2008-12-05 03:23:06 +08:00
|
|
|
--queryformat="%{filenames}" \
|
2011-04-01 20:42:47 +08:00
|
|
|
-qp /data/RPMS/foo-1.0-1.noarch.rpm
|
2008-12-05 03:23:06 +08:00
|
|
|
],
|
|
|
|
[0],
|
|
|
|
[(none)],
|
|
|
|
[])
|
|
|
|
AT_CLEANUP
|
|
|
|
|
|
|
|
# ------------------------------
|
|
|
|
AT_SETUP([different sizes arrays query])
|
|
|
|
AT_KEYWORDS([query])
|
|
|
|
AT_CHECK([
|
2011-04-01 20:42:47 +08:00
|
|
|
runroot rpm \
|
2008-12-05 03:23:06 +08:00
|
|
|
--queryformat="[[%{basenames} %{changelogname}]]" \
|
2011-04-01 20:42:47 +08:00
|
|
|
-qp /data/RPMS/hello-1.0-1.i386.rpm
|
2008-12-05 03:23:06 +08:00
|
|
|
],
|
|
|
|
[0],
|
|
|
|
[],
|
|
|
|
[error: incorrect format: array iterator used with different sized arrays
|
|
|
|
])
|
|
|
|
AT_CLEANUP
|
|
|
|
|
|
|
|
# ------------------------------
|
|
|
|
AT_SETUP([non-existent string tag])
|
|
|
|
AT_KEYWORDS([query])
|
|
|
|
AT_CHECK([
|
2011-04-01 20:42:47 +08:00
|
|
|
runroot rpm \
|
2008-12-05 03:23:06 +08:00
|
|
|
--queryformat="%{vendor}" \
|
2011-04-01 20:42:47 +08:00
|
|
|
-qp /data/RPMS/foo-1.0-1.noarch.rpm
|
2008-12-05 03:23:06 +08:00
|
|
|
],
|
|
|
|
[0],
|
|
|
|
[(none)],
|
|
|
|
[])
|
|
|
|
AT_CLEANUP
|
|
|
|
|
|
|
|
# ------------------------------
|
|
|
|
AT_SETUP([non-existent integer tag query])
|
|
|
|
AT_KEYWORDS([query])
|
|
|
|
AT_CHECK([
|
2011-04-01 20:42:47 +08:00
|
|
|
runroot rpm \
|
2008-12-05 03:23:06 +08:00
|
|
|
--queryformat="%{installcolor}" \
|
2011-04-01 20:42:47 +08:00
|
|
|
-qp /data/RPMS/foo-1.0-1.noarch.rpm
|
2008-12-05 03:23:06 +08:00
|
|
|
],
|
|
|
|
[0],
|
|
|
|
[(none)],
|
|
|
|
[])
|
|
|
|
AT_CLEANUP
|
|
|
|
|
|
|
|
# ------------------------------
|
|
|
|
AT_SETUP([conditional queryformat])
|
|
|
|
AT_KEYWORDS([query])
|
|
|
|
AT_CHECK([
|
2011-04-01 20:42:47 +08:00
|
|
|
runroot rpm \
|
2008-12-05 03:23:06 +08:00
|
|
|
--queryformat="%|name?{%{name}}:{no}| %|installtime?{%{installtime}}:{(not installed)}|" \
|
2011-04-01 20:42:47 +08:00
|
|
|
-qp /data/RPMS/foo-1.0-1.noarch.rpm
|
2008-12-05 03:23:06 +08:00
|
|
|
],
|
|
|
|
[0],
|
|
|
|
[foo (not installed)],
|
|
|
|
[])
|
|
|
|
AT_CLEANUP
|
|
|
|
|
|
|
|
# ------------------------------
|
|
|
|
AT_SETUP([invalid tag query])
|
|
|
|
AT_KEYWORDS([query])
|
|
|
|
AT_CHECK([
|
2011-04-01 20:42:47 +08:00
|
|
|
runroot rpm \
|
2008-12-05 03:23:06 +08:00
|
|
|
--queryformat="%{notag}" \
|
2011-04-01 20:42:47 +08:00
|
|
|
-qp /data/RPMS/foo-1.0-1.noarch.rpm
|
2008-12-05 03:23:06 +08:00
|
|
|
],
|
|
|
|
[0],
|
|
|
|
[],
|
|
|
|
[error: incorrect format: unknown tag
|
|
|
|
])
|
|
|
|
AT_CLEANUP
|
|
|
|
|
|
|
|
# ------------------------------
|
|
|
|
AT_SETUP([invalid data for format query])
|
|
|
|
AT_KEYWORDS([query])
|
|
|
|
AT_CHECK([
|
2011-04-01 20:42:47 +08:00
|
|
|
runroot rpm \
|
2008-12-05 03:23:06 +08:00
|
|
|
--queryformat="%{name:depflags}" \
|
2011-04-01 20:42:47 +08:00
|
|
|
-qp /data/RPMS/foo-1.0-1.noarch.rpm
|
2008-12-05 03:23:06 +08:00
|
|
|
],
|
|
|
|
[0],
|
|
|
|
[(not a number)],
|
|
|
|
[])
|
|
|
|
AT_CLEANUP
|