RPM Community Forums

Mailing List Message of <rpm-users>

Re: rpmbuild and automatic dependencies (symlinks)

From: Jeff Johnson <n3npq@mac.com>
Date: Tue 26 Jul 2011 - 18:36:23 CEST
Message-id: <76D807BD-3090-46C9-A087-6D81C7D9FAC3@mac.com>

On Jul 26, 2011, at 12:15 PM, YuGiOhJCJ Mailing-List wrote:

> Hello,
> I create a RPM package containing this file :
> /etc/mtab -> /proc/mounts
> In fact this is a symlink to '/proc/mounts'.
> So when I want to install this RPM package, there is a dependency :
> # rpm -i fhstree-20090529-1.i686.rpm 
> rpmdb: Build signature doesn't match environment
> error: Failed dependencies:
> 	/proc/mounts is needed by fhstree-20090529-1.i686

There are two significant differences using @rpm5.org code:

	1) Every file depends on its parent directory.
	2) Every symlink depends on its end-point.

The rationale for adding these "synthesized" dependencies (i.e.
you will not see them in Requires: tags) is to assist in
identifying packaging flaws that are otherwise rather difficult
to see.

E.g. "orphan" directories are directories in some path that are not
packaged. All directories in every file path are created in order to
install file content. The reverse operation while erasing isn't symmetric:

	Orphan directories remain after a package is removed.

The goal for the symlink dependency (as you are seeing) is to help
detect dangling symlinks. Your usage case is a bit different because
you are using /proc/mounts which isn't typically packaged.

The recommended fix is this:
	mkdir -p /etc/rpm/sysinfo
	echo "/proc/mounts" > /etc/rpm/sysinfo/Providename
(I believe you can also use Filelinktos instead of Providename if
you wish to separate the types of configurable Provides that you
have, but I haven't checked. Providename will "work", the naming
convention used by RPM is pretty simple to understand:
	1) Remove RPMTAG_ prefix.
	2) Convert to lowercase
	3) Capitalize the first letter to keep the Germans happy ;-)
and the list of available tags (not all of which are pused in /etc/rpm/sysinfo/*)
is available using
	rpm -v --querytags
(-v must precede --querytags) which will also display the data type information.

> A working solution, for the end-user, is adding the '--nodeps' option :
> # rpm -i --nodeps fhstree-20090529-1.i686.rpm
> error: failed to open /etc/mtab: No such file or directory

There are 2 more narrowlytargeted options
that can be used as disablers. There is some sort of macro framework
to do this persistently (but these are per-vendor modifications, I see
no reason to add configurable ways to turn off implementations 7+ years
later, everyone has had more than enough time to either change, or argue
for feature removal, the features were discussed and the consensus was "Do it." years ago)

> I can't create an other package providing '/proc/mounts' file because this file exists only when mounting the '/proc' special partition.

There are ways to package a /proc/mounts path (but /proc has very odd behavior
with stat(2) that isn't typical for what uglix calls "files"), and so
I suggest /etc/rpm/sysinfo/Providename instead.

> So, I would like to create my RPM package containing this symlink but remove the dependencies concerning symlinks.
> I found this for my spec file :
> AutoReqProv: no

There are far more precise solutions (as above) then just removing all dependencies
from a package. AutoReqProv: is as crude as a flint axe, try moving up to the
Bronze Age at least ;-)

> But it doesn't solve my problem (I think 'AutoReqProv: no' just remove the automatic dependencies watching for executable scripts '#!' and binary files dynamic dependencies).

Yes, because the parentdir/linkto dependencies are synthesized from other tags,
not included explicitly as Requires: metadata.

> Is there a way to remove this dependency when building my RPM package?

You can also build rpm without parentdir/linkto dependencies: UNSUPPORTED afaiac, but
you may do as you wish. This issue has been around for years and years ...

73 de Jeff
Received on Tue Jul 26 18:36:29 2011
Driven by Jeff Johnson and the RPM project team.
Hosted by OpenPKG and Ralf S. Engelschall.
Powered by FreeBSD and OpenPKG.