Bug 499645 - The --output option fails when a relative path is used as its value.
Summary: The --output option fails when a relative path is used as its value.
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: mash
Version: rawhide
Hardware: All
OS: Linux
low
low
Target Milestone: ---
Assignee: Bill Nottingham
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2009-05-07 14:36 UTC by Steve Traylen
Modified: 2014-03-17 03:18 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2009-05-07 17:32:55 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Steve Traylen 2009-05-07 14:36:17 UTC
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 15:08:19 UTC
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 15:46:00 UTC
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 17:32:55 UTC
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.