Add testcase for %ghost shared with a real file
authorPanu Matilainen <pmatilai@redhat.com>
Wed, 30 Jan 2013 11:52:23 +0000 (13:52 +0200)
committerPanu Matilainen <pmatilai@redhat.com>
Wed, 30 Jan 2013 12:33:05 +0000 (14:33 +0200)
- Further parametrize conflicttest.spec to allow for different attributes
- Verify that the real file gets created without conflicts, that
  it doesn't get removed when ghost is removed and gets normally removed
  on erase.
- This is the case commit a712252392eca75443ca45c10a72873cabec7963 was
  supposed to fix (which it does but with, ahem, "slight" side-effects)
(cherry picked from commit 0485eab2c96173d1e34e4edb3570e58a693e255e)

tests/data/SPECS/conflicttest.spec
tests/rpmconflict.at

index 894b632..bd1dd1c 100644 (file)
@@ -20,4 +20,4 @@ rm -rf $RPM_BUILD_ROOT
 
 %files
 %defattr(-,root,root,-)
-%{_datadir}/my.version
+%{?fileattr} %{_datadir}/my.version
index 385fed1..90d077d 100644 (file)
@@ -393,3 +393,41 @@ runroot rpm -U "${TOPDIR}"/RPMS/noarch/symlinktest-1.0-2.noarch.rpm
 [      file /usr/share/symlinktest from install of symlinktest-1.0-2.noarch conflicts with file from package symlinktest-1.0-1.noarch
 ])
 AT_CLEANUP
+
+# ------------------------------
+# Regular file shared with a ghost, does not conflict
+# Regular file should be created and not removed when the ghost is removed
+AT_SETUP([real file with shared ghost])
+AT_KEYWORDS([install])
+AT_CHECK([
+RPMDB_CLEAR
+RPMDB_INIT
+fn="${RPMTEST}"/usr/share/my.version
+rm -rf "${TOPDIR}" "${fn}"
+
+runroot rpmbuild --quiet -bb \
+    --define "pkg one" --define "filedata one" \
+    /data/SPECS/conflicttest.spec
+runroot rpmbuild --quiet -bb \
+    --define "pkg two" --define "filedata two" --define "fileattr %ghost"\
+    /data/SPECS/conflicttest.spec
+
+test ! -f "${fn}" && echo OK
+runroot rpm -U \
+    "${TOPDIR}"/RPMS/noarch/conflictone-1.0-1.noarch.rpm \
+    "${TOPDIR}"/RPMS/noarch/conflicttwo-1.0-1.noarch.rpm
+cat "${fn}"
+runroot rpm -e conflicttwo
+cat "${fn}"
+runroot rpm -e conflictone
+test ! -f "${fn}" && echo OK
+],
+[],
+[OK
+one
+one
+OK
+],
+[])
+AT_CLEANUP
+