[mythtv-users] mythv 0.27 test packages (future RPM Fusion)

Richard Shaw hobbes1069 at gmail.com
Fri Sep 20 20:43:48 UTC 2013


On Fri, Sep 20, 2013 at 3:39 PM, Gary Buhrmaster
<gary.buhrmaster at gmail.com>wrote:

> On Fri, Sep 20, 2013 at 8:16 PM, Richard Shaw <hobbes1069 at gmail.com>
> wrote:
> > Ok, yuck... First problem: Broken upgrade path.
> >
> > Because there are files not part of the package in
> /usr/share/mythweb/data,
> > it does not remove the directory upon upgrade, which means the symlink to
> > /usr/lib/mythweb/data fails (actually gets some random number appended
> it).
> >
> > This means I'm going to have to handle both the symlinking and data
> > migration in %post, fun.
>
> It has been some time since I wrote complex spec files, but
> you might be able to do some of the work in the %pre section,
> testing $1 to see if you are upgrading (move the cached
> files elsewhere), and then in %post move them to the new
> locations.  Making it all work right is not at all fun (as I recall).
> I suspect that you are not the first package to have this
> problem, so there should be a documented method to deal
> with this somewhere in the Fedora docs.  Good luck!


Yup, I have a test package but yum/rpm is telling me the data directories
between the two packages conflict... Right now I've got the symbolic link
in %install and then a %pre and %post to migrate the data.

%pre
# If this is an upgrade
if [ $1 -gt 1 ] ; then
    # If data exists and is a directory then we need to migrate it to /var
    if [ -d "%{_datadir}/%{name}/data" ] ; then
        mv %{_datadir}/%{name}/data %{_datadir}/%{name}/_tmp_data
    fi
fi

%post
# If this is an upgrade
if [ $1 -gt 1 ] ; then
    # If there is data to migrate, let's do it
    if [ -e "%{_datadir}/%{name}/_tmp_data" ] ; then
        mv %{_datadir}/%{name}/_tmp_data %{_sharedstatedir}/%{name}/
    fi
fi

Thanks,
Richard
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.mythtv.org/pipermail/mythtv-users/attachments/20130920/aa94672f/attachment.html>


More information about the mythtv-users mailing list