summaryrefslogtreecommitdiffstats
path: root/scripts/contrib/verify-homepage.py
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/contrib/verify-homepage.py')
-rwxr-xr-xscripts/contrib/verify-homepage.py66
1 files changed, 0 insertions, 66 deletions
diff --git a/scripts/contrib/verify-homepage.py b/scripts/contrib/verify-homepage.py
deleted file mode 100755
index a90b5010bc..0000000000
--- a/scripts/contrib/verify-homepage.py
+++ /dev/null
@@ -1,66 +0,0 @@
1#!/usr/bin/env python3
2#
3# Copyright OpenEmbedded Contributors
4#
5# SPDX-License-Identifier: GPL-2.0-only
6#
7# This script can be used to verify HOMEPAGE values for all recipes in
8# the current configuration.
9# The result is influenced by network environment, since the timeout of connect url is 5 seconds as default.
10
11import sys
12import os
13import subprocess
14import urllib.request
15
16
17# Allow importing scripts/lib modules
18scripts_path = os.path.abspath(os.path.dirname(os.path.realpath(__file__)) + '/..')
19lib_path = scripts_path + '/lib'
20sys.path = sys.path + [lib_path]
21import scriptpath
22import scriptutils
23
24# Allow importing bitbake modules
25bitbakepath = scriptpath.add_bitbake_lib_path()
26
27import bb.tinfoil
28
29logger = scriptutils.logger_create('verify_homepage')
30
31def wgetHomepage(pn, homepage):
32 result = subprocess.call('wget ' + '-q -T 5 -t 1 --spider ' + homepage, shell = True)
33 if result:
34 logger.warning("%s: failed to verify HOMEPAGE: %s " % (pn, homepage))
35 return 1
36 else:
37 return 0
38
39def verifyHomepage(bbhandler):
40 pkg_pn = bbhandler.cooker.recipecaches[''].pkg_pn
41 pnlist = sorted(pkg_pn)
42 count = 0
43 checked = []
44 for pn in pnlist:
45 for fn in pkg_pn[pn]:
46 # There's no point checking multiple BBCLASSEXTENDed variants of the same recipe
47 realfn, _, _ = bb.cache.virtualfn2realfn(fn)
48 if realfn in checked:
49 continue
50 data = bbhandler.parse_recipe_file(realfn)
51 homepage = data.getVar("HOMEPAGE")
52 if homepage:
53 try:
54 urllib.request.urlopen(homepage, timeout=5)
55 except Exception:
56 count = count + wgetHomepage(os.path.basename(realfn), homepage)
57 checked.append(realfn)
58 return count
59
60if __name__=='__main__':
61 with bb.tinfoil.Tinfoil() as bbhandler:
62 bbhandler.prepare()
63 logger.info("Start verifying HOMEPAGE:")
64 failcount = verifyHomepage(bbhandler)
65 logger.info("Finished verifying HOMEPAGE.")
66 logger.info("Summary: %s failed" % failcount)