Don't add packages from @conflicts group as dependencies (#756707)
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_DISKS PACE)
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@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
12-20-2011, 11:47 AM
Vratislav Podzimek
Don't add packages from @conflicts group as dependencies (#756707)
Ack. See the comment below for more details.
On Tue, 2011-12-20 at 12:04 +0100, Martin Gracik wrote:
> 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...
This really is ugly, but at the same time the way how to change as few
lines of the rhel5 codebase as possible. So I think we could live with
it.
> + 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_DISKS PACE)
> self.setColor()
> +
> if not self.method.splitmethod:
> self.populateTs(keepold=0)
> self.ts.check()
--
Vratislav Podzimek
Anaconda Rider | Red Hat, Inc. | Brno - Czech Republic
_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
12-20-2011, 02:45 PM
Martin Gracik
Don't add packages from @conflicts group as dependencies (#756707)
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..984366a 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 map(str.lower, 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_DISKS PACE)
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@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list