diff options
author | Patrick Williams <patrick@stwcx.xyz> | 2016-08-17 14:31:25 -0500 |
---|---|---|
committer | Patrick Williams <patrick@stwcx.xyz> | 2016-08-22 16:43:26 +0000 |
commit | 60f9d69e016b11c468c98ea75ba0a60c44afbbc4 (patch) | |
tree | ecb49581a9e41a37943c22cd9ef3f63451b20ee7 /import-layers/yocto-poky/scripts/contrib/verify-homepage.py | |
parent | e18c61205e0234b03697129c20cc69c9b3940efc (diff) | |
download | blackbird-openbmc-60f9d69e016b11c468c98ea75ba0a60c44afbbc4.tar.gz blackbird-openbmc-60f9d69e016b11c468c98ea75ba0a60c44afbbc4.zip |
yocto-poky: Move to import-layers subdir
We are going to import additional layers, so create a subdir to
hold all of the layers that we import with git-subtree.
Change-Id: I6f732153a22be8ca663035c518837e3cc5ec0799
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Diffstat (limited to 'import-layers/yocto-poky/scripts/contrib/verify-homepage.py')
-rwxr-xr-x | import-layers/yocto-poky/scripts/contrib/verify-homepage.py | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/import-layers/yocto-poky/scripts/contrib/verify-homepage.py b/import-layers/yocto-poky/scripts/contrib/verify-homepage.py new file mode 100755 index 000000000..265ff65d3 --- /dev/null +++ b/import-layers/yocto-poky/scripts/contrib/verify-homepage.py @@ -0,0 +1,62 @@ +#!/usr/bin/env python + +# This script can be used to verify HOMEPAGE values for all recipes in +# the current configuration. +# The result is influenced by network environment, since the timeout of connect url is 5 seconds as default. + +import sys +import os +import subprocess +import urllib2 + + +# Allow importing scripts/lib modules +scripts_path = os.path.abspath(os.path.dirname(os.path.realpath(__file__)) + '/..') +lib_path = scripts_path + '/lib' +sys.path = sys.path + [lib_path] +import scriptpath +import scriptutils + +# Allow importing bitbake modules +bitbakepath = scriptpath.add_bitbake_lib_path() + +import bb.tinfoil + +logger = scriptutils.logger_create('verify_homepage') + +def wgetHomepage(pn, homepage): + result = subprocess.call('wget ' + '-q -T 5 -t 1 --spider ' + homepage, shell = True) + if result: + logger.warn("%s: failed to verify HOMEPAGE: %s " % (pn, homepage)) + return 1 + else: + return 0 + +def verifyHomepage(bbhandler): + pkg_pn = bbhandler.cooker.recipecache.pkg_pn + pnlist = sorted(pkg_pn) + count = 0 + checked = [] + for pn in pnlist: + for fn in pkg_pn[pn]: + # There's no point checking multiple BBCLASSEXTENDed variants of the same recipe + realfn, _ = bb.cache.Cache.virtualfn2realfn(fn) + if realfn in checked: + continue + data = bb.cache.Cache.loadDataFull(realfn, bbhandler.cooker.collection.get_file_appends(realfn), bbhandler.config_data) + homepage = data.getVar("HOMEPAGE", True) + if homepage: + try: + urllib2.urlopen(homepage, timeout=5) + except Exception: + count = count + wgetHomepage(os.path.basename(realfn), homepage) + checked.append(realfn) + return count + +if __name__=='__main__': + bbhandler = bb.tinfoil.Tinfoil() + bbhandler.prepare() + logger.info("Start verifying HOMEPAGE:") + failcount = verifyHomepage(bbhandler) + logger.info("Finished verifying HOMEPAGE.") + logger.info("Summary: %s failed" % failcount) |