[CentOS] rpmbuild --define | some rpm sorcerer around?

Johnny Hughes johnny at centos.org
Fri Jun 15 11:24:21 UTC 2018


On 06/09/2018 07:13 AM, Phil Perry wrote:
> On 08/06/18 22:54, lejeczek wrote:
>>
>>
>> On 08/06/18 19:38, Phil Perry wrote:
>>> On 08/06/18 15:54, lejeczek wrote:
>>>> hi
>>>>
>>>> how do you pass vars to rpmbuild for definition? eg
>>>>
>>>> rpmbuild --define \'"${_definition2}"\'
>>>>
>>>> I've been fiddling with ways to escape, but none is fricking working..
>>>> I mean, rpmbuild rushes to work(no errors nor failure) so if you try
>>>> just the command line do not believe it, because later as it
>>>> executes %if you will see process does not see these definitions.
>>>>
>>>> many thanks, L
>>>
>>> I'm not sure what you are trying to define above.
>>>
>>> Normal convention where one wishes to define _foobar as "foo" for
>>> example would be:
>>>
>>> rpmbuild --define '_foobar foo'
>>>
>>> or generically
>>>
>>> rpmbuild --define 'SomeVariable SomeValue'
>>>
>>> Hope that helps
>>
>> Try to pass bash var to rpmbuild, eg:
>>
>> $ _def1="_me no"
>> $ rpmbuild --define ${_def1}
>>
>>
> 
> I assume you are doing this in a bash script?
> 
> ${_def1} may need to be quoted as it contains a space.
> 
> But for that I would do the following to make it more readable:
> 
> ME="no"
> rpmbuild --define '_me ${ME}'
> 
> 
> or if ${ME} contains spaces:
> 
> rpmbuild --define '_me "${ME}"'

Most of the time, bash will not replace variables inside single quotes,
so I am not sure that would work.  I use for my mock script:

mock --configdir=$configdir -D "dist $dist" -r $mock_cfg <other options>

It seems not to get confused with double quotes there .. but it puts in
the literal value $dist if I use single quotes.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: OpenPGP digital signature
URL: <http://lists.centos.org/pipermail/centos/attachments/20180615/22037d3b/attachment.sig>


More information about the CentOS mailing list