ros-infrastructure/rosdep — pull request #357 by cottsay (2014-11-08 23:05:46+00:00)
Title: Add support for RPM macros in rosdep keys

This change adds the ability to include RPM macros in rosdep keys.

For example, (https://github.com/ros-infrastructure/rosdep/commit/107150573b6bdbf3bcb9aa12d6b802cb7e9baa11) added the ability to use RPM virtual packages as rosdep keys. An example of such a key is `gcc-multilib`, which has a value of `[gcc, glibc-devel, glibc-devel(x86-32), glibc-static, glibc-static(x86-32)]` in Fedora [1].

The virtual package `glibc-devel(x86-32)` is provided by the 32-bit `glibc-devel` package on both 32 and 64 bit Fedora, allowing us to make architecture-specific rosdep keys.

This key, however, doesn't work properly for Arm, which does not provide any `foo(x86-bar)` packages, but instead `foo(armv7hl-bar)` ones. We can use the RPM macro `%{__isa_name}` to represent `x86` on `x86` machines, and `armv7hl` on `armhf` machines. The rosdep key would then become: `glibc-devel(%{__isa_name}-32)`.

The macro will be expanded immediately before installation verification via `rpm`, and before installation via `yum` and `dnf`.

When the rosdep keys are used in the creation of `.spec` files in Bloom, the macros can be left as-is, and `rpmbuild` will automatically expand them when the binary packages is built.

As with RPM detection, macro expansion is first attempted with the python library and falls back to invoking the `rpm` command to expand the macro from the command line. Unfortunately, `yum` nor `dnf` support RPM macros directly, so `rpm` must be invoked to expand the macro first.

As always, comments are appreciated.

Thanks,

--scott

[1] https://github.com/ros/rosdistro/blob/master/rosdep/base.yaml#L652-L654

Specifically tagging @jpgr87