Bundled Flash

Adam Williamson awilliam at redhat.com
Fri Aug 23 21:28:23 UTC 2013


On Fri, 2013-08-23 at 23:15 +0200, Michael Scherer wrote:

> > 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.

Thanks, misc.

So to put this in context: it seems ridiculous we don't have single
canonical recommended method for doing this kind of
directory<->something_else change when it really needs to be done. I
suspect we're going to need to do it a whole lot for the js-unbundling
effort - from what I've seen so far, it's often so ugly as to be
impractical to try and patch a webapp to find a js library it expects to
be inside its tree, outside its tree. There's often PHP which looks for
it as a filesystem path but also code which generates *direct URLs* to
the stuff in the shared js library, for instance, which would be ugly to
try and fix up for the shared library being elsewhere (you'd have to
have an Alias for each webapp just for that case).

So anyway - I think we need some best practice on this. We definitely
need a 'if you absolutely must change a directory into a symlink (or a
file, or the same operations in the other direction), here's how you do
it' snippet set. If folks could chip in with thoughts on misc's approach
to doing this, that'd be great: Panu, do you see any problems? Know a
better way? I tried the giant-lump-of-lua from
https://bugs.launchpad.net/rpm/+bug/633636/comments/3 , but it throws a
bunch of warnings when cleanup of the *old* package tries to remove all
the files that are now no longer there, which is bad, and misc thinks
it's bad in other ways, I believe. There are various other attempts to
do this kind of operation spread through various packages in Fedora and
out - moodle has some, for instance, xmvn has one, there are others I
think that I don't have to hand right now.

And, T.C., we probably need the Web Assets policy to set some
rules/guidelines on how best to achieve unbundling: should we always try
to patch the upstream to find the 'official' location of the shared
resource on Fedora? Should we always do it with symlinks or aliases
where possible? Should we allow either approach depending on
circumstances?

I'd like to unbundle tinymce from roundcubemail and moodle, but it's
probably best to decide 'best practice' first then do it in line with
that.
-- 
Adam Williamson
Fedora QA Community Monkey
IRC: adamw | Twitter: AdamW_Fedora | identi.ca: adamwfedora
http://www.happyassassin.net



More information about the devel mailing list