Hi James, hi Seth,

Am Sonntag, 10. Februar 2008 schrieb James Antill:
>  So atm. it's possible for create repo to create metdata which has the
> same nevra pkg (with the same pkgId) multiple times. 
>
> 1. Add an argument to parsePackages() to give "unique" results based on
> just repo.id and pkg.pkgKey, used just be excludes atm.
>
>  I've done #1, and it's available:
>
> http://people.redhat.com/jantill/yum/yum-exclude-all-pkgs.patch

404..

I tried to apply your patch from the original thread, but that didn't apply 
to yum/__init__.py, neither from 3.2.10 nor from 3.2.11, but semantically 
applying it finally succeeded. Attached for reference. 

I can confirm, that it fixed my problem, by restoring the symlinks on that 
repo, and it didn't try to install/update anything excluded. Temporarily 
excluding the excludes seems to install/update the correct packages. All 
behaving as expected. 

I'm finally enjoying the fastest yum in existence.

Thanks a lot,
Pete
--- yum/packages.py
+++ yum/packages.py
@@ -78,7 +78,8 @@ def buildPkgRefDict(pkgs, casematch=True):
             
     return pkgdict
        
-def parsePackages(pkgs, usercommands, casematch=0):
+def parsePackages(pkgs, usercommands, casematch=0,
+                  unique='repo-epoch-name-version-release-arch'):
     """matches up the user request versus a pkg list:
        for installs/updates available pkgs should be the 'others list' 
        for removes it should be the installed list of pkgs
@@ -124,9 +125,21 @@ def parsePackages(pkgs, usercommands, casematch=0):
             else:
                 unmatched.append(command)
 
-    matched = misc.unique(matched)
     unmatched = misc.unique(unmatched)
-    exactmatch = misc.unique(exactmatch)
+    if unique == 'repo-epoch-name-version-release-arch': # pkg.__hash__
+        matched    = misc.unique(matched)
+        exactmatch = misc.unique(exactmatch)
+    elif unique == 'repo-pkgkey': # So we get all pkg entries from a repo
+        def pkgunique(pkgs):
+            u = {}
+            for pkg in pkgs:
+                mark = "%s%s" % (pkg.repo.id, pkg.pkgKey)
+                u[mark] = pkg
+            return u.values()
+        matched    = pkgunique(matched)
+        exactmatch = pkgunique(exactmatch)
+    else:
+        raise ValueError, "Bad value for unique: %s" % unique
     return exactmatch, matched, unmatched
 
 class FakeRepository:
--- yum/__init__.py	2008-02-08 20:02:22.000000000 +0100
+++ yum/__init__.py	2008-02-13 11:01:59.757513701 +0100
@@ -839,9 +839,10 @@ class YumBase(depsolve.Depsolve):
         else:
             self.verbose_logger.log(logginglevels.INFO_2, _('Excluding Packages from %s'),
                 repo.name)
-        
+       
+        pkgs = self._pkgSack.returnPackages(repoid, patterns=excludelist)
         exactmatch, matched, unmatched = \
-           parsePackages(self._pkgSack.returnPackages(repoid), excludelist, casematch=1)
+           parsePackages(pkgs, excludelist, casematch=1, unique='repo-pkgkey')
 
         for po in exactmatch + matched:
             self.verbose_logger.debug('Excluding %s', po)
_______________________________________________
Yum-devel mailing list
[email protected]
https://lists.dulug.duke.edu/mailman/listinfo/yum-devel

Reply via email to