[lsb-discuss] Adding dependency on "lsb" causes huge downloads

Johannes Meixner jsmeix at suse.de
Fri Feb 26 01:48:30 PST 2010


Hello,

On Feb 25 19:26 Craig Scott wrote (shortened):
> There's another option to consider, one which could be considered
> complimentary rather than an alternative. The LSB already uses RPM as
> it's packaging system, so is it possible to improve/use RPM itself to
> work out package dependencies based on actual files that need to be
> present rather than higher level package names? As Till states, distros
> give differing names to packages, so as an ISV, I can't reliably put
> package names as dependencies in our RPM's. What I can do, however, is
> provide a list of files (typically libraries and/or executables, but
> could also be other things) which must be present in order for my
> package to function properly.

First of all: I am really no RPM expert.

Nevertheless I like to share what I observed right now
on my openSUSE 11.1 workstation - perhaps it might be
useful for further discussion:

-------------------------------------------------------------------
# rpm -q --provides cups
cups = 1.3.9-7.9
-------------------------------------------------------------------

On the first glance it seems our RPM package "cups" provides nothing
(except its own package name) but for example when I do this:

-------------------------------------------------------------------
# for f in $( rpm -q -l cups | grep cupsd ) ; \
  do echo "$f is provided by" ; \
     rpm -q --whatprovides $f ; \
  done

/etc/cups/cupsd.conf is provided by
cups-1.3.9-7.9
/etc/cups/cupsd.conf.default is provided by
cups-1.3.9-7.9
/usr/sbin/cupsd is provided by
cups-1.3.9-7.9
/usr/share/doc/packages/cups/help/man-cupsd.conf.html is provided by
cups-1.3.9-7.9
/usr/share/doc/packages/cups/help/man-cupsd.html is provided by
cups-1.3.9-7.9
/usr/share/doc/packages/cups/help/ref-cupsd-conf.html is provided by
cups-1.3.9-7.9
/usr/share/man/man5/cupsd.conf.5.gz is provided by
cups-1.3.9-7.9
/usr/share/man/man8/cupsd.8.gz is provided by
cups-1.3.9-7.9
/usr/share/man/man8/cupsdisable.8.gz is provided by
cups-1.3.9-7.9
-------------------------------------------------------------------

Now it seems our RPM package "cups" provides all its files.


At least in our Novell/Suse RPM spec files we often use e.g.
   Requires: /bin/sed
   Requires: %{_bindir}/perl
   Requires: %{_bindir}/python

Therefore I assume RPM packages provide exectuables (or at least
files in the usual "bin" directories) but perhaps RPM packages
provide usually even all its files.


-------------------------------------------------------------------
# rpm -q --whatprovides /usr/bin/perl
perl-base-5.10.0-62.10

# rpm -q --provides perl-base | grep bin
[no output]
-------------------------------------------------------------------

What is strange here is that "rpm -q --provides package_name"
does not list what "rpm -q --whatprovides capability" shows
so that I wonder if and how it can work for the various package
installation end-user frontend tools when a package may have e.g.
   Requires: /usr/share/doc/packages/cups/help/man-cupsd.html
that then the package installation tools know that this requirement
can be fulfilled by installing a package named "cups".

Unfortunately the rpm man page is not clear here:
--------------------------------------------------------------------
   --whatprovides CAPABILITY
       Query all packages that provide the CAPABILITY capability.
...
   --provides
       List capabilities this package provides.
--------------------------------------------------------------------

I would be interested in a RPM query option which
lists truthfully _all_ capabilities a package provides.


Extend it to a more general question:

Even "dependencies based on actual files" do not fully solve
the issue because even the actual file locations differ from
Linux distribution to Linux distribution.

For example see above
   Requires: /usr/share/doc/packages/cups/help/man-cupsd.html

This could work for Novell/openSUSE RPM packages because our
documentation directory is /usr/share/doc/packages/<package_name>
but other Linux distributions may use other documentation
directories so that it cannot work there.

As far as I understand RPM it would not help to use
   Requires: %{_defaultdocdir}/%{name}/help/man-cupsd.html
because %{_defaultdocdir}/%{name} would be evaluated to its actual
value during package build time on the package build system
so that later in the binary RPM there is a hardcoded value
   /whatever/path/on/the/build/system/help/man-cupsd.html
which may not match to the documentation directory for the
Linux distribution where the package is to be installed.

In particular RPM macros are not evaluated in RPM queries:
--------------------------------------------------------------------
# rpm -q --whatprovides /usr/bin/perl
perl-base-5.10.0-62.10

# rpm -q --whatprovides '%{_bindir}/perl'
[no output]
--------------------------------------------------------------------

Even if
   Requires: %{_defaultdocdir}/%{name}/help/man-cupsd.html
would be evaluated to its actual value on the system
where the package is to be installed, this would not
solve the issue in all cases because we would need
on all systems where the package is to be installed
such predefined RPM macros for all possible cases.

Therefore I think wildcards like
   Requires: /*/help/man-cupsd.html
would much better work to solve the issue in general.

Of course to be more on the safe side to require actually
the right file this could be further restricted with
additional RPM macros like
   Requires: %{_datadir}/*/help/man-cupsd.html

An issue with wildcards is whether or not wildcards like '*'
should match only within one directory level or to any
number of directories i.e. whether or not it should work
like '*' in the bash or like '.*' (greedy) in grep:
----------------------------------------------------------------
# ls /usr/share/*/help/man-cupsd.html
ls: cannot access /usr/share/*/help/man-cupsd.html:
No such file or directory

# ls /usr/share/*/*/*/help/man-cupsd.html
/usr/share/doc/packages/cups/help/man-cupsd.html

# find /usr/share/ | grep '/.*/help/man-cupsd.html'
/usr/share/doc/packages/cups/help/man-cupsd.html
----------------------------------------------------------------

Perhaps it would be best to have both kind of wildcards:
non-greedy
   Requires: %{_datadir}/*/*/*/help/man-cupsd.html
versus greedy
   Requires: %{_datadir}/.*/help/man-cupsd.html


Kind Regards
Johannes Meixner
-- 
SUSE LINUX Products GmbH, Maxfeldstrasse 5, 90409 Nuernberg, Germany
AG Nuernberg, HRB 16746, GF: Markus Rex


More information about the lsb-discuss mailing list