[sysadmin-bin] Revert "Add run_command wrapper"
- From: Bartłomiej Piotrowski <bpiotrowski src gnome org>
- To: gnome-sysadmin gnome org,commits-list gnome org
- Subject: [sysadmin-bin] Revert "Add run_command wrapper"
- Date: Tue, 29 Oct 2019 08:02:57 +0000 (UTC)
commit 8d4a76521a2c88778de1f3a63715cf05d8d46755
Author: Bartłomiej Piotrowski <bpiotrowski gnome org>
Date: Tue Oct 29 09:02:27 2019 +0100
Revert "Add run_command wrapper"
This reverts commit 8cf241d59d84ad73a12ab566817c7fa686c1eb51.
git/post-receive-mirror-github | 24 +++---------------------
1 file changed, 3 insertions(+), 21 deletions(-)
---
diff --git a/git/post-receive-mirror-github b/git/post-receive-mirror-github
index ee076d4..f6e86af 100755
--- a/git/post-receive-mirror-github
+++ b/git/post-receive-mirror-github
@@ -192,24 +192,6 @@ def get_doap_settings(repo_name):
"branches": branches,
}
-
-def run_command(command):
- try:
- out = tempfile.NamedTemporaryFile(prefix="github",suffix="std")
- err = tempfile.NamedTemporaryFile(prefix="github",suffix="err")
- subprocess.check_call(shlex.split(command), stderr=err, stdout=out)
- out.close()
- err.close()
- except subprocess.CalledProcessError:
- out = open(out.name, "r")
- err = open(err.name, "r")
- error_msg = """
-Error trying to run command
-
-{}
-"""
- raise Exception(error_msg.format(command))
-
def main():
repo_name = get_repo_name()
@@ -236,17 +218,17 @@ def main():
github_repo_name = gh.normalize_name(repo_name)
push_command = "git push --force git github com:{}/{} {}:mainline {}"
command = push_command.format(gh.organization, github_repo_name, doap_settings['default_branch'], "
".join(refs))
- run_command(command)
+ subprocess.run(command, shell=True, check=True)
if github_settings['default_branch'] != "mainline":
gh.update_github_repo(repo_name, 'default_branch', "mainline")
github_branches = gh.get_branches(repo_name)
if 'master' in github_branches:
- run_command("git push --force git github com:{}/{} :master".format(gh.organization,
github_repo_name))
+ subprocess.run("git push --force git github com:{}/{} :master".format(gh.organization,
github_repo_name), shell=True, check=True)
for org in ADITIONAL_ORGANIZATIONS.get(repo_name, []):
- run_command("git push --mirror git github com:{}/{}".format(org, github_repo_name))
+ subprocess.run("git push --mirror git github com:{}/{}".format(org, github_repo_name), shell=True,
check=True)
if __name__ == "__main__":
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]