From 9303205a21f05c20f1699c4dd62d7937ac18bb34 Mon Sep 17 00:00:00 2001 From: wangchong1995924 <15229716099@163.com> Date: Wed, 30 Dec 2020 18:03:46 +0800 Subject: [PATCH] optimization function write_new_pkg_rpms_to_file --- core/update_obs_repos.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/core/update_obs_repos.py b/core/update_obs_repos.py index 55257cb..9bce03a 100755 --- a/core/update_obs_repos.py +++ b/core/update_obs_repos.py @@ -209,9 +209,11 @@ class RPMManager(object): """ with open(self.obs_pkg_rpms_file, "w", encoding="utf-8") as f: yaml.dump(self.old_pkg_rpms, f) - cmd = "cd %s && git pull && git add %s && git commit -m 'update rpms' && git push && cd - && rm -rf %s" \ - % (self.obs_pkg_rpms_files_dir, self.obs_pkg_rpms_file, self.obs_pkg_rpms_files_dir) - os.system(cmd) + for i in range(5): + cmd = "cd %s && git pull && git add %s && git commit -m 'update rpms' && git push && cd - && rm -rf %s" \ + % (self.obs_pkg_rpms_files_dir, self.obs_pkg_rpms_file, self.obs_pkg_rpms_files_dir) + if os.system(cmd) == 0: + break def update_repos_db(self): """ -- Gitee