Commits

Michał Górny committed 438df44

Use remote revision fetching whenever possible.

Comments (0)

Files changed (13)

SmartLiveRebuild/cli.py

 #	vim:fileencoding=utf-8
-# (c) 2010 Michał Górny <mgorny@gentoo.org>
+# (c) 2011 Michał Górny <mgorny@gentoo.org>
 # Released under the terms of the 3-clause BSD license or the GPL-2 license.
 
 import itertools, os
 		help='Spawn JOBS parallel processes to perform repository updates.')
 	opt.add_option('-l', '--local-rev', action='store_true', dest='local_rev',
 		help='Force determining the current package revision from the repository instead of using the one saved by portage.')
-	opt.add_option('-N', '--no-network', action='store_false', dest='network',
-		help='Disable network interaction and just aggregate already updated repositories (requires --local-rev not set).')
-	opt.add_option('-O', '--no-offline', action='store_false', dest='offline',
-		help='Disable setting ESCM_OFFLINE & EVCS_OFFLINE for emerge.')
 	opt.add_option('-p', '--pretend', action='store_true', dest='pretend',
 		help='Only print a list of the packages which were updated; do not call emerge to rebuild them.')
 	opt.add_option('-P', '--profile', action='store', dest='profile',

SmartLiveRebuild/config.py

 #	vim:fileencoding=utf-8
-# (c) 2010 Michał Górny <mgorny@gentoo.org>
+# (c) 2011 Michał Górny <mgorny@gentoo.org>
 # Released under the terms of the 3-clause BSD license or the GPL-2 license.
 
 import os, sys
 			'erraneous_merge': 'True',
 			'jobs': '1',
 			'local_rev': 'False',
-			'network': 'True',
-			'offline': 'True',
 			'pretend': 'False',
 			'profile': 'smart-live-rebuild',
 			'quickpkg': 'False',

SmartLiveRebuild/core.py

 #	vim:fileencoding=utf-8
-# (c) 2010 Michał Górny <mgorny@gentoo.org>
+# (c) 2011 Michał Górny <mgorny@gentoo.org>
 # Released under the terms of the 3-clause BSD license or the GPL-2 license.
 
 import bz2, errno, fcntl, os, os.path, pickle, select, shutil, signal, subprocess, sys, tempfile, time
 	if not opts.color:
 		out.monochromize()
 
-	if opts.local_rev and not opts.network:
-		out.err('The --local-rev and --no-network options can not be specified together.')
-		raise SLRFailure('')
 	if opts.jobs <= 0:
 		out.err('The argument to --jobs option must be a positive integer.')
 		raise SLRFailure('')
-	elif opts.jobs > 1 and not opts.network:
-		out.s1('Using parallel jobs with --no-network is inefficient, assuming no --jobs.')
-		opts.jobs = 1
 
 	childpid = None
 	commpipe = None
 									bash.grabenv(env)
 									vcs = vcscl(cpv, bash, opts, settings)
 									env.close()
-									if opts.network or vcs.getsavedrev():
-										dir = vcs.getpath()
-										if dir not in rebuilds:
-											rebuilds[dir] = vcs
-											processes.append(vcs)
-											loop_iter()
-										elif rebuilds[dir] in processes:
-											rebuilds[dir].append(vcs)
-										elif rebuilds[dir].cpv[0] in packages:
-											packages.extend(vcs.cpv)
-										elif rebuilds[dir].cpv[0] in erraneous:
-											erraneous.extend(vcs.cpv)
+
+									dir = vcs.getpath()
+									if dir not in rebuilds:
+										rebuilds[dir] = vcs
+										processes.append(vcs)
+										loop_iter()
+									elif rebuilds[dir] in processes:
+										rebuilds[dir].append(vcs)
+									elif rebuilds[dir].cpv[0] in packages:
+										packages.extend(vcs.cpv)
+									elif rebuilds[dir].cpv[0] in erraneous:
+										erraneous.extend(vcs.cpv)
 						except KeyboardInterrupt:
 							raise
 						except NonLiveEbuild as e:
 			out.s2(' '.join(cmd))
 			subprocess.Popen(cmd, stdout=sys.stderr).wait()
 
-		if opts.offline:
-			if opts.erraneous_merge and len(erraneous) > 0:
-				out.s1('Merging update-failed packages, assuming --no-offline.')
-				opts.offline = False
-			else:
-				os.environ['ESCM_OFFLINE'] = 'true'
-				os.environ['EVCS_OFFLINE'] = 'true'
-
 		if opts.allow_downgrade == 'always':
 			packages = [pkgsplit(x)[0] for x in packages]
 		else:

SmartLiveRebuild/vcs/__init__.py

 #	vim:fileencoding=utf-8
-# (c) 2010 Michał Górny <mgorny@gentoo.org>
+# (c) 2011 Michał Górny <mgorny@gentoo.org>
 # Released under the terms of the 3-clause BSD license or the GPL-2 license.
 
-import locale, os, subprocess, sys
+import locale, os, subprocess
 
 from SmartLiveRebuild.output import out
 
 
 	callenv = {}
 
+	requires_workdir = False
+
 	def __init__(self, cpv, bash, opts, settings):
 		""" Initialize the VCS class for package `cpv', storing it as
 			self.cpv. Call `bash' BashParser instance to get the values
 		""" Get the absolute path to the checkout directory. The program
 			will enter that particular directory before executing
 			the update command or calling one of the following methods:
-			- getrev(),
-			- diffstat().
+			- getrev().
 		"""
 		raise NotImplementedError('VCS class needs to override getpath()')
 
 			raise ValueError('Unable to append %s to %s' % (vcs.__class__, self.__class__))
 		self.cpv.append(vcs.cpv[0])
 
-	def getremoterev(self):
-		""" Return the revision given by the remote server without
-			touching the working copy.
-		"""
-		return None
-
 	def getsavedrev(self):
 		""" Return the revision saved by the eclass whenever the package
 			was built. This method should return the same type
 		""" Grab the revision from the work tree. """
 		raise NotImplementedError('VCS class needs to override getrev() or update()')
 
+	def parseoutput(self, out):
+		""" Parse output from updatecmd and return a revision. """
+		return out
+
 	@staticmethod
 	def revcmp(oldrev, newrev):
 		""" A revision comparison function, appropriate
 		"""
 		raise NotImplementedError('VCS class needs to override getupdatecmd()')
 
-	def diffstat(self, oldrev, newrev):
-		""" Execute the 'diffstat' command, summarizing the changes
-			between revisions `oldrev' and `newrev'.
-
-			If the VCS doesn't provide a standard diffstat command,
-			don't override this method.
-		"""
-		pass
-
 	def startupdate(self):
 		""" Start the update process. Grabs the current revision from
 			the checkout (or getsavedrev()), grabs the update command
 			(self.getupdatecmd()) and executes it in the background
 			using subprocess.Popen().
 
-			The STDOUT of the new process will be forwarded to STDERR
-			to avoid polluting the package list with `--pretend'.
-			If one of the called processes is braindead and insists on
-			closing one of these descriptors, use `2>&1' to force
-			replicating them on shell level.
+			The spawned command is supposed to return the new revision
+			on STDOUT, and any diagnostic messages on STDERR.
+			If necessary, shell output redirection (`>&2') can be used
+			to clean up STDOUT.
 
 			This function returns the spawned Popen() instance.
 		"""
 			# If the working copy was removed, we'll try to ping
 			# the remote server for updates. But for that:
 			# 1) user can't use --local-rev,
-			# 2) we have to able to get the saved rev.
+			# 2) we have to able to get the saved rev,
+			# 3) VCS has to support that.
 			# Otherwise, just re-raise the exception.
-			if self._opts.local_rev:
+			if self._opts.local_rev or self.requires_workdir:
 				raise
 			self.oldrev = self.getsavedrev()
 			if not self.oldrev:
 		else:
 			self.oldrev = (not self._opts.local_rev and self.getsavedrev()) or self.getrev()
 
-			if self._opts.network:
-				cmd = self.getupdatecmd()
-				out.s2(str(self))
-				out.s3(cmd)
-				self.subprocess = subprocess.Popen(cmd, stdout=sys.stderr, env=self.callenv, shell=True)
-			else:
-				self.subprocess = None
+		cmd = self.getupdatecmd()
+		out.s2(str(self))
+		out.s3(cmd)
+		self.subprocess = subprocess.Popen(cmd, stdout=subprocess.PIPE,
+				env=self.callenv, shell=True)
+		self.stdoutbuf = ''
 
 		return self.subprocess
 
 			one and returns the comparison result as a boolean.
 
 			In other words, if the revision changed (and thus package
-			needs to be rebuilt), this method returns True and calls
-			self.diffstat() if appropriate. Otherwise, it returns False.
+			needs to be rebuilt), this method returns True. Otherwise,
+			it returns False.
 		"""
-		if self.subprocess is None:
-			ret = 0
-		elif blocking:
-			ret = self.subprocess.wait()
-		else:
+
+		while True:
+			(sod, sed) = self.subprocess.communicate()
+			if sod:
+				self.stdoutbuf += sod
 			ret = self.subprocess.poll()
-			if ret is None:
+			if ret is not None:
+				break
+			elif not blocking:
 				return None
 
 		if ret == 0:
-			doingremote = False
-			try:
-				os.chdir(self.getpath())
-			except OSError:
-				# The directory could have been removed during update.
-				if not self.oldrev:
-					raise
-				# If we're running offline, just ignore the repo.
-				# Otherwise, try to get the current rev off the remote
-				# server.
-				if not self._opts.network:
-					newrev = self.oldrev
-				else:
-					newrev = self.getremoterev()
-					if not newrev:
-						raise
-					doingremote = True
-			else:
-				newrev = self.getrev()
+			newrev = self.parseoutput(self.stdoutbuf)
 
-			if self._opts.jobs > 1 or not self._opts.network:
+			if newrev is None:
+				if self.requires_workdir:
+					newrev = self.getrev()
+				else:
+					raise Exception('update command failed to return a rev')
+			if self._opts.jobs > 1:
 				out.s2(str(self))
 
 			if self.revcmp(self.oldrev, newrev):
 				out.s3('at rev %s%s%s (no changes)' % (out.green, self.oldrev, out.reset))
 				return False
 			else:
-				if not doingremote and self._opts.diffstat:
-					self.diffstat(self.oldrev, newrev)
 				out.s3('update from %s%s%s to %s%s%s' % (out.green, self.oldrev, out.reset, out.lime, newrev, out.reset))
-				if doingremote:
-					self._opts.offline = False
 				return True
 		else:
 			raise Exception('update command returned non-zero result')

SmartLiveRebuild/vcs/bzr.py

 #	vim:fileencoding=utf-8
-# (c) 2010 Michał Górny <mgorny@gentoo.org>
+# (c) 2011 Michał Górny <mgorny@gentoo.org>
 # Released under the terms of the 3-clause BSD license or the GPL-2 license.
 
-import codecs
-
 from SmartLiveRebuild.vcs import VCSSupport, NonLiveEbuild
 
 class BzrSupport(VCSSupport):
-	reqenv = ['EBZR_REVNO_CMD', 'EBZR_UPDATE_CMD']
-	optenv = ['EBZR_OPTIONS', 'EBZR_REPO_URI', 'EBZR_REVISION',
-			# API 1
-			'EBZR_CACHE_DIR', 'EBZR_STORE_DIR', 'EBZR_TREE_CRC32',
-			# API 2
-			'EBZR_REVNO', 'EBZR_WC_PATH']
+	reqenv = ['EBZR_REPO_URI', 'EBZR_REVNO_CMD', 'EBZR_UPDATE_CMD', 'EBZR_WC_PATH']
+	optenv = ['EBZR_OPTIONS', 'EBZR_REVISION', 'EBZR_REVNO']
 
 	def __init__(self, *args):
 		VCSSupport.__init__(self, *args)
 		if self.env['EBZR_REVISION']:
 			raise NonLiveEbuild('EBZR_REVISION set, package is not really a live one')
-		if self.env['EBZR_WC_PATH']:
-			self.api = 2
-		elif self.env['EBZR_STORE_DIR'] and self.env['EBZR_CACHE_DIR']:
-			self.api = 1
-		else:
-			raise Exception('No known eclass API found')
 		self.callenv['BZR_LOG'] = '/dev/null'
 
 	def getpath(self):
-		if self.api == 2:
-			return self.env['EBZR_WC_PATH']
-		else:
-			return '%s/%s' % (self.env['EBZR_STORE_DIR'], self.env['EBZR_CACHE_DIR'])
+		return self.env['EBZR_WC_PATH']
 
 	def __str__(self):
-		return self.env['EBZR_REPO_URI'] or VCSSupport.__str__(self)
+		return self.env['EBZR_REPO_URI']
+
+	def parseoutput(self, out):
+		return int(out) if out else None
 
 	def getrev(self):
-		if self.api == 2:
-			rev = self.call(self.env['EBZR_REVNO_CMD'].split())
-			return int(rev) if rev else None
-		else:
-			inp = codecs.open('%s/.bzr/checkout/dirstate' % self.getpath(), 'r', 'utf8', 'ignore')
-			for l in inp:
-				lf = l.split(None, 3)
-				if lf[0] == 'crc32:':
-					inp.close()
-					return int(lf[1])
-			else:
-				inp.close()
-				raise ValueError('Unable to find crc32 in .bzr/checkout/dirstate')
+		rev = self.call(self.env['EBZR_REVNO_CMD'].split())
+		return self.parseoutput(rev)
 
 	def getsavedrev(self):
-		if self.api == 2:
-			rev = self.env['EBZR_REVNO']
-		else:
-			rev = self.env['EBZR_TREE_CRC32']
-		return int(rev) if rev else None
+		rev = self.env['EBZR_REVNO']
+		return self.parseoutput(rev)
 
 	def revcmp(self, oldrev, newrev):
-		if self.api == 2:
-			return oldrev >= newrev
-		else:
-			return oldrev == newrev
-
-	def getremoterev(self):
-		if self.api == 2:
-			rev = self.call(self.env['EBZR_REVNO_CMD'].split() + [self.env['EBZR_REPO_URI']])
-			return int(rev) if rev else None
-		else:
-			return None
+		return oldrev >= newrev
 
 	def getupdatecmd(self):
-		return '%s %s' % (self.env['EBZR_UPDATE_CMD'], self.env['EBZR_OPTIONS'])
+		return '%s %s' % (self.env['EBZR_REVNO_CMD'], self.env['EBZR_REPO_URI'])

SmartLiveRebuild/vcs/cvs.py

 #	vim:fileencoding=utf-8
-# (c) 2010 Michał Górny <mgorny@gentoo.org>
+# (c) 2011 Michał Górny <mgorny@gentoo.org>
 # Released under the terms of the 3-clause BSD license or the GPL-2 license.
 
 import hashlib, locale, tempfile
 	optenv = ['ECVS_BRANCH', 'ECVS_CLEAN', 'ECVS_LOCAL', 'ECVS_LOCALNAME', 'ECVS_PASS',
 			'ECVS_RUNAS', 'ECVS_UP_OPTS', 'ECVS_VERSION']
 
+	requires_workdir = True
+
 	def __init__(self, *args):
 		VCSSupport.__init__(self, *args)
 		if self.env['ECVS_RUNAS']:
 	def __str__(self):
 		return '%s (%s)' % (self.env['ECVS_SERVER'], self.env['ECVS_MODULE']) or VCSSupport.__str__(self)
 
+	def parseoutput(self, out):
+		# require calling getrev()
+		return None
+
 	def getsavedrev(self):
 		return self.env['ECVS_VERSION']
 
 		up_cmd = '%s -f -d "%s" update %s %s' % (self.env['ECVS_CVS_COMMAND'], up_root,
 				self.env['ECVS_UP_OPTS'], ' '.join(opts))
 
-		# CVS is stupid as hell and tries to close STDOUT, which is
-		# redirected... making long story short, we need to do some
-		# random magic to make things work with our Popen()...
-		stdout_cmd = 'exec 2>&1'
+		stdout_cmd = 'exec >&2'
 
 		cvs_passfile = tempfile.NamedTemporaryFile(delete=False)
 		env_cmd = 'export CVS_PASSFILE="%s" HOME=' % cvs_passfile.name

SmartLiveRebuild/vcs/darcs.py

 #	vim:fileencoding=utf-8
-# (c) 2010 Michał Górny <mgorny@gentoo.org>
+# (c) 2011 Michał Górny <mgorny@gentoo.org>
 # Released under the terms of the 3-clause BSD license or the GPL-2 license.
 
-import subprocess, sys, re
+import re
 
 from SmartLiveRebuild.vcs import VCSSupport
 
 			'EDARCS_DARCS_CMD']
 	optenv = ['EDARCS_PATCHCOUNT']
 
+	requires_workdir = True
+
 	def getpath(self):
 		return '%s/%s' \
 			% (self.env['EDARCS_TOP_DIR'], self.env['EDARCS_LOCALREPO'])
 	def __str__(self):
 		return self.env['EDARCS_REPOSITORY'] or VCSSupport.__str__(self)
 
+	def parseoutput(self, out):
+		return None
+
 	def getrev(self):
 		result = self.call(['darcs', 'show', 'repo'])
 		return int(re.search('Num Patches: ([0-9]+)', result).group(1))
 		return oldrev == newrev
 
 	def getupdatecmd(self):
-		# darcs trying to close stderr as cvs does
-		# see SmartLiveRebuild/vcs/cvs.py for comments
-		return '%s %s --all %s %s 2>&1' % \
+		return '%s %s --all %s %s >&2' % \
 			(self.env['EDARCS_DARCS_CMD'],
 			self.env['EDARCS_UPDATE_CMD'],
 			self.env['EDARCS_OPTIONS'],
 			self.env['EDARCS_REPOSITORY'])
-
-	def diffstat(self, oldrev, newrev):
-		subprocess.Popen(['darcs', 'chan', '--last', newrev - oldrev],
-				stdout=sys.stderr).wait()

SmartLiveRebuild/vcs/git.py

 #	vim:fileencoding=utf-8
-# (c) 2010 Michał Górny <mgorny@gentoo.org>
+# (c) 2011 Michał Górny <mgorny@gentoo.org>
 # Released under the terms of the 3-clause BSD license or the GPL-2 license.
 
-import subprocess, sys
-
 from SmartLiveRebuild.vcs import VCSSupport, NonLiveEbuild
 
 class GitSupport(VCSSupport):
-	reqenv = ['EGIT_BRANCH', 'EGIT_PROJECT', 'EGIT_STORE_DIR', 'EGIT_UPDATE_CMD']
-	optenv = ['EGIT_COMMIT', 'EGIT_DIFFSTAT_CMD', 'EGIT_HAS_SUBMODULES', 'EGIT_OPTIONS', 'EGIT_REPO_URI', 'EGIT_VERSION']
+	reqenv = ['EGIT_BRANCH', 'EGIT_PROJECT', 'EGIT_REPO_URI', 'EGIT_STORE_DIR']
+	optenv = ['EGIT_COMMIT', 'EGIT_DIFFSTAT_CMD', 'EGIT_HAS_SUBMODULES', 'EGIT_VERSION']
 
 	def __init__(self, *args):
 		VCSSupport.__init__(self, *args)
 		return '%s/%s' % (self.env['EGIT_STORE_DIR'], self.env['EGIT_PROJECT'])
 
 	def __str__(self):
-		return self.env['EGIT_REPO_URI'] or VCSSupport.__str__(self)
+		return self.env['EGIT_REPO_URI']
+
+	def parseoutput(self, out):
+		return out.split()[0]
 
 	def getsavedrev(self):
 		return self.env['EGIT_VERSION']
 			branch = 'origin/%s' % branch
 		return self.call(['git', 'rev-parse', branch]).split('\n')[0]
 
-	def getremoterev(self):
-		return self.call(['git', 'ls-remote', '--heads', self.env['EGIT_REPO_URI'],
-				self.env['EGIT_BRANCH']]).split()[0]
-
 	def getupdatecmd(self):
-		if self.env['EGIT_HAS_SUBMODULES']:
-			upcmd = ['%s %s' % (self.env['EGIT_UPDATE_CMD'], self.env['EGIT_OPTIONS'])]
-			upcmd += ['git submodule %s' % x for x in ('init', 'sync', 'update')]
-			return ' && '.join(upcmd)
-		else:
-			return '%s %s origin %s:%s' % (self.env['EGIT_UPDATE_CMD'], self.env['EGIT_OPTIONS'], self.env['EGIT_BRANCH'], self.env['EGIT_BRANCH'])
-
-	def diffstat(self, oldrev, newrev):
-		subprocess.Popen('%s %s..%s' % (self.env['EGIT_DIFFSTAT_CMD'] or 'git diff', oldrev, newrev), stdout=sys.stderr, shell=True).wait()
+		return 'git ls-remote --heads %s %s' % (
+				self.env['EGIT_REPO_URI'], self.env['EGIT_BRANCH'])

SmartLiveRebuild/vcs/git_2.py

 #	vim:fileencoding=utf-8
-# (c) 2010 Michał Górny <mgorny@gentoo.org>
+# (c) 2011 Michał Górny <mgorny@gentoo.org>
 # Released under the terms of the 3-clause BSD license or the GPL-2 license.
 
-import subprocess, sys
-
 from SmartLiveRebuild.vcs import VCSSupport, NonLiveEbuild
 
 class GitSupport(VCSSupport):
-	reqenv = ['EGIT_BRANCH', 'EGIT_DIR', 'EGIT_UPDATE_CMD']
-	optenv = ['EGIT_COMMIT', 'EGIT_HAS_SUBMODULES', 'EGIT_REPO_URI', 'EGIT_VERSION']
+	reqenv = ['EGIT_BRANCH', 'EGIT_DIR', 'EGIT_REPO_URI']
+	optenv = ['EGIT_COMMIT', 'EGIT_HAS_SUBMODULES', 'EGIT_VERSION']
 
 	def __init__(self, *args):
 		VCSSupport.__init__(self, *args)
 		return self.env['EGIT_DIR']
 
 	def __str__(self):
-		return self.env['EGIT_REPO_URI'] or VCSSupport.__str__(self)
+		return self.env['EGIT_REPO_URI']
+
+	def parseoutput(self, out):
+		return out.split()[0]
 
 	def getsavedrev(self):
 		return self.env['EGIT_VERSION']
 				self.env['EGIT_BRANCH']]).split()[0]
 
 	def getupdatecmd(self):
-		upcmd = self.env['EGIT_UPDATE_CMD']
-		if self.env['EGIT_HAS_SUBMODULES']:
-			submcmds = ['git submodule %s' % x for x in ('init', 'sync', 'update')]
-			upcmd = ' && '.join([upcmd] + submcmds)
-		return upcmd
-
-	def diffstat(self, oldrev, newrev):
-		subprocess.Popen('%s %s..%s' % ('git --no-pager diff --stat', oldrev, newrev), stdout=sys.stderr, shell=True).wait()
+		return 'git ls-remote --heads %s %s' % (self.env['EGIT_REPO_URI'],
+				self.env['EGIT_BRANCH'])

SmartLiveRebuild/vcs/mercurial.py

 #	vim:fileencoding=utf-8
-# (c) 2010 Michał Górny <mgorny@gentoo.org>
+# (c) 2011 Michał Górny <mgorny@gentoo.org>
 # Released under the terms of the 3-clause BSD license or the GPL-2 license.
 
-import os.path, subprocess, sys
+import os.path
 
 from SmartLiveRebuild.vcs import VCSSupport
 
 		return '%s/hg-src/%s/%s' % (dd, self.env['EHG_PROJECT'], bn)
 
 	def __str__(self):
-		return self.env['EHG_REPO_URI'] or VCSSupport.__str__(self)
+		return self.env['EHG_REPO_URI']
 
 	def getsavedrev(self):
 		return self.env['HG_REV_ID']
 		return self.call(['hg', 'identify', '--id', '--rev', self.env['EHG_REVISION']]
 				+ self.trustopt)
 
-	def getremoterev(self):
-		return self.call(['hg', 'identify', '--id', '--rev', self.env['EHG_REVISION'],
-				self.env['EHG_REPO_URI']] + self.trustopt)
-
 	@staticmethod
 	def revcmp(oldrev, newrev):
 		return newrev.startswith(oldrev)
 
 	def getupdatecmd(self):
-		return ' '.join([self.env['EHG_PULL_CMD']] + self.trustopt)
-
-	def diffstat(self, oldrev, newrev):
-		subprocess.Popen(['hg', 'diff', '--stat', '-r', oldrev, '-r', newrev] + self.trustopt, stdout=sys.stderr).wait()
+		return 'hg identify --id --rev %s %s %s' % (
+				self.env['EHG_REVISION'], self.env['EHG_REPO_URI'],
+				' '.join(self.trustopt))

SmartLiveRebuild/vcs/subversion.py

 #	vim:fileencoding=utf-8
-# (c) 2010 Michał Górny <mgorny@gentoo.org>
+# (c) 2011 Michał Górny <mgorny@gentoo.org>
 # Released under the terms of the 3-clause BSD license or the GPL-2 license.
 
 import re
 from SmartLiveRebuild.vcs import VCSSupport, NonLiveEbuild
 
 class SvnSupport(VCSSupport):
-	reqenv = ['ESVN_STORE_DIR', 'ESVN_UPDATE_CMD']
-	optenv = ['ESVN_REVISION', 'ESVN_OPTIONS', 'ESVN_PASSWORD', 'ESVN_REPO_URI', 'ESVN_USER', 'ESVN_WC_PATH', 'ESVN_WC_REVISION']
+	reqenv = ['ESVN_STORE_DIR', 'ESVN_REPO_URI']
+	optenv = ['ESVN_REVISION', 'ESVN_WC_PATH', 'ESVN_WC_REVISION']
 
 	revre = re.compile('(?m)^Last Changed Rev: (\d+)$')
 
 			raise NonLiveEbuild('ESVN_REVISION set, package is not really a live one')
 		elif not self.env['ESVN_WC_PATH']:
 			raise KeyError('Environment does not declare ESVN_WC_PATH while the package is a live one')
+		self.callenv['LC_ALL'] = 'C'
 
 	def getpath(self):
 		return self.env['ESVN_WC_PATH']
 
 	def __str__(self):
-		return self.env['ESVN_REPO_URI'] or VCSSupport.__str__(self)
+		return self.env['ESVN_REPO_URI']
+
+	def parseoutput(self, out):
+		m = self.revre.search(out)
+		return int(m.group(1)) if m is not None else None
 
 	def getsavedrev(self):
 		return int(self.env['ESVN_WC_REVISION'])
 
 	def getrev(self):
-		svninfo = self.call(['svn', '--config-dir', '%s/.subversion' % self.env['ESVN_STORE_DIR'], 'info'],
-				env = {'LC_ALL': 'C'})
-		m = self.revre.search(svninfo)
-		return int(m.group(1)) if m is not None else None
-
-	def getremoterev(self):
-		svninfo = self.call(['svn', '--config-dir', '%s/.subversion' % self.env['ESVN_STORE_DIR'], 'info',
-				self.env['ESVN_REPO_URI']], env = {'LC_ALL': 'C'})
+		svninfo = self.call(['svn', '--config-dir', '%s/.subversion' % \
+				self.env['ESVN_STORE_DIR'], 'info'])
 		m = self.revre.search(svninfo)
 		return int(m.group(1)) if m is not None else None
 
 		return oldrev >= newrev
 
 	def getupdatecmd(self):
-		cmd = '%s %s --non-interactive --config-dir %s/.subversion' % (self.env['ESVN_UPDATE_CMD'], self.env['ESVN_OPTIONS'], self.env['ESVN_STORE_DIR'])
-		if self.env['ESVN_USER']:
-			cmd += ' --user "%s" --password "%s"' % (self.env['ESVN_USER'], self.env['ESVN_PASSWORD'])
-		return cmd
+		# XXX: branch?
+		return 'svn --config-dir %s/.subversion info %s' % (
+			self.env['ESVN_STORE_DIR'], self.env['ESVN_REPO_URI'])

sets.conf.example

 [smart-live-rebuild]
 class = SmartLiveRebuild.sets.SmartLiveRebuildSet
 world-candidate = False
-
-[smart-live-rebuild-nonetwork]
-class = SmartLiveRebuild.sets.SmartLiveRebuildSet
-world-candidate = False
-profile = nonetwork

smart-live-rebuild.conf.example

 [smart-live-rebuild]
 jobs = 6
 # quickpkg = on
-
-[nonetwork]
-network = off
-quickpkg = off
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.