summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--scripts/licensereview.html22
-rwxr-xr-xscripts/licensereview.py12
2 files changed, 21 insertions, 13 deletions
diff --git a/scripts/licensereview.html b/scripts/licensereview.html
index 740858d80c6..f3ab1a2b0ef 100644
--- a/scripts/licensereview.html
+++ b/scripts/licensereview.html
@@ -4,7 +4,7 @@
<!-- TODO format layer nicely -->
<title>License Review for {{layers|join(", ")}}</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bulma@0.9.1/css/bulma.min.css">
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bulma@0.9.3/css/bulma.min.css">
</head>
<body>
<section class="section">
@@ -22,12 +22,20 @@
{% for recipe, data in recipes|dictsort %}
<section class="section">
- <h2 class="title" id="recipe-{{recipe}}">{{recipe}}</h2>
- <p>This recipe claims to be covered by <q>{{data.license}}</q>.</p>
- {% for path,text in data.texts|dictsort %}
- <p id="license-{{recipe}}-{{path}}"><code>{{path}}</code></p>
- <pre>{{text}}</pre>
- {% endfor %}
+ <div class="content">
+ <h2 class="title" id="recipe-{{recipe}}">{{recipe}}</h2>
+ <p>This recipe claims to be covered by <q>{{data.license}}</q>.</p>
+ <ul>
+ {% for path,text in data.texts|dictsort %}
+ <li><a href="#license-{{recipe}}-{{path}}">{{path}}</a></li>
+ {% endfor %}
+ </ul>
+
+ {% for path,text in data.texts|dictsort %}
+ <p id="license-{{recipe}}-{{path}}"><code>{{path}}</code></p>
+ <pre>{{text}}</pre>
+ {% endfor %}
+ </div>
</section>
{% endfor %}
</body>
diff --git a/scripts/licensereview.py b/scripts/licensereview.py
index 4c1d6a3f908..2df42b2ae8d 100755
--- a/scripts/licensereview.py
+++ b/scripts/licensereview.py
@@ -86,9 +86,9 @@ if __name__ == "__main__":
# Thanks to join()s special behaviour with / in components, we can
# just do this to handle relative and absolute paths.
filename = os.path.join(sourcedir, path)
- # Line numbers are 1-based
- beginline = int(params.get("beginline", 1)) - 1
- endline = int(params.get("endline", 1)) - 1
+ # Line numbers are 1-indexed
+ beginline = int(params.get("beginline", 1))
+ endline = int(params.get("endline", 0))
hasher = hashlib.md5()
with open(filename, "rb") as f:
@@ -96,8 +96,8 @@ if __name__ == "__main__":
lines = f.readlines()
if not endline:
endline = len(lines)
- lines = lines[beginline:endline]
-
+ # Line offsets are 1-indexed
+ lines = lines[beginline-1:endline]
licensetext = []
for l in lines:
licensetext.append(l.decode("utf-8", errors="replace").rstrip())
@@ -110,7 +110,7 @@ if __name__ == "__main__":
real_md5 = hasher.hexdigest()
if real_md5 != params["md5"]:
- print(f"MD5 mismatch for {filename}", file=sys.stderr)
+ print(f"MD5 mismatch for {filename} (got {real_md5}, expected {params['md5']})", file=sys.stderr)
continue
recipe_context["texts"][path] = licensetext