diff options
author | Saul Wold <Saul.Wold@intel.com> | 2010-09-27 08:41:06 -0700 |
---|---|---|
committer | Saul Wold <Saul.Wold@intel.com> | 2010-09-27 08:59:16 -0700 |
commit | 055a7203595821bab051c144cc58e904c1a1df3a (patch) | |
tree | 2e4c226f95a14c4f770e0c1c0d28becf75b1ebec /meta/lib | |
parent | 7531480bbb558db46e1d973f5a638fb957a25ffa (diff) | |
download | poky-055a7203595821bab051c144cc58e904c1a1df3a.tar.gz |
distro_check.py: Added additional support for distro checking
Now tells which section a macth occurs (main vs contrib)
Keywords for Poky, OpenedHand, ...
Signed-off-by: Saul Wold <Saul.Wold@intel.com>
Diffstat (limited to 'meta/lib')
-rw-r--r-- | meta/lib/oe/distro_check.py | 124 |
1 files changed, 80 insertions, 44 deletions
diff --git a/meta/lib/oe/distro_check.py b/meta/lib/oe/distro_check.py index e2ecb27cdf..0d6f78befd 100644 --- a/meta/lib/oe/distro_check.py +++ b/meta/lib/oe/distro_check.py | |||
@@ -70,18 +70,41 @@ def clean_package_list(package_list): | |||
70 | return set.keys() | 70 | return set.keys() |
71 | 71 | ||
72 | 72 | ||
73 | def get_latest_released_meego_source_package_list(): | ||
74 | "Returns list of all the name os packages in the latest meego distro" | ||
75 | |||
76 | |||
77 | f = open("/tmp/Meego-1.0", "r") | ||
78 | package_names = [] | ||
79 | for line in f: | ||
80 | package_names.append(line[:-1] + ":" + "main") # Also strip the '\n' at the end | ||
81 | |||
82 | package_list=clean_package_list(package_names) | ||
83 | return "1.0", package_list | ||
84 | |||
85 | def get_source_package_list_from_url(url, section): | ||
86 | "Return a sectioned list of package names from a URL list" | ||
87 | |||
88 | bb.note("Reading %s: %s" % (url, section)) | ||
89 | links = get_links_from_url(url) | ||
90 | srpms = filter(is_src_rpm, links) | ||
91 | names_list = map(package_name_from_srpm, srpms) | ||
92 | |||
93 | new_pkgs = [] | ||
94 | for pkgs in names_list: | ||
95 | new_pkgs.append(pkgs + ":" + section) | ||
96 | |||
97 | return new_pkgs | ||
98 | |||
73 | def get_latest_released_fedora_source_package_list(): | 99 | def get_latest_released_fedora_source_package_list(): |
74 | "Returns list of all the name os packages in the latest fedora distro" | 100 | "Returns list of all the name os packages in the latest fedora distro" |
75 | latest = find_latest_numeric_release("http://download.fedora.redhat.com/pub/fedora/linux/releases/") | 101 | latest = find_latest_numeric_release("http://download.fedora.redhat.com/pub/fedora/linux/releases/") |
76 | 102 | ||
77 | url = "http://download.fedora.redhat.com/pub/fedora/linux/releases/%s/Fedora/source/SRPMS/" % latest | 103 | package_names = get_source_package_list_from_url("http://download.fedora.redhat.com/pub/fedora/linux/releases/%s/Fedora/source/SRPMS/" % latest, "main") |
78 | links = get_links_from_url(url) | ||
79 | url = "http://download.fedora.redhat.com/pub/fedora/linux/updates/%s/SRPMS/" % latest | ||
80 | links += get_links_from_url(url) | ||
81 | 104 | ||
82 | srpms = filter(is_src_rpm, links) | 105 | package_names += get_source_package_list_from_url("http://download.fedora.redhat.com/pub/fedora/linux/releases/%s/Everything/source/SPRMS/" % latest, "everything") |
106 | package_names += get_source_package_list_from_url("http://download.fedora.redhat.com/pub/fedora/linux/updates/%s/SRPMS/" % latest, "updates") | ||
83 | 107 | ||
84 | package_names = map(package_name_from_srpm, srpms) | ||
85 | package_list=clean_package_list(package_names) | 108 | package_list=clean_package_list(package_names) |
86 | 109 | ||
87 | return latest, package_list | 110 | return latest, package_list |
@@ -90,27 +113,19 @@ def get_latest_released_opensuse_source_package_list(): | |||
90 | "Returns list of all the name os packages in the latest opensuse distro" | 113 | "Returns list of all the name os packages in the latest opensuse distro" |
91 | latest = find_latest_numeric_release("http://download.opensuse.org/source/distribution/") | 114 | latest = find_latest_numeric_release("http://download.opensuse.org/source/distribution/") |
92 | 115 | ||
93 | url = "http://download.opensuse.org/source/distribution/%s/repo/oss/suse/src/" % latest | 116 | package_names = get_source_package_list_from_url("http://download.opensuse.org/source/distribution/%s/repo/oss/suse/src/" % latest, "main") |
94 | links = get_links_from_url(url) | 117 | package_names += get_source_package_list_from_url("http://download.opensuse.org/update/%s/rpm/src/" % latest, "updates") |
95 | url = "http://download.opensuse.org/update/%s/rpm/src/" % latest | ||
96 | links += get_links_from_url(url) | ||
97 | srpms = filter(is_src_rpm, links) | ||
98 | 118 | ||
99 | package_names = map(package_name_from_srpm, srpms) | ||
100 | package_list=clean_package_list(package_names) | 119 | package_list=clean_package_list(package_names) |
101 | return latest, package_list | 120 | return latest, package_list |
102 | 121 | ||
103 | def get_latest_released_mandriva_source_package_list(): | 122 | def get_latest_released_mandriva_source_package_list(): |
104 | "Returns list of all the name os packages in the latest mandriva distro" | 123 | "Returns list of all the name os packages in the latest mandriva distro" |
105 | latest = find_latest_numeric_release("http://distrib-coffee.ipsl.jussieu.fr/pub/linux/MandrivaLinux/official/") | 124 | latest = find_latest_numeric_release("http://distrib-coffee.ipsl.jussieu.fr/pub/linux/MandrivaLinux/official/") |
106 | url = "http://distrib-coffee.ipsl.jussieu.fr/pub/linux/MandrivaLinux/official/%s/SRPMS/main/release/" % latest | 125 | package_names = get_source_package_list_from_url("http://distrib-coffee.ipsl.jussieu.fr/pub/linux/MandrivaLinux/official/%s/SRPMS/main/release/" % latest, "main") |
107 | links = get_links_from_url(url) | 126 | package_names += get_source_package_list_from_url("http://distrib-coffee.ipsl.jussieu.fr/pub/linux/MandrivaLinux/official/%s/SRPMS/contrib/release/" % latest, "contrib") |
108 | url = "http://distrib-coffee.ipsl.jussieu.fr/pub/linux/MandrivaLinux/official/%s/SRPMS/main/updates/" % latest | 127 | package_names += get_source_package_list_from_url("http://distrib-coffee.ipsl.jussieu.fr/pub/linux/MandrivaLinux/official/%s/SRPMS/main/updates/" % latest, "updates") |
109 | links += get_links_from_url(url) | ||
110 | |||
111 | srpms = filter(is_src_rpm, links) | ||
112 | 128 | ||
113 | package_names = map(package_name_from_srpm, srpms) | ||
114 | package_list=clean_package_list(package_names) | 129 | package_list=clean_package_list(package_names) |
115 | return latest, package_list | 130 | return latest, package_list |
116 | 131 | ||
@@ -128,7 +143,7 @@ def find_latest_debian_release(url): | |||
128 | except: | 143 | except: |
129 | return "_NotFound_" | 144 | return "_NotFound_" |
130 | 145 | ||
131 | def get_debian_style_source_package_list(url): | 146 | def get_debian_style_source_package_list(url, section): |
132 | "Return the list of package-names stored in the debian style Sources.gz file" | 147 | "Return the list of package-names stored in the debian style Sources.gz file" |
133 | import urllib | 148 | import urllib |
134 | sock = urllib.urlopen(url) | 149 | sock = urllib.urlopen(url) |
@@ -139,23 +154,26 @@ def get_debian_style_source_package_list(url): | |||
139 | sock.close() | 154 | sock.close() |
140 | tmpfile.close() | 155 | tmpfile.close() |
141 | import gzip | 156 | import gzip |
157 | bb.note("Reading %s: %s" % (url, section)) | ||
142 | 158 | ||
143 | f = gzip.open(tmpfilename) | 159 | f = gzip.open(tmpfilename) |
144 | package_names = [] | 160 | package_names = [] |
145 | for line in f: | 161 | for line in f: |
146 | if line[:9] == "Package: ": | 162 | if line[:9] == "Package: ": |
147 | package_names.append(line[9:-1]) # Also strip the '\n' at the end | 163 | package_names.append(line[9:-1] + ":" + section) # Also strip the '\n' at the end |
148 | os.unlink(tmpfilename) | 164 | os.unlink(tmpfilename) |
149 | 165 | ||
150 | return package_names | 166 | return package_names |
151 | 167 | ||
152 | def get_latest_released_debian_source_package_list(): | 168 | def get_latest_released_debian_source_package_list(): |
153 | "Returns list of all the name os packages in the latest debian distro" | 169 | "Returns list of all the name os packages in the latest debian distro" |
154 | latest = find_latest_debian_release("ftp://ftp.debian.org/debian/dists/") | 170 | latest = find_latest_debian_release("http://ftp.debian.org/debian/dists/") |
155 | url = "ftp://ftp.debian.org/debian/dists/stable/main/source/Sources.gz" | 171 | url = "http://ftp.debian.org/debian/dists/stable/main/source/Sources.gz" |
156 | package_names = get_debian_style_source_package_list(url) | 172 | package_names = get_debian_style_source_package_list(url, "main") |
157 | url = "ftp://ftp.debian.org/debian/dists/stable-proposed-updates/main/source/Sources.gz" | 173 | url = "http://ftp.debian.org/debian/dists/stable/contrib/source/Sources.gz" |
158 | package_names += get_debian_style_source_package_list(url) | 174 | package_names += get_debian_style_source_package_list(url, "contrib") |
175 | url = "http://ftp.debian.org/debian/dists/stable-proposed-updates/main/source/Sources.gz" | ||
176 | package_names += get_debian_style_source_package_list(url, "updates") | ||
159 | package_list=clean_package_list(package_names) | 177 | package_list=clean_package_list(package_names) |
160 | return latest, package_list | 178 | return latest, package_list |
161 | 179 | ||
@@ -171,9 +189,13 @@ def get_latest_released_ubuntu_source_package_list(): | |||
171 | "Returns list of all the name os packages in the latest ubuntu distro" | 189 | "Returns list of all the name os packages in the latest ubuntu distro" |
172 | latest = find_latest_ubuntu_release("http://archive.ubuntu.com/ubuntu/dists/") | 190 | latest = find_latest_ubuntu_release("http://archive.ubuntu.com/ubuntu/dists/") |
173 | url = "http://archive.ubuntu.com/ubuntu/dists/%s/main/source/Sources.gz" % latest | 191 | url = "http://archive.ubuntu.com/ubuntu/dists/%s/main/source/Sources.gz" % latest |
174 | package_names = get_debian_style_source_package_list(url) | 192 | package_names = get_debian_style_source_package_list(url, "main") |
193 | url = "http://archive.ubuntu.com/ubuntu/dists/%s/multiverse/source/Sources.gz" % latest | ||
194 | package_names += get_debian_style_source_package_list(url, "multiverse") | ||
195 | url = "http://archive.ubuntu.com/ubuntu/dists/%s/universe/source/Sources.gz" % latest | ||
196 | package_names += get_debian_style_source_package_list(url, "universe") | ||
175 | url = "http://archive.ubuntu.com/ubuntu/dists/%s-updates/main/source/Sources.gz" % latest | 197 | url = "http://archive.ubuntu.com/ubuntu/dists/%s-updates/main/source/Sources.gz" % latest |
176 | package_names += get_debian_style_source_package_list(url) | 198 | package_names += get_debian_style_source_package_list(url, "updates") |
177 | package_list=clean_package_list(package_names) | 199 | package_list=clean_package_list(package_names) |
178 | return latest, package_list | 200 | return latest, package_list |
179 | 201 | ||
@@ -185,11 +207,14 @@ def create_distro_packages_list(distro_check_dir): | |||
185 | for file in os.listdir(pkglst_dir): | 207 | for file in os.listdir(pkglst_dir): |
186 | os.unlink(os.path.join(pkglst_dir, file)) | 208 | os.unlink(os.path.join(pkglst_dir, file)) |
187 | 209 | ||
188 | per_distro_functions = [["Fedora", get_latest_released_fedora_source_package_list], | 210 | per_distro_functions = [ |
189 | ["OpenSuSE", get_latest_released_opensuse_source_package_list], | ||
190 | ["Ubuntu", get_latest_released_ubuntu_source_package_list], | ||
191 | ["Debian", get_latest_released_debian_source_package_list], | 211 | ["Debian", get_latest_released_debian_source_package_list], |
192 | ["Mandriva", get_latest_released_mandriva_source_package_list]] | 212 | ["Ubuntu", get_latest_released_ubuntu_source_package_list], |
213 | ["Fedora", get_latest_released_fedora_source_package_list], | ||
214 | ["OpenSuSE", get_latest_released_opensuse_source_package_list], | ||
215 | ["Mandriva", get_latest_released_mandriva_source_package_list], | ||
216 | ["Meego", get_latest_released_meego_source_package_list] | ||
217 | ] | ||
193 | 218 | ||
194 | from datetime import datetime | 219 | from datetime import datetime |
195 | begin = datetime.now() | 220 | begin = datetime.now() |
@@ -254,6 +279,8 @@ def compare_in_distro_packages_list(distro_check_dir, d): | |||
254 | recipe_name = bb.data.getVar('PN', d, True) | 279 | recipe_name = bb.data.getVar('PN', d, True) |
255 | bb.note("Checking: %s" % pn) | 280 | bb.note("Checking: %s" % pn) |
256 | 281 | ||
282 | trim_dict = dict({"-native":"-native", "-cross":"-cross", "-initial":"-initial"}) | ||
283 | |||
257 | if pn.find("-native") != -1: | 284 | if pn.find("-native") != -1: |
258 | pnstripped = pn.split("-native") | 285 | pnstripped = pn.split("-native") |
259 | bb.data.setVar('OVERRIDES', "pn-" + pnstripped[0] + ":" + bb.data.getVar('OVERRIDES', d, True), localdata) | 286 | bb.data.setVar('OVERRIDES', "pn-" + pnstripped[0] + ":" + bb.data.getVar('OVERRIDES', d, True), localdata) |
@@ -274,31 +301,42 @@ def compare_in_distro_packages_list(distro_check_dir, d): | |||
274 | 301 | ||
275 | bb.note("Recipe: %s" % recipe_name) | 302 | bb.note("Recipe: %s" % recipe_name) |
276 | tmp = bb.data.getVar('DISTRO_PN_ALIAS', localdata, True) | 303 | tmp = bb.data.getVar('DISTRO_PN_ALIAS', localdata, True) |
277 | if tmp == "Poky" or tmp == "OpenedHand" or tmp == "Intel" or tmp == "Upstream": | 304 | |
278 | matching_distros.append(tmp) | 305 | distro_exceptions = dict({"Poky":'Poky', "OpenedHand":'OpenedHand', "Intel":'Intel', "Upstream":'Upstream', "WindRiver":'Windriver'}) |
279 | tmp = None | 306 | |
307 | if tmp: | ||
308 | list = tmp.split(' ') | ||
309 | for str in list: | ||
310 | if str and str.find("=") == -1 and distro_exceptions[str]: | ||
311 | matching_distros.append(str) | ||
280 | 312 | ||
281 | distro_pn_aliases = {} | 313 | distro_pn_aliases = {} |
282 | if tmp: | 314 | if tmp: |
283 | list = tmp.split(' ') | 315 | list = tmp.split(' ') |
284 | for str in list: | 316 | for str in list: |
285 | (dist, pn_alias) = str.split('=') | 317 | if str.find("=") != -1: |
286 | distro_pn_aliases[dist.strip().lower()] = pn_alias.strip() | 318 | (dist, pn_alias) = str.split('=') |
319 | distro_pn_aliases[dist.strip().lower()] = pn_alias.strip() | ||
287 | 320 | ||
288 | for file in os.listdir(pkglst_dir): | 321 | for file in os.listdir(pkglst_dir): |
289 | (distro, distro_release) = file.split("-") | 322 | (distro, distro_release) = file.split("-") |
290 | f = open(os.path.join(pkglst_dir, file), "rb") | 323 | f = open(os.path.join(pkglst_dir, file), "rb") |
291 | for pkg in f: | 324 | for line in f: |
325 | (pkg, section) = line.split(":") | ||
292 | if distro.lower() in distro_pn_aliases: | 326 | if distro.lower() in distro_pn_aliases: |
293 | pn = distro_pn_aliases[distro.lower()] | 327 | pn = distro_pn_aliases[distro.lower()] |
294 | else: | 328 | else: |
295 | pn = recipe_name | 329 | pn = recipe_name |
296 | if pn == pkg[:-1]: # strip the \n at the end | 330 | if pn == pkg: |
297 | matching_distros.append(distro) | 331 | matching_distros.append(distro + "-" + section[:-1]) # strip the \n at the end |
298 | f.close() | 332 | f.close() |
299 | break | 333 | break |
300 | f.close() | 334 | f.close() |
301 | 335 | ||
336 | |||
337 | if tmp != None: | ||
338 | matching_distros.append(tmp) | ||
339 | |||
302 | bb.note("Matching: %s" % matching_distros) | 340 | bb.note("Matching: %s" % matching_distros) |
303 | return matching_distros | 341 | return matching_distros |
304 | 342 | ||
@@ -311,11 +349,9 @@ def save_distro_check_result(result, datetime, d): | |||
311 | if not os.path.isdir(logdir): | 349 | if not os.path.isdir(logdir): |
312 | os.makedirs(logdir) | 350 | os.makedirs(logdir) |
313 | result_file = os.path.join(logdir, "distrocheck.csv") | 351 | result_file = os.path.join(logdir, "distrocheck.csv") |
314 | line = pn + ", " | 352 | line = pn |
315 | for i in result: | 353 | for i in result: |
316 | line = line + i + ", " | 354 | line = line + "," + i |
317 | if result: | ||
318 | line = line[:-2] # Take out the comma at the end of line | ||
319 | if not os.path.exists(result_file): | 355 | if not os.path.exists(result_file): |
320 | open(result_file, 'w+b').close() # touch the file so that the next open won't fail | 356 | open(result_file, 'w+b').close() # touch the file so that the next open won't fail |
321 | f = open(result_file, "a+b") | 357 | f = open(result_file, "a+b") |