[gentoo-commits] proj/portage:master commit in: repoman/pym/repoman/tests/

2018-03-29 Thread Zac Medico
commit: 32f9c278bfc4048191726f4a8670c77ea56d586b
Author: El Acheche Anis  ubuntu  com>
AuthorDate: Mon Jul 24 04:50:07 2017 +
Commit: Zac Medico  gentoo  org>
CommitDate: Fri Mar 30 03:51:21 2018 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=32f9c278

repoman: repoman/pym/repoman/tests/runTests.py: Fix PEP8 E226

 repoman/pym/repoman/tests/runTests.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/repoman/pym/repoman/tests/runTests.py 
b/repoman/pym/repoman/tests/runTests.py
index ca37b14b3..b0e715ec6 100644
--- a/repoman/pym/repoman/tests/runTests.py
+++ b/repoman/pym/repoman/tests/runTests.py
@@ -35,7 +35,7 @@ repoman_pym = 
osp.dirname(osp.dirname(osp.dirname(osp.realpath(__file__
 sys.path.insert(0, repoman_pym)
 
 # Add in the parent portage python modules
-portage_pym = osp.dirname(osp.dirname(repoman_pym))+'/pym'
+portage_pym = osp.dirname(osp.dirname(repoman_pym)) + '/pym'
 sys.path.insert(0, portage_pym)
 
 # import our centrally initialized portage instance



[gentoo-commits] proj/portage:master commit in: repoman/pym/repoman/tests/

2018-03-29 Thread Zac Medico
commit: 4fcf189a18dca35f501d59a0344eba8732520ed4
Author: El Acheche Anis  ubuntu  com>
AuthorDate: Mon Jul 24 04:46:28 2017 +
Commit: Zac Medico  gentoo  org>
CommitDate: Fri Mar 30 03:51:20 2018 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=4fcf189a

repoman: repoman/pym/repoman/tests/runTests.py: Fix PEP8 E401

 repoman/pym/repoman/tests/runTests.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/repoman/pym/repoman/tests/runTests.py 
b/repoman/pym/repoman/tests/runTests.py
index 759abdd82..3125ff058 100644
--- a/repoman/pym/repoman/tests/runTests.py
+++ b/repoman/pym/repoman/tests/runTests.py
@@ -3,7 +3,8 @@
 # Copyright 2006-2017 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
-import os, sys
+import os
+import sys
 import os.path as osp
 import grp
 import platform



[gentoo-commits] proj/portage:master commit in: repoman/pym/repoman/tests/

2018-03-29 Thread Zac Medico
commit: fc80d0b580006e1ffbab6866d6ce4674c32ddb6e
Author: El Acheche Anis  ubuntu  com>
AuthorDate: Mon Jul 24 04:47:42 2017 +
Commit: Zac Medico  gentoo  org>
CommitDate: Fri Mar 30 03:51:20 2018 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=fc80d0b5

repoman: repoman/pym/repoman/tests/runTests.py: Fix PEP8 E302

 repoman/pym/repoman/tests/runTests.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/repoman/pym/repoman/tests/runTests.py 
b/repoman/pym/repoman/tests/runTests.py
index 3125ff058..1795aa487 100644
--- a/repoman/pym/repoman/tests/runTests.py
+++ b/repoman/pym/repoman/tests/runTests.py
@@ -11,6 +11,7 @@ import platform
 import pwd
 import signal
 
+
 def debug_signal(signum, frame):
import pdb
pdb.set_trace()



[gentoo-commits] proj/portage:master commit in: repoman/pym/repoman/tests/

2018-03-29 Thread Zac Medico
commit: 30cb501b641f99a8392261734384c6e681f9c3a8
Author: El Acheche Anis  ubuntu  com>
AuthorDate: Mon Jul 24 04:49:26 2017 +
Commit: Zac Medico  gentoo  org>
CommitDate: Fri Mar 30 03:51:21 2018 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=30cb501b

repoman: repoman/pym/repoman/tests/runTests.py: Fix PEP8 E261

 repoman/pym/repoman/tests/runTests.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/repoman/pym/repoman/tests/runTests.py 
b/repoman/pym/repoman/tests/runTests.py
index 1795aa487..ca37b14b3 100644
--- a/repoman/pym/repoman/tests/runTests.py
+++ b/repoman/pym/repoman/tests/runTests.py
@@ -17,7 +17,7 @@ def debug_signal(signum, frame):
pdb.set_trace()
 
 if platform.python_implementation() == 'Jython':
-   debug_signum = signal.SIGUSR2 # bug #424259
+   debug_signum = signal.SIGUSR2  # bug #424259
 else:
debug_signum = signal.SIGUSR1
 



[gentoo-commits] proj/portage:master commit in: repoman/pym/repoman/tests/simple/, repoman/pym/repoman/, ...

2018-02-27 Thread Michał Górny
commit: 59117bcb1793a6e99b8693eabb18cc891c12f962
Author: Michał Górny  gentoo  org>
AuthorDate: Fri Feb  2 22:50:06 2018 +
Commit: Michał Górny  gentoo  org>
CommitDate: Tue Feb 27 19:06:30 2018 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=59117bcb

repoman: Add commit message verification

Add a check for common mistakes in commit messages. For now, it is
pretty rough and works only for -m/-F. It will be extended to work
in the interactive mode in the future.

Reviewed-by: Brian Dolbec  gentoo.org>

 repoman/pym/repoman/actions.py |  74 +-
 repoman/pym/repoman/tests/commit/__init__.py   |   2 +
 repoman/pym/repoman/tests/commit/__test__.py   |   1 +
 repoman/pym/repoman/tests/commit/test_commitmsg.py | 109 +
 repoman/pym/repoman/tests/simple/test_simple.py|   8 +-
 5 files changed, 189 insertions(+), 5 deletions(-)

diff --git a/repoman/pym/repoman/actions.py b/repoman/pym/repoman/actions.py
index b76a6e466..57b528312 100644
--- a/repoman/pym/repoman/actions.py
+++ b/repoman/pym/repoman/actions.py
@@ -119,7 +119,16 @@ class Actions(object):
if commitmessage[:9].lower() in ("cat/pkg: ",):
commitmessage = self.msg_prefix() + 
commitmessage[9:]
 
-   if not commitmessage or not commitmessage.strip():
+   if commitmessage is not None and commitmessage.strip():
+   res, expl = self.verify_commit_message(commitmessage)
+   if not res:
+   print(bad("RepoMan does not like your commit 
message:"))
+   print(expl)
+   if self.options.force:
+   print('(but proceeding due to --force)')
+   else:
+   sys.exit(1)
+   else:
commitmessage = self.get_new_commit_message(qa_output)
 
commitmessage = commitmessage.rstrip()
@@ -585,3 +594,66 @@ class Actions(object):
print("* no commit message?  aborting commit.")
sys.exit(1)
return commitmessage
+
+   @staticmethod
+   def verify_commit_message(msg):
+   """
+   Check whether the message roughly complies with GLEP66. Returns
+   (True, None) if it does, (False, ) if it does not.
+   """
+
+   problems = []
+   paras = msg.strip().split('\n\n')
+   summary = paras.pop(0)
+
+   if ':' not in summary:
+   problems.append('summary line must start with a logical 
unit name, e.g. "cat/pkg:"')
+   if '\n' in summary.strip():
+   problems.append('commit message must start with a 
*single* line of summary, followed by empty line')
+   # accept 69 overall or unit+50, in case of very long package 
names
+   elif len(summary.strip()) > 69 and len(summary.split(':', 
1)[-1]) > 50:
+   problems.append('summary line is too long (max 69 
characters)')
+
+   multiple_footers = False
+   gentoo_bug_used = False
+   bug_closes_without_url = False
+   body_too_long = False
+
+   footer_re = re.compile(r'^[\w-]+:')
+
+   found_footer = False
+   for p in paras:
+   lines = p.splitlines()
+   # if all lines look like footer material, we assume 
it's footer
+   # else, we assume it's body text
+   if all(footer_re.match(l) for l in lines if l.strip()):
+   # multiple footer-like blocks?
+   if found_footer:
+   multiple_footers = True
+   found_footer = True
+   for l in lines:
+   if l.startswith('Gentoo-Bug'):
+   gentoo_bug_used = True
+   elif l.startswith('Bug:') or 
l.startswith('Closes:'):
+   if 'http://' not in l and 
'https://' not in l:
+   bug_closes_without_url 
= True
+   else:
+   for l in lines:
+   # we recommend wrapping at 72 but 
accept up to 80;
+   # do not complain if we have single 
word (usually
+   # it means very long URL)
+   if len(l.strip()) > 80 and 
len(l.split()) > 1:
+   body_too_long = True
+
+ 

[gentoo-commits] proj/portage:master commit in: repoman/pym/repoman/tests/simple/

2017-11-14 Thread Zac Medico
commit: 167eda54ae504583dab534522a691aa229c68532
Author: Zac Medico  gentoo  org>
AuthorDate: Tue Nov 14 21:27:35 2017 +
Commit: Zac Medico  gentoo  org>
CommitDate: Tue Nov 14 21:31:09 2017 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=167eda54

SimpleRepomanTestCase: remove broken PYTHONPATH setting (bug 637460)

Since PORTAGE_PYM_PATH typically refers to the global site-packages
directory, using it to set PYTHONPATH is unhelpful. The code
involving .repoman_not_installed already overrides sys.path when
necessary.

Bug: https://bugs.gentoo.org/637460

 repoman/pym/repoman/tests/simple/test_simple.py | 15 ---
 1 file changed, 15 deletions(-)

diff --git a/repoman/pym/repoman/tests/simple/test_simple.py 
b/repoman/pym/repoman/tests/simple/test_simple.py
index 114656eac..a24e0d5a3 100644
--- a/repoman/pym/repoman/tests/simple/test_simple.py
+++ b/repoman/pym/repoman/tests/simple/test_simple.py
@@ -8,7 +8,6 @@ import time
 from repoman._portage import portage
 from portage import os
 from portage import _unicode_decode
-from portage.const import PORTAGE_BASE_PATH, PORTAGE_PYM_PATH
 from portage.process import find_binary
 from portage.tests.resolver.ResolverPlayground import ResolverPlayground
 from portage.util import ensure_dirs
@@ -204,19 +203,6 @@ class SimpleRepomanTestCase(TestCase):
("dev-libs/A", repoman_cmd + ("commit", "-m", "bump to 
version 4")),
)
 
-   pythonpath =  os.environ.get("PYTHONPATH")
-   if pythonpath is not None and not pythonpath.strip():
-   pythonpath = None
-   if pythonpath is not None and \
-   pythonpath.split(":")[0] == PORTAGE_PYM_PATH:
-   pass
-   else:
-   if pythonpath is None:
-   pythonpath = ""
-   else:
-   pythonpath = ":" + pythonpath
-   pythonpath = PORTAGE_PYM_PATH + pythonpath
-
env = {
"PORTAGE_OVERRIDE_EPREFIX" : eprefix,
"DISTDIR" : distdir,
@@ -228,7 +214,6 @@ class SimpleRepomanTestCase(TestCase):
"PORTAGE_USERNAME" : os.environ["PORTAGE_USERNAME"],
"PORTAGE_REPOSITORIES" : 
settings.repositories.config_string(),
"PYTHONDONTWRITEBYTECODE" : 
os.environ.get("PYTHONDONTWRITEBYTECODE", ""),
-   "PYTHONPATH" : pythonpath,
}
 
if os.environ.get("SANDBOX_ON") == "1":



[gentoo-commits] proj/portage:master commit in: repoman/pym/repoman/tests/changelog/, pym/portage/tests/sets/, ...

2017-01-28 Thread Zac Medico
commit: c8152407f610fa431c8fa38f2d076cd675f8964a
Author: Zac Medico  gentoo  org>
AuthorDate: Sat Jan 28 19:46:03 2017 +
Commit: Zac Medico  gentoo  org>
CommitDate: Sat Jan 28 20:55:22 2017 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=c8152407

tests: add missing __test__.py files

The missing pym/portage/tests/sync/__test__.py file is the
reason that travis did not trigger the TypeError that was
fixed in commit 23f239134b0290cbe0435e13d8f1b1757c6d8524.

 pym/portage/tests/sets/__test__.py  | 0
 pym/portage/tests/sync/__test__.py  | 0
 repoman/pym/repoman/tests/changelog/__test__.py | 0
 3 files changed, 0 insertions(+), 0 deletions(-)

diff --git a/pym/portage/tests/sets/__test__.py 
b/pym/portage/tests/sets/__test__.py
new file mode 100644
index 000..e69de29

diff --git a/pym/portage/tests/sync/__test__.py 
b/pym/portage/tests/sync/__test__.py
new file mode 100644
index 000..e69de29

diff --git a/repoman/pym/repoman/tests/changelog/__test__.py 
b/repoman/pym/repoman/tests/changelog/__test__.py
new file mode 100644
index 000..e69de29