diff options
-rwxr-xr-x | scripts/contrib/verify-homepage.py | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/scripts/contrib/verify-homepage.py b/scripts/contrib/verify-homepage.py index 3e7333959c..522824ba58 100755 --- a/scripts/contrib/verify-homepage.py +++ b/scripts/contrib/verify-homepage.py | |||
@@ -1,6 +1,7 @@ | |||
1 | #!/usr/bin/env python | 1 | #!/usr/bin/env python |
2 | 2 | ||
3 | # This script is used for verify HOMEPAGE. | 3 | # This script can be used to verify HOMEPAGE values for all recipes in |
4 | # the current configuration. | ||
4 | # The result is influenced by network environment, since the timeout of connect url is 5 seconds as default. | 5 | # The result is influenced by network environment, since the timeout of connect url is 5 seconds as default. |
5 | 6 | ||
6 | import sys | 7 | import sys |
@@ -14,16 +15,19 @@ scripts_path = os.path.abspath(os.path.dirname(os.path.realpath(__file__)) + '/. | |||
14 | lib_path = scripts_path + '/lib' | 15 | lib_path = scripts_path + '/lib' |
15 | sys.path = sys.path + [lib_path] | 16 | sys.path = sys.path + [lib_path] |
16 | import scriptpath | 17 | import scriptpath |
18 | import scriptutils | ||
17 | 19 | ||
18 | # Allow importing bitbake modules | 20 | # Allow importing bitbake modules |
19 | bitbakepath = scriptpath.add_bitbake_lib_path() | 21 | bitbakepath = scriptpath.add_bitbake_lib_path() |
20 | 22 | ||
21 | import bb.tinfoil | 23 | import bb.tinfoil |
22 | 24 | ||
25 | logger = scriptutils.logger_create('verify_homepage') | ||
26 | |||
23 | def wgetHomepage(pn, homepage): | 27 | def wgetHomepage(pn, homepage): |
24 | result = subprocess.call('wget ' + '-q -T 5 -t 1 --spider ' + homepage, shell = True) | 28 | result = subprocess.call('wget ' + '-q -T 5 -t 1 --spider ' + homepage, shell = True) |
25 | if result: | 29 | if result: |
26 | bb.warn("Failed to verify HOMEPAGE (%s) of %s" % (homepage, pn)) | 30 | logger.warn("%s: failed to verify HOMEPAGE: %s " % (pn, homepage)) |
27 | return 1 | 31 | return 1 |
28 | else: | 32 | else: |
29 | return 0 | 33 | return 0 |
@@ -44,10 +48,9 @@ def verifyHomepage(bbhandler): | |||
44 | return count | 48 | return count |
45 | 49 | ||
46 | if __name__=='__main__': | 50 | if __name__=='__main__': |
47 | failcount = 0 | ||
48 | bbhandler = bb.tinfoil.Tinfoil() | 51 | bbhandler = bb.tinfoil.Tinfoil() |
49 | bbhandler.prepare() | 52 | bbhandler.prepare() |
50 | print "Start to verify HOMEPAGE:" | 53 | logger.info("Start verifying HOMEPAGE:") |
51 | failcount = verifyHomepage(bbhandler) | 54 | failcount = verifyHomepage(bbhandler) |
52 | print "finish to verify HOMEPAGE." | 55 | logger.info("Finished verifying HOMEPAGE.") |
53 | print "Summary: %s failed" % failcount | 56 | logger.info("Summary: %s failed" % failcount) |