On 09/06/18 13:13, 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}"' > >none of of these work for me, like I said earlier I fiddle a bit with it. I was hoping someone could confirm this and then maybe it's a bug?
Jonathan Billings
2018-Jun-11 16:32 UTC
[CentOS] rpmbuild --define | some rpm sorcerer around?
On Mon, Jun 11, 2018 at 05:00:11PM +0100, lejeczek wrote:> none of of these work for me, like I said earlier I fiddle a bit with it. I > was hoping someone could confirm this and then maybe it's a bug?This sounds like you're running into bash quoting issues, not a bug in rpmbuild. Are you running these commands in a shell script? Is it executed from a non-interactive service? -- Jonathan Billings <billings at negate.org>
On 11/06/18 17:32, Jonathan Billings wrote:> On Mon, Jun 11, 2018 at 05:00:11PM +0100, lejeczek wrote: >> none of of these work for me, like I said earlier I fiddle a bit with it. I >> was hoping someone could confirm this and then maybe it's a bug? > > This sounds like you're running into bash quoting issues, not a bug in > rpmbuild. Are you running these commands in a shell script? Is it > executed from a non-interactive service? >Everything in bash script. It actually might be working. What I did was I was looking for a confirmation like this: $ ps -FC rpmbuild --cols 9999 UID PID PPID C SZ RSS PSR STIME TTY TIME CMD appmgr 24855 24835 0 44512 6772 16 17:33 pts/0 00:00:00 rpmbuild --define "_MKL 1" --define "_mic 1" waiting to see those quotation marks(single or double) in there, but.. it turns out that it works actually when ps is not showing them, like: $ ps -FC rpmbuild --cols 9999 UID PID PPID C SZ RSS PSR STIME TTY TIME CMD appmgr 24855 24835 0 44512 6772 16 17:33 pts/0 00:00:00 rpmbuild --define _MKL 1 --define _mic 1 and then vars(in a bash script, all in such a script) are simply declared: ... export _definition1='_MKL 1' rpmbuild --define "${_definition1}" --define "${_definition2}" without! any escaping of quotes.