konflux-ci / rpm-lockfile-prototype

GNU General Public License v3.0
3 stars 10 forks source link

$basearch is not supported globally #63

Closed lhh closed 6 days ago

lhh commented 1 month ago

DNF supports using $basearch to represent (effectively) uname -m / architecture in these places:

That is, the following repository is valid for use by dnf from the command line and should work for multi-architecture builds by the rpm-lockfile-prototype generator utility:

[advanced-virt-$basearch-eus-rpms]
name = advanced-virt-$basearch-eus-rpms
baseurl = https://mycoolpackages.com/advanced-virt/20241001/$basearch/os

The DNF command-line utility apparently handles this resolution prior to passing the values to libdnf, so using dnf to install a package with a repo as above works.

As it stands, using a repo like the above causes the rpm-lockfile-protype utility to crash in the following manner:

libdnf._error.Error: Invalid repository id "advanced-virt-$basearch-eus-rpms": invalid character '$' at position 15.

lubomir commented 1 month ago

Adding the variable substitution makes sense and is not difficult, so I'll submit a PR once #61 is merged or dropped (to avoid merge conflict).

Using arch or basearch should be safe, but any variable is going to be problematic, as those come from the host system where the tool is running, and not whatever build environment you are using.

lubomir commented 1 month ago

Fix is proposed in #64. Please check and comment there.