Bug 129179

Summary: rpmbuild --macros=filename does not read the specified file
Product: [Fedora] Fedora Reporter: Bob Langford <langford>
Component: rpmAssignee: Jeff Johnson <jbj>
Status: CLOSED WORKSFORME QA Contact: Mike McLean <mikem>
Severity: medium Docs Contact:
Priority: medium    
Version: 2CC: bugzilla.redhat.com, nobody+pnasrat
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2004-08-05 13:00:40 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Bob Langford 2004-08-04 19:49:51 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040510

Description of problem:
The --macros=file1:file2:...:fileN option on the rpmbuild command
does not work.  

'rpmbuild --help' provides the following description:
  --macros=<FILE:...>        read <FILE:...> instead of default file(s)

'rpmbuild --usage' lists an option with that syntax as well.

'man rpmbuild' does not list that as an option.

Given the difference, I don't know if the man page is correct, or the
program.


Version-Release number of selected component (if applicable):
RPM 4.3.1

How reproducible:
Always

Steps to Reproduce:
1. Create a file with a macro def in it.  Call it foo
2. Do rpmbuild --macros=foo --showrc > logfile.with
3. Do rpmbuild --showrc > logfile.without

Both log files will be identical
    

Actual Results:  The --macros=foo option had no effect.

Expected Results:  The macro defined in the file should be listed in
the output.

Additional info:

It's considered bad practice to build RPMs as root.  This feature of
rpmbuild would go a long way toward making it easier to build RPMs as
a regular user.

Comment 1 Jeff Johnson 2004-08-05 13:00:40 UTC
Create an 2 line rpmrc file:
    include: /usr/lib/rpm/rpmrc
    macrofiles: /usr/lib/rpm/macros:...:/path/to/your/macros
changing "..." and "/path/to/your" as appropriate.

Invoke rpm using --rcfile /path/to/yout/rpmrc.

Comment 2 Penelope Fudd 2012-12-01 00:04:12 UTC
This doesn't work now (rpm-build-4.8.0-27.el6.x86_64).  

The 'macrofiles:' line in the rpmrc file is being ignored.

The '--macros=foo' command line option works, but replaces the predefined macro list.

The '--showrc' command line option doesn't show macros even though they're working.

I don't see any way to find the predefined macro list, so I used strace and cobbled together some files and glob patterns in order to generate a reasonable --macros=... command line parameter that lets me add my macro file to the end of the normal list of macro files.

Thanks