Bug 3724 - rpm --showrc broken
rpm --showrc broken
Product: Red Hat Linux
Classification: Retired
Component: rpm (Show other bugs)
All Linux
medium Severity medium
: ---
: ---
Assigned To: Jay Turner
Depends On:
  Show dependency treegraph
Reported: 1999-06-25 02:35 EDT by , Seek3r
Modified: 2015-01-07 18:37 EST (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 1999-07-17 15:10:24 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description , Seek3r 1999-06-25 02:35:58 EDT
RedHat 5.2 with RPM 2.x allowed a programmer to type 'rpm
--showrc' and get a nice list of the current parameters
(pasted below).
Redhat 6.0 does not allow this, the command is broken or
changed in a way to stop this function. Why did this happen,
is it going to be fixed, and is there clear and consise
directions on how to produce this list with RPM 3.x?

$rpm --showrc
build arch            : i386
compatible build archs: i686 i586 i486 i386 noarch
build os              : Linux
compatible build os's : Linux
install arch          : i686
install os            : Linux
compatible archs      : i686 i586 i486 i386 noarch
compatible os's       : Linux
builddir              : /usr/src/redhat/BUILD
buildroot             : (not set)
buildshell            : /bin/sh
bzip2bin              : /usr/bin/bzip2
dbpath                : /var/lib/rpm
defaultdocdir         : /usr/doc
distribution          : (not set)
excludedocs           : (not set)
fixperms              : a+rX,g-w,o-w
ftpport               : (not set)
ftpproxy              : (not set)
gzipbin               : /bin/gzip
instchangelog         : 5
langpatt              : (not set)
messagelevel          : (not set)
netsharedpath         : (not set)
optflags              : -O2
packager              : (not set)
pgp_name              : (not set)
pgp_path              : (not set)
provides              : (not set)
require_distribution  : (not set)
require_icon          : (not set)
require_vendor        : (not set)
rpmdir                : /usr/src/redhat/RPMS
rpmfilename           :
signature             : none
sourcedir             : /usr/src/redhat/SOURCES
specdir               : /usr/src/redhat/SPECS
srcrpmdir             : /usr/src/redhat/SRPMS
timecheck             : (not set)
tmppath               : /var/tmp
topdir                : /usr/src/redhat
vendor                : (not set)
Comment 1 Jeff Johnson 1999-06-25 05:23:59 EDT
All the same information is supplied by "rpm --showrc" in rpm-3.0.
However, rpm is now configured using macros. The mapping from
old to new is usally of the form

  OLD:	(set in /usr/lib/rpm/rpmrc /etc/rpmrc ~/.rpmrc
	foo:	somevalue

  NEW:	(set in /usr/lib/rpm/macros /etc/rpm/macros ~/.rpmmacros)
	%_foo	somevalue
Comment 2 , Seek3r 1999-06-25 10:30:59 EDT
The problem I have with the new process is that is doesnt give the
entire path.
I would type the command
rpm --showrc | grep specdir
and get back
specdir               : /usr/src/redhat/SPECS

The new way I type the same command
rpm --showrc | grep sourcedir
and get back
-14: _specdir   %{_topdir}/SPECS

Which I then have to follow %{_topdir}, which then I have to follow
%{_usrsrc} and so on.
This is not efficiant at all.
Is there something else I can do that will give me the same as the
How do I handle backward compatability?
Was there any good reason to break the old rpm --showrc format?
Comment 3 Jeff Johnson 1999-06-25 13:01:59 EDT
What are you trying to do that needs the full path? These
paths are predictably distributed with rpm, and any other
custom configuration could be simply echoed to a flat file
in order to retriev full paths ...
Comment 4 , Seek3r 1999-06-25 16:02:59 EDT
I have a program called RPM Builder (http://www.klabs.net/rpmbuilder).
In it a user will open a tar.gz file and I give them a nice GUI to
fill out, which I create the spec file from. To create the spec file I
need to know their specdir. I also copy the tar.gz file to the
sourcedir and build the RPM and SRPM for the user. In this context
'rpm --showrc' was a great help. I need to know how to find out
these two paths so that RPM Builder can run on systems with rpm 2.x
and rpm 3.x using the same code. Currently I will have to make two
seperate versions.
Comment 5 Jeff Johnson 1999-06-26 09:49:59 EDT
What are you trying to do that needs the full path? These
paths are predictably distributed with rpm, and any other
custom configuration could be simply echoed to a flat file
in order to retriev full paths ...
Comment 6 Jeff Johnson 1999-06-26 11:32:59 EDT
I can think of a couple ways to make this happen and I'll definitely
try to get the output of a macro expansion chain available.

However, here's a problem that you need to consider in rpmbuilder.
Here's the configuration I currently use when building rpm's:
        %_topdir        /J
        %_ntopdir       %{_topdir}/%{name}
        %_builddir      %{_ntopdir}
        %_rpmdir        %{_ntopdir}
        %_sourcedir     %{_ntopdir}
        %_specdir       %{_ntopdir}
        %_srpmdir       %{_ntopdir}
        %_rpmfilename   %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm
so that everything -- inputs, build, and outputs -- associated with a
package foo appears in /J/foo. Because of the use of %{name} in the
%_ntopdir definition, the New Fangled macro configuration with Good
Ol' Style output from "rpm --showrc" would show

        specdir: /J/%{name}

and you are right back in the same place that you started with bug
namely you can't find the location of the specfile because your
doesn't know how to expand a macro.

BTW, when I use "rpm -ts foo.tar.gz" with the above config, I have
the same chicken-egg situation as you are facing in rpmbuilder.

One possibility for you in rpmbuilder is to actually expand the macros
yourself. The overhead (I believe) would be minimal:

  To initialize (you might have to expand the ~ into a path):

  To get the absolute path to file foo.spec, you would then do
        path = rpmGetPath("%{_specdir}", "/foo.spec", NULL);

Both those routines are in librpm.a(macro.o).

Anyways, I dunno how to solve this problem yet. It's not as simple as
just restoring "--showrc" because the manner in which rpm can be
has changed.
Comment 7 , Seek3r 1999-06-26 12:48:59 EDT
Will that work for the old RPM versions as well? I need to find a
solution that will work with both, so that the program wont require
two seperate versions. I wrote RPM Builder in tcl/Tk, and will see if
I can figure out how to load that macro. Im not the best programmer in
the world, I just hack until things work, so I am sure I can figure
out how to run that c code in tcl.
Thanks for your help. I hope you find an easier solution.
Comment 8 , Seek3r 1999-06-29 15:43:59 EDT
Just wondering if there is any new info on this problem?
Comment 9 Jeff Johnson 1999-07-17 15:10:59 EDT
This problem is fixed in rpm-3.0.3 by adding a "--eval" flag that
will display macro expansions for the current configuration.

Note You need to log in before you can comment on or make changes to this bug.