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 = []
