summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Fulbright <msf@redhat.com>2002-07-31 00:42:45 +0000
committerMike Fulbright <msf@redhat.com>2002-07-31 00:42:45 +0000
commitdc33b950c545c30e7872dd58664f8088545cd44b (patch)
treeeb40ff3155caac122292066c5b7357c0982dd469
parent6919ce27faac2e2f261a473e86739a4480e5bd5c (diff)
downloadanaconda-dc33b950c545c30e7872dd58664f8088545cd44b.tar.gz
anaconda-dc33b950c545c30e7872dd58664f8088545cd44b.tar.xz
anaconda-dc33b950c545c30e7872dd58664f8088545cd44b.zip
get comps.xml from multiple sources
-rw-r--r--harddrive.py7
-rw-r--r--image.py3
-rw-r--r--installmethod.py34
-rw-r--r--urlinstall.py7
4 files changed, 46 insertions, 5 deletions
diff --git a/harddrive.py b/harddrive.py
index 5cca25b29..c50c62bc4 100644
--- a/harddrive.py
+++ b/harddrive.py
@@ -60,8 +60,8 @@ class OldHardDriveInstallMethod(InstallMethod):
def readCompsViaMethod(self, hdlist):
self.mountMedia()
- cs = ComponentSet(self.tree + self.path +
- '/RedHat/base/comps.xml', hdlist)
+ fname = self.findBestFileMatch(self.tree + self.path, 'comps.xml')
+ cs = ComponentSet(fname, hdlist)
self.umountMedia()
return cs
@@ -163,7 +163,8 @@ class HardDriveInstallMethod(InstallMethod):
def readCompsViaMethod(self, hdlist):
self.mountMedia(1)
- cs = ComponentSet(self.tree + '/RedHat/base/comps.xml', hdlist)
+ fname = self.findBestFileMatch(self.tree, 'comps.xml')
+ cs = ComponentSet(fname, hdlist)
self.umountMedia()
return cs
diff --git a/image.py b/image.py
index d308b1756..36c71e8e9 100644
--- a/image.py
+++ b/image.py
@@ -29,7 +29,8 @@ from rhpl.translate import _
class ImageInstallMethod(InstallMethod):
def readCompsViaMethod(self, hdlist):
- return ComponentSet(self.tree + '/RedHat/base/comps.xml', hdlist)
+ fname = self.findBestFileMatch(self.tree, 'comps.xml')
+ return ComponentSet(fname, hdlist)
def getFilename(self, h, timer):
return self.tree + "/RedHat/RPMS/" + h[1000000]
diff --git a/installmethod.py b/installmethod.py
index c1096c9d0..c03fde4c6 100644
--- a/installmethod.py
+++ b/installmethod.py
@@ -1,9 +1,43 @@
+#
+# installmethod.py - Base class for install methods
+#
+# Copyright 1999-2002 Red Hat, Inc.
+#
+# This software may be freely redistributed under the terms of the GNU
+# library public license.
+#
+# You should have received a copy of the GNU Library Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+#
+
import os
import string
from comps import ComponentSet
+from rhpl.log import log
+
+
class InstallMethod:
+ # find best match from several locations for a file
+ def findBestFileMatch(self, treebase, file):
+ # look in /tmp/updates first
+ rc = None
+ tryloc = ["/tmp/updates"]
+ if treebase is not None:
+ tryloc.append(treebase + "/RHupdates")
+ tryloc.append(treebase + "/RedHat/base")
+
+ for pre in tryloc:
+ tmpname = pre + "/" + file
+ if os.access(tmpname, os.R_OK):
+ log("Using %s", tmpname)
+ return tmpname
+
+ log("Unable to find %s", file)
+ return None
+
def protectedPartitions(self):
return None
diff --git a/urlinstall.py b/urlinstall.py
index 2957bbe5a..509482b7f 100644
--- a/urlinstall.py
+++ b/urlinstall.py
@@ -37,7 +37,12 @@ DISCNUM = 1000002
class UrlInstallMethod(InstallMethod):
def readCompsViaMethod(self, hdlist):
- return ComponentSet(self.baseUrl + '/RedHat/base/comps.xml', hdlist)
+ fname = self.findBestFileMatch(None, 'comps.xml')
+ # if not local then assume its on host
+ if fname is None:
+ fname = self.baseUrl + '/RedHat/base/comps.xml'
+ log("Comps not in update dirs, using %s",fname)
+ return ComponentSet(fname, hdlist)
def getFilename(self, h, timer):
tmppath = self.getTempPath()