[rhel5-branch] Don't add packages from @conflicts group as dependencies (#756707)

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

 



If -@conflicts is used in the kicstart file, we need to make sure
the packages are not only removed from the transaction, but that
they are also not added back later, when resolving the dependencies.

We also need to remove packages that depend on these conflicting
packages.
---
 yuminstall.py |   33 +++++++++++++++++++++++++++++----
 1 files changed, 29 insertions(+), 4 deletions(-)

diff --git a/yuminstall.py b/yuminstall.py
index 6d2b670..833d186 100644
--- a/yuminstall.py
+++ b/yuminstall.py
@@ -455,10 +455,34 @@ class YumSorter(yum.YumBase):
                 dep = self.deps.get(req, None)
                 if dep is None:
                     dep = self._provideToPkg(req)
-                    if dep is None:
-                        log.warning("Unresolvable dependency %s in %s"
-                                    %(req[0], txmbr.name))
-                        continue
+
+                if dep is None:
+                    log.warning("Unresolvable dependency %s in %s"
+                                %(req[0], txmbr.name))
+                    continue
+
+                # XXX: ATTENTION the self.anaconda is in the AnacondaYum class,
+                # which subclasses this class and inherits this method and is actually used;
+                # very ugly, but I don't want to move the whole method...
+                if (self.anaconda.isKickstart and
+                        'conflicts' in self.anaconda.id.ksdata.excludedGroupList):
+
+                    # get the list of packages in @conflicts group for the first time,
+                    # so we can check if the dependencies are there later
+                    if not hasattr(self, '__conflicting_packages'):
+                        self.__conflicting_packages = []
+                        conflicts = self.comps.return_groups('conflicts')
+                        for group in conflicts:
+                            for pkgname in group.packages:
+                                self.__conflicting_packages.append(pkgname)
+
+                    # if the dependency is in the @conflicts group, don't add it
+                    # to the transaction, and also remove the corresponding package
+                    if dep.name in self.__conflicting_packages:
+                        log.warning('Dependency %s for %s in conflicts group' % (dep.name, txmbr.name))
+                        self.__conflicting_packages.append(txmbr.name)
+                        self.tsInfo.remove(txmbr.po.pkgtup)
+                        break
 
                 # Skip filebased requires on self, etc
                 if txmbr.name == dep.name:
@@ -696,6 +720,7 @@ class AnacondaYum(YumSorter):
         if id.getUpgrade():
             self.ts.ts.setProbFilter(~rpm.RPMPROB_FILTER_DISKSPACE)
         self.setColor()
+
         if not self.method.splitmethod:
             self.populateTs(keepold=0)
             self.ts.check()
-- 
1.7.5.4

_______________________________________________
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