[PATCH] Set repo.cachedir to repo.basecachedir when reading configuration

Alexander Todorov <[email protected]>
Newsgroups gmane.linux.rpm.yum
Message-ID <[email protected]>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

Good afternoon folks,
the simple patch below fixed very annoying issue for me but I'm still not 100%
sure what cause it. The issue was that when running the Revisor utility to
create custom Fedora 9 spin one of it scripts was failing. The failure was at:
yumdownloader -c $yumconf anaconda-runtime. The config files that come with
Revisor are of the form:
[main]
cachedir=-yumcache
reposdir=
keepcache=1
debuglevel=1
logfile=-yum.log
pkgpolicy=newest
distroverpkg=redhat-release
tolerant=1
exactarch=1
obsoletes=1
gpgcheck=1
plugins=0
metadata_expire=15
installroot=/home/alexx/temp/yum-test
failovermethod=priority

[fedora]
name=Fedora 9 - Sulphur - x86_64
baseurl=http://localrepo/fedora/releases/9/Everything/x86_64/os/
mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=fedora-9&arch=x86_64
enabled=1
gpgcheck=1

.... skip ....


Apparently it was failing to download the package from http://localrepo as such
doesn't exist but then it was failing to download the package from any
mirrorlist (as a matter of fact mirrorlist was not used). The patch below fixed
that. What I noticed is that repo.cachedir was empty and it was used to
construct the path for mirrorlist.txt which resulted in /mirrorlist.txt and
denied write. Although Revisor was running as root that was failing. I still
have to go and find out why this happened.

Please review and apply the proposed patch.


diff --git a/yum/__init__.py b/yum/__init__.py
index 5786816..8decfca 100644
- --- a/yum/__init__.py
+++ b/yum/__init__.py
@@ -325,6 +325,7 @@ class YumBase(depsolve.Depsolve):

~         # Set attributes not from the config file
~         repo.basecachedir = self.conf.cachedir
+        repo.cachedir = repo.basecachedir
~         repo.yumvar.update(self.conf.yumvar)
~         repo.cfg = parser



Thanks,
Alexander.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (GNU/Linux)
Comment: Using GnuPG with Red Hat - http://enigmail.mozdev.org

iD8DBQFIhyTdhmd3WOiFct4RCjw5AKCp79srHs7LZMevufa9cMp83Xjr0ACfZ9Dg
yF7tJ+l+oACO8ZpiycZCemk=
=U54e
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.