Le vendredi 23 août 2013 à 14:19 -0500, Jon Ciesla a écrit : > > > > On Fri, Aug 23, 2013 at 2:11 PM, Adam Williamson <awilliam@xxxxxxxxxx> > wrote: > On Fri, 2013-08-23 at 13:57 -0500, Jon Ciesla wrote: > > Pretty? Nope. Overkill? Maybe? Reliable? So far. > > Are you sure? Does it work since rpm started throwing file > conflict > errors when you're trying to do this? That seems to be a > fairly recent > innovation, and the changelog indicates this was written in > 2008. Has it > actually been tested recently? > > https://bugzilla.redhat.com/show_bug.cgi?id=447156#c22 > > The discussions I could find about this seem to be down on > doing it in % > pre, so I can't see why %post would be any better. Ref > http://mm3test.fedoraproject.org/hyperkitty/list/devel@xxxxxxxxxxxxxxxxxxxxxxxxx/message/XRQUA2DOHNCFWWP2F7WLFW6L5GHPCERZ/ . > > > No, I've mostly left it as is since written, and adapted to additional > bundled PHP libs as needed. Testing was heavy at the time but has > been mimimal since. Conversely, it's been a long time since I've had > a BZ on any of this, which is not necessarily good evidence that it > works. If you find a better way I'm more than happy to rip it > off^H^H^H^H^H^H^H^H^H^Hlearn. So what we found on irc : Since rpm first create the files for the new rpm that is installed, then remove the files that should be removed still present from old rpm and not in the new one, we fix the issue by waiting until the directory is removed to create the symlink. Looking at https://fedoraproject.org/wiki/Packaging:ScriptletSnippets#Scriptlet_Ordering , we need something after step 10. So in %install : +# remove bundled tinymce +rm -rf %{buildroot}%{roundcubedir}/program/js/tiny_mce + ( + others additions ) Since the only solution we have ( in new rpm ) is step 14, we need to add a %posttrans : +%posttrans +if [ ! -h %{roundcubedir}/program/js/tiny_mce ]; + ln -s /usr/share/tinymce/jscripts/tiny_mce %{roundcubedir}/program/js/tiny_mce +fi %posttrans is kinda garanted to have bash and ln, due to it being run after everything. However, we need to make sure that the symlink is managed by rpm in %files, so we add a %ghost : %config(noreplace) %{_sysconfdir}/httpd/conf.d/roundcubemail.conf %attr(0775,root,apache) %dir /var/log/roundcubemail %config(noreplace) %{_sysconfdir}/logrotate.d/roundcubemail +%ghost %{roundcubedir}/program/js/tiny_mce And if we remove the rpm, we need to remove the symlink : +%preun +if [ $1 -eq 0 ]; then + # remove the symlink we have added in %postrans for migration + rm -f %{roundcubedir}/program/js/tiny_mce +fi Now, this method has a huge problem, we cannot downgrade the package to the bundled version. There is no script that would remove the symlink in time, ie before step 3 of https://fedoraproject.org/wiki/Packaging:ScriptletSnippets#Scriptlet_Ordering Everything that is run is from the new package to install, ie the old rpm that we want to downgrade to. So since we would need to fix the old rpm to have it downgradable, that's a bit hard. Another issue is the %ghost, we cannot really check the symlink is still the same. Maybe there is some better syntax for that. -- Michael Scherer -- devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxxx https://admin.fedoraproject.org/mailman/listinfo/devel Fedora Code of Conduct: http://fedoraproject.org/code-of-conduct