Bug 147014 - %_topdir macro ignored by buildrpmtree and wipebuildtree
%_topdir macro ignored by buildrpmtree and wipebuildtree
Status: CLOSED ERRATA
Product: Fedora
Classification: Fedora
Component: fedora-rpmdevtools (Show other bugs)
3
All Linux
medium Severity low
: ---
: ---
Assigned To: Ville Skyttä
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2005-02-03 13:15 EST by Ignacio Vazquez-Abrams
Modified: 2007-11-30 17:10 EST (History)
1 user (show)

See Also:
Fixed In Version: 0.3.1-1
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2005-02-05 17:55:32 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
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 03:32 EST, Ignacio Vazquez-Abrams
no flags Details | Diff
Revised patch for dirs for buildrpmtree and wipebuildtree (3.80 KB, patch)
2005-02-05 07:54 EST, Ignacio Vazquez-Abrams
no flags Details | Diff
Improved version (4.18 KB, patch)
2005-02-05 09:46 EST, Ville Skyttä
no flags Details | Diff

  None (edit)
Description Ignacio Vazquez-Abrams 2005-02-03 13:15:58 EST
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 15:03:47 EST
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 17:30:06 EST
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 17:39:02 EST
Better to just do a "rpm --eval '%{_topdir}'", I think.  But that's
not the issue.
Comment 4 Warren Togami 2005-02-04 20:56:20 EST
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 03:32:38 EST
Created attachment 110690 [details]
Patch for dirs for buildrpmtree and wipebuildtree

How about this patch?
Comment 6 Ville Skyttä 2005-02-05 05:49:32 EST
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 07:54:03 EST
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
mind.
Comment 8 Ville Skyttä 2005-02-05 09:46:27 EST
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 17:19:01 EST
Works for me. I was just working within the context of the existing
script. Except for that silly "remove the actual _srcrpmdir" thing of
course.
Comment 10 Ville Skyttä 2005-02-05 17:55:32 EST
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.