What is `%setup -q` in RPM spec?

Dacav picture Dacav · Jun 14, 2016 · Viewed 9k times · Source

If you create a .spec file with ViM, the editor will use a skeleton for it. Quite handy!

It bugs me however that the generated %setup macro has this -q flag which I could not find anywhere.

I didn't find any mention on the max-rpm guide page on macros, and does not get expanded by rpmspec: rpmspec --eval '%setup' only returns %setup, and the -p does not change anything. It is not mentioned in other relevant docs also.

With further investigation I noticed that there's plenty of macros which don't get expanded by rpmspec, even if I could find plenty of macros in /usr/lib/rpm (on my Fedora).

So I'm wondering:

  1. What is the -q for?
  2. How come I cannot see all expansions? Am I missing something?
  3. The aforementioned Max RPM guide claims the existence of a --test flag for rpm -b commands. I could see on my system there's no rpm -b, and actually I do all the job with rpmbuild. In rpmbuild there's no --test flag. How do I see the expanded scripts?

Answer

msuchy picture msuchy · Jun 14, 2016

What is the -q for?

See https://docs.fedoraproject.org/en-US/Fedora_Draft_Documentation/0.1/html-single/RPM_Guide/index.html#id366540

It stands for: Run quietly with minimal output.

How come I cannot see all expansions? Am I missing something?

I'm not 100% sure, but %setup is very likely the term and handled by rpm internals. It is the same as %if, which is not expanded as well.

The aforementioned Max RPM guide claims the existence of a --test flag for rpm -b commands. I could see on my system there's no rpm -b, and actually I do all the job with rpmbuild. In rpmbuild there's no --test flag. How do I see the expanded scripts?

The Max RPM is very old. It was written in 2000. And not updated since then. While it is still one of the best and most comprehensive guides. Some things changed. This is one of them. I am not aware of any equivalent of --test. There exist on "rpm --eval" and "rpm --showrc". The last one shows all defined macros on your system.