Merge pull request #31092 from terminalmage/issue31014-2015.8.4.follow_up

Apply PR #31031 to 2015.8.4.follow_up
This commit is contained in:
Mike Place 2016-02-10 13:54:37 -07:00
commit 5a6a93e98b
2 changed files with 9 additions and 13 deletions

View file

@ -185,10 +185,7 @@ def _repoquery(repoquery_args,
_check_repoquery()
if _yum() == 'dnf':
cmd = 'dnf repoquery --quiet --queryformat {0} {1}'.format(
_cmd_quote(
query_format.replace('-%{VERSION}_', '-%{EPOCH}:%{VERSION}_')
),
repoquery_args
_cmd_quote(query_format), repoquery_args
)
else:
cmd = 'repoquery --plugins --queryformat {0} {1}'.format(
@ -207,11 +204,7 @@ def _repoquery(repoquery_args,
comment += call['stdout']
raise CommandExecutionError(comment)
else:
if _yum() == 'dnf':
# Remove the epoch when it is zero to maintain backward compatibility
return call['stdout'].replace('_|-0:', '_|-').splitlines()
else:
return call['stdout'].splitlines()
return call['stdout'].splitlines()
def _get_repo_options(**kwargs):

View file

@ -30,7 +30,8 @@ ARCHES_SH = ('sh3', 'sh4', 'sh4a')
ARCHES = ARCHES_64 + ARCHES_32 + ARCHES_PPC + ARCHES_S390 + \
ARCHES_ALPHA + ARCHES_ARM + ARCHES_SH
QUERYFORMAT = '%{NAME}_|-%{VERSION}_|-%{RELEASE}_|-%{ARCH}_|-%{REPOID}'
# EPOCHNUM can't be used until RHEL5 is EOL as it is not present
QUERYFORMAT = '%{NAME}_|-%{EPOCH}_|-%{VERSION}_|-%{RELEASE}_|-%{ARCH}_|-%{REPOID}'
def _osarch():
@ -69,7 +70,7 @@ def parse_pkginfo(line, osarch=None):
)
try:
name, pkg_version, release, arch, repoid = line.split('_|-')
name, epoch, version, release, arch, repoid = line.split('_|-')
# Handle unpack errors (should never happen with the queryformat we are
# using, but can't hurt to be careful).
except ValueError:
@ -82,6 +83,8 @@ def parse_pkginfo(line, osarch=None):
if arch not in (osarch, 'noarch'):
name += '.{0}'.format(arch)
if release:
pkg_version += '-{0}'.format(release)
version += '-{0}'.format(release)
if epoch not in ('(none)', '0'):
version = ':'.join((epoch, version))
return pkginfo(name, pkg_version, arch, repoid)
return pkginfo(name, version, arch, repoid)