Linux Archive

Linux Archive (http://www.linux-archive.org/)
-   Fedora Development (http://www.linux-archive.org/fedora-development/)
-   -   Add a method that fetches and returns the .treeinfo file. (http://www.linux-archive.org/fedora-development/364325-add-method-fetches-returns-treeinfo-file.html)

David Cantrell 04-30-2010 08:16 PM

Add a method that fetches and returns the .treeinfo file.
 
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Ack with Radek's suggestions. Commit msg needs a Related or Resolves rhbz
reference.

On Thu, 29 Apr 2010, Chris Lumens wrote:


---
yuminstall.py | 25 +++++++++++++++++--------
1 files changed, 17 insertions(+), 8 deletions(-)

diff --git a/yuminstall.py b/yuminstall.py
index 858fe0a..05a3b69 100644
--- a/yuminstall.py
+++ b/yuminstall.py
@@ -589,6 +589,18 @@ class AnacondaYum(YumSorter):

return repo

+ def _getTreeinfo(self):
+ if os.access("%s/.treeinfo" % self.anaconda.methodstr, os.R_OK):
+ return "%s/.treeinfo" % self.anaconda.methodstr
+ else:
+ try:
+ ug = URLGrabber()
+ ug.urlgrab("%s/.treeinfo" % self.anaconda.methodstr,
+ "/tmp/.treeinfo", copy_local=1)
+ return "/tmp/.treeinfo"
+ except:
+ return None
+
# We need to make sure $releasever gets set up before .repo files are
# read. Since there's no redhat-release package in /mnt/sysimage (and
# won't be for quite a while), we need to do our own substutition.
@@ -596,15 +608,12 @@ class AnacondaYum(YumSorter):
from ConfigParser import ConfigParser
c = ConfigParser()

- try:
- if os.access("%s/.treeinfo" % self.anaconda.methodstr, os.R_OK):
- ConfigParser.read(c, "%s/.treeinfo" % self.anaconda.methodstr)
- else:
- ug = URLGrabber()
- ug.urlgrab("%s/.treeinfo" % self.anaconda.methodstr,
- "/tmp/.treeinfo", copy_local=1)
- ConfigParser.read(c, "/tmp/.treeinfo")
+ treeinfo = self._getTreeinfo()
+ if not treeinfo:
+ return productVersion

+ ConfigParser.read(c, treeinfo)
+ try:
return c.get("general", "version")
except:
return productVersion



- --
David Cantrell <dcantrell@redhat.com>

Red Hat / Honolulu, HI

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)

iEYEARECAAYFAkvbOo8ACgkQ5hsjjIy1VkksnQCfSkOaj/ewfomLQMgYFBHyJFax
44cAoNsPaZmHTB5qdS9P9LiCi4VttKa5
=P18L
-----END PGP SIGNATURE-----

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list


All times are GMT. The time now is 08:01 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.