vendredi 21 septembre 2018

rpm conditional with substring?

I have a spec file that uses a conditional like

%if "%{pkgname}" = "wobble"
....
%endif

and now need to treat wobble-thing, wobble-otherthing and any other wobble* as satisfying the same conditon. Easy, you'd think.

I can't find any way to do it without giving up on the awfulness that is spec files and preprocessing the file.

Unfortunately preprocessing the file won't fly in this context, it'll upturn a whole build chain that expects to be able to just rpmbuild the spec.

There's lots of undocumented magic in rpm and rpmbuild, like the ${error:blah} and %{expand:..othermacros...} and %global stuff. And even simple relational operations like %if %{value} < 42 don't seem to actually be documented anywhere.

Does anyone know of a string-prefix or string-infix pattern matching operator?

I'm looking for the spec equivalent of bash's if [[ "${VAR}" == *"substring"* ]]; then construct.

Aucun commentaire:

Enregistrer un commentaire