Re: [PATCH 04/14] Do not use object we are creating.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Chris Lumens wrote:
Yeah, that's a bit of a mess.

One option might be for us to stop doing so much in
AnacondaYum.__init__.  You could make the argument that all you really
should be doing in the __init__ method is initializing variables.  All
the configBaseURL and doConfigSetup stuff could perhaps get moved into
another method.
How about attached patch 0001 (tested)?
Together with attached 0002 it fixes bug #515441.

Radek
>From 595a188d1bfc6d2a4ba150849d9c966eb28d75ed Mon Sep 17 00:00:00 2001
From: Radek Vykydal <rvykydal@xxxxxxxxxx>
Date: Fri, 11 Sep 2009 11:31:58 +0200
Subject: [PATCH] Do not use object we are creating (#515441).

---
 yuminstall.py |   37 ++++++++++++++++++++-----------------
 1 files changed, 20 insertions(+), 17 deletions(-)

diff --git a/yuminstall.py b/yuminstall.py
index c8d59be..194ebaa 100644
--- a/yuminstall.py
+++ b/yuminstall.py
@@ -278,6 +278,24 @@ class AnacondaYum(YumSorter):
         # where Packages/ is located.
         self.tree = "/mnt/source"
 
+        self.macros = {}
+
+        if flags.selinux:
+            for directory in ("/tmp/updates",
+                        "/etc/selinux/targeted/contexts/files",
+                        "/etc/security/selinux/src/policy/file_contexts",
+                        "/etc/security/selinux"):
+                fn = "%s/file_contexts" %(directory,)
+                if os.access(fn, os.R_OK):
+                    break
+            self.macros["__file_context_path"] = fn
+        else:
+            self.macros["__file_context_path"]  = "%{nil}"
+
+        self.updates = []
+        self.localPackages = []
+
+    def setup(self):
         # yum doesn't understand all our method URLs, so use this for all
         # except FTP and HTTP installs.
         self._baseRepoURL = "file://%s" % self.tree
@@ -294,24 +312,8 @@ class AnacondaYum(YumSorter):
 
                 self.anaconda.methodstr = self.anaconda.intf.methodstrRepoWindow()
 
-        self.doConfigSetup(root=anaconda.rootPath)
+        self.doConfigSetup(root=self.anaconda.rootPath)
         self.conf.installonlypkgs = []
-        self.macros = {}
-
-        if flags.selinux:
-            for directory in ("/tmp/updates",
-                        "/etc/selinux/targeted/contexts/files",
-                        "/etc/security/selinux/src/policy/file_contexts",
-                        "/etc/security/selinux"):
-                fn = "%s/file_contexts" %(directory,)
-                if os.access(fn, os.R_OK):
-                    break
-            self.macros["__file_context_path"] = fn
-        else:
-            self.macros["__file_context_path"]  = "%{nil}"
-
-        self.updates = []
-        self.localPackages = []
 
     def _switchCD(self, discnum):
         if os.access("%s/.discinfo" % self.tree, os.R_OK):
@@ -1058,6 +1060,7 @@ reposdir=/etc/anaconda.repos.d,/tmp/updates/anaconda.repos.d,/tmp/product/anacon
 
         iutil.writeRpmPlatform()
         self.ayum = AnacondaYum(anaconda)
+        self.ayum.setup()
 
         self.ayum.doMacros()
 
-- 
1.6.0.6

>From f4add1c306bfbe8a138bdbf088df553d6ea6218d Mon Sep 17 00:00:00 2001
From: Radek Vykydal <rvykydal@xxxxxxxxxx>
Date: Wed, 30 Sep 2009 16:52:24 +0200
Subject: [PATCH] Set related ayum attributes when media is found editing methodstr (#515441).

Duplicates code in configBaseURL, I'd like to do all the media
scanning in configBaseURL and guard only methodstr syntax in
methodstr editing dialog - perhaps next step if it proves doable.
---
 iw/task_gui.py |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/iw/task_gui.py b/iw/task_gui.py
index 0402fe2..ddebc7f 100644
--- a/iw/task_gui.py
+++ b/iw/task_gui.py
@@ -423,6 +423,10 @@ class RepoMethodstrEditor(RepoEditor):
                                       "and try again."))
             return False
 
+        self.anaconda.backend.ayum.mediagrabber = self.anaconda.backend.ayum.mediaHandler
+        self.anaconda.backend.ayum.anaconda.mediaDevice = cdr
+        self.anaconda.backend.ayum.currentMedia = 1
+        log.info("found installation media on %s" % cdr)
         return "cdrom://%s:%s" % (cdr, self.anaconda.backend.ayum.tree)
 
     def _applyNfs(self):
-- 
1.6.0.6

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

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux