public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/overlint:master commit in: overlint/
@ 2012-04-03 21:53 Sebastian Pipping
  0 siblings, 0 replies; 14+ messages in thread
From: Sebastian Pipping @ 2012-04-03 21:53 UTC (permalink / raw
  To: gentoo-commits

commit:     818d518ae65523d18032c4e3082e2ca099ca4d06
Author:     Sebastian Pipping <sebastian <AT> pipping <DOT> org>
AuthorDate: Tue Apr  3 21:52:03 2012 +0000
Commit:     Sebastian Pipping <sping <AT> gentoo <DOT> org>
CommitDate: Tue Apr  3 21:52:03 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/overlint.git;a=commit;h=818d518a

Require overlay location parameter (using argparse)

---
 overlint/cli.py |   47 +++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 39 insertions(+), 8 deletions(-)

diff --git a/overlint/cli.py b/overlint/cli.py
index f660d94..10a3ef7 100644
--- a/overlint/cli.py
+++ b/overlint/cli.py
@@ -2,19 +2,29 @@
 # Licender under GPL v2 or later
 
 from __future__ import print_function
+
+VERSION_STR = '0.2'
+
 import sys
 import os
 import portage
 import re
 
+try:
+	import argparse
+except ImportError:
+	print("ERROR: You need Python 2.7+ unless you have module argparse "
+		"(package dev-python/argparse on Gentoo) installed independently.", file=sys.stderr)
+	sys.exit(1)
+
 
 _revision_matcher = re.compile('-r([0-9]+)$')
 
 
-def find_atoms(repo_folder, category_package):
+def find_atoms(repository_path, category_package):
 	versions = list()
 	category, package = category_package.split('/')
-	for root, dirs, files in os.walk(os.path.join(repo_folder, category_package)):
+	for root, dirs, files in os.walk(os.path.join(repository_path, category_package)):
 		for f in files:
 			if not f.endswith('.ebuild'):
 				continue
@@ -74,7 +84,7 @@ def find_ebuild_changes(category_package, overlay_path, gentoo_versions, overlay
 		ret = os.system(command)
 		if not ret:
 			continue
-		# print("meld '/usr/portage/%s/%s' '%s/%s/%s'" % (category_package, ebuild_name, overlay_path, category_package, ebuild_name))
+		# print("meld '/usr/portage/%s/%s' '%s/%s/%s'" % (category_package, ebuild_name, conf.overlay_path, category_package, ebuild_name))
 		ebuild_changes.append(version)
 	return ebuild_changes
 
@@ -94,21 +104,42 @@ def dump_tree(tree, title):
 	print()
 
 
+def parse_command_line(args):
+	parser = argparse.ArgumentParser(description='Simple tool for static analysis of Gentoo overlays')
+	parser.add_argument(
+		'--version',
+		action='version', version='%(prog)s ' + VERSION_STR)
+	parser.add_argument('overlay_path',
+		metavar='PATH', action='store',
+		help='Path to Gentoo overlay')
+	conf = parser.parse_args(args=args[1:])
+
+	return conf
+
+
 def main(args):
-	overlay_path = '/var/lib/layman/pentoo'
+	conf = parse_command_line(args)
+
+	def sanitize_overlay_path(path):
+		path = path.rstrip('/')
+		if path == '':
+			return '/'
+		return path
+
+	conf.overlay_path = sanitize_overlay_path(conf.overlay_path)
 
 	missed_revision_bumps_tree = dict()
 	missed_version_bumps_tree = dict()
 	ebuild_changes_tree = dict()
 
-	for root, dirs, files in os.walk(overlay_path):
+	for root, dirs, files in os.walk(conf.overlay_path):
 		if '.svn' in dirs:
 			dirs[:] = [d for d in dirs if d != '.svn']
 
 
 		for d in dirs:
 			full_path_overlay = os.path.join(root, d)
-			category_package = full_path_overlay[len(overlay_path + '/'):]
+			category_package = full_path_overlay[len(conf.overlay_path + '/'):]
 			if len(category_package.split('/')) != 2:
 				continue
 			full_path_gentoo = os.path.join('/usr/portage/', category_package)
@@ -116,10 +147,10 @@ def main(args):
 			if not found:
 				continue
 
-			overlay_versions = find_atoms(overlay_path, category_package)
+			overlay_versions = find_atoms(conf.overlay_path, category_package)
 			gentoo_versions = find_atoms('/usr/portage/', category_package)
 			(missed_revision_bumps, missed_version_bumps) = find_missed_bumps(gentoo_versions, overlay_versions)
-			ebuild_changes = find_ebuild_changes(category_package, overlay_path, gentoo_versions, overlay_versions)
+			ebuild_changes = find_ebuild_changes(category_package, conf.overlay_path, gentoo_versions, overlay_versions)
 			category, package = category_package.split('/')
 			if missed_revision_bumps:
 				missed_revision_bumps_tree.setdefault(category, dict())[package] = highest_revision_only(missed_revision_bumps)



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

* [gentoo-commits] proj/overlint:master commit in: overlint/
@ 2012-04-03 21:53 Sebastian Pipping
  0 siblings, 0 replies; 14+ messages in thread
From: Sebastian Pipping @ 2012-04-03 21:53 UTC (permalink / raw
  To: gentoo-commits

commit:     2a05c06b9d2d7c3242636b3b01914ffb427e3133
Author:     Sebastian Pipping <sebastian <AT> pipping <DOT> org>
AuthorDate: Tue Apr  3 21:31:17 2012 +0000
Commit:     Sebastian Pipping <sping <AT> gentoo <DOT> org>
CommitDate: Tue Apr  3 21:31:17 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/overlint.git;a=commit;h=2a05c06b

Move towards print function

---
 overlint/cli.py |   15 ++++++++-------
 1 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/overlint/cli.py b/overlint/cli.py
index 5ee42d7..f660d94 100644
--- a/overlint/cli.py
+++ b/overlint/cli.py
@@ -1,6 +1,7 @@
 # Copyright (C) 2012 Sebastian Pipping <sebastian@pipping.org>
 # Licender under GPL v2 or later
 
+from __future__ import print_function
 import sys
 import os
 import portage
@@ -73,7 +74,7 @@ def find_ebuild_changes(category_package, overlay_path, gentoo_versions, overlay
 		ret = os.system(command)
 		if not ret:
 			continue
-		# print "meld '/usr/portage/%s/%s' '%s/%s/%s'" % (category_package, ebuild_name, overlay_path, category_package, ebuild_name)
+		# print("meld '/usr/portage/%s/%s' '%s/%s/%s'" % (category_package, ebuild_name, overlay_path, category_package, ebuild_name))
 		ebuild_changes.append(version)
 	return ebuild_changes
 
@@ -83,14 +84,14 @@ def sorted_versions(versions):
 
 
 def dump_tree(tree, title):
-	print '==============================================================='
-	print title
-	print '==============================================================='
+	print('===============================================================')
+	print(title)
+	print('===============================================================')
 	for category, package_versions in sorted(tree.items()):
-		print '%s/' % category
+		print('%s/' % category)
 		for package, versions in sorted(package_versions.items()):
-			print '  %s :: %s' % (package, ', '.join(sorted_versions(versions)))
-	print
+			print('  %s :: %s' % (package, ', '.join(sorted_versions(versions))))
+	print()
 
 
 def main(args):



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

* [gentoo-commits] proj/overlint:master commit in: overlint/
@ 2012-04-06 22:26 Sebastian Pipping
  0 siblings, 0 replies; 14+ messages in thread
From: Sebastian Pipping @ 2012-04-06 22:26 UTC (permalink / raw
  To: gentoo-commits

commit:     5b8354a9ae9db7700663e4ea4c987628fbfc5255
Author:     Sebastian Pipping <sebastian <AT> pipping <DOT> org>
AuthorDate: Fri Apr  6 22:24:48 2012 +0000
Commit:     Sebastian Pipping <sping <AT> gentoo <DOT> org>
CommitDate: Fri Apr  6 22:25:27 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/overlint.git;a=commit;h=5b8354a9

No longer count CVS metadata or copyright years as changes

---
 overlint/cli.py |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/overlint/cli.py b/overlint/cli.py
index 10a3ef7..a0720b2 100644
--- a/overlint/cli.py
+++ b/overlint/cli.py
@@ -3,7 +3,7 @@
 
 from __future__ import print_function
 
-VERSION_STR = '0.2'
+VERSION_STR = '0.3'
 
 import sys
 import os
@@ -80,7 +80,10 @@ def find_ebuild_changes(category_package, overlay_path, gentoo_versions, overlay
 	category, package = category_package.split('/')
 	for version in intersection:
 		ebuild_name = '%s-%s.ebuild' % (package, version)
-		command = "bash -c 'cmp --quiet <(fgrep -v KEYWORDS= /usr/portage/%s/%s) <(fgrep -v KEYWORDS= %s/%s/%s) ; exit $?'" % (category_package, ebuild_name, overlay_path, category_package, ebuild_name)
+		command = """bash -c 'FILTER() { sed -e "/# $Header/d" -e "/# Copyright/d" -e "/KEYWORDS=/d" "$@"; }; """ \
+					"""cmp --quiet <(FILTER /usr/portage/%s/%s) <(FILTER %s/%s/%s) ; """ \
+					"""exit $?'""" \
+				% (category_package, ebuild_name, overlay_path, category_package, ebuild_name)
 		ret = os.system(command)
 		if not ret:
 			continue



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

* [gentoo-commits] proj/overlint:master commit in: overlint/
@ 2012-04-06 22:35 Sebastian Pipping
  0 siblings, 0 replies; 14+ messages in thread
From: Sebastian Pipping @ 2012-04-06 22:35 UTC (permalink / raw
  To: gentoo-commits

commit:     32b6de9090156d5d8369e030d143f9d468f63e83
Author:     Sebastian Pipping <sebastian <AT> pipping <DOT> org>
AuthorDate: Fri Apr  6 22:34:11 2012 +0000
Commit:     Sebastian Pipping <sping <AT> gentoo <DOT> org>
CommitDate: Fri Apr  6 22:34:35 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/overlint.git;a=commit;h=32b6de90

Fix report of 6.0-r9 as a version bump with 6.0-r3 in the Gentoo main tree already

---
 overlint/cli.py |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/overlint/cli.py b/overlint/cli.py
index a0720b2..d941f25 100644
--- a/overlint/cli.py
+++ b/overlint/cli.py
@@ -3,7 +3,7 @@
 
 from __future__ import print_function
 
-VERSION_STR = '0.3'
+VERSION_STR = '0.4'
 
 import sys
 import os
@@ -54,6 +54,7 @@ def highest_revision_only(versions):
 def find_missed_bumps(gentoo_versions, overlay_versions):
 	missed_version_bumps = list()
 	missed_revision_bumps = list()
+	gentoo_zero_revisions = set(_revision_matcher.sub('', gv) for gv in gentoo_versions)
 	for ov in overlay_versions:
 		if '999' in ov:
 			continue
@@ -66,7 +67,7 @@ def find_missed_bumps(gentoo_versions, overlay_versions):
 				break
 		if newer_than_gentoo:
 			ov_without_revision = _revision_matcher.sub('', ov)
-			if ov_without_revision in gentoo_versions:
+			if ov_without_revision in gentoo_zero_revisions:
 				missed_revision_bumps.append(ov)
 			else:
 				missed_version_bumps.append(ov)



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

* [gentoo-commits] proj/overlint:master commit in: overlint/
@ 2012-04-08  6:06 Sebastian Pipping
  0 siblings, 0 replies; 14+ messages in thread
From: Sebastian Pipping @ 2012-04-08  6:06 UTC (permalink / raw
  To: gentoo-commits

commit:     7931286fbf5d39881c95c188203283d9bf55b8bd
Author:     Sebastian Pipping <sebastian <AT> pipping <DOT> org>
AuthorDate: Sun Apr  8 05:59:25 2012 +0000
Commit:     Sebastian Pipping <sping <AT> gentoo <DOT> org>
CommitDate: Sun Apr  8 05:59:30 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/overlint.git;a=commit;h=7931286f

Turn sorted(x, cmp=y) into sorted(x, key=f(y)) for Python 3.2 compatibility (bug #411135)

Reported by Chris Mayo

---
 overlint/cli.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/overlint/cli.py b/overlint/cli.py
index 4ba402c..edfe6ac 100644
--- a/overlint/cli.py
+++ b/overlint/cli.py
@@ -94,7 +94,7 @@ def find_ebuild_changes(category_package, overlay_path, gentoo_versions, overlay
 
 
 def sorted_versions(versions):
-	return sorted(versions, cmp=portage.vercmp)
+	return sorted(versions, key=portage.versions.cmp_sort_key(portage.vercmp))
 
 
 def dump_tree(tree, title):



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

* [gentoo-commits] proj/overlint:master commit in: overlint/
@ 2012-04-08  6:06 Sebastian Pipping
  0 siblings, 0 replies; 14+ messages in thread
From: Sebastian Pipping @ 2012-04-08  6:06 UTC (permalink / raw
  To: gentoo-commits

commit:     b1fb03d57cd7c43a70e2c2bcd4069daf5985b3e1
Author:     Sebastian Pipping <sebastian <AT> pipping <DOT> org>
AuthorDate: Sun Apr  8 06:01:19 2012 +0000
Commit:     Sebastian Pipping <sping <AT> gentoo <DOT> org>
CommitDate: Sun Apr  8 06:01:19 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/overlint.git;a=commit;h=b1fb03d5

Bump version to 0.4.2

---
 overlint/cli.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/overlint/cli.py b/overlint/cli.py
index 071e3e8..e2f8087 100644
--- a/overlint/cli.py
+++ b/overlint/cli.py
@@ -3,7 +3,7 @@
 
 from __future__ import print_function
 
-VERSION_STR = '0.4.1'
+VERSION_STR = '0.4.2'
 
 import sys
 import os



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

* [gentoo-commits] proj/overlint:master commit in: overlint/
@ 2012-04-08  6:06 Sebastian Pipping
  0 siblings, 0 replies; 14+ messages in thread
From: Sebastian Pipping @ 2012-04-08  6:06 UTC (permalink / raw
  To: gentoo-commits

commit:     ec14efc8f35b4698208747a0bce5da592ec0325d
Author:     Sebastian Pipping <sebastian <AT> pipping <DOT> org>
AuthorDate: Sun Apr  8 06:00:41 2012 +0000
Commit:     Sebastian Pipping <sping <AT> gentoo <DOT> org>
CommitDate: Sun Apr  8 06:00:41 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/overlint.git;a=commit;h=ec14efc8

Fix typo "ebuils"

Reported by Chris Mayo

---
 overlint/cli.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/overlint/cli.py b/overlint/cli.py
index edfe6ac..071e3e8 100644
--- a/overlint/cli.py
+++ b/overlint/cli.py
@@ -165,7 +165,7 @@ def main(args):
 
 	dump_tree(missed_version_bumps_tree, 'Version bumps missing from Gentoo main tree')
 	dump_tree(missed_revision_bumps_tree, 'Revision bumps missing from Gentoo main tree')
-	dump_tree(ebuild_changes_tree, 'Ebuils that differ at same revision')
+	dump_tree(ebuild_changes_tree, 'Ebuilds that differ at same revision')
 	return 0
 
 



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

* [gentoo-commits] proj/overlint:master commit in: overlint/
@ 2012-04-08 19:04 Sebastian Pipping
  0 siblings, 0 replies; 14+ messages in thread
From: Sebastian Pipping @ 2012-04-08 19:04 UTC (permalink / raw
  To: gentoo-commits

commit:     c94896ce582870cf1188ce8e171349aa29546de7
Author:     Sebastian Pipping <sebastian <AT> pipping <DOT> org>
AuthorDate: Sun Apr  8 18:59:08 2012 +0000
Commit:     Sebastian Pipping <sping <AT> gentoo <DOT> org>
CommitDate: Sun Apr  8 18:59:25 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/overlint.git;a=commit;h=c94896ce

Report ebuilds lagging behind main tree, requested by non7top

---
 overlint/cli.py |   25 ++++++++++++++++++++++++-
 1 files changed, 24 insertions(+), 1 deletions(-)

diff --git a/overlint/cli.py b/overlint/cli.py
index 1a42c17..7ad967d 100644
--- a/overlint/cli.py
+++ b/overlint/cli.py
@@ -3,7 +3,7 @@
 
 from __future__ import print_function
 
-VERSION_STR = '0.4.2'
+VERSION_STR = '0.5'
 
 import sys
 import os
@@ -73,6 +73,23 @@ def find_missed_bumps(gentoo_versions, overlay_versions):
 				missed_version_bumps.append(ov)
 	return (missed_revision_bumps, missed_version_bumps)
 
+
+def find_lagging_behind_gentoo(gentoo_versions, overlay_versions):
+	lagging_behind_gentoo = list()
+	for ov in overlay_versions:
+		if '999' in ov:
+			continue
+		for gv in gentoo_versions:
+			if '999' in gv:
+				continue
+			if ov == gv:
+				continue
+			if portage.vercmp(ov, gv) < 0 and ov not in gentoo_versions:
+				lagging_behind_gentoo.append(ov)
+				break
+	return lagging_behind_gentoo
+
+
 def find_ebuild_changes(category_package, overlay_path, gentoo_versions, overlay_versions):
 	ebuild_changes = list()
 	intersection = set(gentoo_versions) & set(overlay_versions)
@@ -139,6 +156,7 @@ def main(args):
 	missed_revision_bumps_tree = dict()
 	missed_version_bumps_tree = dict()
 	ebuild_changes_tree = dict()
+	lagging_behind_gentoo__tree = dict()
 
 	for root, dirs, files in os.walk(conf.overlay_path):
 		if '.svn' in dirs:
@@ -158,6 +176,7 @@ def main(args):
 			overlay_versions = find_atoms(conf.overlay_path, category_package)
 			gentoo_versions = find_atoms('/usr/portage/', category_package)
 			(missed_revision_bumps, missed_version_bumps) = find_missed_bumps(gentoo_versions, overlay_versions)
+			lagging_behind_gentoo = find_lagging_behind_gentoo(gentoo_versions, overlay_versions)
 			ebuild_changes = find_ebuild_changes(category_package, conf.overlay_path, gentoo_versions, overlay_versions)
 			category, package = category_package.split('/')
 			if missed_revision_bumps:
@@ -166,9 +185,13 @@ def main(args):
 				missed_version_bumps_tree.setdefault(category, dict())[package] = highest_revision_only(missed_version_bumps)
 			if ebuild_changes:
 				ebuild_changes_tree.setdefault(category, dict())[package] = ebuild_changes
+			if lagging_behind_gentoo:
+				lagging_behind_gentoo__tree.setdefault(category, dict())[package] = lagging_behind_gentoo
+
 
 	dump_tree(missed_version_bumps_tree, 'Version bumps missing from Gentoo main tree')
 	dump_tree(missed_revision_bumps_tree, 'Revision bumps missing from Gentoo main tree')
+	dump_tree(lagging_behind_gentoo__tree, 'Ebuilds lagging behind the Gentoo main tree')
 	dump_tree(ebuild_changes_tree, 'Ebuilds that differ at same revision')
 	return 0
 



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

* [gentoo-commits] proj/overlint:master commit in: overlint/
@ 2012-04-08 19:04 Sebastian Pipping
  0 siblings, 0 replies; 14+ messages in thread
From: Sebastian Pipping @ 2012-04-08 19:04 UTC (permalink / raw
  To: gentoo-commits

commit:     0bfa1d0fd93c9558411f044df8c7b90797b88147
Author:     Sebastian Pipping <sebastian <AT> pipping <DOT> org>
AuthorDate: Sun Apr  8 18:41:09 2012 +0000
Commit:     Sebastian Pipping <sping <AT> gentoo <DOT> org>
CommitDate: Sun Apr  8 18:41:09 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/overlint.git;a=commit;h=0bfa1d0f

Check if overlay directory exists

---
 overlint/cli.py |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/overlint/cli.py b/overlint/cli.py
index e2f8087..1a42c17 100644
--- a/overlint/cli.py
+++ b/overlint/cli.py
@@ -132,6 +132,10 @@ def main(args):
 
 	conf.overlay_path = sanitize_overlay_path(conf.overlay_path)
 
+	if not os.path.isdir(conf.overlay_path):
+		print("ERROR: Path \"%s\" is not a diretory" % conf.overlay_path, file=sys.stderr)
+		return 1
+
 	missed_revision_bumps_tree = dict()
 	missed_version_bumps_tree = dict()
 	ebuild_changes_tree = dict()



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

* [gentoo-commits] proj/overlint:master commit in: overlint/
@ 2012-05-18 23:15 Sebastian Pipping
  0 siblings, 0 replies; 14+ messages in thread
From: Sebastian Pipping @ 2012-05-18 23:15 UTC (permalink / raw
  To: gentoo-commits

commit:     119bc8d9d4c7e21462bbfddbf081c2d2e6275003
Author:     XU Benda <heroxbd <AT> gentoo <DOT> org>
AuthorDate: Fri May 18 23:10:26 2012 +0000
Commit:     Sebastian Pipping <sping <AT> gentoo <DOT> org>
CommitDate: Fri May 18 23:10:26 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/overlint.git;a=commit;h=119bc8d9

Use PORTDIR

---
 overlint/cli.py |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/overlint/cli.py b/overlint/cli.py
index 7ad967d..6c91a59 100644
--- a/overlint/cli.py
+++ b/overlint/cli.py
@@ -20,6 +20,7 @@ except ImportError:
 
 _revision_matcher = re.compile('-r([0-9]+)$')
 
+portdir = portage.settings["PORTDIR"]
 
 def find_atoms(repository_path, category_package):
 	versions = list()
@@ -99,9 +100,9 @@ def find_ebuild_changes(category_package, overlay_path, gentoo_versions, overlay
 	for version in intersection:
 		ebuild_name = '%s-%s.ebuild' % (package, version)
 		command = """bash -c 'FILTER() { sed -e "/# $Header/d" -e "/# Copyright/d" -e "/KEYWORDS=/d" "$@"; }; """ \
-					"""cmp --quiet <(FILTER /usr/portage/%s/%s) <(FILTER %s/%s/%s) ; """ \
+					"""cmp --quiet <(FILTER %s/%s/%s) <(FILTER %s/%s/%s) ; """ \
 					"""exit $?'""" \
-				% (category_package, ebuild_name, overlay_path, category_package, ebuild_name)
+				% (portdir, category_package, ebuild_name, overlay_path, category_package, ebuild_name)
 		ret = os.system(command)
 		if not ret:
 			continue
@@ -168,13 +169,13 @@ def main(args):
 			category_package = full_path_overlay[len(conf.overlay_path + '/'):]
 			if len(category_package.split('/')) != 2:
 				continue
-			full_path_gentoo = os.path.join('/usr/portage/', category_package)
+			full_path_gentoo = os.path.join(portdir, category_package)
 			found = os.path.exists(full_path_gentoo)
 			if not found:
 				continue
 
 			overlay_versions = find_atoms(conf.overlay_path, category_package)
-			gentoo_versions = find_atoms('/usr/portage/', category_package)
+			gentoo_versions = find_atoms(portdir, category_package)
 			(missed_revision_bumps, missed_version_bumps) = find_missed_bumps(gentoo_versions, overlay_versions)
 			lagging_behind_gentoo = find_lagging_behind_gentoo(gentoo_versions, overlay_versions)
 			ebuild_changes = find_ebuild_changes(category_package, conf.overlay_path, gentoo_versions, overlay_versions)



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

* [gentoo-commits] proj/overlint:master commit in: overlint/
@ 2012-05-18 23:15 Sebastian Pipping
  0 siblings, 0 replies; 14+ messages in thread
From: Sebastian Pipping @ 2012-05-18 23:15 UTC (permalink / raw
  To: gentoo-commits

commit:     a5e7fc7743404c30a2808d28a8823e44a59646f1
Author:     Sebastian Pipping <sebastian <AT> pipping <DOT> org>
AuthorDate: Fri May 18 23:14:16 2012 +0000
Commit:     Sebastian Pipping <sping <AT> gentoo <DOT> org>
CommitDate: Fri May 18 23:14:16 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/overlint.git;a=commit;h=a5e7fc77

Bump version to 0.5.1

---
 overlint/cli.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/overlint/cli.py b/overlint/cli.py
index 6c91a59..83e2311 100644
--- a/overlint/cli.py
+++ b/overlint/cli.py
@@ -3,7 +3,7 @@
 
 from __future__ import print_function
 
-VERSION_STR = '0.5'
+VERSION_STR = '0.5.1'
 
 import sys
 import os



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

* [gentoo-commits] proj/overlint:master commit in: overlint/
@ 2012-06-16 12:28 Sebastian Pipping
  0 siblings, 0 replies; 14+ messages in thread
From: Sebastian Pipping @ 2012-06-16 12:28 UTC (permalink / raw
  To: gentoo-commits

commit:     87e4675f6dc105039af181d203106879ee17a15f
Author:     Sebastian Pipping <sebastian <AT> pipping <DOT> org>
AuthorDate: Sat Jun 16 12:24:40 2012 +0000
Commit:     Sebastian Pipping <sping <AT> gentoo <DOT> org>
CommitDate: Sat Jun 16 12:26:00 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/overlint.git;a=commit;h=87e4675f

Compare ebuilds ourselves rather than invoking sed and cmp

This solves the issue with "sed: [..]: Broken pipe" and saves a few process forkes

---
 overlint/cli.py |   25 ++++++++++++++++++-------
 1 files changed, 18 insertions(+), 7 deletions(-)

diff --git a/overlint/cli.py b/overlint/cli.py
index 83e2311..049e826 100644
--- a/overlint/cli.py
+++ b/overlint/cli.py
@@ -19,6 +19,7 @@ except ImportError:
 
 
 _revision_matcher = re.compile('-r([0-9]+)$')
+_ignore_matcher = re.compile('(?:^# (?:\\$Header|Copyright)|KEYWORDS=)')
 
 portdir = portage.settings["PORTDIR"]
 
@@ -91,6 +92,19 @@ def find_lagging_behind_gentoo(gentoo_versions, overlay_versions):
 	return lagging_behind_gentoo
 
 
+def _iter_important_lines(ebuild_f):
+	return (line_br for line_br in ebuild_f if _ignore_matcher.search(line_br) is None)
+
+
+def ebuilds_are_equivalent(filename_a, filename_b):
+	fa = open(filename_a, 'r')
+	fb = open(filename_b, 'r')
+	for (la, lb) in zip(_iter_important_lines(fa), _iter_important_lines(fb)):
+		if la != lb:
+			return False
+	return True
+
+
 def find_ebuild_changes(category_package, overlay_path, gentoo_versions, overlay_versions):
 	ebuild_changes = list()
 	intersection = set(gentoo_versions) & set(overlay_versions)
@@ -99,14 +113,11 @@ def find_ebuild_changes(category_package, overlay_path, gentoo_versions, overlay
 	category, package = category_package.split('/')
 	for version in intersection:
 		ebuild_name = '%s-%s.ebuild' % (package, version)
-		command = """bash -c 'FILTER() { sed -e "/# $Header/d" -e "/# Copyright/d" -e "/KEYWORDS=/d" "$@"; }; """ \
-					"""cmp --quiet <(FILTER %s/%s/%s) <(FILTER %s/%s/%s) ; """ \
-					"""exit $?'""" \
-				% (portdir, category_package, ebuild_name, overlay_path, category_package, ebuild_name)
-		ret = os.system(command)
-		if not ret:
+		filename_a = os.path.join(portdir, category_package, ebuild_name)
+		filename_b = os.path.join(overlay_path, category_package, ebuild_name)
+		if ebuilds_are_equivalent(filename_a, filename_b):
 			continue
-		# print("meld '/usr/portage/%s/%s' '%s/%s/%s'" % (category_package, ebuild_name, conf.overlay_path, category_package, ebuild_name))
+		# print("meld '%s' '%s'" % (filename_a, filename_b))
 		ebuild_changes.append(version)
 	return ebuild_changes
 



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

* [gentoo-commits] proj/overlint:master commit in: overlint/
@ 2012-06-16 12:28 Sebastian Pipping
  0 siblings, 0 replies; 14+ messages in thread
From: Sebastian Pipping @ 2012-06-16 12:28 UTC (permalink / raw
  To: gentoo-commits

commit:     e86b9eb898311b2e0d21d8192c4ae1c92fc29aef
Author:     Sebastian Pipping <sebastian <AT> pipping <DOT> org>
AuthorDate: Sat Jun 16 12:26:55 2012 +0000
Commit:     Sebastian Pipping <sping <AT> gentoo <DOT> org>
CommitDate: Sat Jun 16 12:26:55 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/overlint.git;a=commit;h=e86b9eb8

Bump version to 0.5.2

---
 overlint/cli.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/overlint/cli.py b/overlint/cli.py
index 049e826..2161757 100644
--- a/overlint/cli.py
+++ b/overlint/cli.py
@@ -3,7 +3,7 @@
 
 from __future__ import print_function
 
-VERSION_STR = '0.5.1'
+VERSION_STR = '0.5.2'
 
 import sys
 import os



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

* [gentoo-commits] proj/overlint:master commit in: overlint/
@ 2014-10-25 23:16 Sebastian Pipping
  0 siblings, 0 replies; 14+ messages in thread
From: Sebastian Pipping @ 2014-10-25 23:16 UTC (permalink / raw
  To: gentoo-commits

commit:     c73f42c8ba42e34fd552f145e971f32462a96cfa
Author:     Sebastian Pipping <sebastian <AT> pipping <DOT> org>
AuthorDate: Sat Oct 25 23:14:28 2014 +0000
Commit:     Sebastian Pipping <sping <AT> gentoo <DOT> org>
CommitDate: Sat Oct 25 23:15:12 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/overlint.git;a=commit;h=c73f42c8

Pull execution out of module scope

---
 overlint/cli.py | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/overlint/cli.py b/overlint/cli.py
index 2161757..46e3d32 100644
--- a/overlint/cli.py
+++ b/overlint/cli.py
@@ -3,7 +3,7 @@
 
 from __future__ import print_function
 
-VERSION_STR = '0.5.2'
+VERSION_STR = '0.5.3'
 
 import sys
 import os
@@ -21,7 +21,10 @@ except ImportError:
 _revision_matcher = re.compile('-r([0-9]+)$')
 _ignore_matcher = re.compile('(?:^# (?:\\$Header|Copyright)|KEYWORDS=)')
 
-portdir = portage.settings["PORTDIR"]
+
+def get_portdir():
+	return portage.settings["PORTDIR"]
+
 
 def find_atoms(repository_path, category_package):
 	versions = list()
@@ -113,7 +116,7 @@ def find_ebuild_changes(category_package, overlay_path, gentoo_versions, overlay
 	category, package = category_package.split('/')
 	for version in intersection:
 		ebuild_name = '%s-%s.ebuild' % (package, version)
-		filename_a = os.path.join(portdir, category_package, ebuild_name)
+		filename_a = os.path.join(get_portdir(), category_package, ebuild_name)
 		filename_b = os.path.join(overlay_path, category_package, ebuild_name)
 		if ebuilds_are_equivalent(filename_a, filename_b):
 			continue
@@ -180,13 +183,13 @@ def main(args):
 			category_package = full_path_overlay[len(conf.overlay_path + '/'):]
 			if len(category_package.split('/')) != 2:
 				continue
-			full_path_gentoo = os.path.join(portdir, category_package)
+			full_path_gentoo = os.path.join(get_portdir(), category_package)
 			found = os.path.exists(full_path_gentoo)
 			if not found:
 				continue
 
 			overlay_versions = find_atoms(conf.overlay_path, category_package)
-			gentoo_versions = find_atoms(portdir, category_package)
+			gentoo_versions = find_atoms(get_portdir(), category_package)
 			(missed_revision_bumps, missed_version_bumps) = find_missed_bumps(gentoo_versions, overlay_versions)
 			lagging_behind_gentoo = find_lagging_behind_gentoo(gentoo_versions, overlay_versions)
 			ebuild_changes = find_ebuild_changes(category_package, conf.overlay_path, gentoo_versions, overlay_versions)


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

end of thread, other threads:[~2014-10-25 23:16 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-08 19:04 [gentoo-commits] proj/overlint:master commit in: overlint/ Sebastian Pipping
  -- strict thread matches above, loose matches on Subject: below --
2014-10-25 23:16 Sebastian Pipping
2012-06-16 12:28 Sebastian Pipping
2012-06-16 12:28 Sebastian Pipping
2012-05-18 23:15 Sebastian Pipping
2012-05-18 23:15 Sebastian Pipping
2012-04-08 19:04 Sebastian Pipping
2012-04-08  6:06 Sebastian Pipping
2012-04-08  6:06 Sebastian Pipping
2012-04-08  6:06 Sebastian Pipping
2012-04-06 22:35 Sebastian Pipping
2012-04-06 22:26 Sebastian Pipping
2012-04-03 21:53 Sebastian Pipping
2012-04-03 21:53 Sebastian Pipping

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