1 # rpmdb.at: test rpmdb access
3 # Copyright (C) 2007 Ralf Corsépius <corsepiu@fedoraproject.org>
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2 of the License, or
8 # (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software
17 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 AT_BANNER([RPM database access])
21 # ------------------------------
22 # Attempt to initialize a rpmdb
23 AT_SETUP([rpm --initdb])
34 # ------------------------------
35 # Run rpm -qa on an empty rpmdb
37 AT_KEYWORDS([rpmdb query])
47 # ------------------------------
48 # Run rpm -q <package> where <package> exists in the db.
49 AT_SETUP([rpm -q foo])
50 AT_KEYWORDS([rpmdb query])
56 /data/RPMS/foo-1.0-1.noarch.rpm
67 # ------------------------------
68 # Run rpm -q <package>- where <package> exists in the db.
69 AT_SETUP([rpm -q foo-])
70 AT_KEYWORDS([rpmdb query])
76 /data/RPMS/foo-1.0-1.noarch.rpm
82 [package foo- is not installed
87 # ------------------------------
88 # install a noarch package into a local rpmdb without --relocate and --nodeps
89 # * Should always succeed
90 AT_SETUP([rpm -i *.noarch.rpm])
91 AT_KEYWORDS([rpmdb install])
98 /data/RPMS/foo-1.0-1.noarch.rpm
104 # ------------------------------
105 # reinstall a noarch package (with no files)
106 AT_SETUP([rpm -U --replacepkgs])
107 AT_KEYWORDS([rpmdb install])
113 tpkg="/data/RPMS/foo-1.0-1.noarch.rpm"
115 runroot rpm -i "${tpkg}" &&
116 runroot rpm -U --replacepkgs "${tpkg}" &&
126 # ------------------------------
127 # install a package into a local rpmdb
128 # * Shall only work with relocation
129 # * Use --ignorearch because we don't know the arch
130 AT_SETUP([rpm -i --relocate=.. *.i386.rpm])
131 AT_KEYWORDS([rpmdb install])
137 --noscripts --nodeps --ignorearch --relocate=/usr=/check \
138 /data/RPMS/hello-1.0-1.i386.rpm
145 # ------------------------------
146 # install a package into a local rpmdb
147 # * Shall only work with relocation
148 # * Use --ignorearch because we don't know the arch
149 AT_SETUP([rpm -i --relocate=.. *.ppc64.rpm])
150 AT_KEYWORDS([rpmdb install])
156 --noscripts --nodeps --ignorearch --relocate=/usr=/check \
157 /data/RPMS/hello-1.0-1.ppc64.rpm
165 # ------------------------------
166 # Install and verify status
167 AT_SETUP([rpm -U and verify status])
168 AT_KEYWORDS([install rpmdb query])
174 runroot rpmbuild --quiet -bb \
175 --define "pkg status" \
176 --define "filedata same_stuff" \
177 /data/SPECS/conflicttest.spec
179 runroot rpm -U "${TOPDIR}"/RPMS/noarch/conflictstatus-1.0-1.noarch.rpm
180 runroot rpm -qls conflictstatus
183 [normal /usr/share/my.version
188 # ------------------------------
189 # Install and verify status
190 AT_SETUP([rpm -U with _install_lang and verify status])
191 AT_KEYWORDS([install rpmdb query])
197 runroot rpmbuild --quiet -bb \
198 /data/SPECS/flangtest.spec
200 runroot rpm -U --define "_install_langs de:fi" "${TOPDIR}"/RPMS/noarch/flangtest-1.0-1.noarch.rpm
201 runroot rpm -qls flangtest
204 [normal /usr/share/flangtest/de.txt
205 not installed /usr/share/flangtest/en.txt
206 normal /usr/share/flangtest/fi.txt
207 normal /usr/share/flangtest/none.txt
208 not installed /usr/share/flangtest/pl.txt
213 # ------------------------------
214 # Install and verify files exist on disk
215 AT_SETUP([rpm -U and verify files on disk])
216 AT_KEYWORDS([install rpmdb])
221 rm -rf "${RPMTEST}"/opt/*
223 runroot rpmbuild --quiet -bb /data/SPECS/selfconflict.spec
224 runroot rpm -U "${TOPDIR}"/RPMS/noarch/selfconflict-1.0-1.noarch.rpm
225 find "${RPMTEST}"/opt | wc -l
233 # ------------------------------
234 # Install, erase and oerify files removed from disk
235 # Note /opt is not owned by the pkg so it gets left behind
236 AT_SETUP([rpm -e and verify files removed])
237 AT_KEYWORDS([install rpmdb])
242 rm -rf "${RPMTEST}"/opt/*
244 runroot rpmbuild --quiet -bb /data/SPECS/selfconflict.spec
245 runroot rpm -U "${TOPDIR}"/RPMS/noarch/selfconflict-1.0-1.noarch.rpm
246 runroot rpm -e selfconflict
247 find "${RPMTEST}"/opt | wc -l