title: rpm conditional with substring?
body: <p>I have a spec file that uses a conditional like</p>
  
  <pre><code>%if "%{pkgname}" = "wobble"
    Requires: extra-thing
    ....
  %endif
  </code></pre>
  
  <p>and now need to treat <code>wobble-thing</code>, <code>wobble-otherthing</code> and any other <code>wobble*</code> as satisfying the same conditon. Easy, you'd think.</p>
  
  <p>I can't find any way to do it without giving up on the awfulness that is spec files and preprocessing the file.</p>
  
  <p>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.</p>
  
  <p>There's lots of undocumented magic in <code>rpm</code> and <code>rpmbuild</code>, like the <code>${error:blah}</code> and <code>%{expand:..othermacros...}</code> and <code>%global</code> stuff. And even simple relational operations like <code>%if %{value} &lt; 42</code> don't seem to actually be documented anywhere.</p>
  
  <p>Does anyone know of a string-prefix or string-infix pattern matching operator?</p>
  
  <p>I'm looking for the spec equivalent of bash's <code>if [[ "${VAR}" == *"substring"* ]]; then</code> construct.</p>
  
  <p><strong>Edit</strong>: To be clear, the reason I'm not just using shell conditionals is that I need to affect rpm metadata. I thought it was obvious that I'd use shell <code>if</code> if that was an option. I've edited to show more clearly above.</p>
  
  <p><strong>Edit</strong>: To help other people find this, this is about string pattern matching in rpm. Complex conditionals in rpm. Conditional sections in spec files. String prefix, infix or suffix operators and tests in rpmbuild.</p>