1 # rpmvercmp.at: rpm config file behavior tests
3 AT_BANNER([RPM config file behavior])
5 # Install over existing config file
6 AT_SETUP([install config on existiting file])
11 cf="${RPMTEST}"/etc/my.conf
12 rm -f "${cf}" "${cf}".rpm*
15 runroot rpmbuild --quiet -bb \
17 --define "filedata foo" \
18 /data/SPECS/configtest.spec
20 echo "otherstuff" > "${cf}"
21 runroot rpm -U "${TOPDIR}"/RPMS/noarch/configtest-1.0-1.noarch.rpm
23 runroot rpm -e configtest
30 [warning: /etc/my.conf saved as /etc/my.conf.rpmorig]
34 # Install over existing config file
35 AT_SETUP([install config(noreplace) on existiting file])
36 AT_KEYWORDS([install])
40 cf="${RPMTEST}"/etc/my.conf
41 rm -f "${cf}" "${cf}".rpm*
44 runroot rpmbuild --quiet -bb \
46 --define "filedata foo" \
47 /data/SPECS/configtest.spec
49 echo "otherstuff" > "${cf}"
50 runroot rpm -U "${TOPDIR}"/RPMS/noarch/configtest-1.0-1.noarch.rpm
52 runroot rpm -e configtest
59 [warning: /etc/my.conf saved as /etc/my.conf.rpmorig]
63 # Install over existing identical config file, no backup needed
64 AT_SETUP([install config on existiting identical file])
65 AT_KEYWORDS([install])
69 cf="${RPMTEST}"/etc/my.conf
70 rm -f "${cf}" "${cf}".rpm*
73 runroot rpmbuild --quiet -bb \
75 --define "filedata foo" \
76 /data/SPECS/configtest.spec
79 runroot rpm -U "${TOPDIR}"/RPMS/noarch/configtest-1.0-1.noarch.rpm
81 runroot rpm -e configtest
90 # Erase unmodified config file, no backup here
91 AT_SETUP([erase unchanged config])
92 AT_KEYWORDS([install])
96 cf="${RPMTEST}"/etc/my.conf
97 rm -f "${cf}" "${cf}".rpm*
100 runroot rpmbuild --quiet -bb \
102 --define "filedata foo" \
103 /data/SPECS/configtest.spec
105 runroot rpm -U "${TOPDIR}"/RPMS/noarch/configtest-1.0-1.noarch.rpm
107 runroot rpm -e configtest
116 # Erase modified config file
117 AT_SETUP([erase changed config])
118 AT_KEYWORDS([install])
122 cf="${RPMTEST}"/etc/my.conf
123 rm -f "${cf}" "${cf}".rpm*
126 runroot rpmbuild --quiet -bb \
128 --define "filedata foo" \
129 /data/SPECS/configtest.spec
131 runroot rpm -U "${TOPDIR}"/RPMS/noarch/configtest-1.0-1.noarch.rpm
133 echo "otherstuff" > "${cf}"
134 runroot rpm -e configtest
142 [warning: /etc/my.conf saved as /etc/my.conf.rpmsave]
146 # Erase modified config(noreplace) file
147 AT_SETUP([erase changed config(noreplace)])
148 AT_KEYWORDS([install])
152 cf="${RPMTEST}"/etc/my.conf
153 rm -f "${cf}" "${cf}".rpm*
156 runroot rpmbuild --quiet -bb \
158 --define "filedata foo" \
159 --define "noreplace 1" \
160 /data/SPECS/configtest.spec
162 runroot rpm -U "${TOPDIR}"/RPMS/noarch/configtest-1.0-1.noarch.rpm
164 echo "otherstuff" > "${cf}"
165 runroot rpm -e configtest
173 [warning: /etc/my.conf saved as /etc/my.conf.rpmsave]
177 # ------------------------------
178 # (Build and) upgrade package with config file, no backup here
179 AT_SETUP([upgrade unchanged config])
180 AT_KEYWORDS([install])
184 cf="${RPMTEST}"/etc/my.conf
185 rm -f "${cf}" "${cf}".rpm*
188 for v in "1.0" "2.0"; do
189 runroot rpmbuild --quiet -bb \
191 --define "filedata foo" \
192 /data/SPECS/configtest.spec
195 runroot rpm -U "${TOPDIR}"/RPMS/noarch/configtest-1.0-1.noarch.rpm
197 runroot rpm -U "${TOPDIR}"/RPMS/noarch/configtest-2.0-1.noarch.rpm
207 # ------------------------------
208 # Upgrade package with locally modified config file, unchanged in pkg
209 AT_SETUP([upgrade modified config])
210 AT_KEYWORDS([install])
214 cf="${RPMTEST}"/etc/my.conf
215 rm -f "${cf}" "${cf}".rpm*
218 for v in "1.0" "2.0"; do
219 runroot rpmbuild --quiet -bb \
221 --define "filedata foo" \
222 /data/SPECS/configtest.spec
225 runroot rpm -U "${TOPDIR}"/RPMS/noarch/configtest-1.0-1.noarch.rpm
227 echo "otherstuff" > "${cf}"
229 runroot rpm -U "${TOPDIR}"/RPMS/noarch/configtest-2.0-1.noarch.rpm
240 # ------------------------------
241 # Upgrade package with unmodified config file, changed in pkg
242 AT_SETUP([upgrade changing config])
243 AT_KEYWORDS([install])
247 cf="${RPMTEST}"/etc/my.conf
248 rm -f "${cf}" "${cf}".rpm*
251 for v in "1.0" "2.0"; do
252 runroot rpmbuild --quiet -bb \
254 --define "filedata foo-$v" \
255 /data/SPECS/configtest.spec
258 runroot rpm -U "${TOPDIR}"/RPMS/noarch/configtest-1.0-1.noarch.rpm
260 runroot rpm -U "${TOPDIR}"/RPMS/noarch/configtest-2.0-1.noarch.rpm
270 # ------------------------------
271 # Upgrade package with locally modified config file, changed in pkg
272 AT_SETUP([upgrade changing, modified config 1])
273 AT_KEYWORDS([install])
277 cf="${RPMTEST}"/etc/my.conf
278 rm -f "${cf}" "${cf}".rpm*
281 for v in "1.0" "2.0"; do
282 runroot rpmbuild --quiet -bb \
284 --define "filedata foo-$v" \
285 /data/SPECS/configtest.spec
288 runroot rpm -U "${TOPDIR}"/RPMS/noarch/configtest-1.0-1.noarch.rpm
290 echo "otherstuff" > "${RPMTEST}"/etc/my.conf
292 runroot rpm -U "${TOPDIR}"/RPMS/noarch/configtest-2.0-1.noarch.rpm
302 [warning: /etc/my.conf saved as /etc/my.conf.rpmsave]
306 # ------------------------------
307 # Modified config file matches the content from new package.
308 AT_SETUP([upgrade changing, modified config 2])
309 AT_KEYWORDS([install])
313 cf="${RPMTEST}"/etc/my.conf
314 rm -f "${cf}" "${cf}".rpm*
317 for v in "1.0" "2.0"; do
318 runroot rpmbuild --quiet -bb \
320 --define "filedata foo-$v" \
321 /data/SPECS/configtest.spec
324 runroot rpm -U "${TOPDIR}"/RPMS/noarch/configtest-1.0-1.noarch.rpm
326 echo "foo-2.0" > "${RPMTEST}"/etc/my.conf
328 runroot rpm -U "${TOPDIR}"/RPMS/noarch/configtest-2.0-1.noarch.rpm
339 # config(noreplace) variants of the same cases.
341 # ------------------------------
342 # (Build and) upgrade package with config file, no backup here
343 AT_SETUP([upgrade unchanged config(noreplace)])
344 AT_KEYWORDS([install])
348 cf="${RPMTEST}"/etc/my.conf
349 rm -f "${cf}" "${cf}".rpm*
352 for v in "1.0" "2.0"; do
353 runroot rpmbuild --quiet -bb \
355 --define "filedata foo" \
356 --define "noreplace 1" \
357 /data/SPECS/configtest.spec
360 runroot rpm -U "${TOPDIR}"/RPMS/noarch/configtest-1.0-1.noarch.rpm
362 runroot rpm -U "${TOPDIR}"/RPMS/noarch/configtest-2.0-1.noarch.rpm
373 # ------------------------------
374 # Upgrade package with locally modified config file, unchanged in pkg
375 AT_SETUP([upgrade modified config(noreplace)])
376 AT_KEYWORDS([install])
380 cf="${RPMTEST}"/etc/my.conf
381 rm -f "${cf}" "${cf}".rpm*
384 for v in "1.0" "2.0"; do
385 runroot rpmbuild --quiet -bb \
387 --define "filedata foo" \
388 --define "noreplace 1" \
389 /data/SPECS/configtest.spec
392 runroot rpm -U "${TOPDIR}"/RPMS/noarch/configtest-1.0-1.noarch.rpm
394 echo "otherstuff" > "${cf}"
396 runroot rpm -U "${TOPDIR}"/RPMS/noarch/configtest-2.0-1.noarch.rpm
407 # ------------------------------
408 # Upgrade package with unmodified config file, changed in pkg
409 AT_SETUP([upgrade changing config(noreplace)])
410 AT_KEYWORDS([install])
414 cf="${RPMTEST}"/etc/my.conf
415 rm -f "${cf}" "${cf}".rpm*
418 for v in "1.0" "2.0"; do
419 runroot rpmbuild --quiet -bb \
421 --define "filedata foo-$v" \
422 --define "noreplace 1" \
423 /data/SPECS/configtest.spec
426 runroot rpm -U "${TOPDIR}"/RPMS/noarch/configtest-1.0-1.noarch.rpm
428 runroot rpm -U "${TOPDIR}"/RPMS/noarch/configtest-2.0-1.noarch.rpm
438 # ------------------------------
439 # Upgrade package with locally modified config file, changed in pkg
440 AT_SETUP([upgrade changing, modified config(noreplace) 1])
441 AT_KEYWORDS([install])
445 cf="${RPMTEST}"/etc/my.conf
446 rm -f "${cf}" "${cf}".rpm*
449 for v in "1.0" "2.0"; do
450 runroot rpmbuild --quiet -bb \
452 --define "filedata foo-$v" \
453 --define "noreplace 1" \
454 /data/SPECS/configtest.spec
457 runroot rpm -U "${TOPDIR}"/RPMS/noarch/configtest-1.0-1.noarch.rpm
459 echo "otherstuff" > "${RPMTEST}"/etc/my.conf
461 runroot rpm -U "${TOPDIR}"/RPMS/noarch/configtest-2.0-1.noarch.rpm
471 [warning: /etc/my.conf created as /etc/my.conf.rpmnew]
475 # ------------------------------
476 # Modified config file matches the content from new package.
477 AT_SETUP([upgrade changing, modified config(noreplace) 2])
478 AT_KEYWORDS([install])
482 cf="${RPMTEST}"/etc/my.conf
483 rm -f "${cf}" "${cf}".rpm*
486 for v in "1.0" "2.0"; do
487 runroot rpmbuild --quiet -bb \
489 --define "filedata foo-$v" \
490 --define "noreplace 1" \
491 /data/SPECS/configtest.spec
494 runroot rpm -U "${TOPDIR}"/RPMS/noarch/configtest-1.0-1.noarch.rpm
496 echo "foo-2.0" > "${RPMTEST}"/etc/my.conf
498 runroot rpm -U "${TOPDIR}"/RPMS/noarch/configtest-2.0-1.noarch.rpm
509 # Shared config file variants of the same cases
510 # ------------------------------
511 # (Build and) upgrade package with config file, no backup here
512 AT_SETUP([upgrade unchanged shared config])
513 AT_KEYWORDS([install])
517 cf="${RPMTEST}"/etc/my.conf
518 rm -f "${cf}" "${cf}".rpm*
522 for v in "1.0" "2.0"; do
523 runroot rpmbuild --quiet -bb \
526 --define "filedata foo" \
527 /data/SPECS/configtest.spec
532 "${TOPDIR}"/RPMS/noarch/configtest-A-1.0-1.noarch.rpm \
533 "${TOPDIR}"/RPMS/noarch/configtest-B-1.0-1.noarch.rpm
536 "${TOPDIR}"/RPMS/noarch/configtest-A-2.0-1.noarch.rpm \
537 "${TOPDIR}"/RPMS/noarch/configtest-B-2.0-1.noarch.rpm
548 # ------------------------------
549 # Upgrade package with locally modified config file, unchanged in pkg
550 AT_SETUP([upgrade modified shared config])
551 AT_KEYWORDS([install])
555 cf="${RPMTEST}"/etc/my.conf
556 rm -f "${cf}" "${cf}".rpm*
560 for v in "1.0" "2.0"; do
561 runroot rpmbuild --quiet -bb \
564 --define "filedata foo" \
565 /data/SPECS/configtest.spec
570 "${TOPDIR}"/RPMS/noarch/configtest-A-1.0-1.noarch.rpm \
571 "${TOPDIR}"/RPMS/noarch/configtest-B-1.0-1.noarch.rpm
573 echo "otherstuff" > "${cf}"
576 "${TOPDIR}"/RPMS/noarch/configtest-A-2.0-1.noarch.rpm \
577 "${TOPDIR}"/RPMS/noarch/configtest-B-2.0-1.noarch.rpm
588 # ------------------------------
589 # Upgrade package with unmodified config file, changed in pkg
590 AT_SETUP([upgrade changing shared config])
591 AT_KEYWORDS([install])
595 cf="${RPMTEST}"/etc/my.conf
596 rm -f "${cf}" "${cf}".rpm*
600 for v in "1.0" "2.0"; do
601 runroot rpmbuild --quiet -bb \
604 --define "filedata foo-$v" \
605 /data/SPECS/configtest.spec
610 "${TOPDIR}"/RPMS/noarch/configtest-A-1.0-1.noarch.rpm \
611 "${TOPDIR}"/RPMS/noarch/configtest-B-1.0-1.noarch.rpm
614 "${TOPDIR}"/RPMS/noarch/configtest-A-2.0-1.noarch.rpm \
615 "${TOPDIR}"/RPMS/noarch/configtest-B-2.0-1.noarch.rpm
625 # ------------------------------
626 # Upgrade package with locally modified config file, changed in pkg
627 AT_SETUP([upgrade changing, modified shared config 1])
628 AT_KEYWORDS([install])
632 cf="${RPMTEST}"/etc/my.conf
633 rm -f "${cf}" "${cf}".rpm*
637 for v in "1.0" "2.0"; do
638 runroot rpmbuild --quiet -bb \
641 --define "filedata foo-$v" \
642 /data/SPECS/configtest.spec
647 "${TOPDIR}"/RPMS/noarch/configtest-A-1.0-1.noarch.rpm \
648 "${TOPDIR}"/RPMS/noarch/configtest-B-1.0-1.noarch.rpm
650 echo "otherstuff" > "${RPMTEST}"/etc/my.conf
653 "${TOPDIR}"/RPMS/noarch/configtest-A-2.0-1.noarch.rpm \
654 "${TOPDIR}"/RPMS/noarch/configtest-B-2.0-1.noarch.rpm
664 [warning: /etc/my.conf saved as /etc/my.conf.rpmsave]
668 # ------------------------------
669 # Modified config file matches the content from new package.
670 AT_SETUP([upgrade changing, modified shared config 2])
671 AT_KEYWORDS([install])
675 cf="${RPMTEST}"/etc/my.conf
676 rm -f "${cf}" "${cf}".rpm*
680 for v in "1.0" "2.0"; do
681 runroot rpmbuild --quiet -bb \
684 --define "filedata foo-$v" \
685 /data/SPECS/configtest.spec
690 "${TOPDIR}"/RPMS/noarch/configtest-A-1.0-1.noarch.rpm \
691 "${TOPDIR}"/RPMS/noarch/configtest-B-1.0-1.noarch.rpm
693 echo "foo-2.0" > "${RPMTEST}"/etc/my.conf
696 "${TOPDIR}"/RPMS/noarch/configtest-A-2.0-1.noarch.rpm \
697 "${TOPDIR}"/RPMS/noarch/configtest-B-2.0-1.noarch.rpm
708 # Shared config(noreplace) variants of the more interesting cases
709 # ------------------------------
710 # Upgrade package with locally modified config file, changed in pkg.
711 AT_SETUP([upgrade changing, modified shared config(noreplace) 1])
712 AT_KEYWORDS([install])
716 cf="${RPMTEST}"/etc/my.conf
717 rm -f "${cf}" "${cf}".rpm*
721 for v in "1.0" "2.0"; do
722 runroot rpmbuild --quiet -bb \
725 --define "filedata foo-$v" \
726 --define "noreplace 1" \
727 /data/SPECS/configtest.spec
732 "${TOPDIR}"/RPMS/noarch/configtest-A-1.0-1.noarch.rpm \
733 "${TOPDIR}"/RPMS/noarch/configtest-B-1.0-1.noarch.rpm
735 echo "otherstuff" > "${RPMTEST}"/etc/my.conf
738 "${TOPDIR}"/RPMS/noarch/configtest-A-2.0-1.noarch.rpm \
739 "${TOPDIR}"/RPMS/noarch/configtest-B-2.0-1.noarch.rpm
749 [warning: /etc/my.conf created as /etc/my.conf.rpmnew]
753 # ------------------------------
754 # Modified config file matches the content from new package.
755 AT_SETUP([upgrade changing, modified shared config(noreplace) 2])
756 AT_KEYWORDS([install])
760 cf="${RPMTEST}"/etc/my.conf
761 rm -f "${cf}" "${cf}".rpm*
765 for v in "1.0" "2.0"; do
766 runroot rpmbuild --quiet -bb \
769 --define "filedata foo-$v" \
770 --define "noreplace 1" \
771 /data/SPECS/configtest.spec
776 "${TOPDIR}"/RPMS/noarch/configtest-A-1.0-1.noarch.rpm \
777 "${TOPDIR}"/RPMS/noarch/configtest-B-1.0-1.noarch.rpm
779 echo "foo-2.0" > "${RPMTEST}"/etc/my.conf
782 "${TOPDIR}"/RPMS/noarch/configtest-A-2.0-1.noarch.rpm \
783 "${TOPDIR}"/RPMS/noarch/configtest-B-2.0-1.noarch.rpm