Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to know the value of built-in macro in RPM?

How do I view the value of these macros in RPM? I can take a guess that %_bindir is /usr/bin, %_tmppath is /tmp, but: how exactly do I view these values and are their values system-dependent?

%_prefix 
%_exec_prefix 
%_bindir 
%_sbindir 
%_libexecdir 
%_datadir 
%_sysconfdir 
%_sharedstatedir 
%_localstatedir 
%_libdir 
%_includedir 
%_oldincludedir
%_infodir 
%_mandir 
/usr 
%{_prefix) 
%{_exec_prefixl/bin 
%{_exec_prefix}/sbin 
%{_exec_prefix}/libexec 
%{_prefixJ/share 
%{_prefix}/etc 
%{_prefixJ/com 
%{_prefix}/var 
%{_exec_prefix}/lib 
%{_prefix}/include 
/usr/include 
%{_prefix}/info 
%{_prefixl/man 
like image 538
Amumu Avatar asked Nov 10 '11 08:11

Amumu


People also ask

Where are RPM macros defined?

Macros may also be automatically included from /usr/lib/rpm/macros. In addition, rpm itself defines numerous macros. To display the current set, add "%dump" to the beginning of any spec file, process with rpm, and examine the output from stderr.

Where is Rpmmacros?

In most Unix shells, ~ is an abbreviation for "your home directory". So ~/. rpmmacros is the file . rpmmacros in your home directory.

What is Rpmbuild in Linux?

rpmbuild is used to build both binary and source software packages. A package consists of an archive of files and meta- data used to install and erase the archive files. The meta-data includes helper scripts, file attributes, and descriptive information about the package.


2 Answers

Use the --eval switch:

$ rpm --eval '%{_rpmdir}'
/usr/src/redhat/RPMS
like image 63
Corey Henderson Avatar answered Oct 23 '22 13:10

Corey Henderson


The --showrc option...

rpm --showrc

...will dump the complete rpmrc to stdout. This will expose all sorts of interest definitions from the innards of RPM. But Corey's answer is better for finding the value of a particular symbol.

like image 35
Codemonk Avatar answered Oct 23 '22 11:10

Codemonk