diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-07 05:48:48 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-07 05:48:48 +0000 |
commit | ef24de24a82fe681581cc130f342363c47c0969a (patch) | |
tree | 0d494f7e1a38b95c92426f58fe6eaa877303a86c /src/tools/cargo/ci | |
parent | Releasing progress-linux version 1.74.1+dfsg1-1~progress7.99u1. (diff) | |
download | rustc-ef24de24a82fe681581cc130f342363c47c0969a.tar.xz rustc-ef24de24a82fe681581cc130f342363c47c0969a.zip |
Merging upstream version 1.75.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/tools/cargo/ci')
-rw-r--r-- | src/tools/cargo/ci/generate.py | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/src/tools/cargo/ci/generate.py b/src/tools/cargo/ci/generate.py new file mode 100644 index 000000000..b750729dc --- /dev/null +++ b/src/tools/cargo/ci/generate.py @@ -0,0 +1,49 @@ +#!/usr/bin/env python3 + +MAPPING = { + "build-script.html": "https://doc.rust-lang.org/cargo/reference/build-scripts.html", + "config.html": None, + "crates-io.html": "https://doc.rust-lang.org/cargo/reference/publishing.html", + "environment-variables.html": None, + "external-tools.html": None, + "faq.html": "https://doc.rust-lang.org/cargo/faq.html", + "guide.html": "https://doc.rust-lang.org/cargo/guide/", + "index.html": "https://doc.rust-lang.org/cargo/", + "manifest.html": None, + "pkgid-spec.html": None, + "policies.html": "https://crates.io/policies", + "source-replacement.html": None, + "specifying-dependencies.html": None, +} + +TEMPLATE = """\ +<html> +<head> +<meta http-equiv="refresh" content="0; url={mapped}" /> +<script> +window.location.replace("{mapped}" + window.location.hash); +</script> +<title>Page Moved</title> +</head> +<body> +This page has moved. Click <a href="{mapped}">here</a> to go to the new page. +</body> +</html> +""" + +def main(): + for name in sorted(MAPPING): + with open(name, 'w') as f: + mapped = MAPPING[name] + if mapped is None: + mapped = "https://doc.rust-lang.org/cargo/reference/{}".format(name) + f.write(TEMPLATE.format(name=name, mapped=mapped)) + + # WARN: The CNAME file is for GitHub to redirect requests to the custom domain. + # Missing this may entail security hazard and domain takeover. + # See <https://docs.github.com/en/pages/configuring-a-custom-domain-for-your-github-pages-site/managing-a-custom-domain-for-your-github-pages-site#securing-your-custom-domain> + with open('CNAME', 'w') as f: + f.write('doc.crates.io') + +if __name__ == '__main__': + main() |