Commit Graph

1 Commits

Author SHA1 Message Date
Mikhail Gordeev
d2bb16eaa5 brp: Add brp-dupe-bin script
Some packages in Sisyphus install files both under %_prefix and outside
it in subdirectories of /, e. g. in both /bin and /usr/bin, or in /sbin
and /usr/sbin. Those packages must be installable into both unmerged and
merged-usr hierarchies and still work correctly. Most of the packages
can be adapted for use on both hierarchies, if they are rebuilt with
rpm-build with this brp module, with no spec changes required.

This brp module ensures that files under %buildroot/bin and %buildroot/usr/bin
are a copy of each other. If one of them is a symbolic link to another,
it is replaced by a copy of its target. If different files of the same
type are found inside the buildroot, it fails the build.
Likewise for %buildroot/sbin.

This approach has the following advantages:
- The resulting package can be installed on a split-usr hierarchy. We
  cannot use hard links, since our RPM can not auto-replace them while
  installing in an environment where hard link targets are to be on
  different storage sources (aka "split-usr").
- Most of packages in the repo should be installed in both hierarchies
  as is or after rebuild.

The single worst disadvantage is disk space requirements: we store 2
copies in the cpio of product rpms and 2 copies while installed on an
unmerged-usr hierarchy. We hope that this is not too bad: the copied
files themselves are not that big, the cpio in a package file is
compressed, and the eventual upgrade of filesystem < 3 is much less
likely to hit disk space limits.

As for files in /lib*, it is unlikely for packages in the repository to
depend on their particular location, so there is no need to put links or
copies both outside %_prefix and in %_prefix; all the packages with
file conflicts exclusive to merged-usr setups are fixed already.

This module can be safely disabled or removed when we eventually drop
support for unmerged-usr hierarchies.

Link: https://altlinux.org/Usrmerge
2024-03-11 17:00:00 +03:00