[Libreoffice-commits] dev-tools.git: gerrit/auto-submit
Guilhem Moulin (via logerrit)
logerrit at kemper.freedesktop.org
Tue Feb 18 08:07:54 UTC 2020
gerrit/auto-submit/gerrit-autosubmit | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
New commits:
commit 9552c9de868e43650cc5a3f0d8e1f312c6c52ea6
Author: Guilhem Moulin <guilhem at libreoffice.org>
AuthorDate: Tue Feb 18 03:14:06 2020 +0100
Commit: Miklos Vajna <vmiklos at collabora.com>
CommitDate: Tue Feb 18 09:07:36 2020 +0100
gerrit-autosubmit: port to python3, replace os.system call
Change-Id: I847b4e3ed79cc8a448ee91bbc6d8f7d1b40fdd69
Reviewed-on: https://gerrit.libreoffice.org/c/dev-tools/+/88912
Tested-by: Miklos Vajna <vmiklos at collabora.com>
Reviewed-by: Miklos Vajna <vmiklos at collabora.com>
diff --git a/gerrit/auto-submit/gerrit-autosubmit b/gerrit/auto-submit/gerrit-autosubmit
index fdc998e..2d40e23 100755
--- a/gerrit/auto-submit/gerrit-autosubmit
+++ b/gerrit/auto-submit/gerrit-autosubmit
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python3
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -15,14 +15,15 @@ def get_config(key):
sock = subprocess.Popen(["git", "config", "-f", ".gitreview", key], stdout=subprocess.PIPE)
ret = sock.stdout.readline().strip()
sock.stdout.close()
- return ret
+ return ret.decode("utf-8")
server = get_config("gerrit.host")
project = get_config("gerrit.project")
branch = get_config("gerrit.defaultbranch")
while True:
- sock = subprocess.Popen(["ssh", "-o", "ServerAliveInterval=5", server, "gerrit", "stream-events"], stdout=subprocess.PIPE, bufsize=1)
+ cmd = ["ssh", "-o", "ServerAliveInterval=5", server, "gerrit", "stream-events"]
+ sock = subprocess.Popen(cmd, stdout=subprocess.PIPE, bufsize=1)
try:
for line in iter(sock.stdout.readline, b''):
@@ -44,9 +45,9 @@ while True:
continue
rev = event['patchSet']['revision']
- cmd = "ssh " + server + " gerrit review -s " + rev
- print(cmd)
- os.system(cmd)
+ cmd = ["ssh", server, "gerrit", "review", "-s", rev]
+ print(' '.join(cmd))
+ subprocess.call(cmd)
except KeyboardInterrupt:
print("Interrupted.")
break
More information about the Libreoffice-commits
mailing list