def is_update(self, repoq, pkgspec, qf=def_qf):
    if (not repoq):
        pkgs = []
        updates = []
        try:
            my = self.yum_base()
            for rid in self.disablerepo:
                my.repos.disableRepo(rid)
            for rid in self.enablerepo:
                my.repos.enableRepo(rid)
            pkgs = (my.returnPackagesByDep(pkgspec) + my.returnInstalledPackagesByDep(pkgspec))
            if (not pkgs):
                (e, m, _) = my.pkgSack.matchPackageNames([pkgspec])
                pkgs = (e + m)
            updates = my.doPackageLists(pkgnarrow='updates').updates
        except Exception as e:
            self.module.fail_json(msg=('Failure talking to yum: %s' % to_native(e)))
        retpkgs = (pkg for pkg in pkgs if (pkg in updates))
        return set((self.po_to_envra(p) for p in retpkgs))
    else:
        myrepoq = list(repoq)
        r_cmd = ['--disablerepo', ','.join(self.disablerepo)]
        myrepoq.extend(r_cmd)
        r_cmd = ['--enablerepo', ','.join(self.enablerepo)]
        myrepoq.extend(r_cmd)
        cmd = (myrepoq + ['--pkgnarrow=updates', '--qf', qf, pkgspec])
        (rc, out, err) = self.module.run_command(cmd)
        if (rc == 0):
            return set((p for p in out.split('\n') if p.strip()))
        else:
            self.module.fail_json(msg=('Error from repoquery: %s: %s' % (cmd, err)))
    return set()
def is_update(self, repoq, pkgspec, qf=def_qf):
    if (not repoq):
        pkgs = []
        updates = []
        try:
            my = self.yum_base()
            for rid in self.disablerepo:
                my.repos.disableRepo(rid)
            for rid in self.enablerepo:
                my.repos.enableRepo(rid)
            pkgs = (my.returnPackagesByDep(pkgspec) + my.returnInstalledPackagesByDep(pkgspec))
            if (not pkgs):
                (e, m, _) = my.pkgSack.matchPackageNames([pkgspec])
                pkgs = (e + m)
            updates = my.doPackageLists(pkgnarrow='updates').updates
        except Exception as e:
            self.module.fail_json(msg=('Failure talking to yum: %s' % to_native(e)))
        retpkgs = (pkg for pkg in pkgs if (pkg in updates))
        return set((self.po_to_envra(p) for p in retpkgs))
    else:
        myrepoq = list(repoq)
        r_cmd = ['--disablerepo', ','.join(self.disablerepo)]
        myrepoq.extend(r_cmd)
        r_cmd = ['--enablerepo', ','.join(self.enablerepo)]
        myrepoq.extend(r_cmd)
        cmd = (myrepoq + ['--pkgnarrow=updates', '--qf', qf, pkgspec])
        (rc, out, err) = self.module.run_command(cmd)
        if (rc == 0):
            return set((p for p in out.split('\n') if p.strip()))
        else:
            self.module.fail_json(msg=('Error from repoquery: %s: %s' % (cmd, err)))
    return set()