From b58b8969499c76694a7bca088ba4f0e7296ccb0d Mon Sep 17 00:00:00 2001 From: yaokai13 Date: Wed, 31 Mar 2021 11:50:30 +0800 Subject: [PATCH] add param -a for updating all rpms --- core/update_obs_repos.py | 7 +++++-- openeuler_obs.py | 4 ++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/core/update_obs_repos.py b/core/update_obs_repos.py index b40d11f..3c376e7 100755 --- a/core/update_obs_repos.py +++ b/core/update_obs_repos.py @@ -197,7 +197,10 @@ class RPMManager(object): old_rpms_list = None new_rpms_list = self.get_new_rpms_by_pkg(pkg) new_rpms_list.sort() - if old_rpms_list != new_rpms_list and new_rpms_list: + if self.kwargs["all"] and new_rpms_list: + self.copy_new_rpms_to_repo(pkg, new_rpms_list) + self.backup_old_rpms_by_pkg(pkg, old_rpms_list) + elif old_rpms_list != new_rpms_list and new_rpms_list: try: self.copy_new_rpms_to_repo(pkg, new_rpms_list) self.backup_old_rpms_by_pkg(pkg, old_rpms_list) @@ -275,7 +278,7 @@ if __name__ == "__main__": "repo_server_port": "22233", "gitee_user": "xxxxxxxxx", "gitee_pwd": "xxxxxxxxx", - "pkglist": ["zip", "zsh"] + "pkglist": ["zip", "zsh"], } test = RPMManager(**kw) test.update_pkgs() diff --git a/openeuler_obs.py b/openeuler_obs.py index bcb7e6c..262f662 100644 --- a/openeuler_obs.py +++ b/openeuler_obs.py @@ -85,6 +85,9 @@ par.add_argument("-cps", "--check_pkg_service", default=False, help="check if there are any problems with the content of the _service file in the rpm package", required=False) par.add_argument("-prid", "--pr_id", default=False, help="use the pr_id to get this pullrequest", required=False) + +par.add_argument("-a", "--ALL_", default=False, help="update all obs repo rpms", required=False) + args = par.parse_args() #apply kw = { @@ -116,6 +119,7 @@ kw = { "check_codes": args.check_codes, "check_pkg_service": args.check_pkg_service, "pr_id": args.pr_id, + "all":args.ALL_ } run = Runner(**kw) -- Gitee