From 35d89f0f3ff118359f1fef1c328570a944e0ddf8 Mon Sep 17 00:00:00 2001 From: Otto Urpelainen Date: Dec 06 2021 16:44:18 +0000 Subject: Recommend avoiding macros in file depenencies When declaring file and directory dependencies, macros like %{_bindir} should be avoided. Values of such macros vary between packages, and if packages requiring and providing 'sometool' use different values, 'Requires: %{_bindir}/sometool' does not work as expected. --- diff --git a/guidelines/modules/ROOT/pages/RPMMacros.adoc b/guidelines/modules/ROOT/pages/RPMMacros.adoc index e4c8342..d5e78a1 100644 --- a/guidelines/modules/ROOT/pages/RPMMacros.adoc +++ b/guidelines/modules/ROOT/pages/RPMMacros.adoc @@ -31,7 +31,7 @@ $ rpm --define "test Hello, World!" --eval "%{test}" Hello, World! .... - +[#macros_installation] == Macros for paths set and used by build systems The macros for build system invocations diff --git a/guidelines/modules/ROOT/pages/index.adoc b/guidelines/modules/ROOT/pages/index.adoc index 44bd669..c8d227a 100644 --- a/guidelines/modules/ROOT/pages/index.adoc +++ b/guidelines/modules/ROOT/pages/index.adoc @@ -841,6 +841,13 @@ to express the dependency on that directory existing, not on any other functionality of any other package that might provide that directory. +When declaring file and directory dependencies, +xref:RPMMacros.adoc#macros_installation[installation path macros] like `+%{_bindir}+` +MUST NOT be used. +`+%{_bindir}+` of the package that provides `+sometool+` +may be different from `+%{_bindir}+` of a package that requires `+sometool+`. +In such case, `+BuildRequires: %{_bindir}/sometool+` does not work as expected. + === Explicit Requires Explicit Requires are Requires added manually by the packager in the spec file.