# This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/.
import argparse import hashlib import re from datetime import datetime from urllib.parse import urlparse from xml.etree import ElementTree
import requests
def check_hash(plugin, url, valid_urls): if url in valid_urls: return
valid_urls[url] = True
plugin_urls = []
tree = ElementTree.fromstring(response.content) for plugin in tree.findall("./addons/addon"): ifnot"id"in plugin.attrib: continue if plugin.attrib["id"] != plugin_id: continue if"URL"in plugin.attrib: if checkHash:
check_hash(plugin, plugin.attrib["URL"], valid_urls)
plugin_urls.append(plugin.attrib["URL"]) for mirror in plugin.findall("./mirror"): if"URL"in mirror.attrib: if checkHash:
check_hash(plugin, plugin.attrib["URL"], valid_urls)
plugin_urls.append(mirror.attrib["URL"])
results[channel][target] = plugin_urls
matching_channels = {} for channel in channels:
matching_channels[channel] = [channel] for other_channel in channels: if (
channel == other_channel or channel notin results or other_channel notin results
): continue if results[channel] == results[other_channel]:
matching_channels[channel].append(other_channel) del results[other_channel]
for channel in results:
print(", ".join(matching_channels[channel])) for target in targets:
print("\t{}".format(target)) for url in results[channel][target]:
print("\t\t{}".format(url))
parser = argparse.ArgumentParser(
description="Check Balrog XML for GMP plugin updates",
epilog=examples,
formatter_class=argparse.RawDescriptionHelpFormatter,
)
parser.add_argument( "plugin",
help="which plugin: openh264, widevine, widevine_l1",
)
parser.add_argument("version", help="version of Firefox")
parser.add_argument( "--channel", action="extend", nargs="+", help="check specific channel(s)"
)
parser.add_argument( "--list-channels", action="store_true", help="list the supported channels"
)
parser.add_argument( "--target", action="extend", nargs="+", help="check specific target(s)"
)
parser.add_argument( "--list-targets", action="store_true", help="list the supported targets"
)
parser.add_argument("--buildid", help="override generated build ID to be specific")
parser.add_argument( "--url", help="override base URL from which to fetch the balrog configuration"
)
parser.add_argument( "--staging",
action="store_true",
help="using the balrog staging URL instead of production",
)
parser.add_argument( "--checkHash",
action="store_true",
help="download plugins and validate the size/hash",
)
args = parser.parse_args()
valid_channels = ["esr", "release", "beta", "nightly", "nightlytest"] if args.list_channels: for channel in valid_channels:
print(channel) return if args.channel isnotNone: for channel in args.channel: if channel notin valid_channels:
parser.error("`%s` is invalid, see --list-channels" % channel) return
channels = args.channel else:
channels = valid_channels
valid_targets = [ "Darwin_aarch64-gcc3", "Darwin_x86_64-gcc3", "Linux_aarch64-gcc3", "Linux_x86-gcc3", "Linux_x86_64-gcc3", "WINNT_aarch64-msvc-aarch64", "WINNT_x86-msvc", "WINNT_x86_64-msvc",
]
valid_aliases = [ "Linux_x86_64-gcc3-asan", "WINNT_x86-msvc-x64", "WINNT_x86-msvc-x86", "WINNT_x86_64-msvc-x64", "WINNT_x86_64-msvc-x64-asan",
] if args.list_targets: for target in valid_targets:
print(target) for target in valid_aliases:
print("%s (alias)" % target) return if args.target isnotNone: for target in args.target: if target notin valid_targets and target notin valid_aliases:
parser.error("`%s` is invalid, see --list-targets" % target) return
targets = args.target else:
targets = valid_targets
if args.buildid isnotNone: ifnot re.match(r"^\d{14}$", args.buildid):
parser.error("`%s` is invalid, build id must be 14 digits") return
buildid = args.buildid
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.