Commits

Michał Górny committed 79d7755

Drop --allow-downgrade.

Just always allow downgrades.

Comments (0)

Files changed (3)

smartliverebuild/cli.py

 from smartliverebuild.core import SmartLiveRebuild, SLRFailure
 from smartliverebuild.output import out
 
-def check_downgrade(opt, optstr, val):
-	if val not in ('always', 'same-pv', 'never'):
-		raise OptionValueError("option %s: incorrect value %s." % (optstr, val))
-	return val
-
 def check_vcslist(opt, optstr, val):
 	val = val.split(',')
 	for vcs in val:
 	return val
 
 class SLROption(Option):
-	TYPES = Option.TYPES + ('downgrade', 'vcslist', 'cslist')
+	TYPES = Option.TYPES + ('vcslist', 'cslist')
 	TYPE_CHECKER = copy(Option.TYPE_CHECKER)
-	TYPE_CHECKER['downgrade'] = check_downgrade
 	TYPE_CHECKER['vcslist'] = check_vcslist
 	TYPE_CHECKER['cslist'] = check_cslist
 
 		help='Disable colorful output.')
 	opt.add_option('-d', '--debug', action='store_true', dest='debug',
 		help='Enable debugging measures.')
-	opt.add_option('-D', '--allow-downgrade', action='store', type='downgrade', dest='allow_downgrade',
-		help="When to allow downgrading package (one of 'never', 'same-pv', 'always')")
 	opt.add_option('-E', '--no-erraneous-merge', action='store_false', dest='erraneous_merge',
 		help='Disable emerging packages for which the update has failed.')
 	opt.add_option('-f', '--filter-packages', action='append', type='cslist', dest='filter_packages',

smartliverebuild/config.py

 class Config(ConfigParser):
 	def __init__(self, pm_conf):
 		self._real_defaults = {
-			'allow_downgrade': 'same-pv',
 			'color': 'True',
 			'config_file': '/etc/portage/smart-live-rebuild.conf',
 			'debug': 'False',
 				except ValueError:
 					out.err('Incorrect int value: %s=%s' % (k, v))
 					val[k] = int(self._real_defaults[k])
-			elif k == 'allow_downgrade':
-				if v not in ('always', 'same-pv', 'never'):
-					out.err('Incorrect value: %s=%s' % (k, v))
-					val[k] = self._real_defaults[k]
-				else:
-					val[k] = v
 			elif k == 'filter_packages': # list
 				if v != '':
 					val[k] = v.split(',')

smartliverebuild/core.py

 			splitcpv[0] = '-'.join(pkgsplit(splitcpv[0])[0:n])
 			return ':'.join(splitcpv)
 
-		if opts.allow_downgrade == 'always':
-			packages = [mypkgcut(x, 1) for x in packages]
-		else:
-			if opts.allow_downgrade == 'same-pv':
-				packages = [mypkgcut(x, 2) for x in packages]
-			packages = ['>=%s' % x for x in packages]
+		packages = [mypkgcut(x, 1) for x in packages]
 
 		# Check portdb for matches. Drop unmatched packages.
 		for p in list(packages):