Gentoo Archives: gentoo-commits

From: Brian Dolbec <dolsen@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/portage:repoman commit in: pym/repoman/modules/vcs/, pym/repoman/, pym/repoman/modules/vcs/svn/, ...
Date: Mon, 07 Mar 2016 21:53:41
Message-Id: 1457385695.9fee4e53f308324cb556e9fec2f94a91d8e04662.dolsen@gentoo
1 commit: 9fee4e53f308324cb556e9fec2f94a91d8e04662
2 Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
3 AuthorDate: Sun Feb 7 18:32:59 2016 +0000
4 Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
5 CommitDate: Mon Mar 7 21:21:35 2016 +0000
6 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=9fee4e53
7
8 repoman: Migrate thick_manifest to the vcs Changes classes
9
10 pym/repoman/actions.py | 53 ++--------------------------------
11 pym/repoman/modules/vcs/changes.py | 5 ++++
12 pym/repoman/modules/vcs/cvs/changes.py | 19 ++++++++++++
13 pym/repoman/modules/vcs/svn/changes.py | 42 +++++++++++++++++++++++++++
14 4 files changed, 68 insertions(+), 51 deletions(-)
15
16 diff --git a/pym/repoman/actions.py b/pym/repoman/actions.py
17 index 15a0d04..20116db 100644
18 --- a/pym/repoman/actions.py
19 +++ b/pym/repoman/actions.py
20 @@ -131,7 +131,8 @@ class Actions(object):
21 print()
22 elif not self.repo_settings.repo_config.thin_manifest:
23 logging.debug("perform: Calling thick_manifest()")
24 - self.thick_manifest(myupdates, myheaders, no_expansion, expansion)
25 + self.vcs_settings.changes.thick_manifest(myupdates, myheaders,
26 + no_expansion, expansion)
27
28 logging.info("myupdates: %s", myupdates)
29 logging.info("myheaders: %s", myheaders)
30 @@ -570,56 +571,6 @@ class Actions(object):
31 pass
32
33
34 - def thick_manifest(self, myupdates, myheaders, no_expansion, expansion):
35 - if self.vcs_settings.vcs == 'cvs':
36 - headerstring = "'\$(Header|Id).*\$'"
37 - elif self.vcs_settings.vcs == "svn":
38 - svn_keywords = dict((k.lower(), k) for k in [
39 - "Rev",
40 - "Revision",
41 - "LastChangedRevision",
42 - "Date",
43 - "LastChangedDate",
44 - "Author",
45 - "LastChangedBy",
46 - "URL",
47 - "HeadURL",
48 - "Id",
49 - "Header",
50 - ])
51 -
52 - for myfile in myupdates:
53 -
54 - # for CVS, no_expansion contains files that are excluded from expansion
55 - if self.vcs_settings.vcs == "cvs":
56 - if myfile in no_expansion:
57 - continue
58 -
59 - # for SVN, expansion contains files that are included in expansion
60 - elif self.vcs_settings.vcs == "svn":
61 - if myfile not in expansion:
62 - continue
63 -
64 - # Subversion keywords are case-insensitive
65 - # in svn:keywords properties,
66 - # but case-sensitive in contents of files.
67 - enabled_keywords = []
68 - for k in expansion[myfile]:
69 - keyword = svn_keywords.get(k.lower())
70 - if keyword is not None:
71 - enabled_keywords.append(keyword)
72 -
73 - headerstring = "'\$(%s).*\$'" % "|".join(enabled_keywords)
74 -
75 - myout = repoman_getstatusoutput(
76 - "egrep -q %s %s" % (headerstring, portage._shell_quote(myfile)))
77 - if myout[0] == 0:
78 - myheaders.append(myfile)
79 -
80 - print("%s have headers that will change." % green(str(len(myheaders))))
81 - print(
82 - "* Files with headers will"
83 - " cause the manifests to be changed and committed separately.")
84
85
86 def clear_attic(self, myheaders):
87
88 diff --git a/pym/repoman/modules/vcs/changes.py b/pym/repoman/modules/vcs/changes.py
89 index 76ad591..77d7dc1 100644
90 --- a/pym/repoman/modules/vcs/changes.py
91 +++ b/pym/repoman/modules/vcs/changes.py
92 @@ -69,3 +69,8 @@ class ChangesBase(object):
93 def expansion(self):
94 '''Override this function as needed'''
95 return {}
96 +
97 + def thick_manifest(self, myupdates, myheaders, no_expansion, expansion):
98 + '''Create a thick manifest'''
99 + pass
100 +
101
102 diff --git a/pym/repoman/modules/vcs/cvs/changes.py b/pym/repoman/modules/vcs/cvs/changes.py
103 index 3ef91cc..6accd4a 100644
104 --- a/pym/repoman/modules/vcs/cvs/changes.py
105 +++ b/pym/repoman/modules/vcs/cvs/changes.py
106 @@ -41,3 +41,22 @@ class Changes(ChangesBase):
107 return self._unadded
108 self._unadded = portage.cvstree.findunadded(self._tree, recursive=1, basedir="./")
109 return self._unadded
110 + def thick_manifest(self, myupdates, myheaders, no_expansion, expansion):
111 + headerstring = "'\$(Header|Id).*\$'"
112 +
113 + for myfile in myupdates:
114 +
115 + # for CVS, no_expansion contains files that are excluded from expansion
116 + if myfile in no_expansion:
117 + continue
118 +
119 + myout = repoman_getstatusoutput(
120 + "egrep -q %s %s" % (headerstring, portage._shell_quote(myfile)))
121 + if myout[0] == 0:
122 + myheaders.append(myfile)
123 +
124 + print("%s have headers that will change." % green(str(len(myheaders))))
125 + print(
126 + "* Files with headers will"
127 + " cause the manifests to be changed and committed separately.")
128 +
129
130 diff --git a/pym/repoman/modules/vcs/svn/changes.py b/pym/repoman/modules/vcs/svn/changes.py
131 index 9a0efbf..6b25a21 100644
132 --- a/pym/repoman/modules/vcs/svn/changes.py
133 +++ b/pym/repoman/modules/vcs/svn/changes.py
134 @@ -64,3 +64,45 @@ class Changes(ChangesBase):
135 if elem.startswith("?") or elem.startswith("I")]
136 del svnstatus
137 return self._unadded
138 +
139 + def thick_manifest(self, myupdates, myheaders, no_expansion, expansion):
140 + svn_keywords = dict((k.lower(), k) for k in [
141 + "Rev",
142 + "Revision",
143 + "LastChangedRevision",
144 + "Date",
145 + "LastChangedDate",
146 + "Author",
147 + "LastChangedBy",
148 + "URL",
149 + "HeadURL",
150 + "Id",
151 + "Header",
152 + ])
153 +
154 + for myfile in myupdates:
155 + # for SVN, expansion contains files that are included in expansion
156 + if myfile not in expansion:
157 + continue
158 +
159 + # Subversion keywords are case-insensitive
160 + # in svn:keywords properties,
161 + # but case-sensitive in contents of files.
162 + enabled_keywords = []
163 + for k in expansion[myfile]:
164 + keyword = svn_keywords.get(k.lower())
165 + if keyword is not None:
166 + enabled_keywords.append(keyword)
167 +
168 + headerstring = "'\$(%s).*\$'" % "|".join(enabled_keywords)
169 +
170 + myout = repoman_getstatusoutput(
171 + "egrep -q %s %s" % (headerstring, portage._shell_quote(myfile)))
172 + if myout[0] == 0:
173 + myheaders.append(myfile)
174 +
175 + print("%s have headers that will change." % green(str(len(myheaders))))
176 + print(
177 + "* Files with headers will"
178 + " cause the manifests to be changed and committed separately.")
179 +