aboutsummaryrefslogtreecommitdiff
path: root/rust_tools/rust_uprev.py
diff options
context:
space:
mode:
authorBob Haarman <inglorion@chromium.org>2022-04-19 11:41:38 -0700
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-07-28 23:04:44 +0000
commitf1c66c20439fd3465b3033289300a93f2cfc228e (patch)
tree538f24a698576d03ee27cbe96e60b069b232ba9e /rust_tools/rust_uprev.py
parent14668ed47d28f2541792809231cfd08598c12f0c (diff)
downloadtoolchain-utils-f1c66c20439fd3465b3033289300a93f2cfc228e.tar.gz
rust_uprev: Remove flip_mirror_in_ebuild
Previously, we temporarily switched on RESTRICT="mirror" for an ebuild before updating the manifest. This allows us to fetch distfiles from their original locations (rather than the default, which is to require them to be fetched from mirrors). We don't actually need this, so this change removes the code that does this. BUG=None TEST=unit tests, also tested on rust-1.60.0 uprev Change-Id: I5f29ffad83a5826dbe523db4657d9ea17c43bcff Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/3594132 Commit-Queue: Bob Haarman <inglorion@chromium.org> Reviewed-by: George Burgess <gbiv@chromium.org> Tested-by: Bob Haarman <inglorion@chromium.org>
Diffstat (limited to 'rust_tools/rust_uprev.py')
-rwxr-xr-xrust_tools/rust_uprev.py25
1 files changed, 0 insertions, 25 deletions
diff --git a/rust_tools/rust_uprev.py b/rust_tools/rust_uprev.py
index 49df7172..7e170443 100755
--- a/rust_tools/rust_uprev.py
+++ b/rust_tools/rust_uprev.py
@@ -360,27 +360,6 @@ def update_ebuild(ebuild_file: str,
new_bootstrap_version)
-def flip_mirror_in_ebuild(ebuild_file: Path, add: bool) -> None:
- restrict_re = re.compile(
- r'(?P<before>RESTRICT=")(?P<values>"[^"]*"|.*)(?P<after>")')
- with open(ebuild_file, encoding='utf-8') as f:
- contents = f.read()
- m = restrict_re.search(contents)
- assert m, 'failed to find RESTRICT variable in Rust ebuild'
- values = m.group('values')
- if add:
- if 'mirror' in values:
- return
- values += ' mirror'
- else:
- if 'mirror' not in values:
- return
- values = values.replace(' mirror', '')
- new_contents = restrict_re.sub(r'\g<before>%s\g<after>' % values, contents)
- with open(ebuild_file, 'w', encoding='utf-8') as f:
- f.write(new_contents)
-
-
def ebuild_actions(package: str,
actions: List[str],
sudo: bool = False) -> None:
@@ -482,11 +461,7 @@ def get_distdir() -> os.PathLike:
def update_manifest(ebuild_file: os.PathLike) -> None:
"""Updates the MANIFEST for the ebuild at the given path."""
ebuild = Path(ebuild_file)
- logging.info('Added "mirror" to RESTRICT to %s', ebuild.name)
- flip_mirror_in_ebuild(ebuild, add=True)
ebuild_actions(ebuild.parent.name, ['manifest'])
- logging.info('Removed "mirror" to RESTRICT from %s', ebuild.name)
- flip_mirror_in_ebuild(ebuild, add=False)
def update_rust_packages(rust_version: RustVersion, add: bool) -> None: