This shows you the differences between two versions of the page.
Both sides previous revision Previous revision | Next revision Both sides next revision | ||
rpm5 [2012-11-24 17:14] glen [Excluding dependencies] |
rpm5 [2012-11-24 17:39] glen use spec syntax hiliting |
||
---|---|---|---|
Line 27: | Line 27: | ||
The semantics of rpm query option **-f** (**--file**) has changed in rpm 5.x; '''rpm -q -f <file-with-path>''' will **not** resolve all symlinks in queried file's path. So the query (assuming ///usr/src/linux// is a symlink to ///usr/src/linux-A.B.C-R//): | The semantics of rpm query option **-f** (**--file**) has changed in rpm 5.x; '''rpm -q -f <file-with-path>''' will **not** resolve all symlinks in queried file's path. So the query (assuming ///usr/src/linux// is a symlink to ///usr/src/linux-A.B.C-R//): | ||
- | <file>rpm -q -f /usr/src/linux/include/linux/fs.h | + | <code>rpm -q -f /usr/src/linux/include/linux/fs.h |
- | </file> | + | </code> |
That returned //kernel-headers-A.B.C-R.arch.rpm// with old rpm, will return nothing with rpm 5.x. You have to do '''readlink -f''' first, or change to symlinked directory and do relative path query. | That returned //kernel-headers-A.B.C-R.arch.rpm// with old rpm, will return nothing with rpm 5.x. You have to do '''readlink -f''' first, or change to symlinked directory and do relative path query. | ||
Line 59: | Line 60: | ||
==== Loading additional macros in .spec files ==== | ==== Loading additional macros in .spec files ==== | ||
- | With old rpm 4.x several macro files were loaded in .spec files via **#include** directive: | ||
+ | With old rpm 4.x several macro files were loaded in .spec files via **#include** directive: | ||
- | <file>%include /usr/lib/rpm/macros.perl | + | <file rpmspec>%include /usr/lib/rpm/macros.perl |
</file> | </file> | ||
- | In rpm 5.x those macro files have been moved to ''/usr/lib/rpm/macros.d/'' directory, and must be loaded using %{load:} directive. However the old statement still works, as it contains the same code to load the macros. | ||
+ | In rpm 5.x those macro files have been moved to ''/usr/lib/rpm/macros.d/'' directory, and must be loaded using %{load:} directive. However the old statement still works, as it contains the same code to load the macros. | ||
- | <file>%{load:/usr/lib/rpm/macros.d/perl} | + | <file rpmspec>%{load:/usr/lib/rpm/macros.d/perl} |
</file> | </file> | ||
Line 76: | Line 77: | ||
Regexp patterns for '''%%_noauto*%%''' macros changed slightly, and '(' must be escaped now, for example: | Regexp patterns for '''%%_noauto*%%''' macros changed slightly, and '(' must be escaped now, for example: | ||
- | <file> | + | <file rpmspec> |
%define _noautoreq 'perl\\(something::.*\\)' | %define _noautoreq 'perl\\(something::.*\\)' | ||
</file> | </file> | ||
Line 82: | Line 83: | ||
rpm-build-tools [[http://git.pld-linux.org/?p=packages/rpm-build-macros.git;a=commitdiff;h=0a9bb9747529d8f89a74f6db5f317abe1454d8ac|v1.654]] adds handy macros to have same syntax for rpm4/5 .specs: | rpm-build-tools [[http://git.pld-linux.org/?p=packages/rpm-build-macros.git;a=commitdiff;h=0a9bb9747529d8f89a74f6db5f317abe1454d8ac|v1.654]] adds handy macros to have same syntax for rpm4/5 .specs: | ||
- | <code> | + | <code rpmspec> |
BuildRequires: rpmbuild(macros) >= 1.654 | BuildRequires: rpmbuild(macros) >= 1.654 | ||
| | ||
Line 88: | Line 89: | ||
%define _noautoreq_perl Apache::.* | %define _noautoreq_perl Apache::.* | ||
</code> | </code> | ||
+ | |||
==== noarch subpackages ==== | ==== noarch subpackages ==== | ||
Line 94: | Line 96: | ||
To use it within a package, add in the preamble of a subpackage that should be/is architecture independent: | To use it within a package, add in the preamble of a subpackage that should be/is architecture independent: | ||
- | <file> | + | <file rpmspec> |
# noarch subpackages only when building with rpm5 | # noarch subpackages only when building with rpm5 | ||
%if "%{_rpmversion}" >= "5" | %if "%{_rpmversion}" >= "5" |