|
|
eb5f31 |
commit d4ff5427368977f74a8ba7b0be51752023592025
|
|
|
eb5f31 |
Author: Valentina Mukhamedzhanova <vmukhame@redhat.com>
|
|
|
eb5f31 |
Date: Wed Mar 16 16:22:34 2016 +0100
|
|
|
eb5f31 |
|
|
|
eb5f31 |
Add config options skip_missing_names_on_install and skip_missing_names_on_update. BZ#1274211
|
|
|
eb5f31 |
|
|
|
eb5f31 |
diff --git a/cli.py b/cli.py
|
|
|
eb5f31 |
index fd6e715..54a2e81 100755
|
|
|
eb5f31 |
--- a/cli.py
|
|
|
eb5f31 |
+++ b/cli.py
|
|
|
eb5f31 |
@@ -982,6 +982,8 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
|
|
|
eb5f31 |
except:
|
|
|
eb5f31 |
self.verbose_logger.warning(_('Bad %s argument %s.'),
|
|
|
eb5f31 |
basecmd, arg)
|
|
|
eb5f31 |
+ if not self.conf.skip_missing_names_on_install:
|
|
|
eb5f31 |
+ return 1, [_('Not tolerating missing names on install, stopping.')]
|
|
|
eb5f31 |
continue
|
|
|
eb5f31 |
txmbrs = self.install(name=n, arch=a)
|
|
|
eb5f31 |
elif basecmd == 'install-nevra':
|
|
|
eb5f31 |
@@ -992,6 +994,8 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
|
|
|
eb5f31 |
except:
|
|
|
eb5f31 |
self.verbose_logger.warning(_('Bad %s argument %s.'),
|
|
|
eb5f31 |
basecmd, arg)
|
|
|
eb5f31 |
+ if not self.conf.skip_missing_names_on_install:
|
|
|
eb5f31 |
+ return 1, [_('Not tolerating missing names on install, stopping.')]
|
|
|
eb5f31 |
continue
|
|
|
eb5f31 |
txmbrs = self.install(name=n,
|
|
|
eb5f31 |
epoch=e, version=v, release=r, arch=a)
|
|
|
eb5f31 |
@@ -1000,12 +1004,16 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
|
|
|
eb5f31 |
txmbrs = self.install(pattern=arg)
|
|
|
eb5f31 |
except yum.Errors.GroupInstallError, e:
|
|
|
eb5f31 |
self.verbose_logger.log(yum.logginglevels.INFO_2, e)
|
|
|
eb5f31 |
+ if not self.conf.skip_missing_names_on_install:
|
|
|
eb5f31 |
+ return 1, [_('Not tolerating missing names on install, stopping.')]
|
|
|
eb5f31 |
except yum.Errors.InstallError:
|
|
|
eb5f31 |
self.verbose_logger.log(yum.logginglevels.INFO_2,
|
|
|
eb5f31 |
_('No package %s%s%s available.'),
|
|
|
eb5f31 |
self.term.MODE['bold'], arg,
|
|
|
eb5f31 |
self.term.MODE['normal'])
|
|
|
eb5f31 |
self._maybeYouMeant(arg)
|
|
|
eb5f31 |
+ if not self.conf.skip_missing_names_on_install:
|
|
|
eb5f31 |
+ return 1, [_('Not tolerating missing names on install, stopping.')]
|
|
|
eb5f31 |
else:
|
|
|
eb5f31 |
done = True
|
|
|
eb5f31 |
self._install_upgraded_requires(txmbrs)
|
|
|
eb5f31 |
@@ -1057,10 +1065,19 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
|
|
|
eb5f31 |
self._install_upgraded_requires(txmbrs)
|
|
|
eb5f31 |
continue
|
|
|
eb5f31 |
|
|
|
eb5f31 |
- txmbrs = self.update(pattern=item, update_to=update_to)
|
|
|
eb5f31 |
+ try:
|
|
|
eb5f31 |
+ txmbrs = self.update(pattern=item, update_to=update_to)
|
|
|
eb5f31 |
+ except (yum.Errors.UpdateMissingNameError, yum.Errors.GroupInstallError):
|
|
|
eb5f31 |
+ self._checkMaybeYouMeant(item)
|
|
|
eb5f31 |
+ return 1, [_('Not tolerating missing names on update, stopping.')]
|
|
|
eb5f31 |
+
|
|
|
eb5f31 |
self._install_upgraded_requires(txmbrs)
|
|
|
eb5f31 |
if not txmbrs:
|
|
|
eb5f31 |
self._checkMaybeYouMeant(item)
|
|
|
eb5f31 |
+ if not self.conf.skip_missing_names_on_update:
|
|
|
eb5f31 |
+ matches = self.doPackageLists(pkgnarrow='all', patterns=[item], ignore_case=False)
|
|
|
eb5f31 |
+ if matches.available and not matches.installed:
|
|
|
eb5f31 |
+ return 1, [_('Not tolerating missing names on update, stopping.')]
|
|
|
eb5f31 |
|
|
|
eb5f31 |
if len(self.tsInfo) > oldcount:
|
|
|
eb5f31 |
change = len(self.tsInfo) - oldcount
|
|
|
eb5f31 |
diff --git a/docs/yum.conf.5 b/docs/yum.conf.5
|
|
|
eb5f31 |
index 116829a..f823c6f 100644
|
|
|
eb5f31 |
--- a/docs/yum.conf.5
|
|
|
eb5f31 |
+++ b/docs/yum.conf.5
|
|
|
eb5f31 |
@@ -945,6 +945,17 @@ Either `0' or `1'. Set this to `0' to disable the checking for writability on
|
|
|
eb5f31 |
/usr in the installroot (when going into the depsolving stage). Default is `1'
|
|
|
eb5f31 |
(perform the check).
|
|
|
eb5f31 |
|
|
|
eb5f31 |
+.IP
|
|
|
eb5f31 |
+\fBskip_missing_names_on_install\fR
|
|
|
eb5f31 |
+If set to False, 'yum install' will fail if it can't find any of the provided
|
|
|
eb5f31 |
+names (package, group, rpm file). Boolean (1, 0, True, False, yes, no). Defaults to True.
|
|
|
eb5f31 |
+
|
|
|
eb5f31 |
+.IP
|
|
|
eb5f31 |
+\fBskip_missing_names_on_update\fR
|
|
|
eb5f31 |
+If set to False, 'yum update' will fail if it can't find any of the provided
|
|
|
eb5f31 |
+names (package, group, rpm file). It will also fail if the provided name is a package
|
|
|
eb5f31 |
+which is available, but not installed. Boolean (1, 0, True, False, yes, no). Defaults to True.
|
|
|
eb5f31 |
+
|
|
|
eb5f31 |
.SH "[repository] OPTIONS"
|
|
|
eb5f31 |
.LP
|
|
|
eb5f31 |
The repository section(s) take the following form:
|
|
|
eb5f31 |
diff --git a/test/testbase.py b/test/testbase.py
|
|
|
eb5f31 |
index 6d240b0..b303356 100644
|
|
|
eb5f31 |
--- a/test/testbase.py
|
|
|
eb5f31 |
+++ b/test/testbase.py
|
|
|
eb5f31 |
@@ -46,6 +46,8 @@ class FakeConf(object):
|
|
|
eb5f31 |
self.tsflags = []
|
|
|
eb5f31 |
self.installonly_limit = 0
|
|
|
eb5f31 |
self.skip_broken = False
|
|
|
eb5f31 |
+ self.skip_missing_names_on_install = True
|
|
|
eb5f31 |
+ self.skip_missing_names_on_update = True
|
|
|
eb5f31 |
self.disable_excludes = []
|
|
|
eb5f31 |
self.multilib_policy = 'best'
|
|
|
eb5f31 |
self.persistdir = '/should-not-exist-bad-test!'
|
|
|
eb5f31 |
diff --git a/yum/Errors.py b/yum/Errors.py
|
|
|
eb5f31 |
index f69c061..3f87b0b 100644
|
|
|
eb5f31 |
--- a/yum/Errors.py
|
|
|
eb5f31 |
+++ b/yum/Errors.py
|
|
|
eb5f31 |
@@ -117,6 +117,9 @@ class GroupInstallError(InstallError):
|
|
|
eb5f31 |
|
|
|
eb5f31 |
class UpdateError(YumBaseError):
|
|
|
eb5f31 |
pass
|
|
|
eb5f31 |
+
|
|
|
eb5f31 |
+class UpdateMissingNameError(UpdateError):
|
|
|
eb5f31 |
+ pass
|
|
|
eb5f31 |
|
|
|
eb5f31 |
class RemoveError(YumBaseError):
|
|
|
eb5f31 |
pass
|
|
|
eb5f31 |
diff --git a/yum/__init__.py b/yum/__init__.py
|
|
|
eb5f31 |
index 1f6ce16..acaa973 100644
|
|
|
eb5f31 |
--- a/yum/__init__.py
|
|
|
eb5f31 |
+++ b/yum/__init__.py
|
|
|
eb5f31 |
@@ -4581,7 +4581,10 @@ much more problems).
|
|
|
eb5f31 |
return self._at_groupinstall(pattern, upgrade=True)
|
|
|
eb5f31 |
except Errors.GroupInstallError, e:
|
|
|
eb5f31 |
self.logger.warning(_('Warning: %s'), e)
|
|
|
eb5f31 |
- return []
|
|
|
eb5f31 |
+ if self.conf.skip_missing_names_on_update:
|
|
|
eb5f31 |
+ return []
|
|
|
eb5f31 |
+ else:
|
|
|
eb5f31 |
+ raise
|
|
|
eb5f31 |
|
|
|
eb5f31 |
def _at_groupremove(self, pattern):
|
|
|
eb5f31 |
" Do groupremove via. leading @ on the cmd line, for remove."
|
|
|
eb5f31 |
@@ -5185,6 +5188,8 @@ much more problems).
|
|
|
eb5f31 |
|
|
|
eb5f31 |
if not availpkgs and not instpkgs:
|
|
|
eb5f31 |
self.logger.critical(_('No Match for argument: %s') % to_unicode(arg))
|
|
|
eb5f31 |
+ if not self.conf.skip_missing_names_on_update:
|
|
|
eb5f31 |
+ raise Errors.UpdateMissingNameError, _('Not tolerating missing names on update, stopping.')
|
|
|
eb5f31 |
|
|
|
eb5f31 |
else: # we have kwargs, sort them out.
|
|
|
eb5f31 |
nevra_dict = self._nevra_kwarg_parse(kwargs)
|
|
|
eb5f31 |
diff --git a/yum/config.py b/yum/config.py
|
|
|
eb5f31 |
index 6bd8d24..954700b 100644
|
|
|
eb5f31 |
--- a/yum/config.py
|
|
|
eb5f31 |
+++ b/yum/config.py
|
|
|
eb5f31 |
@@ -729,6 +729,8 @@ class StartupConf(BaseConfig):
|
|
|
eb5f31 |
syslog_facility = Option('LOG_USER')
|
|
|
eb5f31 |
syslog_device = Option('/dev/log')
|
|
|
eb5f31 |
persistdir = Option('/var/lib/yum')
|
|
|
eb5f31 |
+ skip_missing_names_on_install = BoolOption(True)
|
|
|
eb5f31 |
+ skip_missing_names_on_update = BoolOption(True)
|
|
|
eb5f31 |
|
|
|
eb5f31 |
class YumConf(StartupConf):
|
|
|
eb5f31 |
"""Configuration option definitions for yum.conf's [main] section.
|
|
|
eb5f31 |
commit be18ab78927522db11cfae5e4f270b073ed1df0b
|
|
|
eb5f31 |
Author: Valentina Mukhamedzhanova <vmukhame@redhat.com>
|
|
|
eb5f31 |
Date: Wed Mar 16 16:16:49 2016 +0100
|
|
|
eb5f31 |
|
|
|
eb5f31 |
Fix returnPackages() to respect ignore_case.
|
|
|
eb5f31 |
|
|
|
eb5f31 |
diff --git a/yum/rpmsack.py b/yum/rpmsack.py
|
|
|
eb5f31 |
index 11814f1..0990edd 100644
|
|
|
eb5f31 |
--- a/yum/rpmsack.py
|
|
|
eb5f31 |
+++ b/yum/rpmsack.py
|
|
|
eb5f31 |
@@ -607,6 +607,9 @@ class RPMDBPackageSack(PackageSackBase):
|
|
|
eb5f31 |
# will pick up any loads :)
|
|
|
eb5f31 |
pkgs = self.searchNames([pat])
|
|
|
eb5f31 |
if not pkgs:
|
|
|
eb5f31 |
+ # We could be given gliBc or mysql
|
|
|
eb5f31 |
+ if ignore_case:
|
|
|
eb5f31 |
+ break
|
|
|
eb5f31 |
# We need to do a big search for 'pkg*'
|
|
|
eb5f31 |
if misc.re_glob(pat):
|
|
|
eb5f31 |
break
|