I have a build support script for building my packages. Now I want to automatically set the Version in my spec files. I use the macro %{auto_version}
for that. In my script I want to invoke rpmbuild -D 'auto_version 1.1' packet.spec
for example.
#!/bin/bash
version=$(version.sh)
#snip
define="'auto_version ${version}'"
build_spec () {
spec=$1
define=$2
#snip
build_output=$(rpmbuild -D "$define" $spec)
# snip
}
build_spec $build_spec "$define"
However this generates the error error: Macro % has illegal name (%define)
I've tried different escaping, quoting and making define
an array, handled with ${define[@]}
.
define="auto_version ${version}"
without the single quotes (though not familiar with RPM; but requiring literal quotes in the value would be very weird indeed).