diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:22:09 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:22:09 +0000 |
commit | 43a97878ce14b72f0981164f87f2e35e14151312 (patch) | |
tree | 620249daf56c0258faa40cbdcf9cfba06de2a846 /build/vs/generate_yaml.py | |
parent | Initial commit. (diff) | |
download | firefox-upstream.tar.xz firefox-upstream.zip |
Adding upstream version 110.0.1.upstream/110.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rwxr-xr-x | build/vs/generate_yaml.py | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/build/vs/generate_yaml.py b/build/vs/generate_yaml.py new file mode 100755 index 0000000000..2d6a429d3e --- /dev/null +++ b/build/vs/generate_yaml.py @@ -0,0 +1,55 @@ +#!/usr/bin/env python3 +# 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 sys + +import yaml +from vsdownload import ( + getArgsParser, + getManifest, + getPackages, + getSelectedPackages, + lowercaseIgnores, + setPackageSelection, +) + +if __name__ == "__main__": + parser = getArgsParser() + parser.add_argument("-o", dest="output", required=True, help="Output file") + args = parser.parse_args() + lowercaseIgnores(args) + + packages = getPackages(getManifest(args)) + setPackageSelection(args, packages) + selected = getSelectedPackages(packages, args) + reduced = [] + # Filter-out data we won't be using. + for s in selected: + type = s["type"] + if type == "Component" or type == "Workload" or type == "Group": + continue + if type == "Vsix" or s["id"].startswith(("Win10SDK", "Win11SDK")): + filtered = {k: v for k, v in s.items() if k in ("type", "id", "version")} + filtered["payloads"] = [ + { + k: v + for k, v in payload.items() + if k in ("fileName", "sha256", "size", "url") + } + for payload in s["payloads"] + if payload["fileName"].endswith((".cab", ".msi", ".vsix")) + ] + reduced.append(filtered) + with open(args.output, "w") as out: + print("# Generated with:", file=out) + print( + "# ./mach python --virtualenv build build/vs/generate_yaml.py \\", file=out + ) + for i, arg in enumerate(sys.argv[1:]): + if i < len(sys.argv) - 2: + print("# ", arg, "\\", file=out) + else: + print("# ", arg, file=out) + print(yaml.dump(reduced), file=out) |