Skip to content
ᴀɴᴛᴏɴ ɴᴏᴠᴏᴊɪʟᴏᴠ edited this page Jun 23, 2024 · 6 revisions

Description

Checks build, install, and clean scriptlets for using variables instead of macroses.

Problematic code

%build
gcc $RPM_OPT_FLAGS -o myapp myapp.c

%install
rm -rf %{buildroot}

install -pm myapp $RPM_BUILD_ROOT%{_usr}/

Correct code

%build
gcc %{optflags} -o myapp myapp.c

%install
rm -rf %{buildroot}

install -pm myapp %{buildroot}%{_usr}/

Rationale

Variables contain the same data as macroses, there is no demand to mix them.

Variable Macros
$RPM_BUILD_ROOT %{buildroot}
$RPM_OPT_FLAGS %{optflags}
$RPM_LD_FLAGS %{build_ldflags}
$RPM_DOC_DIR %{_docdir}
$RPM_SOURCE_DIR %{_sourcedir}
$RPM_BUILD_DIR %{_builddir}
$RPM_ARCH %{_arch}
$RPM_OS %{_os}
$RPM_PACKAGE_NAME %{name}
$RPM_PACKAGE_VERSION %{version}
$RPM_PACKAGE_RELEASE %{release}
Clone this wiki locally