[buildbot] phase2: add support for overriding feeds host

LEDE Commits lede-commits at lists.infradead.org
Tue Jan 13 00:01:38 PST 2026


ynezz pushed a commit to buildbot.git, branch main:
https://git.openwrt.org/f2c82f2232b2ebdf1e643b38b406e41923181a72

commit f2c82f2232b2ebdf1e643b38b406e41923181a72
Author: Petr Štetiar <ynezz at true.cz>
AuthorDate: Sun Jan 11 09:43:43 2026 +0100

    phase2: add support for overriding feeds host
    
    Port the feeds_host_override functionality from phase1 to phase2,
    allowing phase2 builds to use alternate feed hosts.
    
    Signed-off-by: Petr Štetiar <ynezz at true.cz>
---
 phase2/config.ini.example |  1 +
 phase2/master.cfg         | 32 ++++++++++++++++++++++++++++++++
 2 files changed, 33 insertions(+)

diff --git a/phase2/config.ini.example b/phase2/config.ini.example
index eda9763..fcb6f06 100644
--- a/phase2/config.ini.example
+++ b/phase2/config.ini.example
@@ -10,6 +10,7 @@ status_user = example
 status_password = example
 port = 9990
 persistent = false
+feeds_host_override =
 git_ssh = true
 git_ssh_key = -----BEGIN RSA PRIVATE KEY-----
 	MIIEpAIBAAKCAQEAuCJwo6OmrRDxcGfsMgBhq0vdzp2ZIdqnedFH8u6tVYLt9WDU
diff --git a/phase2/master.cfg b/phase2/master.cfg
index 0a5bd7e..939d688 100644
--- a/phase2/master.cfg
+++ b/phase2/master.cfg
@@ -136,6 +136,9 @@ repo_branch = "main"
 if ini.has_option("repo", "branch"):
 	repo_branch = ini.get("repo", "branch")
 
+if feeds_host_override:
+	repo_url = re.sub(r"git\.openwrt\.org/openwrt", feeds_host_override, repo_url)
+
 usign_key = None
 usign_comment = "untrusted comment: " + repo_branch.replace("-", " ").title() + " key"
 
@@ -153,6 +156,7 @@ archnames = [ ]
 if not os.path.isdir(work_dir+'/source.git'):
 	subprocess.call(["git", "clone", "--depth=1", "--branch="+repo_branch, repo_url, work_dir+'/source.git'])
 else:
+	subprocess.call(["git", "remote", "set-url", "origin", repo_url], cwd = work_dir+'/source.git')
 	subprocess.call(["git", "pull"], cwd = work_dir+'/source.git')
 
 os.makedirs(work_dir+'/source.git/tmp', exist_ok=True)
@@ -321,6 +325,13 @@ def IsSignEnabled(step):
 		IsUsignEnabled(step) or IsApkSigningEnabled(step) or IsGpgSigningEnabled(step)
 	)
 
+def IsFeedsHostOverrideEnabled(step):
+	return bool(feeds_host_override)
+
+ at util.renderer
+def GetFeedsHostOverride(props):
+	return feeds_host_override
+
 @defer.inlineCallbacks
 def getNewestCompleteTime(bldr):
 	"""Returns the complete_at of the latest completed and not SKIPPED
@@ -548,6 +559,18 @@ for arch in arches:
 		command = ["./ccache.sh"],
 		haltOnFailure = True))
 
+	factory.addStep(ShellCommand(
+		name = "feeds-override",
+		description = "Creating feeds.conf with host override",
+		descriptionDone = "feeds.conf with override created",
+		workdir = "build/sdk",
+		command = Interpolate(
+			"sed -E 's;git.openwrt.org/(feed|project);%(kw:host)s;' feeds.conf.default > feeds.conf",
+			host=GetFeedsHostOverride,
+		),
+		doStepIf = IsFeedsHostOverrideEnabled,
+		haltOnFailure = True))
+
 	factory.addStep(ShellCommand(
 		name = "updatefeeds",
 		description = "Updating feeds",
@@ -562,6 +585,15 @@ for arch in arches:
 		command = ["./scripts/feeds", "install", "-a"],
 		haltOnFailure = True))
 
+	factory.addStep(ShellCommand(
+		name = "feeds-cleanup",
+		description = "Removing feeds.conf override",
+		descriptionDone = "feeds.conf override removed",
+		workdir = "build/sdk",
+		command = ["rm", "-f", "feeds.conf"],
+		doStepIf = IsFeedsHostOverrideEnabled,
+		haltOnFailure = True))
+
 	factory.addStep(ShellCommand(
 		name = "logclear",
 		description = "Clearing failure logs",




More information about the lede-commits mailing list