[gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/modules/vcs/, pym/repoman/modules/vcs/cvs/

2016-04-21 Thread Brian Dolbec
commit: f0a93aa3bd64e86854e26a3826410ed1b3ed61b1
Author: Brian Dolbec  gentoo  org>
AuthorDate: Sun Feb  7 18:46:27 2016 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Thu Apr 21 16:49:27 2016 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=f0a93aa3

repoman:  Move clear_attic() code to the modules

 pym/repoman/actions.py | 24 +---
 pym/repoman/modules/vcs/changes.py |  4 
 pym/repoman/modules/vcs/cvs/changes.py | 21 +
 3 files changed, 26 insertions(+), 23 deletions(-)

diff --git a/pym/repoman/actions.py b/pym/repoman/actions.py
index f477aec..8ff658c 100644
--- a/pym/repoman/actions.py
+++ b/pym/repoman/actions.py
@@ -153,7 +153,7 @@ class Actions(object):
# inside the $Header path. This code detects the problem and 
corrects it
# so that the Manifest will generate correctly. See bug #169500.
# Use binary mode in order to avoid potential character 
encoding issues.
-   self.clear_attic(myheaders)
+   self.vcs_settings.changes.clear_attic(myheaders)
 
if self.scanner.repolevel == 1:
utilities.repoman_sez(
@@ -582,28 +582,6 @@ class Actions(object):
pass
 
 
-
-
-   def clear_attic(self, myheaders):
-   cvs_header_re = re.compile(br'^#\s*\$Header.*\$$')
-   attic_str = b'/Attic/'
-   attic_replace = b'/'
-   for x in myheaders:
-   f = open(
-   _unicode_encode(x, encoding=_encodings['fs'], 
errors='strict'),
-   mode='rb')
-   mylines = f.readlines()
-   f.close()
-   modified = False
-   for i, line in enumerate(mylines):
-   if cvs_header_re.match(line) is not None and \
-   attic_str in line:
-   mylines[i] = line.replace(attic_str, 
attic_replace)
-   modified = True
-   if modified:
-   portage.util.write_atomic(x, b''.join(mylines), 
mode='wb')
-
-
def sign_manifest(self, myupdates, myremoved, mymanifests):
try:
for x in sorted(vcs_files_to_cps(

diff --git a/pym/repoman/modules/vcs/changes.py 
b/pym/repoman/modules/vcs/changes.py
index 77d7dc1..1745a65 100644
--- a/pym/repoman/modules/vcs/changes.py
+++ b/pym/repoman/modules/vcs/changes.py
@@ -74,3 +74,7 @@ class ChangesBase(object):
'''Create a thick manifest'''
pass
 
+   @staticmethod
+   def clear_attic(myheaders):
+   '''Old CVS leftover'''
+   pass

diff --git a/pym/repoman/modules/vcs/cvs/changes.py 
b/pym/repoman/modules/vcs/cvs/changes.py
index 6accd4a..061486f 100644
--- a/pym/repoman/modules/vcs/cvs/changes.py
+++ b/pym/repoman/modules/vcs/cvs/changes.py
@@ -41,6 +41,27 @@ class Changes(ChangesBase):
return self._unadded
self._unadded = portage.cvstree.findunadded(self._tree, 
recursive=1, basedir="./")
return self._unadded
+
+   @staticmethod
+   def clear_attic(myheaders):
+   cvs_header_re = re.compile(br'^#\s*\$Header.*\$$')
+   attic_str = b'/Attic/'
+   attic_replace = b'/'
+   for x in myheaders:
+   f = open(
+   _unicode_encode(x, encoding=_encodings['fs'], 
errors='strict'),
+   mode='rb')
+   mylines = f.readlines()
+   f.close()
+   modified = False
+   for i, line in enumerate(mylines):
+   if cvs_header_re.match(line) is not None and \
+   attic_str in line:
+   mylines[i] = line.replace(attic_str, 
attic_replace)
+   modified = True
+   if modified:
+   portage.util.write_atomic(x, b''.join(mylines), 
mode='wb')
+
def thick_manifest(self, myupdates, myheaders, no_expansion, expansion):
headerstring = "'\$(Header|Id).*\$'"
 



[gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/modules/vcs/, pym/repoman/modules/vcs/cvs/, ...

2016-04-21 Thread Brian Dolbec
commit: 542473fa98fd7ec29cec93a82a6da94cfb885d5a
Author: Brian Dolbec  gentoo  org>
AuthorDate: Sun Feb  7 18:32:59 2016 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Thu Apr 21 16:49:27 2016 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=542473fa

repoman: Migrate thick_manifest to the vcs Changes classes

 pym/repoman/actions.py | 53 ++
 pym/repoman/modules/vcs/changes.py |  5 
 pym/repoman/modules/vcs/cvs/changes.py | 19 
 pym/repoman/modules/vcs/svn/changes.py | 42 +++
 4 files changed, 68 insertions(+), 51 deletions(-)

diff --git a/pym/repoman/actions.py b/pym/repoman/actions.py
index 7a29635..f477aec 100644
--- a/pym/repoman/actions.py
+++ b/pym/repoman/actions.py
@@ -132,7 +132,8 @@ class Actions(object):
print()
elif not self.repo_settings.repo_config.thin_manifest:
logging.debug("perform: Calling thick_manifest()")
-   self.thick_manifest(myupdates, myheaders, no_expansion, 
expansion)
+   self.vcs_settings.changes.thick_manifest(myupdates, 
myheaders,
+   no_expansion, expansion)
 
logging.info("myupdates: %s", myupdates)
logging.info("myheaders: %s", myheaders)
@@ -581,56 +582,6 @@ class Actions(object):
pass
 
 
-   def thick_manifest(self, myupdates, myheaders, no_expansion, expansion):
-   if self.vcs_settings.vcs == 'cvs':
-   headerstring = "'\$(Header|Id).*\$'"
-   elif self.vcs_settings.vcs == "svn":
-   svn_keywords = dict((k.lower(), k) for k in [
-   "Rev",
-   "Revision",
-   "LastChangedRevision",
-   "Date",
-   "LastChangedDate",
-   "Author",
-   "LastChangedBy",
-   "URL",
-   "HeadURL",
-   "Id",
-   "Header",
-   ])
-
-   for myfile in myupdates:
-
-   # for CVS, no_expansion contains files that are 
excluded from expansion
-   if self.vcs_settings.vcs == "cvs":
-   if myfile in no_expansion:
-   continue
-
-   # for SVN, expansion contains files that are included 
in expansion
-   elif self.vcs_settings.vcs == "svn":
-   if myfile not in expansion:
-   continue
-
-   # Subversion keywords are case-insensitive
-   # in svn:keywords properties,
-   # but case-sensitive in contents of files.
-   enabled_keywords = []
-   for k in expansion[myfile]:
-   keyword = svn_keywords.get(k.lower())
-   if keyword is not None:
-   enabled_keywords.append(keyword)
-
-   headerstring = "'\$(%s).*\$'" % 
"|".join(enabled_keywords)
-
-   myout = repoman_getstatusoutput(
-   "egrep -q %s %s" % (headerstring, 
portage._shell_quote(myfile)))
-   if myout[0] == 0:
-   myheaders.append(myfile)
-
-   print("%s have headers that will change." % 
green(str(len(myheaders
-   print(
-   "* Files with headers will"
-   " cause the manifests to be changed and committed 
separately.")
 
 
def clear_attic(self, myheaders):

diff --git a/pym/repoman/modules/vcs/changes.py 
b/pym/repoman/modules/vcs/changes.py
index 76ad591..77d7dc1 100644
--- a/pym/repoman/modules/vcs/changes.py
+++ b/pym/repoman/modules/vcs/changes.py
@@ -69,3 +69,8 @@ class ChangesBase(object):
def expansion(self):
'''Override this function as needed'''
return {}
+
+   def thick_manifest(self, myupdates, myheaders, no_expansion, expansion):
+   '''Create a thick manifest'''
+   pass
+

diff --git a/pym/repoman/modules/vcs/cvs/changes.py 
b/pym/repoman/modules/vcs/cvs/changes.py
index 3ef91cc..6accd4a 100644
--- a/pym/repoman/modules/vcs/cvs/changes.py
+++ b/pym/repoman/modules/vcs/cvs/changes.py
@@ -41,3 +41,22 @@ class Changes(ChangesBase):
return self._unadded
self._unadded = portage.cvstree.findunadded(self._tree, 
recursive=1, basedir="./")