[PATCH 08/11] Remove support for split media transactions from yuminstall.py.

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

 



---
 pyanaconda/sortedtransaction.py |   87 ---------------------------------
 pyanaconda/yuminstall.py        |  101 ++++++++++++---------------------------
 2 files changed, 31 insertions(+), 157 deletions(-)
 delete mode 100644 pyanaconda/sortedtransaction.py

diff --git a/pyanaconda/sortedtransaction.py b/pyanaconda/sortedtransaction.py
deleted file mode 100644
index d7384bb..0000000
--- a/pyanaconda/sortedtransaction.py
+++ /dev/null
@@ -1,87 +0,0 @@
-#
-# sortedtransaction.py
-#
-# Copyright (C) 2007  Red Hat, Inc.  All rights reserved.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-#
-
-from yum.transactioninfo import TransactionData, TransactionMember, SortableTransactionData
-from yum.constants import *
-from yum.Errors import YumBaseError
-
-import urlparse
-urlparse.uses_fragment.append('media')
-
-import logging
-log = logging.getLogger("anaconda")
-
-
-class SplitMediaTransactionData(SortableTransactionData):
-    def __init__(self):
-        SortableTransactionData.__init__(self)
-        self.reqmedia = {}
-        self.curmedia = 0 
-
-    def __getMedia(self, po):
-        try:
-            uri = po.returnSimple('basepath')
-            (scheme, netloc, path, query, fragid) = urlparse.urlsplit(uri)
-            if scheme != "media" or not fragid:
-                return -99
-            else:
-                return int(fragid)
-        except (KeyError, AttributeError):
-            return -99
-
-    def getMembers(self, pkgtup=None):
-        if not self.curmedia:
-            return TransactionData.getMembers(self, pkgtup)
-        if pkgtup is None:
-            returnlist = []
-            for ele in self.reqmedia[self.curmedia]:
-                returnlist.extend(self.pkgdict[ele])
-
-            return returnlist
-
-        if pkgtup in self.reqmedia[self.curmedia]:
-            return self.pkgdict[pkgtup]
-        else:
-            return []
-
-    def add(self, txmember):
-        if txmember.output_state in TS_INSTALL_STATES:
-            id = self.__getMedia(txmember.po)
-            if id:
-                if id not in self.reqmedia.keys():
-                    self.reqmedia[id] = [ txmember.pkgtup ]
-                elif txmember.pkgtup not in self.reqmedia[id]:
-                    self.reqmedia[id].append(txmember.pkgtup)
-        SortableTransactionData.add(self, txmember)
-
-    def remove(self, pkgtup):
-        if not self.pkgdict.has_key(pkgtup):
-            return
-        txmembers = self.pkgdict[pkgtup]
-        if len(txmembers) > 0:
-            for txmbr in txmembers:
-                if txmbr.output_state not in TS_INSTALL_STATES:
-                    continue
-                id = self.__getMedia(txmbr.po)
-                if id:
-                    self.reqmedia[id].remove(pkgtup)
-                    if len(self.reqmedia[id]) == 0:
-                        self.reqmedia.pop(id)
-                del txmbr
-                SortableTransactionData.remove(self, pkgtup)
diff --git a/pyanaconda/yuminstall.py b/pyanaconda/yuminstall.py
index 7999551..109455e 100644
--- a/pyanaconda/yuminstall.py
+++ b/pyanaconda/yuminstall.py
@@ -49,7 +49,6 @@ from yum.misc import to_unicode
 from yum.yumRepo import YumRepository
 from backend import AnacondaBackend
 from product import isBeta, productName, productVersion, productStamp
-from sortedtransaction import SplitMediaTransactionData
 from constants import *
 from image import *
 from compssort import *
@@ -309,13 +308,9 @@ class AnacondaYumRepo(YumRepository):
     anacondaBaseURLs = property(_getAnacondaBaseURLs, _setAnacondaBaseURLs,
                                 doc="Extends AnacondaYum.baseurl to store non-yum urls:")
 
-class YumSorter(yum.YumBase):
-    def _transactionDataFactory(self):
-        return SplitMediaTransactionData()
-
-class AnacondaYum(YumSorter):
+class AnacondaYum(yum.YumBase):
     def __init__(self, anaconda):
-        YumSorter.__init__(self)
+        yum.YumBase.__init__(self)
         self.anaconda = anaconda
         self._timestamp = None
 
@@ -770,9 +765,9 @@ class AnacondaYum(YumSorter):
             self.preconf.root = root
             self.preconf.releasever = self._getReleasever()
             self.preconf.enabled_plugins = ["whiteout", "blacklist"]
-            YumSorter._getConfig(self)
+            yum.YumBase._getConfig(self)
         else:
-            YumSorter._getConfig(self, fn=fn, root=root,
+            yum.YumBase._getConfig(self, fn=fn, root=root,
                                  enabled_plugins=["whiteout", "blacklist"])
         self.configBaseRepo(root=root)
 
@@ -879,7 +874,7 @@ class AnacondaYum(YumSorter):
         while True:
             # retrying version of download header
             try:
-                YumSorter.downloadHeader(self, po)
+                yum.YumBase.downloadHeader(self, po)
                 break
             except yum.Errors.NoMoreMirrorsRepoError:
                 self._handleFailure(po)
@@ -967,68 +962,42 @@ class AnacondaYum(YumSorter):
             self.ts.ts.setColor(3)
 
     def run(self, instLog, cb, intf):
-        def mediasort(a, b):
-            # sort so that first CD comes first, etc.  -99 is a magic number
-            # to tell us that the cd should be last
-            if a == -99:
-                return 1
-            elif b == -99:
-                return -1
-            if a < b:
-                return -1
-            elif a > b:
-                return 1
-            return 0
-
         self.initActionTs()
         if self.anaconda.upgrade:
             self.ts.ts.setProbFilter(~rpm.RPMPROB_FILTER_DISKSPACE)
         self.setColor()
 
-        # If we don't have any required media assume single disc
-        if self.tsInfo.reqmedia == {}:
-            self.tsInfo.reqmedia[0] = None
-        mkeys = self.tsInfo.reqmedia.keys()
-        mkeys.sort(mediasort)
-
-        for i in mkeys:
-            self.tsInfo.curmedia = i
-            if i > 0:
-                pkgtup = self.tsInfo.reqmedia[i][0]
-
-            try:
-                self.dsCallback = DownloadHeaderProgress(intf, self)
-                self.populateTs(keepold=0)
-                self.dsCallback.pop()
-                self.dsCallback = None
-            except RepoError, e:
-                msg = _("There was an error running your transaction for "
-                        "the following reason: %s\n") % str(e)
+        try:
+            self.dsCallback = DownloadHeaderProgress(intf, self)
+            self.populateTs(keepold=0)
+            self.dsCallback.pop()
+            self.dsCallback = None
+        except RepoError, e:
+            msg = _("There was an error running your transaction for "
+                    "the following reason: %s\n") % str(e)
 
-                if self.anaconda.upgrade:
-                    rc = intf.messageWindow(_("Error"), msg, type="custom",
-                                            custom_icon="error",
-                                            custom_buttons=[_("_Exit installer")])
-                    sys.exit(1)
-                else:
-                    rc = intf.messageWindow(_("Error"), msg,
-                            type="custom", custom_icon="error",
-                            custom_buttons=[_("_Back"), _("_Exit installer")])
+            if self.anaconda.upgrade:
+                rc = intf.messageWindow(_("Error"), msg, type="custom",
+                                        custom_icon="error",
+                                        custom_buttons=[_("_Exit installer")])
+                sys.exit(1)
+            else:
+                rc = intf.messageWindow(_("Error"), msg,
+                        type="custom", custom_icon="error",
+                        custom_buttons=[_("_Back"), _("_Exit installer")])
 
-                if rc == 1:
-                    sys.exit(1)
-                else:
-                    self.tsInfo.curmedia = None
-                    return DISPATCH_BACK
+            if rc == 1:
+                sys.exit(1)
+            else:
+                return DISPATCH_BACK
 
-            self.ts.check()
-            self.ts.order()
+        self.ts.check()
+        self.ts.order()
 
-            if self._run(instLog, cb, intf) == DISPATCH_BACK:
-                self.tsInfo.curmedia = None
-                return DISPATCH_BACK
+        if self._run(instLog, cb, intf) == DISPATCH_BACK:
+            return DISPATCH_BACK
 
-            self.ts.close()
+        self.ts.close()
 
     def _run(self, instLog, cb, intf):
         # set log fd.  FIXME: this is ugly.  see changelog entry from 2005-09-13
@@ -1965,17 +1934,9 @@ reposdir=/etc/anaconda.repos.d,/tmp/updates/anaconda.repos.d,/tmp/product/anacon
         allPkgNames = map(lambda pkg: pkg.name, self.ayum.pkgSack.returnPackages())
         allPkgNames.sort()
 
-        # On CD/DVD installs, we have one transaction per CD and will end up
-        # checking allPkgNames against a very short list of packages.  So we
-        # have to reset to media #0, which is an all packages transaction.
-        old = self.ayum.tsInfo.curmedia
-        self.ayum.tsInfo.curmedia = 0
-
         self.ayum.tsInfo.makelists()
         txmbrNames = map (lambda x: x.name, self.ayum.tsInfo.getMembers())
 
-        self.ayum.tsInfo.curmedia = old
-
         if len(self.ayum.tsInfo.instgroups) == 0 and len(txmbrNames) == 0:
             return
 
-- 
1.7.1.1

_______________________________________________
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