msm: consistency for equally ranked keys
[platform/upstream/rpm.git] / tests / rpmconfig2.at
1 #    rpmvercmp.at: rpm config link behavior tests
2
3 AT_BANNER([RPM config symlink behavior])
4
5 # Install over existing config file
6 AT_SETUP([install config on existiting symlink])
7 AT_KEYWORDS([install])
8 AT_CHECK([
9 RPMDB_CLEAR
10 RPMDB_INIT
11 cf="${RPMTEST}"/etc/my.conf
12 rm -rf "${cf}" "${cf}".rpm*
13 rm -rf "${TOPDIR}"
14
15 runroot rpmbuild --quiet -bb \
16         --define "ver 1.0" \
17         --define "filedata foo" \
18         --define "filetype link" \
19           /data/SPECS/configtest.spec
20
21 ln -s "otherstuff" "${cf}"
22 runroot rpm -U "${TOPDIR}"/RPMS/noarch/configtest-1.0-1.noarch.rpm
23 readlink "${cf}"
24 runroot rpm -e configtest
25 readlink "${cf}.rpmorig"
26 ],
27 [0],
28 [foo
29 otherstuff
30 ],
31 [warning: /etc/my.conf saved as /etc/my.conf.rpmorig]
32 )
33 AT_CLEANUP
34
35 # Install over existing identical config link, no backup needed
36 AT_SETUP([install config on existiting identical link])
37 AT_KEYWORDS([install])
38 AT_CHECK([
39 RPMDB_CLEAR
40 RPMDB_INIT
41 cf="${RPMTEST}"/etc/my.conf
42 rm -rf "${cf}" "${cf}".rpm*
43 rm -rf "${TOPDIR}"
44
45 runroot rpmbuild --quiet -bb \
46         --define "ver 1.0" \
47         --define "filedata foo" \
48         --define "filetype link" \
49           /data/SPECS/configtest.spec
50
51 ln -s "foo" "${cf}"
52 readlink "${cf}"
53 runroot rpm -U "${TOPDIR}"/RPMS/noarch/configtest-1.0-1.noarch.rpm
54 readlink "${cf}"
55 runroot rpm -e configtest
56 test ! -L "${cf}"
57 ],
58 [0],
59 [foo
60 foo
61 ],
62 [])
63 AT_CLEANUP
64
65 # Erase unmodified config link, no backup here
66 AT_SETUP([erase unchanged config link])
67 AT_KEYWORDS([install])
68 AT_CHECK([
69 RPMDB_CLEAR
70 RPMDB_INIT
71 cf="${RPMTEST}"/etc/my.conf
72 rm -rf "${cf}" "${cf}".rpm*
73 rm -rf "${TOPDIR}"
74
75 runroot rpmbuild --quiet -bb \
76         --define "ver 1.0" \
77         --define "filedata foo" \
78         --define "filetype link" \
79           /data/SPECS/configtest.spec
80
81 runroot rpm -U "${TOPDIR}"/RPMS/noarch/configtest-1.0-1.noarch.rpm
82 readlink "${cf}"
83 runroot rpm -e configtest
84 test ! -L "${cf}"
85 ],
86 [0],
87 [foo
88 ],
89 [])
90 AT_CLEANUP
91
92 # Erase modified config link
93 AT_SETUP([erase changed config link])
94 AT_KEYWORDS([install])
95 AT_CHECK([
96 RPMDB_CLEAR
97 RPMDB_INIT
98 cf="${RPMTEST}"/etc/my.conf
99 rm -rf "${cf}" "${cf}".rpm*
100 rm -rf "${TOPDIR}"
101
102 runroot rpmbuild --quiet -bb \
103         --define "ver 1.0" \
104         --define "filedata foo" \
105         --define "filetype link" \
106           /data/SPECS/configtest.spec
107
108 runroot rpm -U "${TOPDIR}"/RPMS/noarch/configtest-1.0-1.noarch.rpm
109 readlink "${cf}"
110 ln -sf "otherstuff" "${cf}"
111 runroot rpm -e configtest
112 readlink "${cf}.rpmsave"
113 ],
114 [0],
115 [foo
116 otherstuff
117 ],
118 [warning: /etc/my.conf saved as /etc/my.conf.rpmsave]
119 )
120 AT_CLEANUP
121
122 # ------------------------------
123 # (Build and) upgrade package with config link, no backup here
124 AT_SETUP([upgrade unchanged config link])
125 AT_KEYWORDS([install])
126 AT_CHECK([
127 RPMDB_CLEAR
128 RPMDB_INIT
129 cf="${RPMTEST}"/etc/my.conf
130 rm -rf "${cf}" "${cf}".rpm*
131 rm -rf "${TOPDIR}"
132
133 for v in "1.0" "2.0"; do
134     runroot rpmbuild --quiet -bb \
135         --define "ver $v" \
136         --define "filedata foo" \
137         --define "filetype link" \
138           /data/SPECS/configtest.spec
139 done
140
141 runroot rpm -U "${TOPDIR}"/RPMS/noarch/configtest-1.0-1.noarch.rpm
142 readlink "${cf}"
143 runroot rpm -U "${TOPDIR}"/RPMS/noarch/configtest-2.0-1.noarch.rpm
144 readlink "${cf}"
145 ],
146 [0],
147 [foo
148 foo
149 ],
150 [])
151 AT_CLEANUP
152
153 #
154 # ------------------------------
155 # Upgrade package with modified config link, unchanged in pkg. No backup.
156 AT_SETUP([upgrade modified config link])
157 AT_KEYWORDS([install])
158 AT_CHECK([
159 RPMDB_CLEAR
160 RPMDB_INIT
161 cf="${RPMTEST}"/etc/my.conf
162 rm -rf "${cf}" "${cf}".rpm*
163 rm -rf "${TOPDIR}"
164
165 for v in "1.0" "2.0"; do
166     runroot rpmbuild --quiet -bb \
167         --define "ver $v" \
168         --define "filedata foo" \
169         --define "filetype link" \
170           /data/SPECS/configtest.spec
171 done
172
173 runroot rpm -U "${TOPDIR}"/RPMS/noarch/configtest-1.0-1.noarch.rpm
174 readlink "${cf}"
175 ln -sf "otherstuff" "${cf}"
176 readlink "${cf}"
177 runroot rpm -U "${TOPDIR}"/RPMS/noarch/configtest-2.0-1.noarch.rpm
178 readlink "${cf}"
179 ],
180 [0],
181 [foo
182 otherstuff
183 otherstuff
184 ],
185 [])
186 AT_CLEANUP
187
188 # ------------------------------
189 # Upgrade package with unmodified config link, changed in pkg
190 AT_SETUP([upgrade changing config link])
191 AT_KEYWORDS([install])
192 AT_CHECK([
193 RPMDB_CLEAR
194 RPMDB_INIT
195 cf="${RPMTEST}"/etc/my.conf
196 rm -rf "${cf}" "${cf}".rpm*
197 rm -rf "${TOPDIR}"
198
199 for v in "1.0" "2.0"; do
200     runroot rpmbuild --quiet -bb \
201         --define "ver $v" \
202         --define "filedata foo-$v" \
203         --define "filetype link" \
204           /data/SPECS/configtest.spec
205 done
206
207 runroot rpm -U "${TOPDIR}"/RPMS/noarch/configtest-1.0-1.noarch.rpm
208 readlink "${cf}"
209 runroot rpm -U "${TOPDIR}"/RPMS/noarch/configtest-2.0-1.noarch.rpm
210 readlink "${cf}"
211 ],
212 [0],
213 [foo-1.0
214 foo-2.0
215 ],
216 [])
217 AT_CLEANUP
218
219 # ------------------------------
220 # Upgrade package with locally modified config link, changed in pkg
221 AT_SETUP([upgrade changing, modified config link 1])
222 AT_KEYWORDS([install])
223 AT_CHECK([
224 RPMDB_CLEAR
225 RPMDB_INIT
226 cf="${RPMTEST}"/etc/my.conf
227 rm -rf "${cf}" "${cf}".rpm*
228 rm -rf "${TOPDIR}"
229
230 for v in "1.0" "2.0"; do
231     runroot rpmbuild --quiet -bb \
232         --define "ver $v" \
233         --define "filedata foo-$v" \
234         --define "filetype link" \
235           /data/SPECS/configtest.spec
236 done
237
238 runroot rpm -U "${TOPDIR}"/RPMS/noarch/configtest-1.0-1.noarch.rpm
239 readlink "${cf}"
240 ln -sf "otherstuff" "${cf}"
241 readlink "${cf}"
242 runroot rpm -U "${TOPDIR}"/RPMS/noarch/configtest-2.0-1.noarch.rpm
243 readlink "${cf}"
244 readlink "${cf}.rpmsave"
245 ],
246 [0],
247 [foo-1.0
248 otherstuff
249 foo-2.0
250 otherstuff
251 ],
252 [warning: /etc/my.conf saved as /etc/my.conf.rpmsave]
253 )
254 AT_CLEANUP
255
256 # ------------------------------
257 # Modified config link matches the content from new package.
258 AT_SETUP([upgrade changing, modified config link 2])
259 AT_KEYWORDS([install])
260 AT_CHECK([
261 RPMDB_CLEAR
262 RPMDB_INIT
263 cf="${RPMTEST}"/etc/my.conf
264 rm -rf "${cf}" "${cf}".rpm*
265 rm -rf "${TOPDIR}"
266
267 for v in "1.0" "2.0"; do
268     runroot rpmbuild --quiet -bb \
269         --define "ver $v" \
270         --define "filedata foo-$v" \
271         --define "filetype link" \
272           /data/SPECS/configtest.spec
273 done
274
275 runroot rpm -U "${TOPDIR}"/RPMS/noarch/configtest-1.0-1.noarch.rpm
276 readlink "${cf}"
277 ln -sf "foo-2.0" "${cf}"
278 readlink "${cf}"
279 runroot rpm -U "${TOPDIR}"/RPMS/noarch/configtest-2.0-1.noarch.rpm
280 readlink "${cf}"
281 ],
282 [0],
283 [foo-1.0
284 foo-2.0
285 foo-2.0
286 ],
287 [])
288 AT_CLEANUP
289
290 # config(noreplace) variants of the same cases.
291 #
292 # ------------------------------
293 # (Build and) upgrade package with config file, no backup here
294 AT_SETUP([upgrade unchanged config(noreplace) link])
295 AT_KEYWORDS([install])
296 AT_CHECK([
297 RPMDB_CLEAR
298 RPMDB_INIT
299 cf="${RPMTEST}"/etc/my.conf
300 rm -rf "${cf}" "${cf}".rpm*
301 rm -rf "${TOPDIR}"
302
303 for v in "1.0" "2.0"; do
304     runroot rpmbuild --quiet -bb \
305         --define "ver $v" \
306         --define "filedata foo" \
307         --define "filetype link" \
308         --define "noreplace 1" \
309           /data/SPECS/configtest.spec
310 done
311
312 runroot rpm -U "${TOPDIR}"/RPMS/noarch/configtest-1.0-1.noarch.rpm
313 readlink "${cf}"
314 runroot rpm -U "${TOPDIR}"/RPMS/noarch/configtest-2.0-1.noarch.rpm
315 readlink "${cf}"
316 ],
317 [0],
318 [foo
319 foo
320 ],
321 [])
322 AT_CLEANUP
323
324 #
325 # ------------------------------
326 # Upgrade package with locally modified config file, unchanged in pkg
327 AT_SETUP([upgrade modified config(noreplace) link])
328 AT_KEYWORDS([install])
329 AT_CHECK([
330 RPMDB_CLEAR
331 RPMDB_INIT
332 cf="${RPMTEST}"/etc/my.conf
333 rm -rf "${cf}" "${cf}".rpm*
334 rm -rf "${TOPDIR}"
335
336 for v in "1.0" "2.0"; do
337     runroot rpmbuild --quiet -bb \
338         --define "ver $v" \
339         --define "filedata foo" \
340         --define "filetype link" \
341         --define "noreplace 1" \
342           /data/SPECS/configtest.spec
343 done
344
345 runroot rpm -U "${TOPDIR}"/RPMS/noarch/configtest-1.0-1.noarch.rpm
346 readlink "${cf}"
347 ln -sf "otherstuff" "${cf}"
348 readlink "${cf}"
349 runroot rpm -U "${TOPDIR}"/RPMS/noarch/configtest-2.0-1.noarch.rpm
350 readlink "${cf}"
351 ],
352 [0],
353 [foo
354 otherstuff
355 otherstuff
356 ],
357 [])
358 AT_CLEANUP
359
360 # ------------------------------
361 # Upgrade package with unmodified config file, changed in pkg
362 AT_SETUP([upgrade changing config(noreplace) link])
363 AT_KEYWORDS([install])
364 AT_CHECK([
365 RPMDB_CLEAR
366 RPMDB_INIT
367 cf="${RPMTEST}"/etc/my.conf
368 rm -rf "${cf}" "${cf}".rpm*
369 rm -rf "${TOPDIR}"
370
371 for v in "1.0" "2.0"; do
372     runroot rpmbuild --quiet -bb \
373         --define "ver $v" \
374         --define "filedata foo-$v" \
375         --define "filetype link" \
376         --define "noreplace 1" \
377           /data/SPECS/configtest.spec
378 done
379
380 runroot rpm -U "${TOPDIR}"/RPMS/noarch/configtest-1.0-1.noarch.rpm
381 readlink "${cf}"
382 runroot rpm -U "${TOPDIR}"/RPMS/noarch/configtest-2.0-1.noarch.rpm
383 readlink "${cf}"
384 ],
385 [0],
386 [foo-1.0
387 foo-2.0
388 ],
389 [])
390 AT_CLEANUP
391
392 # ------------------------------
393 # Upgrade package with locally modified config file, changed in pkg
394 AT_SETUP([upgrade changing, modified config(noreplace) link 1])
395 AT_KEYWORDS([install])
396 AT_CHECK([
397 RPMDB_CLEAR
398 RPMDB_INIT
399 cf="${RPMTEST}"/etc/my.conf
400 rm -rf "${cf}" "${cf}".rpm*
401 rm -rf "${TOPDIR}"
402
403 for v in "1.0" "2.0"; do
404     runroot rpmbuild --quiet -bb \
405         --define "ver $v" \
406         --define "filedata foo-$v" \
407         --define "filetype link" \
408         --define "noreplace 1" \
409           /data/SPECS/configtest.spec
410 done
411
412 runroot rpm -U "${TOPDIR}"/RPMS/noarch/configtest-1.0-1.noarch.rpm
413 readlink "${cf}"
414 ln -sf "otherstuff" "${cf}"
415 readlink "${cf}"
416 runroot rpm -U "${TOPDIR}"/RPMS/noarch/configtest-2.0-1.noarch.rpm
417 readlink "${cf}"
418 readlink "${cf}.rpmnew"
419 ],
420 [0],
421 [foo-1.0
422 otherstuff
423 otherstuff
424 foo-2.0
425 ],
426 [warning: /etc/my.conf created as /etc/my.conf.rpmnew]
427 )
428 AT_CLEANUP
429
430 # ------------------------------
431 # Modified config link matches the content from new package.
432 AT_SETUP([upgrade changing, modified config(noreplace) link 2])
433 AT_KEYWORDS([install])
434 AT_CHECK([
435 RPMDB_CLEAR
436 RPMDB_INIT
437 cf="${RPMTEST}"/etc/my.conf
438 rm -rf "${cf}" "${cf}".rpm*
439 rm -rf "${TOPDIR}"
440
441 for v in "1.0" "2.0"; do
442     runroot rpmbuild --quiet -bb \
443         --define "ver $v" \
444         --define "filedata foo-$v" \
445         --define "filetype link" \
446         --define "noreplace 1" \
447           /data/SPECS/configtest.spec
448 done
449
450 runroot rpm -U "${TOPDIR}"/RPMS/noarch/configtest-1.0-1.noarch.rpm
451 readlink "${cf}"
452 ln -sf "foo-2.0" "${cf}"
453 readlink "${cf}"
454 runroot rpm -U "${TOPDIR}"/RPMS/noarch/configtest-2.0-1.noarch.rpm
455 readlink "${cf}"
456 test ! -L "${cf}.rpmnew"
457 ],
458 [0],
459 [foo-1.0
460 foo-2.0
461 foo-2.0
462 ],
463 [])
464 AT_CLEANUP
465
466 # Shared config link variants of the same cases
467 # ------------------------------
468 # (Build and) upgrade package with config file, no backup here
469 AT_SETUP([upgrade unchanged shared config link])
470 AT_KEYWORDS([install])
471 AT_CHECK([
472 RPMDB_CLEAR
473 RPMDB_INIT
474 cf="${RPMTEST}"/etc/my.conf
475 rm -rf "${cf}" "${cf}".rpm*
476 rm -rf "${TOPDIR}"
477
478 for s in "A" "B"; do
479     for v in "1.0" "2.0"; do
480         runroot rpmbuild --quiet -bb \
481             --define "sub $s" \
482             --define "ver $v" \
483             --define "filedata foo" \
484             --define "filetype link" \
485               /data/SPECS/configtest.spec
486     done
487 done
488
489 runroot rpm -U \
490     "${TOPDIR}"/RPMS/noarch/configtest-A-1.0-1.noarch.rpm \
491     "${TOPDIR}"/RPMS/noarch/configtest-B-1.0-1.noarch.rpm
492 readlink "${cf}"
493 runroot rpm -U \
494     "${TOPDIR}"/RPMS/noarch/configtest-A-2.0-1.noarch.rpm \
495     "${TOPDIR}"/RPMS/noarch/configtest-B-2.0-1.noarch.rpm
496 readlink "${cf}"
497 ],
498 [0],
499 [foo
500 foo
501 ],
502 [])
503
504 AT_CLEANUP
505 #
506 # ------------------------------
507 # Upgrade package with locally modified config file, unchanged in pkg
508 AT_SETUP([upgrade modified shared config link])
509 AT_KEYWORDS([install])
510 AT_CHECK([
511 RPMDB_CLEAR
512 RPMDB_INIT
513 cf="${RPMTEST}"/etc/my.conf
514 rm -rf "${cf}" "${cf}".rpm*
515 rm -rf "${TOPDIR}"
516
517 for s in "A" "B"; do
518     for v in "1.0" "2.0"; do
519         runroot rpmbuild --quiet -bb \
520             --define "sub $s" \
521             --define "ver $v" \
522             --define "filedata foo" \
523             --define "filetype link" \
524               /data/SPECS/configtest.spec
525     done
526 done
527
528 runroot rpm -U \
529     "${TOPDIR}"/RPMS/noarch/configtest-A-1.0-1.noarch.rpm \
530     "${TOPDIR}"/RPMS/noarch/configtest-B-1.0-1.noarch.rpm
531 readlink "${cf}"
532 ln -sf "otherstuff" "${cf}"
533 readlink "${cf}"
534 runroot rpm -U \
535     "${TOPDIR}"/RPMS/noarch/configtest-A-2.0-1.noarch.rpm \
536     "${TOPDIR}"/RPMS/noarch/configtest-B-2.0-1.noarch.rpm
537 readlink "${cf}"
538 ],
539 [0],
540 [foo
541 otherstuff
542 otherstuff
543 ],
544 [])
545 AT_CLEANUP
546
547 # ------------------------------
548 # Upgrade package with unmodified config file, changed in pkg
549 AT_SETUP([upgrade changing shared config link])
550 AT_KEYWORDS([install])
551 AT_CHECK([
552 RPMDB_CLEAR
553 RPMDB_INIT
554 cf="${RPMTEST}"/etc/my.conf
555 rm -rf "${cf}" "${cf}".rpm*
556 rm -rf "${TOPDIR}"
557
558 for s in "A" "B"; do
559     for v in "1.0" "2.0"; do
560         runroot rpmbuild --quiet -bb \
561             --define "sub $s" \
562             --define "ver $v" \
563             --define "filedata foo-$v" \
564             --define "filetype link" \
565               /data/SPECS/configtest.spec
566     done
567 done
568
569 runroot rpm -U \
570     "${TOPDIR}"/RPMS/noarch/configtest-A-1.0-1.noarch.rpm \
571     "${TOPDIR}"/RPMS/noarch/configtest-B-1.0-1.noarch.rpm
572 readlink "${cf}"
573 runroot rpm -U \
574     "${TOPDIR}"/RPMS/noarch/configtest-A-2.0-1.noarch.rpm \
575     "${TOPDIR}"/RPMS/noarch/configtest-B-2.0-1.noarch.rpm
576 readlink "${cf}"
577 ],
578 [0],
579 [foo-1.0
580 foo-2.0
581 ],
582 [])
583 AT_CLEANUP
584
585 # ------------------------------
586 # Upgrade package with locally modified config file, changed in pkg
587 AT_SETUP([upgrade changing, modified shared config link 1])
588 AT_KEYWORDS([install])
589 AT_CHECK([
590 RPMDB_CLEAR
591 RPMDB_INIT
592 cf="${RPMTEST}"/etc/my.conf
593 rm -rf "${cf}" "${cf}".rpm*
594 rm -rf "${TOPDIR}"
595
596 for s in "A" "B"; do
597     for v in "1.0" "2.0"; do
598         runroot rpmbuild --quiet -bb \
599             --define "sub $s" \
600             --define "ver $v" \
601             --define "filedata foo-$v" \
602             --define "filetype link" \
603               /data/SPECS/configtest.spec
604     done
605 done
606
607 runroot rpm -U \
608     "${TOPDIR}"/RPMS/noarch/configtest-A-1.0-1.noarch.rpm \
609     "${TOPDIR}"/RPMS/noarch/configtest-B-1.0-1.noarch.rpm
610 readlink "${cf}"
611 ln -sf "otherstuff" "${cf}"
612 readlink "${cf}"
613 runroot rpm -U \
614     "${TOPDIR}"/RPMS/noarch/configtest-A-2.0-1.noarch.rpm \
615     "${TOPDIR}"/RPMS/noarch/configtest-B-2.0-1.noarch.rpm
616 readlink "${cf}"
617 readlink "${cf}.rpmsave"
618 ],
619 [0],
620 [foo-1.0
621 otherstuff
622 foo-2.0
623 otherstuff
624 ],
625 [warning: /etc/my.conf saved as /etc/my.conf.rpmsave]
626 )
627 AT_CLEANUP
628
629 # ------------------------------
630 # Modified config link matches the content from new package.
631 AT_SETUP([upgrade changing, modified shared config link 2])
632 AT_KEYWORDS([install])
633 AT_CHECK([
634 RPMDB_CLEAR
635 RPMDB_INIT
636 cf="${RPMTEST}"/etc/my.conf
637 rm -rf "${cf}" "${cf}".rpm*
638 rm -rf "${TOPDIR}"
639
640 for s in "A" "B"; do
641     for v in "1.0" "2.0"; do
642         runroot rpmbuild --quiet -bb \
643             --define "sub $s" \
644             --define "ver $v" \
645             --define "filedata foo-$v" \
646             --define "filetype link" \
647               /data/SPECS/configtest.spec
648     done
649 done
650
651 runroot rpm -U \
652     "${TOPDIR}"/RPMS/noarch/configtest-A-1.0-1.noarch.rpm \
653     "${TOPDIR}"/RPMS/noarch/configtest-B-1.0-1.noarch.rpm
654 readlink "${cf}"
655 ln -sf "foo-2.0" "${cf}"
656 readlink "${cf}"
657 runroot rpm -U \
658     "${TOPDIR}"/RPMS/noarch/configtest-A-2.0-1.noarch.rpm \
659     "${TOPDIR}"/RPMS/noarch/configtest-B-2.0-1.noarch.rpm
660 readlink "${cf}"
661 ],
662 [0],
663 [foo-1.0
664 foo-2.0
665 foo-2.0
666 ],
667 [])
668 AT_CLEANUP
669
670 # Shared config(noreplace) variants of the more interesting cases
671 # ------------------------------
672 # Upgrade package with locally modified config file, changed in pkg.
673 AT_SETUP([upgrade changing, modified shared config(noreplace) link 1])
674 AT_KEYWORDS([install])
675 AT_CHECK([
676 RPMDB_CLEAR
677 RPMDB_INIT
678 cf="${RPMTEST}"/etc/my.conf
679 rm -rf "${cf}" "${cf}".rpm*
680 rm -rf "${TOPDIR}"
681
682 for s in "A" "B"; do
683     for v in "1.0" "2.0"; do
684         runroot rpmbuild --quiet -bb \
685             --define "sub $s" \
686             --define "ver $v" \
687             --define "filedata foo-$v" \
688             --define "filetype link" \
689             --define "noreplace 1" \
690               /data/SPECS/configtest.spec
691     done
692 done
693
694 runroot rpm -U \
695     "${TOPDIR}"/RPMS/noarch/configtest-A-1.0-1.noarch.rpm \
696     "${TOPDIR}"/RPMS/noarch/configtest-B-1.0-1.noarch.rpm
697 readlink "${cf}"
698 ln -sf "otherstuff" "${cf}"
699 readlink "${cf}"
700 runroot rpm -U \
701     "${TOPDIR}"/RPMS/noarch/configtest-A-2.0-1.noarch.rpm \
702     "${TOPDIR}"/RPMS/noarch/configtest-B-2.0-1.noarch.rpm
703 readlink "${cf}"
704 readlink "${cf}.rpmnew"
705 ],
706 [0],
707 [foo-1.0
708 otherstuff
709 otherstuff
710 foo-2.0
711 ],
712 [warning: /etc/my.conf created as /etc/my.conf.rpmnew]
713 )
714 AT_CLEANUP
715
716 # ------------------------------
717 # Modified config link matches the content from new package.
718 AT_SETUP([upgrade changing, modified shared config(noreplace) link 2])
719 AT_KEYWORDS([install])
720 AT_CHECK([
721 RPMDB_CLEAR
722 RPMDB_INIT
723 cf="${RPMTEST}"/etc/my.conf
724 rm -rf "${cf}" "${cf}".rpm*
725 rm -rf "${TOPDIR}"
726
727 for s in "A" "B"; do
728     for v in "1.0" "2.0"; do
729         runroot rpmbuild --quiet -bb \
730             --define "sub $s" \
731             --define "ver $v" \
732             --define "filedata foo-$v" \
733             --define "filetype link" \
734             --define "noreplace 1" \
735               /data/SPECS/configtest.spec
736     done
737 done
738
739 runroot rpm -U \
740     "${TOPDIR}"/RPMS/noarch/configtest-A-1.0-1.noarch.rpm \
741     "${TOPDIR}"/RPMS/noarch/configtest-B-1.0-1.noarch.rpm
742 readlink "${cf}"
743 ln -sf "foo-2.0" "${cf}"
744 readlink "${cf}"
745 runroot rpm -U \
746     "${TOPDIR}"/RPMS/noarch/configtest-A-2.0-1.noarch.rpm \
747     "${TOPDIR}"/RPMS/noarch/configtest-B-2.0-1.noarch.rpm
748 readlink "${cf}"
749 test ! -L "${cf}.rpmnew"
750 ],
751 [0],
752 [foo-1.0
753 foo-2.0
754 foo-2.0
755 ],
756 [])
757 AT_CLEANUP