Commits

Michał Górny committed 0fbfdd1

Drop no longer needed code from VCSes.

We no longer require non-workdir VCSes to provide the workdir paths or
getrev() function.

Comments (0)

Files changed (6)

SmartLiveRebuild/vcs/__init__.py

 
 		if self.requires_workdir:
 			os.chdir(self.getpath())
-
 		self.oldrev = self.getsavedrev()
-		if not self.getsavedrev(): # TEMPORARY
-			raise Exception('getsavedrev() failed to return a revision')
 
 		cmd = self.getupdatecmd()
 		out.s2(str(self))

SmartLiveRebuild/vcs/bzr.py

 from SmartLiveRebuild.vcs import VCSSupport, NonLiveEbuild
 
 class BzrSupport(VCSSupport):
-	reqenv = ['EBZR_REPO_URI', 'EBZR_REVNO_CMD', 'EBZR_UPDATE_CMD', 'EBZR_WC_PATH']
-	optenv = ['EBZR_OPTIONS', 'EBZR_REVISION', 'EBZR_REVNO']
+	reqenv = ['EBZR_REPO_URI', 'EBZR_REVNO', 'EBZR_REVNO_CMD']
+	optenv = ['EBZR_REVISION']
 
 	def __init__(self, *args):
 		VCSSupport.__init__(self, *args)
 			raise NonLiveEbuild('EBZR_REVISION set, package is not really a live one')
 		self.callenv['BZR_LOG'] = '/dev/null'
 
-	def getpath(self):
-		return self.env['EBZR_WC_PATH']
-
 	def __str__(self):
 		return self.env['EBZR_REPO_URI']
 

SmartLiveRebuild/vcs/git.py

 from SmartLiveRebuild.vcs import VCSSupport, NonLiveEbuild
 
 class GitSupport(VCSSupport):
-	reqenv = ['EGIT_BRANCH', 'EGIT_PROJECT', 'EGIT_REPO_URI', 'EGIT_STORE_DIR']
-	optenv = ['EGIT_COMMIT', 'EGIT_DIFFSTAT_CMD', 'EGIT_HAS_SUBMODULES', 'EGIT_VERSION']
+	reqenv = ['EGIT_BRANCH', 'EGIT_REPO_URI', 'EGIT_VERSION']
+	optenv = ['EGIT_COMMIT']
 
 	def __init__(self, *args):
 		VCSSupport.__init__(self, *args)
 		if self.env['EGIT_COMMIT'] and self.env['EGIT_COMMIT'] != self.env['EGIT_BRANCH']:
 			raise NonLiveEbuild('EGIT_COMMIT set, package is not really a live one')
 
-	def getpath(self):
-		return '%s/%s' % (self.env['EGIT_STORE_DIR'], self.env['EGIT_PROJECT'])
-
 	def __str__(self):
 		return self.env['EGIT_REPO_URI']
 
 	def getsavedrev(self):
 		return self.env['EGIT_VERSION']
 
-	def getrev(self):
-		branch = self.env['EGIT_BRANCH']
-		if self.env['EGIT_HAS_SUBMODULES']:
-			branch = 'origin/%s' % branch
-		return self.call(['git', 'rev-parse', branch]).split('\n')[0]
-
 	def getupdatecmd(self):
 		return 'git ls-remote --heads %s %s' % (
 				self.env['EGIT_REPO_URI'], self.env['EGIT_BRANCH'])

SmartLiveRebuild/vcs/git_2.py

 from SmartLiveRebuild.vcs import VCSSupport, NonLiveEbuild
 
 class GitSupport(VCSSupport):
-	reqenv = ['EGIT_BRANCH', 'EGIT_DIR', 'EGIT_REPO_URI']
-	optenv = ['EGIT_COMMIT', 'EGIT_HAS_SUBMODULES', 'EGIT_VERSION']
+	reqenv = ['EGIT_BRANCH', 'EGIT_REPO_URI', 'EGIT_VERSION']
+	optenv = ['EGIT_COMMIT']
 
 	def __init__(self, *args):
 		VCSSupport.__init__(self, *args)
 		if self.env['EGIT_COMMIT'] and self.env['EGIT_COMMIT'] != self.env['EGIT_BRANCH']:
 			raise NonLiveEbuild('EGIT_COMMIT set, package is not really a live one')
 
-	def getpath(self):
-		return self.env['EGIT_DIR']
-
 	def __str__(self):
 		return self.env['EGIT_REPO_URI']
 
 	def getsavedrev(self):
 		return self.env['EGIT_VERSION']
 
-	def getrev(self):
-		branch = self.env['EGIT_BRANCH']
-		if self.env['EGIT_HAS_SUBMODULES']:
-			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]

SmartLiveRebuild/vcs/mercurial.py

 # (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
-
 from SmartLiveRebuild.vcs import VCSSupport
 
 class HgSupport(VCSSupport):
-	reqenv = ['EHG_PROJECT', 'EHG_PULL_CMD', 'EHG_REPO_URI', 'EHG_REVISION']
-	optenv = ['HG_REV_ID']
+	reqenv = ['EHG_REPO_URI', 'EHG_REVISION', 'HG_REV_ID']
 
 	trustopt = ['--config', 'trusted.users=portage']
 
-	def getpath(self):
-		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 != '')
-
-		return '%s/hg-src/%s/%s' % (dd, self.env['EHG_PROJECT'], bn)
-
 	def __str__(self):
 		return self.env['EHG_REPO_URI']
 
 	def getsavedrev(self):
 		return self.env['HG_REV_ID']
 
-	def getrev(self):
-		return self.call(['hg', 'identify', '--id', '--rev', self.env['EHG_REVISION']]
-				+ self.trustopt)
-
 	@staticmethod
 	def revcmp(oldrev, newrev):
 		return newrev.startswith(oldrev)

SmartLiveRebuild/vcs/subversion.py

 from SmartLiveRebuild.vcs import VCSSupport, NonLiveEbuild
 
 class SvnSupport(VCSSupport):
-	reqenv = ['ESVN_STORE_DIR', 'ESVN_REPO_URI']
-	optenv = ['ESVN_REVISION', 'ESVN_WC_PATH', 'ESVN_WC_REVISION']
+	reqenv = ['ESVN_REPO_URI', 'ESVN_STORE_DIR', 'ESVN_WC_REVISION']
+	optenv = ['ESVN_REVISION']
 
 	revre = re.compile('(?m)^Last Changed Rev: (\d+)$')
 
 			raise NonLiveEbuild('ESVN_REPO_URI specifies revision, package is not really a live one')
 		elif self.env['ESVN_REVISION']:
 			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']
 
 	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'])
-		m = self.revre.search(svninfo)
-		return int(m.group(1)) if m is not None else None
-
 	@staticmethod
 	def revcmp(oldrev, newrev):
 		return oldrev >= newrev