public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/vcs/
@ 2014-05-30 19:25 Brian Dolbec
  0 siblings, 0 replies; 7+ messages in thread
From: Brian Dolbec @ 2014-05-30 19:25 UTC (permalink / raw
  To: gentoo-commits

commit:     93411d21c0355ed38fd9708d865834f9a3fbce20
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Thu May 29 22:29:13 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Fri May 30 19:22:38 2014 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=93411d21

repoman/main.py: Split out vcsstatus.py with VCSStatus class

This class scans the vcs to determine ebuilds not added.

---
 pym/repoman/main.py          |  81 +++-----------------------
 pym/repoman/vcs/vcsstatus.py | 134 +++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 143 insertions(+), 72 deletions(-)

diff --git a/pym/repoman/main.py b/pym/repoman/main.py
index ee70735..f48c8ba 100755
--- a/pym/repoman/main.py
+++ b/pym/repoman/main.py
@@ -83,6 +83,7 @@ from repoman._subprocess import repoman_popen, repoman_getstatusoutput
 from repoman import utilities
 from repoman.vcs.vcs import (git_supports_gpg_sign, vcs_files_to_cps,
 	vcs_new_changed, VCSSettings)
+from repoman.vcs.vcsstatus import VCSStatus
 from repoman._xml import _XMLParser, _MetadataTreeBuilder, XmlLint
 
 
@@ -449,78 +450,14 @@ for xpkg in effective_scanlist:
 			if f is not None:
 				f.close()
 
-	if vcs_settings.vcs in ("git", "hg") and check_ebuild_notadded:
-		if vcs_settings.vcs == "git":
-			myf = repoman_popen(
-				"git ls-files --others %s" %
-				(portage._shell_quote(checkdir_relative),))
-		if vcs_settings.vcs == "hg":
-			myf = repoman_popen(
-				"hg status --no-status --unknown %s" %
-				(portage._shell_quote(checkdir_relative),))
-		for l in myf:
-			if l[:-1][-7:] == ".ebuild":
-				stats["ebuild.notadded"] += 1
-				fails["ebuild.notadded"].append(
-					os.path.join(xpkg, os.path.basename(l[:-1])))
-		myf.close()
-
-	if vcs_settings.vcs in ("cvs", "svn", "bzr") and check_ebuild_notadded:
-		try:
-			if vcs_settings.vcs == "cvs":
-				myf = open(checkdir + "/CVS/Entries", "r")
-			if vcs_settings.vcs == "svn":
-				myf = repoman_popen(
-					"svn status --depth=files --verbose " +
-					portage._shell_quote(checkdir))
-			if vcs_settings.vcs == "bzr":
-				myf = repoman_popen(
-					"bzr ls -v --kind=file " +
-					portage._shell_quote(checkdir))
-			myl = myf.readlines()
-			myf.close()
-			for l in myl:
-				if vcs_settings.vcs == "cvs":
-					if l[0] != "/":
-						continue
-					splitl = l[1:].split("/")
-					if not len(splitl):
-						continue
-					if splitl[0][-7:] == ".ebuild":
-						eadded.append(splitl[0][:-7])
-				if vcs_settings.vcs == "svn":
-					if l[:1] == "?":
-						continue
-					if l[:7] == '      >':
-						# tree conflict, new in subversion 1.6
-						continue
-					l = l.split()[-1]
-					if l[-7:] == ".ebuild":
-						eadded.append(os.path.basename(l[:-7]))
-				if vcs_settings.vcs == "bzr":
-					if l[1:2] == "?":
-						continue
-					l = l.split()[-1]
-					if l[-7:] == ".ebuild":
-						eadded.append(os.path.basename(l[:-7]))
-			if vcs_settings.vcs == "svn":
-				myf = repoman_popen(
-					"svn status " +
-					portage._shell_quote(checkdir))
-				myl = myf.readlines()
-				myf.close()
-				for l in myl:
-					if l[0] == "A":
-						l = l.rstrip().split(' ')[-1]
-						if l[-7:] == ".ebuild":
-							eadded.append(os.path.basename(l[:-7]))
-		except IOError:
-			if vcs_settings.vcs == "cvs":
-				stats["CVS/Entries.IO_error"] += 1
-				fails["CVS/Entries.IO_error"].append(checkdir + "/CVS/Entries")
-			else:
-				raise
-			continue
+###############
+	status_check = VCSStatus(vcs_settings, checkdir, checkdir_relative, xpkg)
+	status_check.check(check_ebuild_notadded)
+	eadded.extend(status_check.eadded)
+	for key in list(status_check.stats):
+		stats[key] += status_check.stats[key]
+		fails[key].extend(status_check.fails[key])
+###############
 
 	mf = repoman_settings.repositories.get_repo_for_location(
 		os.path.dirname(os.path.dirname(checkdir)))

diff --git a/pym/repoman/vcs/vcsstatus.py b/pym/repoman/vcs/vcsstatus.py
new file mode 100644
index 0000000..346c20e
--- /dev/null
+++ b/pym/repoman/vcs/vcsstatus.py
@@ -0,0 +1,134 @@
+
+
+import portage
+from portage import os
+
+from repoman._subprocess import repoman_popen
+
+
+
+class VCSStatus(object):
+	'''Determines the status of the vcs repositories
+	to determine if files are not added'''
+
+	def __init__(self, vcs_settings, checkdir, checkdir_relative, xpkg):
+		self.vcs_settings = vcs_settings
+		self.vcs = vcs_settings.vcs
+		self.eadded = []
+		self.checkdir = checkdir
+		self.checkdir_relative = checkdir_relative
+		self.xpkg = xpkg
+		self.stats = {}
+		self.fails = {}
+
+
+	def check(self, check_not_added):
+		if check_not_added:
+			vcscheck = getattr(self, 'check_%s' % self.vcs)
+			vcscheck()
+
+
+	def post_git_hg(self, myf):
+			for l in myf:
+				if l[:-1][-7:] == ".ebuild":
+					if "ebuild.notadded" in list(self.fails):
+						self.stats["ebuild.notadded"] += 1
+						self.fails["ebuild.notadded"].append(
+						os.path.join(self.xpkg, os.path.basename(l[:-1])))
+					else:
+						self.stats["ebuild.notadded"] = 1
+						self.fails["ebuild.notadded"] = [os.path.join(
+							self.xpkg, os.path.basename(l[:-1]))]
+			myf.close()
+
+
+	def check_git(self):
+		myf = repoman_popen(
+			"git ls-files --others %s" %
+			(portage._shell_quote(self.checkdir_relative),))
+		self.post_git_hg(myf)
+
+
+	def check_hg(self):
+		myf = repoman_popen(
+			"hg status --no-status --unknown %s" %
+			(portage._shell_quote(self.checkdir_relative),))
+		self.post_git_hg(myf)
+
+
+	def check_cvs(self):
+			try:
+				myf = open(self.checkdir + "/CVS/Entries", "r")
+				myl = myf.readlines()
+				myf.close()
+			except IOError:
+				if "CVS/Entries.IO_error" in list(self.fails):
+					self.stats["CVS/Entries.IO_error"] += 1
+					self.fails["CVS/Entries.IO_error"].append(
+						self.checkdir + "/CVS/Entries")
+				else:
+					self.stats["CVS/Entries.IO_error"] = 1
+					self.fails["CVS/Entries.IO_error"] = [
+						self.checkdir + "/CVS/Entries"]
+				return True
+			for l in myl:
+				if l[0] != "/":
+					continue
+				splitl = l[1:].split("/")
+				if not len(splitl):
+					continue
+				if splitl[0][-7:] == ".ebuild":
+					self.eadded.append(splitl[0][:-7])
+			return True
+
+
+	def check_svn(self):
+		try:
+			myf = repoman_popen(
+				"svn status --depth=files --verbose " +
+				portage._shell_quote(self.checkdir))
+			myl = myf.readlines()
+			myf.close()
+		except IOError:
+			raise
+		for l in myl:
+			if l[:1] == "?":
+				continue
+			if l[:7] == '      >':
+				# tree conflict, new in subversion 1.6
+				continue
+			l = l.split()[-1]
+			if l[-7:] == ".ebuild":
+				self.eadded.append(os.path.basename(l[:-7]))
+		try:
+			myf = repoman_popen(
+				"svn status " +
+				portage._shell_quote(self.checkdir))
+			myl = myf.readlines()
+			myf.close()
+		except IOError:
+			raise
+		for l in myl:
+			if l[0] == "A":
+				l = l.rstrip().split(' ')[-1]
+				if l[-7:] == ".ebuild":
+					self.eadded.append(os.path.basename(l[:-7]))
+		return True
+
+
+	def check_bzr(self):
+		try:
+			myf = repoman_popen(
+				"bzr ls -v --kind=file " +
+				portage._shell_quote(self.checkdir))
+			myl = myf.readlines()
+			myf.close()
+		except IOError:
+			raise
+		for l in myl:
+			if l[1:2] == "?":
+				continue
+			l = l.split()[-1]
+			if l[-7:] == ".ebuild":
+				self.eadded.append(os.path.basename(l[:-7]))
+		return  True


^ permalink raw reply related	[flat|nested] 7+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/vcs/
@ 2015-09-05 21:48 Brian Dolbec
  0 siblings, 0 replies; 7+ messages in thread
From: Brian Dolbec @ 2015-09-05 21:48 UTC (permalink / raw
  To: gentoo-commits

commit:     d395ac47ec46b56fd437da1e99c73c00afa80099
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Tue Jun  3 18:42:37 2014 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sat Sep  5 21:47:36 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=d395ac47

Repoman: Refactor VCSStatus to pass non consistent data to the check()

This will facilitae for the initialization of the class before the big xpkg loop.

 pym/repoman/main.py          |  4 ++--
 pym/repoman/vcs/vcsstatus.py | 39 ++++++++++++++++++---------------------
 2 files changed, 20 insertions(+), 23 deletions(-)

diff --git a/pym/repoman/main.py b/pym/repoman/main.py
index e942dca..0b78001 100755
--- a/pym/repoman/main.py
+++ b/pym/repoman/main.py
@@ -325,8 +325,8 @@ for xpkg in effective_scanlist:
 	filescheck.check(checkdir, checkdirlist, checkdir_relative,
 		changed.changed, changed.new)
 #######################
-	status_check = VCSStatus(vcs_settings, checkdir, checkdir_relative, xpkg, qatracker)
-	status_check.check(check_ebuild_notadded)
+	status_check = VCSStatus(vcs_settings, qatracker)
+	status_check.check(check_ebuild_notadded, checkdir, checkdir_relative, xpkg)
 	eadded.extend(status_check.eadded)
 
 #################

diff --git a/pym/repoman/vcs/vcsstatus.py b/pym/repoman/vcs/vcsstatus.py
index 6a81b1b..0517c04 100644
--- a/pym/repoman/vcs/vcsstatus.py
+++ b/pym/repoman/vcs/vcsstatus.py
@@ -13,52 +13,49 @@ class VCSStatus(object):
 	'''Determines the status of the vcs repositories
 	to determine if files are not added'''
 
-	def __init__(self, vcs_settings, checkdir, checkdir_relative, xpkg, qatracker):
+	def __init__(self, vcs_settings, qatracker):
 		self.vcs_settings = vcs_settings
 		self.vcs = vcs_settings.vcs
 		self.eadded = []
-		self.checkdir = checkdir
-		self.checkdir_relative = checkdir_relative
-		self.xpkg = xpkg
 		self.qatracker = qatracker
 
 
-	def check(self, check_not_added):
+	def check(self, check_not_added, checkdir, checkdir_relative, xpkg):
 		if self.vcs and check_not_added:
 			vcscheck = getattr(self, 'check_%s' % self.vcs)
-			vcscheck()
+			vcscheck(checkdir, checkdir_relative, xpkg)
 
 
-	def post_git_hg(self, myf):
+	def post_git_hg(self, myf, xpkg):
 			for l in myf:
 				if l[:-1][-7:] == ".ebuild":
 					self.qatracker.add_error("ebuild.notadded",
-						os.path.join(self.xpkg, os.path.basename(l[:-1])))
+						os.path.join(xpkg, os.path.basename(l[:-1])))
 			myf.close()
 
 
-	def check_git(self):
+	def check_git(self, checkdir, checkdir_relative, xpkg):
 		myf = repoman_popen(
 			"git ls-files --others %s" %
-			(portage._shell_quote(self.checkdir_relative),))
-		self.post_git_hg(myf)
+			(portage._shell_quote(checkdir_relative),))
+		self.post_git_hg(myf, xpkg)
 
 
-	def check_hg(self):
+	def check_hg(self, checkdir, checkdir_relative, xpkg):
 		myf = repoman_popen(
 			"hg status --no-status --unknown %s" %
-			(portage._shell_quote(self.checkdir_relative),))
-		self.post_git_hg(myf)
+			(portage._shell_quote(checkdir_relative),))
+		self.post_git_hg(myf, xpkg)
 
 
-	def check_cvs(self):
+	def check_cvs(self, checkdir, checkdir_relative, xpkg):
 			try:
-				myf = open(self.checkdir + "/CVS/Entries", "r")
+				myf = open(checkdir + "/CVS/Entries", "r")
 				myl = myf.readlines()
 				myf.close()
 			except IOError:
 				self.qatracker.add_error("CVS/Entries.IO_error",
-					self.checkdir + "/CVS/Entries")
+					checkdir + "/CVS/Entries")
 				return True
 			for l in myl:
 				if l[0] != "/":
@@ -71,7 +68,7 @@ class VCSStatus(object):
 			return True
 
 
-	def check_svn(self):
+	def check_svn(self, checkdir, checkdir_relative, xpkg):
 		try:
 			myf = repoman_popen(
 				"svn status --depth=files --verbose " +
@@ -92,7 +89,7 @@ class VCSStatus(object):
 		try:
 			myf = repoman_popen(
 				"svn status " +
-				portage._shell_quote(self.checkdir))
+				portage._shell_quote(checkdir))
 			myl = myf.readlines()
 			myf.close()
 		except IOError:
@@ -105,11 +102,11 @@ class VCSStatus(object):
 		return True
 
 
-	def check_bzr(self):
+	def check_bzr(self, checkdir, checkdir_relative, xpkg):
 		try:
 			myf = repoman_popen(
 				"bzr ls -v --kind=file " +
-				portage._shell_quote(self.checkdir))
+				portage._shell_quote(checkdir))
 			myl = myf.readlines()
 			myf.close()
 		except IOError:


^ permalink raw reply related	[flat|nested] 7+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/vcs/
@ 2015-09-05 21:27 Brian Dolbec
  0 siblings, 0 replies; 7+ messages in thread
From: Brian Dolbec @ 2015-09-05 21:27 UTC (permalink / raw
  To: gentoo-commits

commit:     ad7af05dbac5cd201e7f02c797d7a4263fd6ce02
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Tue Jun  3 18:42:37 2014 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sat Sep  5 21:26:58 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=ad7af05d

Repoman: Refactor VCSStatus to pass non consistent data to the check()

This will facilitae for the initialization of the class before the big xpkg loop.

 pym/repoman/main.py          |  4 ++--
 pym/repoman/vcs/vcsstatus.py | 39 ++++++++++++++++++---------------------
 2 files changed, 20 insertions(+), 23 deletions(-)

diff --git a/pym/repoman/main.py b/pym/repoman/main.py
index 9f7c64b..db6c468 100755
--- a/pym/repoman/main.py
+++ b/pym/repoman/main.py
@@ -325,8 +325,8 @@ for xpkg in effective_scanlist:
 	filescheck.check(checkdir, checkdirlist, checkdir_relative,
 		changed.changed, changed.new)
 #######################
-	status_check = VCSStatus(vcs_settings, checkdir, checkdir_relative, xpkg, qatracker)
-	status_check.check(check_ebuild_notadded)
+	status_check = VCSStatus(vcs_settings, qatracker)
+	status_check.check(check_ebuild_notadded, checkdir, checkdir_relative, xpkg)
 	eadded.extend(status_check.eadded)
 
 #################

diff --git a/pym/repoman/vcs/vcsstatus.py b/pym/repoman/vcs/vcsstatus.py
index 6a81b1b..0517c04 100644
--- a/pym/repoman/vcs/vcsstatus.py
+++ b/pym/repoman/vcs/vcsstatus.py
@@ -13,52 +13,49 @@ class VCSStatus(object):
 	'''Determines the status of the vcs repositories
 	to determine if files are not added'''
 
-	def __init__(self, vcs_settings, checkdir, checkdir_relative, xpkg, qatracker):
+	def __init__(self, vcs_settings, qatracker):
 		self.vcs_settings = vcs_settings
 		self.vcs = vcs_settings.vcs
 		self.eadded = []
-		self.checkdir = checkdir
-		self.checkdir_relative = checkdir_relative
-		self.xpkg = xpkg
 		self.qatracker = qatracker
 
 
-	def check(self, check_not_added):
+	def check(self, check_not_added, checkdir, checkdir_relative, xpkg):
 		if self.vcs and check_not_added:
 			vcscheck = getattr(self, 'check_%s' % self.vcs)
-			vcscheck()
+			vcscheck(checkdir, checkdir_relative, xpkg)
 
 
-	def post_git_hg(self, myf):
+	def post_git_hg(self, myf, xpkg):
 			for l in myf:
 				if l[:-1][-7:] == ".ebuild":
 					self.qatracker.add_error("ebuild.notadded",
-						os.path.join(self.xpkg, os.path.basename(l[:-1])))
+						os.path.join(xpkg, os.path.basename(l[:-1])))
 			myf.close()
 
 
-	def check_git(self):
+	def check_git(self, checkdir, checkdir_relative, xpkg):
 		myf = repoman_popen(
 			"git ls-files --others %s" %
-			(portage._shell_quote(self.checkdir_relative),))
-		self.post_git_hg(myf)
+			(portage._shell_quote(checkdir_relative),))
+		self.post_git_hg(myf, xpkg)
 
 
-	def check_hg(self):
+	def check_hg(self, checkdir, checkdir_relative, xpkg):
 		myf = repoman_popen(
 			"hg status --no-status --unknown %s" %
-			(portage._shell_quote(self.checkdir_relative),))
-		self.post_git_hg(myf)
+			(portage._shell_quote(checkdir_relative),))
+		self.post_git_hg(myf, xpkg)
 
 
-	def check_cvs(self):
+	def check_cvs(self, checkdir, checkdir_relative, xpkg):
 			try:
-				myf = open(self.checkdir + "/CVS/Entries", "r")
+				myf = open(checkdir + "/CVS/Entries", "r")
 				myl = myf.readlines()
 				myf.close()
 			except IOError:
 				self.qatracker.add_error("CVS/Entries.IO_error",
-					self.checkdir + "/CVS/Entries")
+					checkdir + "/CVS/Entries")
 				return True
 			for l in myl:
 				if l[0] != "/":
@@ -71,7 +68,7 @@ class VCSStatus(object):
 			return True
 
 
-	def check_svn(self):
+	def check_svn(self, checkdir, checkdir_relative, xpkg):
 		try:
 			myf = repoman_popen(
 				"svn status --depth=files --verbose " +
@@ -92,7 +89,7 @@ class VCSStatus(object):
 		try:
 			myf = repoman_popen(
 				"svn status " +
-				portage._shell_quote(self.checkdir))
+				portage._shell_quote(checkdir))
 			myl = myf.readlines()
 			myf.close()
 		except IOError:
@@ -105,11 +102,11 @@ class VCSStatus(object):
 		return True
 
 
-	def check_bzr(self):
+	def check_bzr(self, checkdir, checkdir_relative, xpkg):
 		try:
 			myf = repoman_popen(
 				"bzr ls -v --kind=file " +
-				portage._shell_quote(self.checkdir))
+				portage._shell_quote(checkdir))
 			myl = myf.readlines()
 			myf.close()
 		except IOError:


^ permalink raw reply related	[flat|nested] 7+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/vcs/
@ 2014-10-01 23:46 Brian Dolbec
  0 siblings, 0 replies; 7+ messages in thread
From: Brian Dolbec @ 2014-10-01 23:46 UTC (permalink / raw
  To: gentoo-commits

commit:     4628c9fba067e03bb9bf9bc72f5e09c0d1c48ca2
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Tue Jun  3 18:42:37 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Wed Oct  1 23:45:33 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=4628c9fb

Repoman: Refactor VCSStatus to pass non consistent data to the check()

This will facilitae for the initialization of the class before the big xpkg loop.

---
 pym/repoman/main.py          |  4 ++--
 pym/repoman/vcs/vcsstatus.py | 39 ++++++++++++++++++---------------------
 2 files changed, 20 insertions(+), 23 deletions(-)

diff --git a/pym/repoman/main.py b/pym/repoman/main.py
index c19bf94..8197400 100755
--- a/pym/repoman/main.py
+++ b/pym/repoman/main.py
@@ -322,8 +322,8 @@ for xpkg in effective_scanlist:
 	filescheck.check(checkdir, checkdirlist, checkdir_relative,
 		changed.changed, changed.new)
 #######################
-	status_check = VCSStatus(vcs_settings, checkdir, checkdir_relative, xpkg, qatracker)
-	status_check.check(check_ebuild_notadded)
+	status_check = VCSStatus(vcs_settings, qatracker)
+	status_check.check(check_ebuild_notadded, checkdir, checkdir_relative, xpkg)
 	eadded.extend(status_check.eadded)
 
 #################

diff --git a/pym/repoman/vcs/vcsstatus.py b/pym/repoman/vcs/vcsstatus.py
index 6a81b1b..0517c04 100644
--- a/pym/repoman/vcs/vcsstatus.py
+++ b/pym/repoman/vcs/vcsstatus.py
@@ -13,52 +13,49 @@ class VCSStatus(object):
 	'''Determines the status of the vcs repositories
 	to determine if files are not added'''
 
-	def __init__(self, vcs_settings, checkdir, checkdir_relative, xpkg, qatracker):
+	def __init__(self, vcs_settings, qatracker):
 		self.vcs_settings = vcs_settings
 		self.vcs = vcs_settings.vcs
 		self.eadded = []
-		self.checkdir = checkdir
-		self.checkdir_relative = checkdir_relative
-		self.xpkg = xpkg
 		self.qatracker = qatracker
 
 
-	def check(self, check_not_added):
+	def check(self, check_not_added, checkdir, checkdir_relative, xpkg):
 		if self.vcs and check_not_added:
 			vcscheck = getattr(self, 'check_%s' % self.vcs)
-			vcscheck()
+			vcscheck(checkdir, checkdir_relative, xpkg)
 
 
-	def post_git_hg(self, myf):
+	def post_git_hg(self, myf, xpkg):
 			for l in myf:
 				if l[:-1][-7:] == ".ebuild":
 					self.qatracker.add_error("ebuild.notadded",
-						os.path.join(self.xpkg, os.path.basename(l[:-1])))
+						os.path.join(xpkg, os.path.basename(l[:-1])))
 			myf.close()
 
 
-	def check_git(self):
+	def check_git(self, checkdir, checkdir_relative, xpkg):
 		myf = repoman_popen(
 			"git ls-files --others %s" %
-			(portage._shell_quote(self.checkdir_relative),))
-		self.post_git_hg(myf)
+			(portage._shell_quote(checkdir_relative),))
+		self.post_git_hg(myf, xpkg)
 
 
-	def check_hg(self):
+	def check_hg(self, checkdir, checkdir_relative, xpkg):
 		myf = repoman_popen(
 			"hg status --no-status --unknown %s" %
-			(portage._shell_quote(self.checkdir_relative),))
-		self.post_git_hg(myf)
+			(portage._shell_quote(checkdir_relative),))
+		self.post_git_hg(myf, xpkg)
 
 
-	def check_cvs(self):
+	def check_cvs(self, checkdir, checkdir_relative, xpkg):
 			try:
-				myf = open(self.checkdir + "/CVS/Entries", "r")
+				myf = open(checkdir + "/CVS/Entries", "r")
 				myl = myf.readlines()
 				myf.close()
 			except IOError:
 				self.qatracker.add_error("CVS/Entries.IO_error",
-					self.checkdir + "/CVS/Entries")
+					checkdir + "/CVS/Entries")
 				return True
 			for l in myl:
 				if l[0] != "/":
@@ -71,7 +68,7 @@ class VCSStatus(object):
 			return True
 
 
-	def check_svn(self):
+	def check_svn(self, checkdir, checkdir_relative, xpkg):
 		try:
 			myf = repoman_popen(
 				"svn status --depth=files --verbose " +
@@ -92,7 +89,7 @@ class VCSStatus(object):
 		try:
 			myf = repoman_popen(
 				"svn status " +
-				portage._shell_quote(self.checkdir))
+				portage._shell_quote(checkdir))
 			myl = myf.readlines()
 			myf.close()
 		except IOError:
@@ -105,11 +102,11 @@ class VCSStatus(object):
 		return True
 
 
-	def check_bzr(self):
+	def check_bzr(self, checkdir, checkdir_relative, xpkg):
 		try:
 			myf = repoman_popen(
 				"bzr ls -v --kind=file " +
-				portage._shell_quote(self.checkdir))
+				portage._shell_quote(checkdir))
 			myl = myf.readlines()
 			myf.close()
 		except IOError:


^ permalink raw reply related	[flat|nested] 7+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/vcs/
@ 2014-10-01 23:02 Brian Dolbec
  0 siblings, 0 replies; 7+ messages in thread
From: Brian Dolbec @ 2014-10-01 23:02 UTC (permalink / raw
  To: gentoo-commits

commit:     598024be9e966eabc42e27ec32bdcbc630035290
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Tue Jun  3 18:42:37 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Wed Oct  1 22:58:13 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=598024be

Repoman: Refactor VCSStatus to pass non consistent data to the check()

This will facilitae for the initialization of the class before the big xpkg loop.

---
 pym/repoman/main.py          |  4 ++--
 pym/repoman/vcs/vcsstatus.py | 39 ++++++++++++++++++---------------------
 2 files changed, 20 insertions(+), 23 deletions(-)

diff --git a/pym/repoman/main.py b/pym/repoman/main.py
index c19bf94..8197400 100755
--- a/pym/repoman/main.py
+++ b/pym/repoman/main.py
@@ -322,8 +322,8 @@ for xpkg in effective_scanlist:
 	filescheck.check(checkdir, checkdirlist, checkdir_relative,
 		changed.changed, changed.new)
 #######################
-	status_check = VCSStatus(vcs_settings, checkdir, checkdir_relative, xpkg, qatracker)
-	status_check.check(check_ebuild_notadded)
+	status_check = VCSStatus(vcs_settings, qatracker)
+	status_check.check(check_ebuild_notadded, checkdir, checkdir_relative, xpkg)
 	eadded.extend(status_check.eadded)
 
 #################

diff --git a/pym/repoman/vcs/vcsstatus.py b/pym/repoman/vcs/vcsstatus.py
index 6a81b1b..0517c04 100644
--- a/pym/repoman/vcs/vcsstatus.py
+++ b/pym/repoman/vcs/vcsstatus.py
@@ -13,52 +13,49 @@ class VCSStatus(object):
 	'''Determines the status of the vcs repositories
 	to determine if files are not added'''
 
-	def __init__(self, vcs_settings, checkdir, checkdir_relative, xpkg, qatracker):
+	def __init__(self, vcs_settings, qatracker):
 		self.vcs_settings = vcs_settings
 		self.vcs = vcs_settings.vcs
 		self.eadded = []
-		self.checkdir = checkdir
-		self.checkdir_relative = checkdir_relative
-		self.xpkg = xpkg
 		self.qatracker = qatracker
 
 
-	def check(self, check_not_added):
+	def check(self, check_not_added, checkdir, checkdir_relative, xpkg):
 		if self.vcs and check_not_added:
 			vcscheck = getattr(self, 'check_%s' % self.vcs)
-			vcscheck()
+			vcscheck(checkdir, checkdir_relative, xpkg)
 
 
-	def post_git_hg(self, myf):
+	def post_git_hg(self, myf, xpkg):
 			for l in myf:
 				if l[:-1][-7:] == ".ebuild":
 					self.qatracker.add_error("ebuild.notadded",
-						os.path.join(self.xpkg, os.path.basename(l[:-1])))
+						os.path.join(xpkg, os.path.basename(l[:-1])))
 			myf.close()
 
 
-	def check_git(self):
+	def check_git(self, checkdir, checkdir_relative, xpkg):
 		myf = repoman_popen(
 			"git ls-files --others %s" %
-			(portage._shell_quote(self.checkdir_relative),))
-		self.post_git_hg(myf)
+			(portage._shell_quote(checkdir_relative),))
+		self.post_git_hg(myf, xpkg)
 
 
-	def check_hg(self):
+	def check_hg(self, checkdir, checkdir_relative, xpkg):
 		myf = repoman_popen(
 			"hg status --no-status --unknown %s" %
-			(portage._shell_quote(self.checkdir_relative),))
-		self.post_git_hg(myf)
+			(portage._shell_quote(checkdir_relative),))
+		self.post_git_hg(myf, xpkg)
 
 
-	def check_cvs(self):
+	def check_cvs(self, checkdir, checkdir_relative, xpkg):
 			try:
-				myf = open(self.checkdir + "/CVS/Entries", "r")
+				myf = open(checkdir + "/CVS/Entries", "r")
 				myl = myf.readlines()
 				myf.close()
 			except IOError:
 				self.qatracker.add_error("CVS/Entries.IO_error",
-					self.checkdir + "/CVS/Entries")
+					checkdir + "/CVS/Entries")
 				return True
 			for l in myl:
 				if l[0] != "/":
@@ -71,7 +68,7 @@ class VCSStatus(object):
 			return True
 
 
-	def check_svn(self):
+	def check_svn(self, checkdir, checkdir_relative, xpkg):
 		try:
 			myf = repoman_popen(
 				"svn status --depth=files --verbose " +
@@ -92,7 +89,7 @@ class VCSStatus(object):
 		try:
 			myf = repoman_popen(
 				"svn status " +
-				portage._shell_quote(self.checkdir))
+				portage._shell_quote(checkdir))
 			myl = myf.readlines()
 			myf.close()
 		except IOError:
@@ -105,11 +102,11 @@ class VCSStatus(object):
 		return True
 
 
-	def check_bzr(self):
+	def check_bzr(self, checkdir, checkdir_relative, xpkg):
 		try:
 			myf = repoman_popen(
 				"bzr ls -v --kind=file " +
-				portage._shell_quote(self.checkdir))
+				portage._shell_quote(checkdir))
 			myl = myf.readlines()
 			myf.close()
 		except IOError:


^ permalink raw reply related	[flat|nested] 7+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/vcs/
@ 2014-06-03 19:33 Brian Dolbec
  0 siblings, 0 replies; 7+ messages in thread
From: Brian Dolbec @ 2014-06-03 19:33 UTC (permalink / raw
  To: gentoo-commits

commit:     b92c2564c1cdf5d53a5c148a427b51ff617f5613
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Tue Jun  3 18:42:37 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Tue Jun  3 18:42:37 2014 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=b92c2564

Repoman: Refactor VCSStatus to pass non consistent data to the check()

This will facilitae for the initialization of the class before the big xpkg loop.

---
 pym/repoman/main.py          |  4 ++--
 pym/repoman/vcs/vcsstatus.py | 39 ++++++++++++++++++---------------------
 2 files changed, 20 insertions(+), 23 deletions(-)

diff --git a/pym/repoman/main.py b/pym/repoman/main.py
index 5f91713..37319a3 100755
--- a/pym/repoman/main.py
+++ b/pym/repoman/main.py
@@ -315,8 +315,8 @@ for xpkg in effective_scanlist:
 	filescheck.check(checkdir, checkdirlist, checkdir_relative,
 		changed.changed, changed.new)
 #######################
-	status_check = VCSStatus(vcs_settings, checkdir, checkdir_relative, xpkg, qatracker)
-	status_check.check(check_ebuild_notadded)
+	status_check = VCSStatus(vcs_settings, qatracker)
+	status_check.check(check_ebuild_notadded, checkdir, checkdir_relative, xpkg)
 	eadded.extend(status_check.eadded)
 
 #################

diff --git a/pym/repoman/vcs/vcsstatus.py b/pym/repoman/vcs/vcsstatus.py
index 6a81b1b..0517c04 100644
--- a/pym/repoman/vcs/vcsstatus.py
+++ b/pym/repoman/vcs/vcsstatus.py
@@ -13,52 +13,49 @@ class VCSStatus(object):
 	'''Determines the status of the vcs repositories
 	to determine if files are not added'''
 
-	def __init__(self, vcs_settings, checkdir, checkdir_relative, xpkg, qatracker):
+	def __init__(self, vcs_settings, qatracker):
 		self.vcs_settings = vcs_settings
 		self.vcs = vcs_settings.vcs
 		self.eadded = []
-		self.checkdir = checkdir
-		self.checkdir_relative = checkdir_relative
-		self.xpkg = xpkg
 		self.qatracker = qatracker
 
 
-	def check(self, check_not_added):
+	def check(self, check_not_added, checkdir, checkdir_relative, xpkg):
 		if self.vcs and check_not_added:
 			vcscheck = getattr(self, 'check_%s' % self.vcs)
-			vcscheck()
+			vcscheck(checkdir, checkdir_relative, xpkg)
 
 
-	def post_git_hg(self, myf):
+	def post_git_hg(self, myf, xpkg):
 			for l in myf:
 				if l[:-1][-7:] == ".ebuild":
 					self.qatracker.add_error("ebuild.notadded",
-						os.path.join(self.xpkg, os.path.basename(l[:-1])))
+						os.path.join(xpkg, os.path.basename(l[:-1])))
 			myf.close()
 
 
-	def check_git(self):
+	def check_git(self, checkdir, checkdir_relative, xpkg):
 		myf = repoman_popen(
 			"git ls-files --others %s" %
-			(portage._shell_quote(self.checkdir_relative),))
-		self.post_git_hg(myf)
+			(portage._shell_quote(checkdir_relative),))
+		self.post_git_hg(myf, xpkg)
 
 
-	def check_hg(self):
+	def check_hg(self, checkdir, checkdir_relative, xpkg):
 		myf = repoman_popen(
 			"hg status --no-status --unknown %s" %
-			(portage._shell_quote(self.checkdir_relative),))
-		self.post_git_hg(myf)
+			(portage._shell_quote(checkdir_relative),))
+		self.post_git_hg(myf, xpkg)
 
 
-	def check_cvs(self):
+	def check_cvs(self, checkdir, checkdir_relative, xpkg):
 			try:
-				myf = open(self.checkdir + "/CVS/Entries", "r")
+				myf = open(checkdir + "/CVS/Entries", "r")
 				myl = myf.readlines()
 				myf.close()
 			except IOError:
 				self.qatracker.add_error("CVS/Entries.IO_error",
-					self.checkdir + "/CVS/Entries")
+					checkdir + "/CVS/Entries")
 				return True
 			for l in myl:
 				if l[0] != "/":
@@ -71,7 +68,7 @@ class VCSStatus(object):
 			return True
 
 
-	def check_svn(self):
+	def check_svn(self, checkdir, checkdir_relative, xpkg):
 		try:
 			myf = repoman_popen(
 				"svn status --depth=files --verbose " +
@@ -92,7 +89,7 @@ class VCSStatus(object):
 		try:
 			myf = repoman_popen(
 				"svn status " +
-				portage._shell_quote(self.checkdir))
+				portage._shell_quote(checkdir))
 			myl = myf.readlines()
 			myf.close()
 		except IOError:
@@ -105,11 +102,11 @@ class VCSStatus(object):
 		return True
 
 
-	def check_bzr(self):
+	def check_bzr(self, checkdir, checkdir_relative, xpkg):
 		try:
 			myf = repoman_popen(
 				"bzr ls -v --kind=file " +
-				portage._shell_quote(self.checkdir))
+				portage._shell_quote(checkdir))
 			myl = myf.readlines()
 			myf.close()
 		except IOError:


^ permalink raw reply related	[flat|nested] 7+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/vcs/
@ 2014-05-30 13:03 Brian Dolbec
  0 siblings, 0 replies; 7+ messages in thread
From: Brian Dolbec @ 2014-05-30 13:03 UTC (permalink / raw
  To: gentoo-commits

commit:     3418e0f2e3fd983c61a1731eee6bb737325f9cba
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Thu May 29 22:29:13 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Thu May 29 22:36:21 2014 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=3418e0f2

repoman/main.py: Split out vcsstatus.py with VCSStatus class

This class scans the vcs to determine ebuilds not added.

---
 pym/repoman/main.py          |  81 +++----------------------
 pym/repoman/vcs/vcsstatus.py | 137 +++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 146 insertions(+), 72 deletions(-)

diff --git a/pym/repoman/main.py b/pym/repoman/main.py
index ee70735..f48c8ba 100755
--- a/pym/repoman/main.py
+++ b/pym/repoman/main.py
@@ -83,6 +83,7 @@ from repoman._subprocess import repoman_popen, repoman_getstatusoutput
 from repoman import utilities
 from repoman.vcs.vcs import (git_supports_gpg_sign, vcs_files_to_cps,
 	vcs_new_changed, VCSSettings)
+from repoman.vcs.vcsstatus import VCSStatus
 from repoman._xml import _XMLParser, _MetadataTreeBuilder, XmlLint
 
 
@@ -449,78 +450,14 @@ for xpkg in effective_scanlist:
 			if f is not None:
 				f.close()
 
-	if vcs_settings.vcs in ("git", "hg") and check_ebuild_notadded:
-		if vcs_settings.vcs == "git":
-			myf = repoman_popen(
-				"git ls-files --others %s" %
-				(portage._shell_quote(checkdir_relative),))
-		if vcs_settings.vcs == "hg":
-			myf = repoman_popen(
-				"hg status --no-status --unknown %s" %
-				(portage._shell_quote(checkdir_relative),))
-		for l in myf:
-			if l[:-1][-7:] == ".ebuild":
-				stats["ebuild.notadded"] += 1
-				fails["ebuild.notadded"].append(
-					os.path.join(xpkg, os.path.basename(l[:-1])))
-		myf.close()
-
-	if vcs_settings.vcs in ("cvs", "svn", "bzr") and check_ebuild_notadded:
-		try:
-			if vcs_settings.vcs == "cvs":
-				myf = open(checkdir + "/CVS/Entries", "r")
-			if vcs_settings.vcs == "svn":
-				myf = repoman_popen(
-					"svn status --depth=files --verbose " +
-					portage._shell_quote(checkdir))
-			if vcs_settings.vcs == "bzr":
-				myf = repoman_popen(
-					"bzr ls -v --kind=file " +
-					portage._shell_quote(checkdir))
-			myl = myf.readlines()
-			myf.close()
-			for l in myl:
-				if vcs_settings.vcs == "cvs":
-					if l[0] != "/":
-						continue
-					splitl = l[1:].split("/")
-					if not len(splitl):
-						continue
-					if splitl[0][-7:] == ".ebuild":
-						eadded.append(splitl[0][:-7])
-				if vcs_settings.vcs == "svn":
-					if l[:1] == "?":
-						continue
-					if l[:7] == '      >':
-						# tree conflict, new in subversion 1.6
-						continue
-					l = l.split()[-1]
-					if l[-7:] == ".ebuild":
-						eadded.append(os.path.basename(l[:-7]))
-				if vcs_settings.vcs == "bzr":
-					if l[1:2] == "?":
-						continue
-					l = l.split()[-1]
-					if l[-7:] == ".ebuild":
-						eadded.append(os.path.basename(l[:-7]))
-			if vcs_settings.vcs == "svn":
-				myf = repoman_popen(
-					"svn status " +
-					portage._shell_quote(checkdir))
-				myl = myf.readlines()
-				myf.close()
-				for l in myl:
-					if l[0] == "A":
-						l = l.rstrip().split(' ')[-1]
-						if l[-7:] == ".ebuild":
-							eadded.append(os.path.basename(l[:-7]))
-		except IOError:
-			if vcs_settings.vcs == "cvs":
-				stats["CVS/Entries.IO_error"] += 1
-				fails["CVS/Entries.IO_error"].append(checkdir + "/CVS/Entries")
-			else:
-				raise
-			continue
+###############
+	status_check = VCSStatus(vcs_settings, checkdir, checkdir_relative, xpkg)
+	status_check.check(check_ebuild_notadded)
+	eadded.extend(status_check.eadded)
+	for key in list(status_check.stats):
+		stats[key] += status_check.stats[key]
+		fails[key].extend(status_check.fails[key])
+###############
 
 	mf = repoman_settings.repositories.get_repo_for_location(
 		os.path.dirname(os.path.dirname(checkdir)))

diff --git a/pym/repoman/vcs/vcsstatus.py b/pym/repoman/vcs/vcsstatus.py
new file mode 100644
index 0000000..4f57c42
--- /dev/null
+++ b/pym/repoman/vcs/vcsstatus.py
@@ -0,0 +1,137 @@
+
+
+import portage
+from portage import os
+
+from repoman._subprocess import repoman_popen
+
+
+
+class VCSStatus(object):
+	'''Determines the status of the vcs repositories
+	to determine if files are not added'''
+
+	def __init__(self, vcs_settings, checkdir, checkdir_relative, xpkg):
+		self.vcs_settings = vcs_settings
+		self.vcs = vcs_settings.vcs
+		self.eadded = []
+		self.checkdir = checkdir
+		self.checkdir_relative = checkdir_relative
+		self.xpkg = xpkg
+		self.stats = {}
+		self.fails = {}
+
+
+	def check(self, check_not_added):
+		if check_not_added:
+			vcscheck = getattr(self, 'check_%s' % self.vcs)
+			vcscheck()
+
+
+	def post_git_hg(self, myf):
+			for l in myf:
+				if l[:-1][-7:] == ".ebuild":
+					if "ebuild.notadded" in list(self.fails):
+						self.stats["ebuild.notadded"] += 1
+						self.fails["ebuild.notadded"].append(
+						os.path.join(self.xpkg, os.path.basename(l[:-1])))
+					else:
+						self.stats["ebuild.notadded"] = 1
+						self.fails["ebuild.notadded"] = [os.path.join(
+							self.xpkg, os.path.basename(l[:-1]))]
+			myf.close()
+
+
+	def check_git(self):
+		myf = repoman_popen(
+			"git ls-files --others %s" %
+			(portage._shell_quote(self.checkdir_relative),))
+		self.post_git_hg(myf)
+
+
+	def check_hg(self):
+		myf = repoman_popen(
+			"hg status --no-status --unknown %s" %
+			(portage._shell_quote(self.checkdir_relative),))
+		self.post_git_hg(myf)
+
+
+	def check_cvs(self):
+			try:
+				myf = open(self.checkdir + "/CVS/Entries", "r")
+				myl = myf.readlines()
+				myf.close()
+				for l in myl:
+					if l[0] != "/":
+						continue
+					splitl = l[1:].split("/")
+					if not len(splitl):
+						continue
+					if splitl[0][-7:] == ".ebuild":
+						self.eadded.append(splitl[0][:-7])
+			except IOError:
+				if "CVS/Entries.IO_error" in list(self.fails):
+					self.stats["CVS/Entries.IO_error"] += 1
+					self.fails["CVS/Entries.IO_error"].append(
+						self.checkdir + "/CVS/Entries")
+				else:
+					self.stats["CVS/Entries.IO_error"] = 1
+					self.fails["CVS/Entries.IO_error"] = [
+						self.checkdir + "/CVS/Entries"]
+			return True
+
+
+	def check_svn(self):
+		try:
+			myf = repoman_popen(
+				"svn status --depth=files --verbose " +
+				portage._shell_quote(self.checkdir))
+			myl = myf.readlines()
+			myf.close()
+			for l in myl:
+				if l[:1] == "?":
+					continue
+				if l[:7] == '      >':
+					# tree conflict, new in subversion 1.6
+					continue
+				l = l.split()[-1]
+				if l[-7:] == ".ebuild":
+					self.eadded.append(os.path.basename(l[:-7]))
+		except IOError:
+			raise
+		return True
+
+
+	def check_bzr(self):
+		try:
+			myf = repoman_popen(
+				"bzr ls -v --kind=file " +
+				portage._shell_quote(self.checkdir))
+			myl = myf.readlines()
+			myf.close()
+			for l in myl:
+				if l[1:2] == "?":
+					continue
+				l = l.split()[-1]
+				if l[-7:] == ".ebuild":
+					self.eadded.append(os.path.basename(l[:-7]))
+		except IOError:
+			raise
+		return True
+
+
+	def post_cvs_svn_bzr(self, myf):
+				if self.vcs == "svn":
+					myf = repoman_popen(
+						"svn status " +
+						portage._shell_quote(self.checkdir))
+					myl = myf.readlines()
+					myf.close()
+					for l in myl:
+						if l[0] == "A":
+							l = l.rstrip().split(' ')[-1]
+							if l[-7:] == ".ebuild":
+								self.eadded.append(os.path.basename(l[:-7]))
+				else:
+					raise
+				#continue


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2015-09-05 21:48 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-30 19:25 [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/vcs/ Brian Dolbec
  -- strict thread matches above, loose matches on Subject: below --
2015-09-05 21:48 Brian Dolbec
2015-09-05 21:27 Brian Dolbec
2014-10-01 23:46 Brian Dolbec
2014-10-01 23:02 Brian Dolbec
2014-06-03 19:33 Brian Dolbec
2014-05-30 13:03 Brian Dolbec

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox