[Fedora-packaging] resolving rpmlint absolute symlinks issue

Paul Howarth paul at city-fan.org
Sat Aug 16 06:52:03 UTC 2008


On Sat, 16 Aug 2008 13:46:50 +1000
David Timms <dtimms at iinet.net.au> wrote:

> Paul Howarth wrote:
> > David Timms wrote:
> >> Tom spot Callaway wrote:
> >>> On Fri, 15 Aug 2008 08:11:11 +1000
> >>> David Timms <dtimms at iinet.net.au> wrote:
> ...
> >>> Instead of doing:
> >>>
> >>> ln -s /usr/lib/python2.5/site-packages/pyvnc2swf/edit.py 
> >>> /usr/bin/vnc2swf-edit
> >>>
> >>> You do a relative link, like this:
> >>>
> >>> cd /usr/lib/python2.5/site-packages/pyvnc2swf/
> >>> ln -s edit.py ../../../../bin/vnc2swf-edit
> >>
> >> OK, that works for my raw file system, but how is it done in a
> >> package ? cd %{buildroot}%{python_sitelib}/pyvnc2swf/
> >> ln -s vnc2swf.py ../../../../bin/vnc2swf
> >>
> >> rpmbuilds fine, but get rpmlint from the other way:
> >>
> >> rpmlint --info pyvnc2swf-0.9.3-4.fc9.noarch.rpm
> >> pyvnc2swf.noarch: W: dangling-relative-symlink /usr/bin/vnc2swf 
> >> vnc2swf.py
> >> The relative symbolic link points nowhere.
> >>
> >> Is it OK to leave with that warning ?
> >> Should it be fixed like Paul shows {with symlinks} in the above
> >> bug ? Or is there another easy fix that doesn't require such
> >> trickery ?
> > 
> > Try this, which is I think what Spot meant:
> > 
> > ln -s ../lib/python2.5/site-packages/pyvnc2swf/vnc2swf.py \
> >     %{buildroot}%{_bindir}/vnc2swf
> > 
> > ln -s ../lib/python2.5/site-packages/pyvnc2swf/edit.py \
> >     %{buildroot}%{_bindir}/vnc2swf-edit
> > 
> > The problem with this is that you can't use the %{python_sitelib}
> > macro to do it cleanly. You could take the relative link right up
> > to the root directory to avoid that pitfall:
> > 
> > ln -s ../..%{python_sitelib}/pyvnc2swf/vnc2swf.py \
> >     %{buildroot}%{_bindir}/vnc2swf
> > 
> > ln -s ../..%{python_sitelib}/pyvnc2swf/edit.py \
> >     %{buildroot}%{_bindir}/vnc2swf-edit
> > 
> > However, this still requires the assumption that %{_bindir} is two 
> > levels down from the root directory, which is why I prefer the
> > approach of using the "symlinks" utility - it requires no such
> > assumptions.
> 
> Thanks again Paul, I missed the fact that I screwed up my reply to
> the wrong list, so I missed your second response until now.
> Meanwhile, I worked out the same that you mention.
> 
> I would prefer to know what the widely used solution to this lint
> issue is, since in looking at some random py* packages in cvs I
> didn't find any packages doing the same {providing a link in bindir
> for a .py script}.

Here's one that uses the "ln -s ../..%{python_sitelib}/..." approach:
http://cvs.fedora.redhat.com/viewcvs/rpms/python-kid/devel/python-kid.spec?view=markup

Another common approach is to use simple wrapper scripts, like this one
for "manhole" from python-twisted-core:

#!/usr/bin/python

# Twisted, the Framework of Your Internet
# Copyright (c) 2001-2004 Twisted Matrix Laboratories.
# See LICENSE for details.


"""This script runs GtkManhole, a client for Twisted.Manhole
"""

### Twisted Preamble
# This makes sure that users don't have to set up their environment
# specially in order to run these programs from bin/.
import sys, os, string
if string.find(os.path.abspath(sys.argv[0]), os.sep+'Twisted') != -1:
    sys.path.insert(0,
os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]), os.pardir,
os.pardir))) ### end of preamble


from twisted.scripts import manhole
manhole.run()


Paul.




More information about the devel mailing list