Why is “dir-or-file-in-usr-local” an error rather than a warning

fhsrpmrpmbuildrpmlint

I'm building some rpm packages and checking for standards and style conformance using rpmlint. The packages are specific to systems at my place of work and they won't get pushed upstream. Our packages include a variety of software, including in-house software, patched versions of software from the repositories, and software not available from the official repositories. We install local packages into /usr/local for many reasons:

  • avoids naming conflicts with official packages
  • prevents yum update from clobbering local packages
  • allows local packages to live on separate partition or disk and/or be shared over NFS so that packages and configurations can be shared among hosts
  • allows us to have greater control over packages that are installed from sources outside the official repository, many of which do not conform to the standard installation paths (bin, lib, include, share, etc.)

However, rpmlint gets very complainy when run on a package that installs files to /usr/local. For instance, on a custom build of GNU Hello World, this is what rpmlint -i has to say:

hello.x86_64: E: dir-or-file-in-usr-local /usr/local/hello-2.8/bin/hello
A file in the package is located in /usr/local. It's not permitted for
packages to install files in this directory.

I'm aware of the filesystem hierarchy standard, according to which:

The original idea behind '/usr/local' was to have a separate ('local')
'/usr' directory on every machine besides '/usr', which might be just
mounted read-only from somewhere else. It copies the structure of
'/usr'. These days, '/usr/local' is widely regarded as a good place in
which to keep self-compiled or third-party programs. The /usr/local
hierarchy is for use by the system administrator when installing
software locally. It needs to be safe from being overwritten when the
system software is updated. It may be used for programs and data that
are shareable amongst a group of hosts, but not found in /usr. Locally
installed software must be placed within /usr/local rather than /usr
unless it is being installed to replace or upgrade software in /usr.

We are, in fact, following these standards and installing our local software to /usr/local for just these reasons, so I don't see why there should be anything wrong with using a package manager to install packages to /usr/local. However, I'd also like our packages to be standards-compliant, if for no other reason than consistency among our local packages. So why does rpmlint throw an error for files in /usr/local? Shouldn't this be at the packager's descretion? Can I ignore this error or at least make rpmlint print a warning instead?

Best Answer

rpmlint is a tool to check RPMs against some sort of packaging policy. Its configuration is typically distribution dependant and it checks packages against the particular distribution policy. Checking your own packages is fine as long as this is what you want.

If your policy differs from the distribution policy, you either have to configure rpmlint accordingly, refrain from using it or ignore the specific errors.

The following should do the trick when added to /etc/rpmlint/config or ~/.config/rpmlint (not tested):

addFilter("E: dir-or-file-in-usr-local")

Sources:

Related Question