|
|
@ -725,31 +725,41 @@ def install(module, items, repoq, yum_basecmd, conf_file, en_repos, dis_repos, i
|
|
|
|
downgrade_candidate = False
|
|
|
|
downgrade_candidate = False
|
|
|
|
|
|
|
|
|
|
|
|
# check if pkgspec is installed (if possible for idempotence)
|
|
|
|
# check if pkgspec is installed (if possible for idempotence)
|
|
|
|
# localpkg
|
|
|
|
if spec.endswith('.rpm'):
|
|
|
|
if spec.endswith('.rpm') and '://' not in spec:
|
|
|
|
if '://' not in spec and not os.path.exists(spec):
|
|
|
|
# get the pkg name-v-r.arch
|
|
|
|
|
|
|
|
if not os.path.exists(spec):
|
|
|
|
|
|
|
|
res['msg'] += "No RPM file matching '%s' found on system" % spec
|
|
|
|
res['msg'] += "No RPM file matching '%s' found on system" % spec
|
|
|
|
res['results'].append("No RPM file matching '%s' found on system" % spec)
|
|
|
|
res['results'].append("No RPM file matching '%s' found on system" % spec)
|
|
|
|
res['rc'] = 127 # Ensure the task fails in with-loop
|
|
|
|
res['rc'] = 127 # Ensure the task fails in with-loop
|
|
|
|
module.fail_json(**res)
|
|
|
|
module.fail_json(**res)
|
|
|
|
|
|
|
|
|
|
|
|
envra = local_envra(spec)
|
|
|
|
if '://' in spec:
|
|
|
|
|
|
|
|
package = fetch_rpm_from_url(spec, module=module)
|
|
|
|
# look for them in the rpmdb
|
|
|
|
else:
|
|
|
|
if is_installed(module, repoq, envra, conf_file, en_repos=en_repos, dis_repos=dis_repos, installroot=installroot):
|
|
|
|
package = spec
|
|
|
|
# if they are there, skip it
|
|
|
|
|
|
|
|
continue
|
|
|
|
|
|
|
|
pkg = spec
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# URL
|
|
|
|
# most common case is the pkg is already installed
|
|
|
|
elif '://' in spec:
|
|
|
|
|
|
|
|
# download package so that we can check if it's already installed
|
|
|
|
|
|
|
|
package = fetch_rpm_from_url(spec, module=module)
|
|
|
|
|
|
|
|
envra = local_envra(package)
|
|
|
|
envra = local_envra(package)
|
|
|
|
if is_installed(module, repoq, envra, conf_file, en_repos=en_repos, dis_repos=dis_repos, installroot=installroot):
|
|
|
|
installed_pkgs = is_installed(module, repoq, envra, conf_file, en_repos=en_repos, dis_repos=dis_repos, installroot=installroot)
|
|
|
|
# if it's there, skip it
|
|
|
|
if installed_pkgs:
|
|
|
|
|
|
|
|
res['results'].append('%s providing %s is already installed' % (installed_pkgs[0], package))
|
|
|
|
continue
|
|
|
|
continue
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(name, ver, rel, epoch, arch) = splitFilename(envra)
|
|
|
|
|
|
|
|
installed_pkgs = is_installed(module, repoq, name, conf_file, en_repos=en_repos, dis_repos=dis_repos, installroot=installroot)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# TODO support downgrade for rpm files
|
|
|
|
|
|
|
|
if len(installed_pkgs) == 1:
|
|
|
|
|
|
|
|
installed_pkg = installed_pkgs[0]
|
|
|
|
|
|
|
|
(cur_name, cur_ver, cur_rel, cur_epoch, cur_arch) = splitFilename(installed_pkg)
|
|
|
|
|
|
|
|
cur_epoch = cur_epoch or '0'
|
|
|
|
|
|
|
|
compare = compareEVR((cur_epoch, cur_ver, cur_rel), (epoch, ver, rel))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# compare > 0 (higher version is installed) or compare == 0 (exact version is installed)
|
|
|
|
|
|
|
|
if compare >= 0:
|
|
|
|
|
|
|
|
continue
|
|
|
|
|
|
|
|
# else: if there are more installed packages with the same name, that would mean
|
|
|
|
|
|
|
|
# kernel, gpg-pubkey or like, so just let yum deal with it and try to install it
|
|
|
|
|
|
|
|
|
|
|
|
pkg = package
|
|
|
|
pkg = package
|
|
|
|
|
|
|
|
|
|
|
|
# groups
|
|
|
|
# groups
|
|
|
|