diff options
| author | dd <dd@wx.tnyzeq.icu> | 2025-04-15 06:18:28 +0200 |
|---|---|---|
| committer | dd <dd@wx.tnyzeq.icu> | 2025-04-15 06:18:28 +0200 |
| commit | 2c3db635a837dc15a5aabde2a02685477ae2c804 (patch) | |
| tree | d4422926d6319a9b8031381e43d55118ba639a20 | |
| parent | ab48893ef5e3504adcc572afdc18437d2c146fbd (diff) | |
| download | vyos-jenkins-2c3db635a837dc15a5aabde2a02685477ae2c804.tar.gz vyos-jenkins-2c3db635a837dc15a5aabde2a02685477ae2c804.zip | |
circinus: fixed too eager github link replacement where incorrectly all links were blindly rewritten leading to broken links
| -rw-r--r-- | new/lib/helpers.py | 8 | ||||
| -rwxr-xr-x | new/package_builder.py | 2 |
2 files changed, 7 insertions, 3 deletions
diff --git a/new/lib/helpers.py b/new/lib/helpers.py index 87bc7e9..7adab63 100644 --- a/new/lib/helpers.py +++ b/new/lib/helpers.py @@ -198,8 +198,12 @@ def refuse_root(): exit(1) -def replace_github_repo_org(git_url, new_org): - return re.sub(r"github\.com/[^/]+", "github.com/%s" % new_org, git_url) +def replace_github_repo_org(git_url, new_org, carefully_only_this_org=None): + if carefully_only_this_org is not None: + pattern = r"github\.com/%s" % re.escape(carefully_only_this_org) + else: + pattern = r"github\.com/[^/]+" + return re.sub(pattern, "github.com/%s" % new_org, git_url) def create_missing_package_exception(package): diff --git a/new/package_builder.py b/new/package_builder.py index a8eef9e..bfea0ef 100755 --- a/new/package_builder.py +++ b/new/package_builder.py @@ -236,7 +236,7 @@ class PackageBuilder: if "packages" in payload: for package in payload["packages"]: if "scm_url" in package: - scm_url = replace_github_repo_org(package["scm_url"], self.clone_org) + scm_url = replace_github_repo_org(package["scm_url"], self.clone_org, carefully_only_this_org="vyos") if scm_url != package["scm_url"]: changed = True logging.info("Updating package.toml GIT url from %s to %s" % (package["scm_url"], scm_url)) |
