1 |
On Thu, 16 Jan 2014 08:03:03 +0100 |
2 |
Sebastian Luther <SebastianLuther@×××.de> wrote: |
3 |
|
4 |
> Am 16.01.2014 01:07, schrieb Tom Wijsman: |
5 |
> > --- |
6 |
> > bin/repoman | 53 |
7 |
> > +++++++++++++++++++++++++++++++++++++++++++++++++++++ man/repoman.1 |
8 |
> > | 4 ++++ 2 files changed, 57 insertions(+) |
9 |
> > |
10 |
> > diff --git a/bin/repoman b/bin/repoman |
11 |
> > index d1542e9..9b703dc 100755 |
12 |
> > --- a/bin/repoman |
13 |
> > +++ b/bin/repoman |
14 |
> > @@ -36,6 +36,9 @@ pym_path = |
15 |
> > osp.join(osp.dirname(osp.dirname(osp.realpath(__file__))), "pym") |
16 |
> > sys.path.insert(0, pym_path) import portage |
17 |
> > portage._internal_caller = True |
18 |
> > + |
19 |
> > +from portage._sets.profiles import PackagesSystemSet |
20 |
> > +system_set_atoms = |
21 |
> > PackagesSystemSet(portage.settings.profiles).getAtoms() |
22 |
> > portage._disable_legacy_globals() |
23 |
> |
24 |
> You should be using repoman_settings instead of portage.settings. |
25 |
|
26 |
If I understand correctly, that is this URL? |
27 |
|
28 |
http://dev.gentoo.org/~zmedico/portage/doc/api/portage.repository.config-module.html |
29 |
|
30 |
How do I get the @system set out of that? |
31 |
|
32 |
> Considering the later use |
33 |
|
34 |
Which use? |
35 |
|
36 |
> you don't need PackagesSystemSet set here, |
37 |
> just use a set. |
38 |
|
39 |
Okay, thus I need to create some kind of set object here (I don't see |
40 |
one in the list of http://dev.gentoo.org/~zmedico/portage/doc/api/ |
41 |
though) and then specify that it would be the @system set? Which class? |
42 |
|
43 |
> And use atom.cp instead of the atoms. |
44 |
|
45 |
So, if I understood correctly; using list comprehension, I directly |
46 |
transform the getAtoms() to a list of atom.cp's... Okay, good idea. |
47 |
|
48 |
> > try: |
49 |
> > @@ -300,6 +303,7 @@ qahelp = { |
50 |
> > "inherit.missing": "Ebuild uses functions from an eclass |
51 |
> > but does not inherit it", "inherit.unused": "Ebuild inherits an |
52 |
> > eclass but does not use it", "java.eclassesnotused": "With |
53 |
> > virtual/jdk in DEPEND you must inherit a java eclass", |
54 |
> > + "unpack.DEPEND.missing": "A rare archive format was used |
55 |
> > in SRC_URI, but its package to unpack it is missing in DEPEND.", |
56 |
> > "wxwidgets.eclassnotused": "Ebuild DEPENDs on x11-libs/wxGTK |
57 |
> > without inheriting wxwidgets.eclass", "KEYWORDS.dropped": "Ebuilds |
58 |
> > that appear to have dropped KEYWORDS for some arch", |
59 |
> > "KEYWORDS.missing": "Ebuilds that have a missing or empty KEYWORDS |
60 |
> > variable", @@ -399,6 +403,7 @@ qawarnings = |
61 |
> > set(( "metadata.warning", "portage.internal", |
62 |
> > "repo.eapi.deprecated", +"unpack.DEPEND.missing", |
63 |
> > "usage.obsolete", |
64 |
> > "upstream.workaround", |
65 |
> > "LIVEVCS.stable", |
66 |
> > @@ -479,6 +484,25 @@ ruby_deprecated = frozenset([ |
67 |
> > "ruby_targets_ree18", |
68 |
> > ]) |
69 |
> > |
70 |
> > +# TODO: Add functionality to support checking for deb2targz on |
71 |
> > platforms where +# GNU binutils is absent; see PMS 5, section |
72 |
> > 11.3.3.13. +archive_formats = { |
73 |
> > + "\.7[zZ]":"app-arch/p7zip", |
74 |
> > + "\.(bz2?|tbz2)":"app-arch/bzip2", |
75 |
> > + "\.jar":"app-arch/unzip", |
76 |
> > + "\.(LH[aA]|lha|lzh)":"app-arch/lha", |
77 |
> > + "\.lzma":"app-arch/lzma-utils", |
78 |
> > + "\.(rar|RAR)":"app-arch/unrar", |
79 |
> > + "\.(tar(\.(bz2?|gz|Z))?|tbz2|t[bg]z)?":"app-arch/tar", |
80 |
> > + "\.(gz|tar\.Z|t[bg]z|[zZ])":"app-arch/gzip", |
81 |
> > + "\.(zip|ZIP)":"app-arch/unzip", |
82 |
> > +} |
83 |
> > + |
84 |
> > +archive_formats_eapi_3_to_5 = { |
85 |
> > + "\.tar.xz":"app-arch/tar", |
86 |
> > + "\.xz":"app-arch/xz-utils", |
87 |
> > +} |
88 |
> > + |
89 |
> > metadata_xml_encoding = 'UTF-8' |
90 |
> > metadata_xml_declaration = '<?xml version="1.0" encoding="%s"?>' % |
91 |
> > \ (metadata_xml_encoding,) |
92 |
> > @@ -1559,6 +1583,7 @@ for x in effective_scanlist: |
93 |
> > fetchlist_dict = portage.FetchlistDict(checkdir, |
94 |
> > repoman_settings, portdb) myfiles_all = [] |
95 |
> > src_uri_error = False |
96 |
> > + needed_unpack_depends = {} |
97 |
> > for mykey in fetchlist_dict: |
98 |
> > try: |
99 |
> > myfiles_all.extend(fetchlist_dict[mykey]) |
100 |
> > @@ -1573,7 +1598,22 @@ for x in effective_scanlist: |
101 |
> > stats["SRC_URI.syntax"] += 1 |
102 |
> > fails["SRC_URI.syntax"].append( |
103 |
> > "%s.ebuild SRC_URI: %s" % |
104 |
> > (mykey, e)) + |
105 |
> > + # Compare each SRC_URI entry against |
106 |
> > archive_formats; if one of the |
107 |
> > + # extensions match, we remember which archive |
108 |
> > depends are needed to |
109 |
> > + # check them later on. |
110 |
> > + needed_unpack_depends[mykey] = [] |
111 |
> > + for file_extension in archive_formats or \ |
112 |
> > + ((re.match('[345]$', eapi) is not None) \ |
113 |
> |
114 |
> Use portage.eapi for the line above. |
115 |
|
116 |
Why? 'eapi' is the EAPI of the ebuild, what is wrong with that? |
117 |
|
118 |
> You may have to add a new function to portage.eapi. |
119 |
|
120 |
What would the purpose of that function be? |
121 |
|
122 |
> > + and file_extension in |
123 |
> > archive_formats_eapi_3_to_5): |
124 |
> > + for entry in fetchlist_dict[mykey]: |
125 |
> > + if re.match('.*%s$' % |
126 |
> > file_extension, entry) is not None: |
127 |
> > + format = |
128 |
> > archive_formats[file_extension] |
129 |
> |
130 |
> As these regex are used frequently, they should be compiled using |
131 |
> re.compile. |
132 |
|
133 |
I know, but it contains %s; but, I'll look if I can make a list of |
134 |
regex, one for each file extension. Or rather, I'll first try to instead |
135 |
match the last characters of the string using a substring without |
136 |
having to create a regex at all, which should be even faster. |
137 |
|
138 |
> > + if format not in |
139 |
> > needed_unpack_depends[mykey]: |
140 |
> > + |
141 |
> > needed_unpack_depends[mykey].append(format) |
142 |
> |
143 |
> I'd make needed_unpack_depends[mykey] a set. Then you can just add() |
144 |
> instead of checking and appending. |
145 |
|
146 |
Thanks for the suggestion, I'll look into this. |
147 |
|
148 |
> > del fetchlist_dict |
149 |
> > + |
150 |
> > if not src_uri_error: |
151 |
> > # This test can produce false positives if SRC_URI |
152 |
> > could not # be parsed for one or more ebuilds. There's no point in |
153 |
> > @@ -2010,6 +2050,17 @@ for x in effective_scanlist: |
154 |
> > atoms = None |
155 |
> > badsyntax.append(str(e)) |
156 |
> > |
157 |
> > + if atoms and mytype == 'DEPEND': |
158 |
> |
159 |
> Use "if atoms and buildtime:" here. |
160 |
|
161 |
+1 |
162 |
|
163 |
> > + # We check whether the needed |
164 |
> > archive dependencies are present |
165 |
> > + # in DEPEND, which were determined |
166 |
> > from SRC_URI. |
167 |
> > + for entry in |
168 |
> > needed_unpack_depends[catdir + '/' + y]: |
169 |
> |
170 |
> Use the existing catpkg here. |
171 |
|
172 |
Missed that, thank you. |
173 |
|
174 |
> > + if entry not in |
175 |
> > system_set_atoms and entry \ |
176 |
> > + not in [atom.cp |
177 |
> > for atom in atoms if atom != "||"]: |
178 |
> > + stats['unpack.' + |
179 |
> > mytype + '.missing'] += 1 |
180 |
> > + fails['unpack.' + |
181 |
> > mytype + '.missing'].append( \ |
182 |
> > + |
183 |
> > relative_path + ": %s is missing in %s" % \ |
184 |
> > + (entry, |
185 |
> > mytype)) + |
186 |
> > if atoms and mytype.endswith("DEPEND"): |
187 |
> > if runtime and \ |
188 |
> > "test?" in |
189 |
> > mydepstr.split(): @@ -2384,6 +2435,8 @@ for x in effective_scanlist: |
190 |
> > "%s/metadata.xml: unused local |
191 |
> > USE-description: '%s'" % \ (x, myflag)) |
192 |
> > |
193 |
> > + del needed_unpack_depends |
194 |
> > + |
195 |
> > if options.if_modified == "y" and len(effective_scanlist) < 1: |
196 |
> > logging.warn("--if-modified is enabled, but no modified |
197 |
> > packages were found!") |
198 |
> > diff --git a/man/repoman.1 b/man/repoman.1 |
199 |
> > index a78f94e..e739d56 100644 |
200 |
> > --- a/man/repoman.1 |
201 |
> > +++ b/man/repoman.1 |
202 |
> > @@ -334,6 +334,10 @@ Ebuild inherits a deprecated eclass |
203 |
> > With virtual/jdk in DEPEND you must inherit a java eclass. Refer to |
204 |
> > \fIhttp://www.gentoo.org/proj/en/java/java\-devel.xml\fR for more |
205 |
> > information. .TP |
206 |
> > +.B unpack.DEPEND.missing |
207 |
> > +A rare archive format was used in SRC_URI, but its package to |
208 |
> > unpack it is |
209 |
> ^^^ |
210 |
> the(?) |
211 |
|
212 |
Unsure myself as well, but yes; the is the safe option here. |
213 |
|
214 |
> > +missing in DEPEND. |
215 |
> ^^ |
216 |
> from(?) |
217 |
|
218 |
Yes, 'in action' or 'from something'; thus 'from'. Thanks. |
219 |
|
220 |
> > +TP |
221 |
> > .B manifest.bad |
222 |
> > Manifest has missing or incorrect digests |
223 |
> > .TP |
224 |
> > |
225 |
> |
226 |
> Maybe you could remove the entries from the archive_formats variable |
227 |
> once you know if they are in the system set. |
228 |
|
229 |
The purpose here is to allow to support changes in the system set; when |
230 |
something is added or present in the system set, it doesn't necessarily |
231 |
imply that it will stay. Keeping them listed foresees that a format |
232 |
could become deprecated or less used in the future. |
233 |
|
234 |
-- |
235 |
With kind regards, |
236 |
|
237 |
Tom Wijsman (TomWij) |
238 |
Gentoo Developer |
239 |
|
240 |
E-mail address : TomWij@g.o |
241 |
GPG Public Key : 6D34E57D |
242 |
GPG Fingerprint : C165 AF18 AB4C 400B C3D2 ABF0 95B2 1FCD 6D34 E57D |