On Sun, 2008-02-10 at 14:24 +0100, Hans-Peter Jansen wrote:

> Yep, that's the culprit. For whatever reason, SUSE creates symlinks for 
> every updated package out there (since ages). I'm able to exclude these 
> symlinks from my local repos, but this will probably fail with the official 
> repos (and it's a bit unintuitive, that excludes may fail under these 
> conditions..). Generally ignoring symlinks in createrepo (by option) isn't 
> that brilliant either, since I do use them also myself in a few places 
> (with low propability to interfere with exclude items, though).

 Do you have an example SuSE repo which has this problem in it? All the
ones I looked at only had a single pkg per. "nerva" in the metadata,
although they might well have more packages/symlinks that aren't in the
metadata. Having the extra symlinks is fine, having the same nevra pkgs
in the metadata multiple times is bad.

> The whole issue is complicated by SUSE's delta.rpm packages, which, if 
> forgotten to exclude them on the createrepo run, adds another source of 
> similar packages, and further contribute to the problem (as happened here 
> with my tests.. :-(). 
> 
> >  If so the short term solution would be to just delete one of them. If
> > there's another reason they are being listed twice, we'll probably have
> > a fix you can try soon.
> 
> Good to know. Since the repos are created in such a way since a long time, I 
> think, it's better to fix this problem in yum itself, but as it stands, 
> your right, createrepo should better have handled this case properly.

 Feel free to try the attached patch[1] based on HEAD, it solves the
problem for me. I'm going to wait until I can speak to Seth before I
commit it though, as there are a number of ways to "fix" this and he
might prefer a different approach.


[1] Also available from:

 http://people.redhat.com/jantill/yum/yum-exclude-all-pkgs.patch

-- 
James Antill <[EMAIL PROTECTED]>
Red Hat
diff --git a/yum/__init__.py b/yum/__init__.py
index a139d52..55dd038 100644
--- a/yum/__init__.py
+++ b/yum/__init__.py
@@ -842,7 +842,7 @@ class YumBase(depsolve.Depsolve):
 
         pkgs = self._pkgSack.returnPackages(repoid, patterns=excludelist)
         exactmatch, matched, unmatched = \
-           parsePackages(pkgs, excludelist, casematch=1)
+           parsePackages(pkgs, excludelist, casematch=1, unique='repo-pkgkey')
 
         for po in exactmatch + matched:
             self.verbose_logger.debug('Excluding %s', po)
diff --git a/yum/packages.py b/yum/packages.py
index 42c3174..ebb0301 100644
--- a/yum/packages.py
+++ b/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:

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
Yum-devel mailing list
[email protected]
https://lists.dulug.duke.edu/mailman/listinfo/yum-devel

Reply via email to