def cmp_pkgrevno(package, revno, pkgcache=None):
    """Compare supplied revno with the revno of the installed package.

    *  1 => Installed revno is greater than supplied arg
    *  0 => Installed revno is the same as supplied arg
    * -1 => Installed revno is less than supplied arg

    This function imports YumBase function if the pkgcache argument
    is None.
    """
    if not pkgcache:
        y = yum.YumBase()
        packages = y.doPackageLists()
        pkgcache = {i.Name: i.version for i in packages['installed']}
    pkg = pkgcache[package]
    if pkg > revno:
        return 1
    if pkg < revno:
        return -1
    return 0
Compare supplied revno with the revno of the installed package.

    *  1 => Installed revno is greater than supplied arg
    *  0 => Installed revno is the same as supplied arg
    * -1 => Installed revno is less than supplied arg

    This function imports YumBase function if the pkgcache argument
    is None.