diff options
author | Panu Matilainen <pmatilai@redhat.com> | 2013-02-06 10:08:14 +0200 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2013-02-06 10:26:34 +0200 |
commit | 66c16b16b2b34fcca16fd34b65c70188b20b0210 (patch) | |
tree | 6405add6e1401dfbce96af4274ec7555950ed93c | |
parent | f99bd6589194c3708ee016303bc3829381984e65 (diff) | |
download | rpm-66c16b16b2b34fcca16fd34b65c70188b20b0210.tar.gz |
Add testcase for %ghost %config behavior
- Further parametrize configtest.spec to allow for different attributes
- Verify pre-existing %ghost %config is preserved on install,
that it survives upgrades and is usually left alone on erasure.
- NOTE: The erasure behavior differs from rpm >= 4.11.0.1 in the
strange corner-case of on-disk file content matching the non-packaged
%ghost from build-time. Newer rpm never erases %ghost %config,
but rpm 4.10.x preserves the exact legacy behavior of removing
such "non-modified" ghost on erasure. The newer behavior is far
less quirky but backporting it would require too many changes
for a release like this.
-rw-r--r-- | tests/data/SPECS/configtest.spec | 2 | ||||
-rw-r--r-- | tests/rpmconfig.at | 53 |
2 files changed, 54 insertions, 1 deletions
diff --git a/tests/data/SPECS/configtest.spec b/tests/data/SPECS/configtest.spec index 5ea7cae72..9bf7ba291 100644 --- a/tests/data/SPECS/configtest.spec +++ b/tests/data/SPECS/configtest.spec @@ -20,4 +20,4 @@ rm -rf $RPM_BUILD_ROOT %files %defattr(-,root,root,-) -%config %{_sysconfdir}/my.conf +%{?fileattr} %config %{_sysconfdir}/my.conf diff --git a/tests/rpmconfig.at b/tests/rpmconfig.at index e84afb2d5..c889739ef 100644 --- a/tests/rpmconfig.at +++ b/tests/rpmconfig.at @@ -101,3 +101,56 @@ runroot rpm -U "${TOPDIR}"/RPMS/noarch/configtest-2.0-1.noarch.rpm [warning: /etc/my.conf saved as /etc/my.conf.rpmsave] ) AT_CLEANUP + +--------- +# Test pre-existing and post-install config ghost survival and erasure +AT_SETUP([install/upgrade/erase ghost config]) +AT_KEYWORDS([install]) +AT_CHECK([ +RPMDB_CLEAR +RPMDB_INIT +cf="${RPMTEST}"/etc/my.conf +rm -rf "${cf}" "${cf}".rpm* +rm -rf "${TOPDIR}" + +for v in 1.0 2.0; do + runroot rpmbuild --quiet -bb \ + --define "ver ${v}" \ + --define "filetype file" \ + --define "filedata buster" \ + --define "fileattr %ghost" \ + /data/SPECS/configtest.spec +done + +# pre-existing config, install, erase +test ! -f "${cf}" && echo OK1 +echo "keaton" > "${cf}" +cat "${cf}" +runroot rpm -U "${TOPDIR}"/RPMS/noarch/configtest-1.0-1.noarch.rpm +cat "${cf}" +runroot rpm -e configtest +cat "${cf}" +rm -f "${cf}" + +# post-install config, upgrade, erase +runroot rpm -U "${TOPDIR}"/RPMS/noarch/configtest-1.0-1.noarch.rpm +test ! -f "${cf}" && echo OK2 +echo "buster" > "${cf}" +cat "${cf}" +runroot rpm -U "${TOPDIR}"/RPMS/noarch/configtest-2.0-1.noarch.rpm +cat "${cf}" +runroot rpm -e configtest +test ! -f "${cf}" && echo OK2 +], +[], +[OK1 +keaton +keaton +keaton +OK2 +buster +buster +OK2 +], +[]) +AT_CLEANUP |