1 |
Am 16.01.2014 01:07, schrieb Tom Wijsman: |
2 |
> --- |
3 |
> bin/repoman | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ |
4 |
> man/repoman.1 | 4 ++++ |
5 |
> 2 files changed, 57 insertions(+) |
6 |
> |
7 |
> diff --git a/bin/repoman b/bin/repoman |
8 |
> index d1542e9..9b703dc 100755 |
9 |
> --- a/bin/repoman |
10 |
> +++ b/bin/repoman |
11 |
> @@ -36,6 +36,9 @@ pym_path = osp.join(osp.dirname(osp.dirname(osp.realpath(__file__))), "pym") |
12 |
> sys.path.insert(0, pym_path) |
13 |
> import portage |
14 |
> portage._internal_caller = True |
15 |
> + |
16 |
> +from portage._sets.profiles import PackagesSystemSet |
17 |
> +system_set_atoms = PackagesSystemSet(portage.settings.profiles).getAtoms() |
18 |
> portage._disable_legacy_globals() |
19 |
> |
20 |
|
21 |
You should be using repoman_settings instead of portage.settings. |
22 |
|
23 |
Considering the later use, you don't need PackagesSystemSet set here, |
24 |
just use a set. And use atom.cp instead of the atoms. |
25 |
|
26 |
> try: |
27 |
> @@ -300,6 +303,7 @@ qahelp = { |
28 |
> "inherit.missing": "Ebuild uses functions from an eclass but does not inherit it", |
29 |
> "inherit.unused": "Ebuild inherits an eclass but does not use it", |
30 |
> "java.eclassesnotused": "With virtual/jdk in DEPEND you must inherit a java eclass", |
31 |
> + "unpack.DEPEND.missing": "A rare archive format was used in SRC_URI, but its package to unpack it is missing in DEPEND.", |
32 |
> "wxwidgets.eclassnotused": "Ebuild DEPENDs on x11-libs/wxGTK without inheriting wxwidgets.eclass", |
33 |
> "KEYWORDS.dropped": "Ebuilds that appear to have dropped KEYWORDS for some arch", |
34 |
> "KEYWORDS.missing": "Ebuilds that have a missing or empty KEYWORDS variable", |
35 |
> @@ -399,6 +403,7 @@ qawarnings = set(( |
36 |
> "metadata.warning", |
37 |
> "portage.internal", |
38 |
> "repo.eapi.deprecated", |
39 |
> +"unpack.DEPEND.missing", |
40 |
> "usage.obsolete", |
41 |
> "upstream.workaround", |
42 |
> "LIVEVCS.stable", |
43 |
> @@ -479,6 +484,25 @@ ruby_deprecated = frozenset([ |
44 |
> "ruby_targets_ree18", |
45 |
> ]) |
46 |
> |
47 |
> +# TODO: Add functionality to support checking for deb2targz on platforms where |
48 |
> +# GNU binutils is absent; see PMS 5, section 11.3.3.13. |
49 |
> +archive_formats = { |
50 |
> + "\.7[zZ]":"app-arch/p7zip", |
51 |
> + "\.(bz2?|tbz2)":"app-arch/bzip2", |
52 |
> + "\.jar":"app-arch/unzip", |
53 |
> + "\.(LH[aA]|lha|lzh)":"app-arch/lha", |
54 |
> + "\.lzma":"app-arch/lzma-utils", |
55 |
> + "\.(rar|RAR)":"app-arch/unrar", |
56 |
> + "\.(tar(\.(bz2?|gz|Z))?|tbz2|t[bg]z)?":"app-arch/tar", |
57 |
> + "\.(gz|tar\.Z|t[bg]z|[zZ])":"app-arch/gzip", |
58 |
> + "\.(zip|ZIP)":"app-arch/unzip", |
59 |
> +} |
60 |
> + |
61 |
> +archive_formats_eapi_3_to_5 = { |
62 |
> + "\.tar.xz":"app-arch/tar", |
63 |
> + "\.xz":"app-arch/xz-utils", |
64 |
> +} |
65 |
> + |
66 |
> metadata_xml_encoding = 'UTF-8' |
67 |
> metadata_xml_declaration = '<?xml version="1.0" encoding="%s"?>' % \ |
68 |
> (metadata_xml_encoding,) |
69 |
> @@ -1559,6 +1583,7 @@ for x in effective_scanlist: |
70 |
> fetchlist_dict = portage.FetchlistDict(checkdir, repoman_settings, portdb) |
71 |
> myfiles_all = [] |
72 |
> src_uri_error = False |
73 |
> + needed_unpack_depends = {} |
74 |
> for mykey in fetchlist_dict: |
75 |
> try: |
76 |
> myfiles_all.extend(fetchlist_dict[mykey]) |
77 |
> @@ -1573,7 +1598,22 @@ for x in effective_scanlist: |
78 |
> stats["SRC_URI.syntax"] += 1 |
79 |
> fails["SRC_URI.syntax"].append( |
80 |
> "%s.ebuild SRC_URI: %s" % (mykey, e)) |
81 |
> + |
82 |
> + # Compare each SRC_URI entry against archive_formats; if one of the |
83 |
> + # extensions match, we remember which archive depends are needed to |
84 |
> + # check them later on. |
85 |
> + needed_unpack_depends[mykey] = [] |
86 |
> + for file_extension in archive_formats or \ |
87 |
> + ((re.match('[345]$', eapi) is not None) \ |
88 |
|
89 |
Use portage.eapi for the line above. You may have to add a new function |
90 |
to portage.eapi. |
91 |
|
92 |
> + and file_extension in archive_formats_eapi_3_to_5): |
93 |
> + for entry in fetchlist_dict[mykey]: |
94 |
> + if re.match('.*%s$' % file_extension, entry) is not None: |
95 |
> + format = archive_formats[file_extension] |
96 |
|
97 |
As these regex are used frequently, they should be compiled using |
98 |
re.compile. |
99 |
|
100 |
> + |
101 |
> + if format not in needed_unpack_depends[mykey]: |
102 |
> + needed_unpack_depends[mykey].append(format) |
103 |
|
104 |
I'd make needed_unpack_depends[mykey] a set. Then you can just add() |
105 |
instead of checking and appending. |
106 |
|
107 |
> del fetchlist_dict |
108 |
> + |
109 |
> if not src_uri_error: |
110 |
> # This test can produce false positives if SRC_URI could not |
111 |
> # be parsed for one or more ebuilds. There's no point in |
112 |
> @@ -2010,6 +2050,17 @@ for x in effective_scanlist: |
113 |
> atoms = None |
114 |
> badsyntax.append(str(e)) |
115 |
> |
116 |
> + if atoms and mytype == 'DEPEND': |
117 |
|
118 |
Use "if atoms and buildtime:" here. |
119 |
|
120 |
> + # We check whether the needed archive dependencies are present |
121 |
> + # in DEPEND, which were determined from SRC_URI. |
122 |
> + for entry in needed_unpack_depends[catdir + '/' + y]: |
123 |
|
124 |
Use the existing catpkg here. |
125 |
|
126 |
> + if entry not in system_set_atoms and entry \ |
127 |
> + not in [atom.cp for atom in atoms if atom != "||"]: |
128 |
> + stats['unpack.' + mytype + '.missing'] += 1 |
129 |
> + fails['unpack.' + mytype + '.missing'].append( \ |
130 |
> + relative_path + ": %s is missing in %s" % \ |
131 |
> + (entry, mytype)) |
132 |
> + |
133 |
> if atoms and mytype.endswith("DEPEND"): |
134 |
> if runtime and \ |
135 |
> "test?" in mydepstr.split(): |
136 |
> @@ -2384,6 +2435,8 @@ for x in effective_scanlist: |
137 |
> "%s/metadata.xml: unused local USE-description: '%s'" % \ |
138 |
> (x, myflag)) |
139 |
> |
140 |
> + del needed_unpack_depends |
141 |
> + |
142 |
> if options.if_modified == "y" and len(effective_scanlist) < 1: |
143 |
> logging.warn("--if-modified is enabled, but no modified packages were found!") |
144 |
> |
145 |
> diff --git a/man/repoman.1 b/man/repoman.1 |
146 |
> index a78f94e..e739d56 100644 |
147 |
> --- a/man/repoman.1 |
148 |
> +++ b/man/repoman.1 |
149 |
> @@ -334,6 +334,10 @@ Ebuild inherits a deprecated eclass |
150 |
> With virtual/jdk in DEPEND you must inherit a java eclass. Refer to |
151 |
> \fIhttp://www.gentoo.org/proj/en/java/java\-devel.xml\fR for more information. |
152 |
> .TP |
153 |
> +.B unpack.DEPEND.missing |
154 |
> +A rare archive format was used in SRC_URI, but its package to unpack it is |
155 |
^^^ |
156 |
the(?) |
157 |
> +missing in DEPEND. |
158 |
^^ |
159 |
from(?) |
160 |
> +TP |
161 |
> .B manifest.bad |
162 |
> Manifest has missing or incorrect digests |
163 |
> .TP |
164 |
> |
165 |
|
166 |
|
167 |
Maybe you could remove the entries from the archive_formats variable |
168 |
once you know if they are in the system set. |