Browse Source

add changes needed for self-hosted signed beta version

pull/2/head
Raymond Hill 7 years ago
parent
commit
702fbba914
No known key found for this signature in database GPG Key ID: 25E1490B761470C2
  1. 2
      .gitignore
  2. 14
      dist/firefox/updates.json
  3. 1
      dist/version
  4. 14
      platform/webext/updates.template.json
  5. 29
      tools/make-chromium-meta.py
  6. 20
      tools/make-webext-meta.py

2
.gitignore

@ -1 +1 @@
dist/
dist/build/

14
dist/firefox/updates.json

@ -0,0 +1,14 @@
{
"addons": {
"uMatrix@raymondhill.net": {
"updates": [
{
"version": "1.3.3b8",
"applications": { "gecko": { "strict_min_version": "56" } },
"update_info_url": "https://github.com/gorhill/uMatrix/releases/tag/1.3.3b8",
"update_link": "https://github.com/gorhill/uMatrix/releases/download/1.3.3b8/uBlock0.webext.signed.xpi"
}
]
}
}
}

1
dist/version

@ -0,0 +1 @@
1.3.3.8

14
platform/webext/updates.template.json

@ -0,0 +1,14 @@
{
"addons": {
"uMatrix@raymondhill.net": {
"updates": [
{
"version": "$version",
"applications": { "gecko": { "strict_min_version": "56" } },
"update_info_url": "https://github.com/gorhill/uMatrix/releases/tag/$version",
"update_link": "https://github.com/gorhill/uMatrix/releases/download/$version/uMatrix.webext.signed.xpi"
}
]
}
}
}

29
tools/make-chromium-meta.py

@ -9,24 +9,27 @@ if len(sys.argv) == 1 or not sys.argv[1]:
raise SystemExit('Build dir missing.')
proj_dir = os.path.join(os.path.split(os.path.abspath(__file__))[0], '..')
build_dir = os.path.abspath(sys.argv[1])
version = ''
with open(os.path.join(proj_dir, 'dist', 'version')) as f:
version = f.read().strip()
manifest_out = {}
manifest_out_file = os.path.join(build_dir, 'manifest.json')
with open(manifest_out_file) as f:
manifest_out = json.load(f)
manifest_in = {}
manifest_in_file = os.path.join(proj_dir, 'platform', 'chromium', 'manifest.json')
with open(manifest_in_file) as f1:
manifest_in = json.load(f1)
manifest_out['version'] = version
# Development build? If so, modify name accordingly.
match = re.search('^\d+\.\d+\.\d+\.\d+$', manifest_in['version'])
match = re.search('^\d+\.\d+\.\d+\.\d+$', version)
if match:
build_dir = os.path.abspath(sys.argv[1])
dev_build = ' dev build'
manifest_out = {}
manifest_out_file = os.path.join(build_dir, 'manifest.json')
with open(manifest_out_file) as f2:
manifest_out = json.load(f2)
manifest_out['name'] += dev_build
manifest_out['short_name'] += dev_build
manifest_out['browser_action']['default_title'] += dev_build
with open(manifest_out_file, 'w') as f2:
json.dump(manifest_out, f2, indent=2, separators=(',', ': '), sort_keys=True)
f2.write('\n')
with open(manifest_out_file, 'w') as f:
json.dump(manifest_out, f, indent=2, separators=(',', ': '), sort_keys=True)
f.write('\n')

20
tools/make-webext-meta.py

@ -11,20 +11,16 @@ if len(sys.argv) == 1 or not sys.argv[1]:
proj_dir = os.path.join(os.path.split(os.path.abspath(__file__))[0], '..')
build_dir = os.path.abspath(sys.argv[1])
# Import data from chromium platform
chromium_manifest = {}
webext_manifest = {}
chromium_manifest_file = os.path.join(proj_dir, 'platform', 'chromium', 'manifest.json')
with open(chromium_manifest_file) as f1:
chromium_manifest = json.load(f1)
version = ''
with open(os.path.join(proj_dir, 'dist', 'version')) as f:
version = f.read().strip()
# WebExtension
webext_manifest = {}
webext_manifest_file = os.path.join(build_dir, 'manifest.json')
with open(webext_manifest_file) as f2:
webext_manifest = json.load(f2)
with open(webext_manifest_file) as f:
webext_manifest = json.load(f)
match = re.search('^(\d+\.\d+\.\d+)(\.\d+)$', chromium_manifest['version'])
match = re.search('^(\d+\.\d+\.\d+)(\.\d+)$', version)
if match:
buildtype = int(match.group(2)[1:])
if buildtype < 100:
@ -33,7 +29,7 @@ if match:
builttype = 'rc' + str(buildtype - 100)
webext_manifest['version'] = match.group(1) + builttype
else:
webext_manifest['version'] = chromium_manifest['version']
webext_manifest['version'] = version
with open(webext_manifest_file, 'w') as f2:
json.dump(webext_manifest, f2, indent=2, separators=(',', ': '), sort_keys=True)

Loading…
Cancel
Save