roll_util: Remove normalize_remote()
This method is now in git_roll_util.
Bug: b/359925419
Change-Id: Ib214cc314ad30f086f5da04d0abbb1ad1ebadefc
Reviewed-on: https://pigweed-review.googlesource.com/c/infra/recipes/+/234255
Lint: Lint 🤖 <android-build-ayeaye@system.gserviceaccount.com>
Pigweed-Auto-Submit: Rob Mohr <mohrr@google.com>
Reviewed-by: Danielle Kay <danikay@google.com>
Commit-Queue: Auto-Submit <auto-submit@pigweed-service-accounts.iam.gserviceaccount.com>
diff --git a/recipe_modules/roll_util/api.py b/recipe_modules/roll_util/api.py
index 964bfb0..4f2d512 100644
--- a/recipe_modules/roll_util/api.py
+++ b/recipe_modules/roll_util/api.py
@@ -626,36 +626,6 @@
pres.links[old_revision] = f'{remote}/+/{old_revision}'
pres.links[new_revision] = f'{remote}/+/{new_revision}'
- def normalize_remote(self, remote: str, base: str) -> str:
- """Convert relative paths to absolute paths.
-
- Support relative paths. If the top-level project is
- "https://pigweed.googlesource.com/ex/ample" then a submodule path of
- "./abc" maps to "https://pigweed.googlesource.com/ex/ample/abc" and
- "../abc" maps to "https://pigweed.googlesource.com/ex/abc". Minimal
- error-checking because git does most of these checks for us.
-
- Also converts sso to https.
-
- Args:
- remote (str): Submodule remote URL.
- base (str): Fully-qualified superproject remote URL.
- """
- if remote.startswith('.'):
- remote = '/'.join((base.rstrip('/'), remote.lstrip('/')))
-
- changes = 1
- while changes:
- changes = 0
-
- remote, n = re.subn(r'/\./', '/', remote)
- changes += n
-
- remote, n = re.subn(r'/[^/]+/\.\./', '/', remote)
- changes += n
-
- return self.m.sso.sso_to_https(remote)
-
def merge_auto_roller_overrides(
self,
auto_roller_options: AutoRollerOptions,
diff --git a/recipe_modules/roll_util/tests/labels.py b/recipe_modules/roll_util/tests/labels.py
index 672c51a..6600ceb 100644
--- a/recipe_modules/roll_util/tests/labels.py
+++ b/recipe_modules/roll_util/tests/labels.py
@@ -36,10 +36,6 @@
pres.step_summary_text = repr(api.roll_util.labels_to_wait_on)
assert api.roll_util.test_api.format_prefix('foo') == 'foo.'
- assert (
- api.roll_util.normalize_remote('../foo', 'sso://host/bar')
- == 'https://host.googlesource.com/foo'
- )
def GenTests(api) -> Generator[recipe_test_api.TestData, None, None]:
diff --git a/recipe_modules/submodule_roll/api.py b/recipe_modules/submodule_roll/api.py
index 9d6aa85..7a0c7db 100644
--- a/recipe_modules/submodule_roll/api.py
+++ b/recipe_modules/submodule_roll/api.py
@@ -26,6 +26,7 @@
if TYPE_CHECKING: # pragma: no cover
from typing import Generator
from recipe_engine import config_types
+ from RECIPE_MODULES.fuchsia.git_roll_util import api as git_roll_util_api
from RECIPE_MODULES.pigweed.checkout import api as checkout_api
from RECIPE_MODULES.pigweed.roll_util import api as roll_util_api
@@ -99,7 +100,7 @@
self,
checkout: checkout_api.CheckoutContext,
submodule_entry: SubmoduleEntry,
- ) -> roll_util_api.Roll:
+ ) -> git_roll_util_api.Roll:
gitmodules = self.read_gitmodules(checkout.root / '.gitmodules')
submodule = Submodule(
@@ -129,7 +130,7 @@
except configparser.NoOptionError:
submodule.branch = 'main'
- submodule.remote = self.m.roll_util.normalize_remote(
+ submodule.remote = self.m.git_roll_util.normalize_remote(
gitmodules.get(section, 'url'),
checkout.options.remote,
)