Mailinglist Archive: opensuse-packaging (206 mails)

< Previous Next >
Re: [opensuse-packaging] Where do the macros "BUILD_ORIG" and "BUILD_ORIG_ADDON" come from?
On 31/01/11 15:37, Dave Plater wrote:
On 01/31/2011 05:06 PM, Pavol Rusnak wrote:

On 31/01/11 12:52, Cristian Rodríguez wrote:


Use

%{?glib2_gsettings_schema_requires: %glib2_gsettings_schema_requires}

In the spec file.


Isn't %{?glib2_gsettings_schema_requires} enough?



It works in gstreamer and if it ain't broke don't fix it. I'm in favour
of less key presses. In fact jokes aside, the advice is don't use braces
if the macro takes input and use braces otherwise but what is the
purpose of the leading "?"?
Dave P

I'm by no means an expert, but I'm surprised people are packaging
missing this info ... Here's the basics / what I know:

Braces are generally recommended for anything but the most trivial
macros and (possibly) macros with arguments, on their own line.
Define a macro with "%define macro value", use a macro with "%{macro}"
or one of the following:
%{?macro} expands to the value of %macro if %macro is defined, and ""
(empty string) if it isn't.
similarly %{?macro:foo} expands to "foo" if %macro is defined.
and the opposite is %{!?macro:bar} which expands to "bar" if %macro
isn't defined.
These can be nested.

For example I've used
%{?make_install} %{!?make_install:%makeinstall}
which will work if make_install OR makeinstall is defined.

This also should explain the common idiom
%if 0%{?suse_version}
If just "%if %{suse_version}", when trying to build on a non-suse
distro, rpm would complain about an unrecognized macro. If just "%if
%{?suse_version}" was used, rpm would see only %if "" (empty string) and
complain about missing argument to %if.

%{?macro:%macro} is clearly redundant given the above definitions; so in
the above case %{?glib2_gsettings_schema_requires} should be sufficient.
This sounds distro-specific so the leading "?" is a good idea - no
errors on distro's without the macro defined.

Packagers: If you haven't already, at least skim through the interesting
bits of "Maximum RPM" http://www.rpm.org/max-rpm/
and the packager-relevant docs at http://rpm.org/wiki/Docs.
It would help to improve packager-focused documentation ... maybe an rpm
macros / spec file "cheat sheet" could come with the OBS documentation?

Regards,
Tejas
--
To unsubscribe, e-mail: opensuse-packaging+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: opensuse-packaging+help@xxxxxxxxxxxx

< Previous Next >