#12 golist should be buildroot prefix aware
Closed 5 years ago by nim. Opened 5 years ago by nim.

The last stage of rpm packaging is copying a clean final copy of all the files that will be shipped in an arborescence under a %{buildroot} prefix.

That is the deployment tree that is operated on to compute the actual requires and provides rpm will generate.

As a consequence of this rpm design we can not change:

  • the files operated on are not in their final place but under a root prefix (%{buildroot}/something instead of something), and
  • absolute symbolic links that point within the target deployment tree are left dangling (they point to something, when /something is still at %{buildroot}/something)

Since golist is used to compute provides and requires for Go sources, and those sources can include absolute symlinks, and will continue to prefer absolute symlinks over relative symlinks because relative symlinks are quite hard to get right, golist needs to learn to work in prefix mode:

  • walk to %{buildroot}/something when encountering a /something symlink in the source tree.
  • and only resolve it to /something when %{buildroot}/something does not exist

Is this not all handled when in BUILD? Or is something changing as to when golist is called?

I don't remember where the files end up (under BUILD or BUILDROOT) and I may have mixed up the rpm variable representing rpm's last stage staging directory.

The basic point is that for Requires/Provides we are not calling golist explicitly, rpm is doing it in generator mode. And the filesystem tree rpm is operating in generator mode is a mirror of the target FHS structure, except / is replaced by a prefix directory.

That breaks absolute symlinks (they are already pointing to / not the prefix directory), so anything that walks the directory structure like golist needs to have special code for computing the correct symlink target in Requires/Provides generator mode. ie “the symlink is pointing to /foo/bar but I’m in prefix mode so the actual target is probably /prefix/foo/bar/

This could probably be made better rpm upstream side by making Requires/Provides on a container that fakes the root properly, but rpm was designed before containers existed and getting the containing logic right is hard .

Ok, I found a workaround. Let’s focus on still broken things for now

Metadata Update from @nim:
- Issue status updated to: Closed (was: Open)

5 years ago

Login to comment on this ticket.

Metadata