aboutsummaryrefslogtreecommitdiff
blob: 963abf615ba7fc4bc59b2085d30439a604cb1a7c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
'''
Git module Status class submodule
'''

import re

from repoman._portage import portage
from portage import os
from repoman._subprocess import repoman_popen, repoman_getstatusoutput


class Status(object):
	'''Performs status checks on the svn repository'''

	def __init__(self, qatracker, eadded):
		'''Class init

		@param qatracker: QATracker class instance
		@param eadded: list
		'''
		self.qatracker = qatracker
		self.eadded = eadded

	def check(self, checkdir, checkdir_relative, xpkg):
		'''Perform the svn status check

		@param checkdir: string of the directory being checked
		@param checkdir_relative: string of the relative directory being checked
		@param xpkg: string of the package being checked
		@returns: boolean
		'''
		myf = repoman_popen(
			"git ls-files --others %s" %
			(portage._shell_quote(checkdir_relative),))
		for l in myf:
			if l[:-1][-7:] == ".ebuild":
				self.qatracker.add_error(
					"ebuild.notadded",
					os.path.join(xpkg, os.path.basename(l[:-1])))
		myf.close()
		return True

	@staticmethod
	def detect_conflicts(options):
		'''Are there any merge conflicts present in the VCS tracking system

		@param options: command line options
		@returns: Boolean
		'''
		return False

	@staticmethod
	def supports_gpg_sign():
		'''Does this vcs system support gpg commit signatures

		@returns: Boolean
		'''
		status, cmd_output = \
			repoman_getstatusoutput("git --version")
		cmd_output = cmd_output.split()
		if cmd_output:
			version = re.match(r'^(\d+)\.(\d+)\.(\d+)', cmd_output[-1])
			if version is not None:
				version = [int(x) for x in version.groups()]
				if version[0] > 1 or \
					(version[0] == 1 and version[1] > 7) or \
					(version[0] == 1 and version[1] == 7 and version[2] >= 9):
					return True
		return False

	@staticmethod
	def isVcsDir(dirname):
		return dirname in [".git"]