Bug 147014 - %_topdir macro ignored by buildrpmtree and wipebuildtree
Summary: %_topdir macro ignored by buildrpmtree and wipebuildtree
Alias: None
Product: Fedora
Classification: Fedora
Component: fedora-rpmdevtools   
(Show other bugs)
Version: 3
Hardware: All
OS: Linux
Target Milestone: ---
Assignee: Ville Skyttä
QA Contact: Fedora Extras Quality Assurance
Depends On:
TreeView+ depends on / blocked
Reported: 2005-02-03 18:15 UTC by Ignacio Vazquez-Abrams
Modified: 2007-11-30 22:10 UTC (History)
1 user (show)

Fixed In Version: 0.3.1-1
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2005-02-05 22:55:32 UTC
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
Patch for dirs for buildrpmtree and wipebuildtree (2.03 KB, patch)
2005-02-05 08:32 UTC, Ignacio Vazquez-Abrams
no flags Details | Diff
Revised patch for dirs for buildrpmtree and wipebuildtree (3.80 KB, patch)
2005-02-05 12:54 UTC, Ignacio Vazquez-Abrams
no flags Details | Diff
Improved version (4.18 KB, patch)
2005-02-05 14:46 UTC, Ville Skyttä
no flags Details | Diff

Description Ignacio Vazquez-Abrams 2005-02-03 18:15:58 UTC
While both fedora-buildrpmtree and fedora-wipebuildtree check for the
presence of %_topdir in ~/.rpmmacros, they fail to actually use any
value it may contain and instead blithely assume that ~/rpmbuild is
the correct directory.

Comment 1 Ville Skyttä 2005-02-03 20:03:47 UTC
Right, thanks for the catch.

I am undecided what to do about this.  Perhaps I'd be slightly leaning
towards removing both of these scripts from the package as they fit a
very specific setup currently (albeit one that fits many), deal only
with %{_topdir} not taking %{_srcrpmdir} and friends into account, and
it would be quite a lot of work to make them "universally" applicable.

Warren, WDYT?  IIRC these scripts are sort of "yours" in
fedora-rpmdevtools.  Maybe remove them from fedora-rpmdevtools, and
provide a Wiki doc page instead.

Comment 2 Ignacio Vazquez-Abrams 2005-02-04 22:30:06 UTC
FWIW, you can use 'rpm --showrc | grep -- "-14: _topdir" | cut -b14-'
to get the current value of %_topdir.

Comment 3 Ville Skyttä 2005-02-04 22:39:02 UTC
Better to just do a "rpm --eval '%{_topdir}'", I think.  But that's
not the issue.

Comment 4 Warren Togami 2005-02-05 01:56:20 UTC
I would prefer to keep both scripts in the package with this bugfix. 
They are useful as both teaching tools and quick package
testing/building on any box.

Comment 5 Ignacio Vazquez-Abrams 2005-02-05 08:32:38 UTC
Created attachment 110690 [details]
Patch for dirs for buildrpmtree and wipebuildtree

How about this patch?

Comment 6 Ville Skyttä 2005-02-05 10:49:32 UTC
wipebuildtree: it still checks for hardcoded "rpmbuild" and "redhat"
dirs and bails out in case of no match.  Shouldn't all the tests from
it just be removed; just go ahead and empty the %{_*dir}s?

buildrpmtree: with the other changes, testing/creating/cd'ing to
%{_topdir} at the end of the script doesn't seem necessary to me any more.

Comment 7 Ignacio Vazquez-Abrams 2005-02-05 12:54:03 UTC
Created attachment 110691 [details]
Revised patch for dirs for buildrpmtree and wipebuildtree

Agreed on both counts. I also did a bit of terminology cleanup, hope you don't

Comment 8 Ville Skyttä 2005-02-05 14:46:27 UTC
Created attachment 110693 [details]
Improved version

Still some comments,

buildrpmtree: the 0.06 commentary is no longer accurate, as the paths are not
necessarily defined in ~/.rpmmacros.  $RHDIR can also be removed, it's unused. 
$TOPDIR and $ISTOP don't seem to add any value to the debug info.

wipebuildtree: by removing the tests, I meant _removing all the tests_.  Maybe
it's good to keep the superuser check, or to verify that the dirs to rm -rf'd
don't look like "/".  Additionally, your latest patch changes things so that it
will remove the actual _srcrpmdir and friends, instead of their contents.  This
will break setups until fedora-buildrpmtree is run again, or the dirs manually
recreated.  Also, I don't see why wipebuildtree should care if ~/.rpmmacros
exists or not.	Per-user %{_topdir} can also be defined eg. in /etc/rpm/macros.

Revised patch attached, unless there are objections, I'll commit this one.

Comment 9 Ignacio Vazquez-Abrams 2005-02-05 22:19:01 UTC
Works for me. I was just working within the context of the existing
script. Except for that silly "remove the actual _srcrpmdir" thing of

Comment 10 Ville Skyttä 2005-02-05 22:55:32 UTC
Committed to fedora.us CVS (that's where the development tree for this
package still resides).  Expect a 0.3.1 release containing this fix in
Extras next week.  Thanks.

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