Bug 499645 - The --output option fails when a relative path is used as its value.
The --output option fails when a relative path is used as its value.
Status: CLOSED RAWHIDE
Product: Fedora
Classification: Fedora
Component: mash (Show other bugs)
rawhide
All Linux
low Severity low
: ---
: ---
Assigned To: Bill Nottingham
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2009-05-07 10:36 EDT by Steve Traylen
Modified: 2014-03-16 23:18 EDT (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2009-05-07 13:32:55 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Steve Traylen 2009-05-07 10:36:17 EDT
Description of problem:


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

mash-0.4.2-3.fc10.noarch


How reproducible:
Every time.


Steps to Reproduce:
1.  mash -c etc/mash.conf -o out centos4     (with -o to a relative path)
  
Actual results:

Traceback (most recent call last):
  File "/usr/bin/mash", line 82, in <module>
    main()
  File "/usr/bin/mash", line 70, in main
    rc = themash.doMultilib()
  File "/usr/lib/python2.5/site-packages/mash/__init__.py", line 515, in doMultilib
    pid = self.doDepSolveAndMultilib(arch, repocache)
  File "/usr/lib/python2.5/site-packages/mash/__init__.py", line 466, in doDepSolveAndMultilib
    yumbase.doTsSetup()
  File "/usr/lib/python2.5/site-packages/yum/depsolve.py", line 86, in doTsSetup
    return self._getTs()
  File "/usr/lib/python2.5/site-packages/yum/depsolve.py", line 101, in _getTs
    self._getTsInfo(remove_only)
  File "/usr/lib/python2.5/site-packages/yum/depsolve.py", line 112, in _getTsInfo
    pkgSack = self.pkgSack
  File "/usr/lib/python2.5/site-packages/yum/__init__.py", line 592, in <lambda>
    pkgSack = property(fget=lambda self: self._getSacks(),
  File "/usr/lib/python2.5/site-packages/yum/__init__.py", line 435, in _getSacks
    self.repos.populateSack(which=repos)
  File "/usr/lib/python2.5/site-packages/yum/repos.py", line 251, in populateSack
    sack.populate(repo, mdtype, callback, cacheonly)
  File "/usr/lib/python2.5/site-packages/yum/yumRepo.py", line 162, in populate
    if self._check_db_version(repo, mydbtype):
  File "/usr/lib/python2.5/site-packages/yum/yumRepo.py", line 223, in _check_db_version
    return repo._check_db_version(mdtype)
  File "/usr/lib/python2.5/site-packages/yum/yumRepo.py", line 1147, in _check_db_version
    repoXML = self.repoXML
  File "/usr/lib/python2.5/site-packages/yum/yumRepo.py", line 1305, in <lambda>
    repoXML = property(fget=lambda self: self._getRepoXML(),
  File "/usr/lib/python2.5/site-packages/yum/yumRepo.py", line 1301, in _getRepoXML
    raise Errors.RepoError, msg
yum.Errors.RepoError: Cannot retrieve repository metadata (repomd.xml) for repository: centos4-x86_64. Please verify its path and try again
2009-05-07 16:31:55 mash: Depsolve and createrepo finished.
mash failed in out/centos4


Expected results:
to work :-)

Additional info:

On suggestion from a mailing list I dumped out the generated yum.conf
file.

It contained.

[main]
debuglevel=2
pkgpolicy=newest
exactarch=1
gpgcheck=0
reposdir=/dev/null
cachedir=/yumcache
installroot=/tmp/mash-centos4/centos4-x86_64.tmp
logfile=/yum.log
[centos4-x86_64]
name=centos4
baseurl=file://out/centos4/x86_64/
enabled=1

In particular that baseurl is wrong.

Calling the command with an absolute path then all is well

mash -c etc/mash.conf -o /home/straylen/mash/out centos4

and then the command completes.

Steve
Comment 1 Bill Nottingham 2009-05-07 11:08:19 EDT
Does:

diff --git a/mash.py b/mash.py
index f0aa613..f33c9c5 100755
--- a/mash.py
+++ b/mash.py
@@ -48,6 +48,8 @@ def main():
     conf = mash.config.readMainConfig(opts.config)
     
     if opts.outputdir != "":
+        if opts.outputdir[0] != '/':
+            opts.outputdir = os.path.join(os.getcwd(), opts.outputdir)
         for dist in conf.distros:
             dist.outputdir = opts.outputdir
     if opts.compsfile != "":

work for you?
Comment 2 Steve Traylen 2009-05-07 11:46:00 EDT
Hi Bill,
  Yes it looks good with this no change patch to yours.

--- mash.ORIG   2009-05-07 17:43:23.000000000 +0200
+++ mash        2009-05-07 17:43:51.000000000 +0200
@@ -44,6 +44,8 @@
     conf = mash.config.readMainConfig(opts.config)
     
     if opts.outputdir != "":
+        if opts.outputdir[0] != '/':
+            opts.outputdir = os.path.join(os.getcwd(), opts.outputdir)
         conf.workdir = opts.outputdir
         for dist in conf.distros:
             dist.workdir = opts.outputdir

 thanks again.
Comment 3 Bill Nottingham 2009-05-07 13:32:55 EDT
Added a os.path.realpath() bit too, so it will normalize '../../' paths.

http://git.fedorahosted.org/git/?p=mash;a=commitdiff;h=b51e2b1be0386dd6d2c7ea78320492cb4fe2ebc7

Given that there's a simple workaround to pass the full path, just queued for rawhide. May make a F11 update at some point.

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