Commits

Michał Górny committed f9287d3

Fix remaining portage.settings references.

This should fix updating Mercurial repos when using the package set.

Comments (0)

Files changed (4)

SmartLiveRebuild/core.py

 class SLRFailure(Exception):
 	pass
 
-def SmartLiveRebuild(opts, db = None, saveuid = False):
+def SmartLiveRebuild(opts, db = None, saveuid = False, settings = None):
+	if settings is None:
+		settings = portage.settings
 	if not opts.color:
 		out.monochromize()
 
 			envtmpf = tempfile.NamedTemporaryFile('w+b')
 			try:
 				if db is None:
-					db = portage.db[portage.settings['ROOT']]['vartree'].dbapi
+					db = portage.db[settings['ROOT']]['vartree'].dbapi
 
 				for cpv in db.cpv_all():
 					try:
 
 							if vcses[vcs] is not None:
 								env = bz2.BZ2File('%s/environment.bz2' % db.getpath(cpv), 'r')
-								vcs = vcses[vcs](cpv, env, envtmpf, opts)
+								vcs = vcses[vcs](cpv, env, envtmpf, opts, settings)
 								env.close()
 								if opts.network or vcs.getsavedrev():
 									dir = vcs.getpath()

SmartLiveRebuild/sets.py

 		try:
 			if packages is None:
 				packages = SmartLiveRebuild(self._options,
-						db = self._dbapi, saveuid = True)
+						db = self._dbapi, saveuid = True, settings = self._settings)
 		except SLRFailure:
 			pass
 		else:

SmartLiveRebuild/vcs/__init__.py

 
 		return dict(zip(vars, self.call(['bash', '-c', script]).split('\0')))
 
-	def __init__(self, cpv, envf, tmpf, opts):
+	def __init__(self, cpv, envf, tmpf, opts, settings):
 		self.cpv = [cpv]
 		self.env = self.bashparse(envf, self.reqenv + self.optenv, tmpf)
 		self._opts = opts
+		self._settings = settings
 
 		missingvars = [v for v in self.reqenv if self.env[v] == '']
 		if len(missingvars) > 0:

SmartLiveRebuild/vcs/mercurial.py

 			raise NonLiveEbuild('EHG_REVISION set, package is not really a live one')
 
 	def getpath(self):
-		dd = portage.settings['PORTAGE_ACTUAL_DISTDIR'] or portage.settings['DISTDIR']
+		dd = self._settings['PORTAGE_ACTUAL_DISTDIR'] or self._settings['DISTDIR']
 		bn = os.path.basename(self.env['EHG_REPO_URI']) or os.path.basename(os.path.dirname(self.env['EHG_REPO_URI']))
 		assert (bn != '')