Sanitize python object -> tag number exception handling
[platform/upstream/rpm.git] / tests / rpmconflict.at
1 #    rpmconflict.at: rpm file conflict tests
2
3 AT_BANNER([RPM file conflicts])
4
5 # ------------------------------
6 # (Build and) install conflicting package (should fail)
7 AT_SETUP([rpm -U to package with file conflict])
8 AT_KEYWORDS([install])
9 AT_CHECK([
10 RPMDB_CLEAR
11 rm -rf "${TOPDIR}"
12
13 for p in "one" "two"; do
14     run rpmbuild --quiet -bb \
15         --define "pkg $p" \
16         --define "filedata $p" \
17           ${RPMDATA}/SPECS/conflicttest.spec
18 done
19
20 runroot rpm -U "${TOPDIR}"/RPMS/noarch/conflictone-1.0-1.noarch.rpm
21 runroot rpm -U "${TOPDIR}"/RPMS/noarch/conflicttwo-1.0-1.noarch.rpm
22 ],
23 [1],
24 [ignore],
25 [ignore])
26 AT_CLEANUP
27
28 # ------------------------------
29 # Install conflicting packages in same transaction (should fail)
30 AT_SETUP([rpm -U two packages with a conflicting file])
31 AT_KEYWORDS([install])
32 AT_CHECK([
33 RPMDB_CLEAR
34
35 runroot rpm -U \
36   "${TOPDIR}"/RPMS/noarch/conflictone-1.0-1.noarch.rpm \
37   "${TOPDIR}"/RPMS/noarch/conflicttwo-1.0-1.noarch.rpm
38 ],
39 [2],
40 [ignore],
41 [ignore])
42 AT_CLEANUP
43
44 # ------------------------------
45 # (Build and) install package with shareable file
46 AT_SETUP([rpm -U package with shareable file])
47 AT_KEYWORDS([install])
48 AT_CHECK([
49 RPMDB_CLEAR
50 rm -rf "${TOPDIR}"
51
52 for p in "one" "two"; do
53     run rpmbuild --quiet -bb \
54         --define "pkg $p" \
55         --define "filedata same_stuff" \
56           ${RPMDATA}/SPECS/conflicttest.spec
57 done
58
59 runroot rpm -U "${TOPDIR}"/RPMS/noarch/conflictone-1.0-1.noarch.rpm
60 runroot rpm -U "${TOPDIR}"/RPMS/noarch/conflicttwo-1.0-1.noarch.rpm
61 ],
62 [0],
63 [ignore],
64 [ignore])
65 AT_CLEANUP
66
67 # ------------------------------
68 # Install packages with shareable file in same transaction
69 AT_SETUP([rpm -U two packages with shareable file])
70 AT_KEYWORDS([install])
71 AT_CHECK([
72 RPMDB_CLEAR
73
74 runroot rpm -U \
75   "${TOPDIR}"/RPMS/noarch/conflictone-1.0-1.noarch.rpm \
76   "${TOPDIR}"/RPMS/noarch/conflicttwo-1.0-1.noarch.rpm
77 ],
78 [0],
79 [ignore],
80 [ignore])
81 AT_CLEANUP
82
83
84 # ------------------------------
85 # Replace directory with symlink, this is expected to fail
86 AT_SETUP([rpm -U replacing directory with symlink])
87 AT_KEYWORDS([install])
88 AT_CHECK([
89 RPMDB_CLEAR
90 rm -rf "${TOPDIR}"
91 rm -rf "${RPMTEST}"/usr/{share,lib}/symlinktest*
92
93 run rpmbuild --quiet -bb \
94     --define "rel 1" --without symlink ${RPMDATA}/SPECS/symlinktest.spec
95 run rpmbuild --quiet -bb \
96     --define "rel 2" --with symlink ${RPMDATA}/SPECS/symlinktest.spec
97
98 runroot rpm -U "${TOPDIR}"/RPMS/noarch/symlinktest-1.0-1.noarch.rpm
99 runroot rpm -U "${TOPDIR}"/RPMS/noarch/symlinktest-1.0-2.noarch.rpm
100 ],
101 [1],
102 [],
103 [error: unpacking of archive failed on file /usr/share/symlinktest: cpio: rename failed - Is a directory
104 ])
105 AT_CLEANUP
106
107 # ------------------------------
108 # Replace symlink with a directory - the upgrade succeeds but leaves an
109 # orphan directory that the symlink now points to. Should verify the
110 # result more carefully...
111 AT_SETUP([rpm -U replacing symlink with directory])
112 AT_KEYWORDS([install])
113 AT_CHECK([
114 RPMDB_CLEAR
115 rm -rf "${TOPDIR}"
116 rm -rf "${RPMTEST}"/usr/{share,lib}/symlinktest*
117
118 run rpmbuild --quiet -bb \
119     --define "rel 1" --with symlink ${RPMDATA}/SPECS/symlinktest.spec
120 run rpmbuild --quiet -bb \
121     --define "rel 2" --without symlink ${RPMDATA}/SPECS/symlinktest.spec
122
123 runroot rpm -U "${TOPDIR}"/RPMS/noarch/symlinktest-1.0-1.noarch.rpm
124 runroot rpm -U "${TOPDIR}"/RPMS/noarch/symlinktest-1.0-2.noarch.rpm
125 ],
126 [0],
127 [],
128 [])
129 AT_CLEANUP