[Yum-devel] Depsolving test cases

James Antill jantill at redhat.com
Thu Sep 6 21:18:53 UTC 2007


 I've been trying to understand enough of the code+unit tests so I can
add test cases for all the problems we had with 3.2.1* that I tried to
get into RHEL-5.1.
 Atm. I've got one thing that might be a bug, and one that I'm jsut
confused about:

1. I have:

    def testInstallSinglePackageRequireVer3Installed(self):
        po = FakePackage('zsh', '1', '1', None, 'i386')
        po.addRequires('zip', 'GE', ('2', '1.3', '4'))
        self.tsInfo.addInstall(po)

        ipo = FakePackage('zip', '1.3', '4', '2', 'i386')
        self.rpmdb.addPackage(ipo)

        self.assertEquals('ok', self.resolveCode(self.tsInfo, self.rpmdb))

...but this fails due to yum/packages.py:matchingPrcos() where:

        for (n, f, (e, v, r)) in self.returnPrco(prcotype):
            # But here f == '=':
            [...]
            matched = rpmUtils.miscutils.rangeCompare(
                reqtuple, (n, f, (e, v, r)))
            # So this is ('zip', 'GE', ('2', '1.3', '4')) ('zip', '=', ('2', '1.3', '4'))
            # which fails.

...the following diff fixes the test case for me, but seems hacky:

diff --git a/yum/packages.py b/yum/packages.py
index d11816e..43fa097 100644
--- a/yum/packages.py
+++ b/yum/packages.py
@@ -277,6 +277,8 @@ class RpmBase(object):
             if reqn != n:
                 continue
 
+            if f == '=':
+                f = 'EQ'
             if f != 'EQ' and prcotype == 'provides':
                 # isn't this odd, it's not 'EQ' and it is a provides
                 # - it really should be EQ

2. The second problem I have is that, I can't see how to create a
correct multi-lib. requires ... the prco list of tuples doesn't contain
it and yum doesn't seem to take it from the package with the requires
so:

    def testInstallSinglePackageRequireNotProvidedMultiLib(self):
        po = FakePackage('zsh', '1', '1', None, 'x86_64')
        po.addRequires('zip', None, (None, None, None))
        self.tsInfo.addInstall(po)

        ipo = FakePackage('zip', '1', '3', None, 'i386')
        self.rpmdb.addPackage(ipo)

        # self.assertEquals('err', self.resolveCode(self.tsInfo, self.rpmdb))

...if the above assert is uncommented it fails. I'm sure I'm doing
_something_ wrong here, but I can't see what.


 Current tree can be got from...

 git clone http://people.redhat.com/jantill/gits/yum check

-- 
James Antill <jantill at redhat.com>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://lists.baseurl.org/pipermail/yum-devel/attachments/20070906/a7592c97/attachment.pgp 


More information about the Yum-devel mailing list