Re: [PATCH] Add anaconda support for group removal syntax (#558516).

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

 



Hi,

I cannot find anything obviously wrong with this, but
then again it is sort of Chinese to me, so you may want to have
someone who knows this code better take a look (if we have
such a person).

Regards,

Hans


On 01/27/2010 03:51 PM, Chris Lumens wrote:
This requires adding a new method to yuminstall.py that will iterate over
all the packages in a group and remove them from the transaction, regardless
of whether they are part of any installed group or not.  This is subtly
different from our existing group removal function that only handles groups
selected via the UI.
---
  anaconda.spec |    2 +-
  backend.py    |    4 ++++
  kickstart.py  |    3 ++-
  yuminstall.py |   17 +++++++++++++++++
  4 files changed, 24 insertions(+), 2 deletions(-)

diff --git a/anaconda.spec b/anaconda.spec
index 0cbb8d5..f12dc02 100644
--- a/anaconda.spec
+++ b/anaconda.spec
@@ -11,7 +11,7 @@ BuildPreReq: rpm-python>= 4.2-0.61, newt-devel, rpm-devel, gettext>= 0.11
  BuildPreReq: rhpl, booty, libxml2-python, zlib-devel, elfutils-devel
  BuildPreReq: beecrypt-devel, libselinux-devel>= 1.6, libX11-devel
  BuildPreReq: libXxf86misc-devel, intltool>= 0.31.2-3, python-urlgrabber
-BuildPreReq: pykickstart, yum>= 2.9.2, device-mapper>= 1.01.05-3,
+BuildPreReq: pykickstart>= 0.43.8, yum>= 2.9.2, device-mapper>= 1.01.05-3,
  BuildPreReq: libsepol-devel
  BuildPreReq: pango-devel, pirut, libXt-devel, slang-devel>= 2.0.6-2
  BuildPreReq: libdhcp-devel>= 1.20-10, mkinitrd-devel>= 5.1.2-1
diff --git a/backend.py b/backend.py
index 3efcac8..18bf56f 100644
--- a/backend.py
+++ b/backend.py
@@ -147,6 +147,10 @@ class AnacondaBackend:
          log.warning("deselectPackage not implemented for backend!")
          pass

+    def removeGroupsPackages(self, grp, *args):
+        log.warning("removeGroupsPackages not implemented for backend!")
+        pass
+
      def getDefaultGroups(self, anaconda):
          log.warning("getDefaultGroups not implemented for backend!")
          pass
diff --git a/kickstart.py b/kickstart.py
index e9caeaa..3a7579b 100644
--- a/kickstart.py
+++ b/kickstart.py
@@ -958,7 +958,7 @@ class Kickstart(cobject):

      def _havePackages(self):
          return len(self.ksdata.groupList)>  0 or len(self.ksdata.packageList)>  0 or \
-               len(self.ksdata.excludedList)>  0
+               len(self.ksdata.excludedList)>  0 or len(self.ksdata.excludedGroupList)

      def setSteps(self, dispatch):
          if self.ksdata.upgrade:
@@ -1095,6 +1095,7 @@ class Kickstart(cobject):
                  pass

          map(anaconda.backend.deselectPackage, self.ksdata.excludedList)
+        map(anaconda.backend.removeGroupsPackages, self.ksdata.excludedGroupList)

  # look through ksfile and if it contains any lines:
  #
diff --git a/yuminstall.py b/yuminstall.py
index 67cffe7..14c3334 100644
--- a/yuminstall.py
+++ b/yuminstall.py
@@ -1800,6 +1800,9 @@ class YumBackend(AnacondaBackend):
                  return 0

      def deselectGroup(self, group, *args):
+        # This method is meant to deselect groups that have been previously
+        # selected in the UI.  It does not handle groups removed via kickstart.
+        # yum does not work that way (in 5.5).
          try:
              self.ayum.deselectGroup(group)
          except yum.Errors.GroupsError, e:
@@ -1844,6 +1847,20 @@ class YumBackend(AnacondaBackend):
              log.debug("no such package %s to remove" %(pkg,))
              return 0

+    def removeGroupsPackages(self, grp):
+        # This method removes all the groups of a package that has been
+        # excluded via kickstart.  This is subtly different from removing
+        # a group previously selected in the UI.
+        groups = self.ayum.comps.return_groups(grp)
+        for grp in groups:
+            for pkgname in grp.packages:
+                for txmbr in self.ayum.tsInfo:
+                    if txmbr.po.name == pkgname and txmbr.po.state in TS_INSTALL_STATES:
+                        self.ayum.tsInfo.remove(txmbr.po.pkgtup)
+
+                        for pkg in self.ayum.tsInfo.conditionals.get(txmbr.name, []):
+                            self.ayum.tsInfo.remove(pkg.pkgtup)
+
      def upgradeFindPackages(self):
          # check the installed system to see if the packages just
          # are not newer in this release.

_______________________________________________
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