File: 0024-Use-downloaded-static-file-for-reproducible-build.patch

package info (click to toggle)
calibre 6.13.0%2Brepack-2%2Bdeb12u5
  • links: PTS, VCS
  • area: main
  • in suites: bookworm-proposed-updates
  • size: 1,147,768 kB
  • sloc: python: 461,364; ansic: 80,698; cpp: 18,081; javascript: 2,855; xml: 1,297; sh: 892; sql: 683; objc: 544; makefile: 71; perl: 66; sed: 6
file content (52 lines) | stat: -rw-r--r-- 2,098 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
From: YOKOTA Hiroshi <yokota.hgml@gmail.com>
Date: Sun, 19 Feb 2023 12:46:58 +0900
Subject: Use downloaded static file for reproducible build

---
 setup/browser_data.py | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/setup/browser_data.py b/setup/browser_data.py
index b119620..25aa488 100644
--- a/setup/browser_data.py
+++ b/setup/browser_data.py
@@ -7,6 +7,7 @@ import os
 import sys
 from datetime import datetime
 from urllib.request import urlopen
+from pathlib import Path
 
 from setup import download_securely
 
@@ -23,7 +24,8 @@ def filter_ans(ans):
 
 def common_user_agents():
     print('Getting recent UAs...')
-    raw = download_from_calibre_server('https://code.calibre-ebook.com/ua-popularity')
+    p = Path.cwd() / "debian" / "resources-src" / "recent_uas" / "common_user_agents.bz2"
+    raw = download_from_calibre_server(p.as_uri())
     ans = {}
     for line in bz2.decompress(raw).decode('utf-8').splitlines():
         count, ua = line.partition(':')[::2]
@@ -37,8 +39,9 @@ def common_user_agents():
 def firefox_versions():
     print('Getting firefox versions...')
     import html5lib
+    p = Path.cwd() / "debian" / "resources-src" / "recent_uas" / "firefox_versions.html"
     raw = download_securely(
-        'https://www.mozilla.org/en-US/firefox/releases/').decode('utf-8')
+        p.as_uri()).decode('utf-8')
     root = html5lib.parse(raw, treebuilder='lxml', namespaceHTMLElements=False)
     ol = root.xpath('//main[@id="main-content"]/ol')[0]
     ol.xpath('descendant::li/strong/a[@href]')
@@ -51,8 +54,9 @@ def firefox_versions():
 def chrome_versions():
     print('Getting chrome versions...')
     import html5lib
+    p = Path.cwd() / "debian" / "resources-src" / "recent_uas" / "chrome_versions.html"
     raw = download_securely(
-        'https://en.wikipedia.org/wiki/Google_Chrome_version_history').decode('utf-8')
+        p.as_uri()).decode('utf-8')
     root = html5lib.parse(raw, treebuilder='lxml', namespaceHTMLElements=False)
     table = root.xpath('//*[@id="mw-content-text"]//tbody')[-1]
     ans = []