build-unit-test-docker: escape topic queries
Gerrit topics can contain spaces[1]. We need to escape those so
that the http request can be done successfully.
[1]: https://gerrit.openbmc.org/c/openbmc/entity-manager/+/83520
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I934a012497eb4e33ee606f133f2f705b8e5fcd10
diff --git a/scripts/build-unit-test-docker b/scripts/build-unit-test-docker
index a1e0312..db248fe 100755
--- a/scripts/build-unit-test-docker
+++ b/scripts/build-unit-test-docker
@@ -471,10 +471,13 @@
if gerrit_project == self.package and gerrit_rev:
return False
+ # URL escape any spaces. Gerrit uses pluses.
+ gerrit_topic_escape = urllib.parse.quote_plus(gerrit_topic)
+
try:
commits = json.loads(
urllib.request.urlopen(
- f"https://gerrit.openbmc.org/changes/?q=status:open+project:{self.package}+topic:{gerrit_topic}"
+ f'https://gerrit.openbmc.org/changes/?q=status:open+project:{self.package}+topic:"{gerrit_topic_escape}"'
)
.read()
.splitlines()[-1]