diff options
author | Mei Lei <lei.mei@intel.com> | 2011-05-16 19:06:21 +0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2011-05-17 15:14:44 +0100 |
commit | 60ab6fc60cba2ec2456125b618d23f98966468bd (patch) | |
tree | 0bf154f18a3d70cee186299734d88f4a7faadab9 /meta/lib/oe | |
parent | afe43ed09086ea1497c88e07c90bff9fecb59ce8 (diff) | |
download | poky-60ab6fc60cba2ec2456125b618d23f98966468bd.tar.gz |
Add a new task checklicense and fix some bugs in distro_check.py
distro_check.py: Create a new function called create_log_file to reduce a lot of repeat code in distrodata.bbclass.
We needn't to create log file in function save_distro_check_result, because the log file has been generated in check_eventhandler.
Another bug is that we maybe access the /tmp/Meego-1.0 before we create this file.
Add a judge statement to decide whether we need to create this file firstly.
distrodata.bbclass: Add a new task checklicense to collect missing text license information.
This can help package-report system to know how many recipes are missing license text.
(From OE-Core rev: b41148cda9f0cc292b662a8473f26bc1ee0148f3)
Signed-off-by: Mei Lei <lei.mei@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oe')
-rw-r--r-- | meta/lib/oe/distro_check.py | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/meta/lib/oe/distro_check.py b/meta/lib/oe/distro_check.py index c85d4fb28b..55cdcad461 100644 --- a/meta/lib/oe/distro_check.py +++ b/meta/lib/oe/distro_check.py | |||
@@ -73,7 +73,8 @@ def clean_package_list(package_list): | |||
73 | def get_latest_released_meego_source_package_list(): | 73 | def get_latest_released_meego_source_package_list(): |
74 | "Returns list of all the name os packages in the latest meego distro" | 74 | "Returns list of all the name os packages in the latest meego distro" |
75 | 75 | ||
76 | 76 | if not os.path.isfile("/tmp/Meego-1.0"): | |
77 | os.mknod("/tmp/Meego-1.0") | ||
77 | f = open("/tmp/Meego-1.0", "r") | 78 | f = open("/tmp/Meego-1.0", "r") |
78 | package_names = [] | 79 | package_names = [] |
79 | for line in f: | 80 | for line in f: |
@@ -341,7 +342,22 @@ def compare_in_distro_packages_list(distro_check_dir, d): | |||
341 | bb.note("Matching: %s" % matching_distros) | 342 | bb.note("Matching: %s" % matching_distros) |
342 | return matching_distros | 343 | return matching_distros |
343 | 344 | ||
344 | def save_distro_check_result(result, datetime, d): | 345 | def create_log_file(d, logname): |
346 | logpath = bb.data.getVar('LOG_DIR', d, True) | ||
347 | bb.utils.mkdirhier(logpath) | ||
348 | logfn, logsuffix = os.path.splitext(logname) | ||
349 | logfile = os.path.join(logpath, "%s.%s%s" % (logfn, bb.data.getVar('DATETIME', d, True), logsuffix)) | ||
350 | if not os.path.exists(logfile): | ||
351 | slogfile = os.path.join(logpath, logname) | ||
352 | if os.path.exists(slogfile): | ||
353 | os.remove(slogfile) | ||
354 | os.system("touch %s" % logfile) | ||
355 | os.symlink(logfile, slogfile) | ||
356 | bb.data.setVar('LOG_FILE', logfile, d) | ||
357 | return logfile | ||
358 | |||
359 | |||
360 | def save_distro_check_result(result, datetime, result_file, d): | ||
345 | pn = bb.data.getVar('PN', d, True) | 361 | pn = bb.data.getVar('PN', d, True) |
346 | logdir = bb.data.getVar('LOG_DIR', d, True) | 362 | logdir = bb.data.getVar('LOG_DIR', d, True) |
347 | if not logdir: | 363 | if not logdir: |
@@ -349,16 +365,9 @@ def save_distro_check_result(result, datetime, d): | |||
349 | return | 365 | return |
350 | if not os.path.isdir(logdir): | 366 | if not os.path.isdir(logdir): |
351 | os.makedirs(logdir) | 367 | os.makedirs(logdir) |
352 | result_file = os.path.join(logdir, "distrocheck.%s.csv" % datetime) | ||
353 | line = pn | 368 | line = pn |
354 | for i in result: | 369 | for i in result: |
355 | line = line + "," + i | 370 | line = line + "," + i |
356 | if not os.path.exists(result_file): | ||
357 | sresult_file = os.path.join(logdir, "distrocheck.csv") | ||
358 | if os.path.exists(sresult_file): | ||
359 | os.remove(sresult_file) | ||
360 | os.system("touch %s" % result_file) | ||
361 | os.symlink(result_file, sresult_file) | ||
362 | f = open(result_file, "a") | 371 | f = open(result_file, "a") |
363 | import fcntl | 372 | import fcntl |
364 | fcntl.lockf(f, fcntl.LOCK_EX) | 373 | fcntl.lockf(f, fcntl.LOCK_EX) |