#411 Correct source flattening for RPM 4.19.90+ (#2290735)
Closed by mvadkert. Opened by adamwill.
adamwill/standard-test-roles rpm-420-flatten  into  master

Download 411.patch

RPM 4.19.90 (4.20 alpha 1) introduced per-build directories,
which adds one more level to the build directory nesting that
this is trying to flatten out. I can't think of a command that
will work with both RPM versions, and I can't find a way to get
RPM to tell us more directly whether this feature is present
(it seems like the macros used are sufficiently internal that
you can't rpm --eval them), so I can't see a better way to
handle this than a rather awkward version check, unfortunately.

Signed-off-by: Adam Williamson awilliam@redhat.com

I guess another option here would be to parse the spec, figure out the unique build directory name, and check whether it exists...not sure which is better.

PR #412 is another option which tries to do the "check for the per-package build dir" thing.

What about using ansible.builtin.package_facts to get the version directly and then compare the version. More complicated to something so basic, but it's more ansible-y

I considered that, but unless I'm misunderstanding how it works, it gets the info on every package on the system, which seems heavy for this. I was hoping there was an ansible fact for "what is the low-level package manager and what is its version", but it doesn't seem like there is :(

We could use the ansible version compare thing instead of sort -C -V, it's a trade-off of ansible-ness vs. conciseness, I guess. Unfortunately it doesn't remove the need for shell because we'd still need to pipe to cut, unless we find an ansible-y way to do that part too. (the raw output is something like "RPM version 4.19.91", the cut command cuts it down to just the version number).

Checked the implementation and indeed it's not lazy-loaded. Ansible is capable of lazy-loading, but I guess it hasn't been useful to implement it yet. About cut, couldn't we get a more sanitized/machine-readable version from dnf? Or querying the installed package in general.

oh, yeah, I guess we can use rpm -q --queryformat="%{VERSION}\n" rpm...

rebased onto 9ec1f454c6a02983b8fb4678e14c7e742f615a3a

okay, for now tweaked it to still use the shell command but get the rpm version that way, as it does seem a bit more robust. thanks.

rebased onto 9ec1f454c6a02983b8fb4678e14c7e742f615a3a

Panu posted a trick for this at https://github.com/rpm-software-management/rpm/issues/3147#issuecomment-2154192419 , using that is probably our best option; I'll send a new PR for that later.

Can somebody please take a look and merge one of these fixes? this is a clear and significant breakage. #413 is probably the best fix.

Closing in favor of #413

Pull-Request has been closed by mvadkert

Metadata