What does 1%{?dist} mean? What does %{?} mean? I didn't find the meaning of this anywhere
Name: hello
Version: 2.8
Release: 1%{?dist}
Summary: The "Hello World" program from GNU
License: GPLv3+
URL: http://ftp.gnu.org/gnu/%{name}
Source0: http://ftp.gnu.org/gnu/%{name}/%{name}-%{version}.tar.gz
BuildRequires: gettext
Requires(post): info
Requires(preun): info
%description
The "Hello World" program, done with all bells and whistles of a proper FOSS project, including configuration, build, internationalization, help files, etc.
%prep
%autosetup
%build
%configure
make %{?_smp_mflags}
The question mark is for conditional evaluation. When a macro has no value rpm leaves the macro tag in place by default. The ?
tells rpm to remove the macro tag if there is no value and substitute the value of the macro if there is one:
$ rpm -E 'foo:%{foo}'$'\n''bar:%{?bar}'
foo:%{foo}
bar:
$ rpm -D'foo foov' -E 'foo:%{foo}'$'\n''bar:%{?bar}'
foo:foov
bar:
$ rpm -D'foo foov' -D'bar barv' -E 'foo:%{foo}'$'\n''bar:%{?bar}'
foo:foov
bar:barv
So, as RahulKrishnanRA says, %{?dist}
says use the distribution tag (rh
, el5
, rf
, etc.) when one exists and an empty string when it doesn't.
Unfortunately, the only documentation link I have about this is not a particularly good one. http://www.rpm.org/wiki/PackagerDocs/ConditionalBuilds and the linked manual page.
The {?dist}
tag is used to mark the distribution revision of a package
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With