Merge pull request #6304 from terminalmage/issue6299

yum: Allow 32bit pkgs in arches other than i686
This commit is contained in:
Joseph Hall 2013-07-24 19:06:40 -07:00
commit 66de441abf
2 changed files with 41 additions and 24 deletions

View File

@ -15,8 +15,9 @@ account when configuring your syslog daemon.
# Import python libs
import copy
import os
import logging
import os
import re
import yaml
# Import salt libs
@ -302,8 +303,9 @@ def list_pkgs(versions_as_list=False, **kwargs):
yb = yum.YumBase()
for p in yb.rpmdb:
name = p.name
if __grains__.get('cpuarch', '') == 'x86_64' and p.arch == 'i686':
name += '.i686'
if __grains__.get('cpuarch', '') == 'x86_64' \
and re.match('i\d86', p.arch):
name += '.{0}'.format(p.arch)
pkgver = p.version
if p.release:
pkgver += '-{0}'.format(p.release)
@ -433,8 +435,9 @@ def install(name=None,
software repository. To install a package file manually, use the
"sources" option.
32-bit packages can be installed on 64-bit systems by appending
``.i686`` to the end of the package name.
32-bit packages can be installed on 64-bit systems by appending the
architecture designation (``.i686``, ``.i586``, etc.) to the end of the
package name.
CLI Example::
salt '*' pkg.install <package name>
@ -536,11 +539,14 @@ def install(name=None,
else:
version = pkg_params[pkgname]
if version is not None:
if __grains__.get('cpuarch', '') == 'x86_64' \
and pkgname.endswith('.i686'):
# Remove '.i686' from pkgname
pkgname = pkgname[:-5]
arch = '.i686'
if __grains__.get('cpuarch', '') == 'x86_64':
try:
arch = re.search('(\.i\d86)$', pkgname).group(1)
except AttributeError:
arch = ''
else:
# Remove arch from pkgname
pkgname = pkgname[:-len(arch)]
else:
arch = ''
target = '{0}-{1}{2}'.format(pkgname, version, arch)
@ -652,10 +658,15 @@ def remove(name=None, pkgs=None, **kwargs):
# same comments as in upgrade for remove.
for target in targets:
if __grains__.get('cpuarch', '') == 'x86_64' \
and target.endswith('.i686'):
target = target[:-5]
arch = 'i686'
if __grains__.get('cpuarch', '') == 'x86_64':
try:
arch = re.search('(\.i\d86)$', target).group(1)
except AttributeError:
arch = None
else:
# Remove arch from pkgname
target = target[:-len(arch)]
arch = arch.lstrip('.')
else:
arch = None
yumbase.remove(name=target, arch=arch)

View File

@ -3,9 +3,10 @@ Support for YUM
'''
# Import python libs
import collections
import copy
import logging
import collections
import re
# Import salt libs
import salt.utils
@ -73,8 +74,9 @@ def _parse_pkginfo(line):
return None
# Support 32-bit packages on x86_64 systems
if __grains__.get('cpuarch', '') == 'x86_64' and arch == 'i686':
name += '.i686'
if __grains__.get('cpuarch', '') == 'x86_64' \
and re.match('i\d86', arch):
name += '.{0}'.format(arch)
if rel:
pkgver += '-{0}'.format(rel)
@ -282,8 +284,9 @@ def install(name=None,
software repository. To install a package file manually, use the
"sources" option.
32-bit packages can be installed on 64-bit systems by appending
``.i686`` to the end of the package name.
32-bit packages can be installed on 64-bit systems by appending the
architecture designation (``.i686``, ``.i586``, etc.) to the end of the
package name.
CLI Example::
salt '*' pkg.install <package name>
@ -370,11 +373,14 @@ def install(name=None,
targets.append(pkgname)
else:
cver = old.get(pkgname, '')
if __grains__.get('cpuarch', '') == 'x86_64' \
and pkgname.endswith('.i686'):
# Remove '.i686' from pkgname
pkgname = pkgname[:-5]
arch = '.i686'
if __grains__.get('cpuarch', '') == 'x86_64':
try:
arch = re.search('(\.i\d86)$', pkgname).group(1)
except AttributeError:
arch = ''
else:
# Remove arch from pkgname
pkgname = pkgname[:-len(arch)]
else:
arch = ''
pkgstr = '"{0}-{1}{2}"'.format(pkgname, version_num, arch)