8ca9b298875423f21162c01855171a0f7889df76
[platform/upstream/rpm.git] / tests / rpmdb.at
1 #    rpmdb.at: test rpmdb access
2 #
3 #    Copyright (C) 2007  Ralf Corsépius <corsepiu@fedoraproject.org>
4 #
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.
9 #
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.
14 #
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
18
19
20 # Attempt to initialize a rpmdb
21 AT_SETUP([rpm --initdb])
22 AT_CHECK([
23 DBPATH=`rpm --rcfile=${RPMRC} --eval '%_dbpath'`
24 rm -rf "${abs_builddir}"/testing"${DBPATH}"/*
25 rpm \
26   --rcfile=${RPMRC} \
27   --root="${abs_builddir}"/testing \
28   --initdb],
29 [0],
30 [ignore],
31 [ignore])
32 AT_CLEANUP
33
34 # Run rpm -qa on an empty rpmdb
35 AT_SETUP([rpm -qa])
36 AT_CHECK([
37 DBPATH=`rpm --rcfile=${RPMRC} --eval '%_dbpath'`
38 rm -rf "${abs_builddir}"/testing"${DBPATH}"/*
39 rpm \
40   --rcfile=${RPMRC} \
41   --root="${abs_builddir}"/testing \
42   --initdb
43 rpm \
44   --rcfile=${RPMRC} \
45   --root="${abs_builddir}"/testing \
46   -qa
47 ],
48 [0],
49 [ignore],
50 [ignore])
51 AT_CLEANUP
52
53
54 # install a package into a local rpmdb without --relocate and --nodeps
55 # * Must fail due to missing deps
56 # * Use --ignorearch because we don't know the arch
57 AT_SETUP([rpm -i *.i386.rpm])
58 AT_CHECK([
59 DBPATH=`rpm --rcfile=${RPMRC} --eval '%_dbpath'`
60 rm -rf "${abs_builddir}"/testing"${DBPATH}"/*
61
62 rpm \
63   --rcfile=${RPMRC} \
64   --root="${abs_builddir}"/testing \
65   --initdb
66 ],
67 [0],[ignore],[ignore])
68
69 AT_CHECK([
70 rpm -i \
71   --rcfile=${RPMRC} \
72   --root="${abs_builddir}"/testing \
73   --ignorearch \
74   "${abs_srcdir}"/data/RPMS/hello-1.0-1.i386.rpm
75 ],
76 [1],
77 [ignore],
78 [error: Failed dependencies:
79         /bin/sh is needed by hello-1.0-1.i386
80         libc.so.6 is needed by hello-1.0-1.i386
81         libc.so.6(GLIBC_2.0) is needed by hello-1.0-1.i386
82         rtld(GNU_HASH) is needed by hello-1.0-1.i386
83 ])
84
85 AT_CLEANUP
86
87
88 # install a package into a local rpmdb
89 # * Shall only work with relocation
90 # * Use --ignorearch because we don't know the arch
91 AT_SETUP([rpm -i --relocate=.. *.i386.rpm])
92 AT_CHECK([
93 DBPATH=`rpm --rcfile=${RPMRC} --eval '%_dbpath'`
94 rm -rf "${abs_builddir}"/testing"${DBPATH}"/*
95
96 rpm \
97   --rcfile=${RPMRC} \
98   --root="${abs_builddir}"/testing \
99   --initdb
100 ],
101 [0],[ignore],[ignore])
102
103 AT_CHECK([
104 rpm -i \
105   --rcfile=${RPMRC} \
106   --root="${abs_builddir}"/testing \
107   --nodeps --ignorearch --relocate=/usr="${abs_builddir}"/testing \
108   "${abs_srcdir}"/data/RPMS/hello-1.0-1.i386.rpm
109 ],
110 [0],
111 [ignore],
112 [ignore])
113
114 AT_CLEANUP
115
116
117 # install a package into a local rpmdb
118 # * Shall only work with relocation
119 # * Use --ignorearch because we don't know the arch
120 AT_SETUP([rpm -i --relocate=.. *.ppc64.rpm])
121 AT_CHECK([
122 DBPATH=`rpm --rcfile=${RPMRC} --eval '%_dbpath'`
123 rm -rf "${abs_builddir}"/testing"${DBPATH}"/*
124
125 rpm \
126   --rcfile=${RPMRC} \
127   --root="${abs_builddir}"/testing \
128   --initdb
129 ],
130 [0],[ignore],[ignore])
131
132 AT_CHECK([
133 rpm -i \
134   --rcfile=${RPMRC} \
135   --root="${abs_builddir}"/testing \
136   --nodeps --ignorearch --relocate=/usr="${abs_builddir}"/testing \
137   "${abs_srcdir}"/data/RPMS/hello-1.0-1.ppc64.rpm
138 ],
139 [0],
140 [ignore],
141 [ignore])
142
143 AT_CLEANUP