| 1 | #! /usr/bin/python -tt
|
|---|
| 2 |
|
|---|
| 3 | import sys
|
|---|
| 4 | import yum
|
|---|
| 5 |
|
|---|
| 6 | __provides_of_requires_exact__ = False
|
|---|
| 7 |
|
|---|
| 8 | yb1 = yum.YumBase()
|
|---|
| 9 | yb1.conf.cache = True
|
|---|
| 10 | yb2 = yum.YumBase()
|
|---|
| 11 | yb2.conf.cache = True
|
|---|
| 12 |
|
|---|
| 13 | if len(sys.argv) > 1 and sys.argv[1].lower() == 'full':
|
|---|
| 14 | print "Doing full test"
|
|---|
| 15 | __provides_of_requires_exact__ = True
|
|---|
| 16 |
|
|---|
| 17 | assert hasattr(yb1.rpmdb, '__cache_rpmdb__')
|
|---|
| 18 | yb1.rpmdb.__cache_rpmdb__ = False
|
|---|
| 19 | yb2.setCacheDir()
|
|---|
| 20 |
|
|---|
| 21 | # Version
|
|---|
| 22 | ver1 = yb1.rpmdb.simpleVersion(main_only=True)[0]
|
|---|
| 23 | ver2 = yb2.rpmdb.simpleVersion(main_only=True)[0]
|
|---|
| 24 | if ver1 != ver2:
|
|---|
| 25 | print >>sys.stderr, "Error: Version mismatch:", ver1, ver2
|
|---|
| 26 |
|
|---|
| 27 | # Conflicts
|
|---|
| 28 | cpkgs1 = yb1.rpmdb.returnConflictPackages()
|
|---|
| 29 | cpkgs2 = yb2.rpmdb.returnConflictPackages()
|
|---|
| 30 | if len(cpkgs1) != len(cpkgs2):
|
|---|
| 31 | print >>sys.stderr, "Error: Conflict len mismatch:", len(cpkgs1),len(cpkgs2)
|
|---|
| 32 | for pkg in cpkgs1:
|
|---|
| 33 | if pkg not in cpkgs2:
|
|---|
| 34 | print >>sys.stderr, "Error: Conflict cache missing", pkg
|
|---|
| 35 | for pkg in cpkgs2:
|
|---|
| 36 | if pkg not in cpkgs1:
|
|---|
| 37 | print >>sys.stderr, "Error: Conflict cache extra", pkg
|
|---|
| 38 |
|
|---|
| 39 | # File Requires
|
|---|
| 40 | frd1, blah, fpd1 = yb1.rpmdb.fileRequiresData()
|
|---|
| 41 | frd2, blah, fpd2 = yb2.rpmdb.fileRequiresData()
|
|---|
| 42 | if len(frd1) != len(frd2):
|
|---|
| 43 | print >>sys.stderr, "Error: FileReq len mismatch:", len(frd1), len(frd2)
|
|---|
| 44 | for pkgtup in frd1:
|
|---|
| 45 | if pkgtup not in frd2:
|
|---|
| 46 | print >>sys.stderr, "Error: FileReq cache missing", pkgtup
|
|---|
| 47 | continue
|
|---|
| 48 | if len(set(frd1[pkgtup])) != len(set(frd2[pkgtup])):
|
|---|
| 49 | print >>sys.stderr, ("Error: FileReq[%s] len mismatch:" % (pkgtup,),
|
|---|
| 50 | len(frd1[pkgtup]), len(frd2[pkgtup]))
|
|---|
| 51 | for name in frd1[pkgtup]:
|
|---|
| 52 | if name not in frd2[pkgtup]:
|
|---|
| 53 | print >>sys.stderr, ("Error: FileReq[%s] cache missing" % (pkgtup,),
|
|---|
| 54 | name)
|
|---|
| 55 | for pkgtup in frd2:
|
|---|
| 56 | if pkgtup not in frd1:
|
|---|
| 57 | print >>sys.stderr, "Error: FileReq cache extra", pkgtup
|
|---|
| 58 | continue
|
|---|
| 59 | for name in frd2[pkgtup]:
|
|---|
| 60 | if name not in frd1[pkgtup]:
|
|---|
| 61 | print >>sys.stderr, ("Error: FileReq[%s] cache extra" % (pkgtup,),
|
|---|
| 62 | name)
|
|---|
| 63 |
|
|---|
| 64 | # File Provides (of requires) -- not exact
|
|---|
| 65 | if len(fpd1) != len(fpd2):
|
|---|
| 66 | print >>sys.stderr, "Error: FileProv len mismatch:", len(fpd1), len(fpd2)
|
|---|
| 67 | for name in fpd1:
|
|---|
| 68 | if name not in fpd2:
|
|---|
| 69 | print >>sys.stderr, "Error: FileProv cache missing", name
|
|---|
| 70 | continue
|
|---|
| 71 |
|
|---|
| 72 | if not __provides_of_requires_exact__:
|
|---|
| 73 | continue # We might be missing some providers
|
|---|
| 74 |
|
|---|
| 75 | if len(fpd1[name]) != len(fpd2[name]):
|
|---|
| 76 | print >>sys.stderr, ("Error: FileProv[%s] len mismatch:" % (pkgtup,),
|
|---|
| 77 | len(fpd1[name]), len(fpd2[name]))
|
|---|
| 78 | for pkgtup in fpd1[name]:
|
|---|
| 79 | if pkgtup not in fpd2[name]:
|
|---|
| 80 | print >>sys.stderr,"Error: FileProv[%s] cache missing" % name,pkgtup
|
|---|
| 81 | for name in fpd2:
|
|---|
| 82 | if name not in fpd1:
|
|---|
| 83 | print >>sys.stderr, "Error: FileProv cache extra", name
|
|---|
| 84 | continue
|
|---|
| 85 | for pkgtup in fpd2[name]:
|
|---|
| 86 | if pkgtup not in fpd1[name]:
|
|---|
| 87 | print >>sys.stderr,"Error: FileProv[%s] cache extra" % name,pkgtup
|
|---|