From d11af2fd99a5b6a0dbbdb71107967c3824068b13 Mon Sep 17 00:00:00 2001 From: Stephen Seo Date: Tue, 3 Oct 2023 10:51:43 +0900 Subject: [PATCH] Instead of sys.exit(1), fail gracefully some cases --- update.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/update.py b/update.py index 534a364..9041a45 100755 --- a/update.py +++ b/update.py @@ -709,7 +709,7 @@ def get_pkgbuild_version( 'ERROR: Failed to get dep "{}"'.format(dep), other_state=other_state, ) - sys.exit(1) + return False, None, None, None command_list.insert(2, "-I") command_list.insert(3, dep_fullpath) for aur_dep in pkg_state[pkg]["aur_deps"]: @@ -721,7 +721,7 @@ def get_pkgbuild_version( 'ERROR: Failed to get aur_dep "{}"'.format(aur_dep), other_state=other_state, ) - sys.exit(1) + return False, None, None, None command_list.insert(2, "-I") command_list.insert(3, aur_dep_fullpath) subprocess.run( @@ -1245,6 +1245,7 @@ def update_pkg_list( "--log", "--holdver", ] + failure = False for dep in pkg_state[pkg]["other_deps"]: dep_fullpath = get_latest_pkg(dep, "/var/cache/pacman/pkg") if not dep_fullpath: @@ -1252,9 +1253,12 @@ def update_pkg_list( 'ERROR: Failed to get dep "{}"'.format(dep), other_state=other_state, ) - sys.exit(1) + failure = True + break command_list.insert(2, "-I") command_list.insert(3, dep_fullpath) + if failure: + continue for aur_dep in pkg_state[pkg]["aur_deps"]: aur_dep_fullpath = get_latest_pkg( aur_dep, other_state["pkg_out_dir"] @@ -1264,9 +1268,12 @@ def update_pkg_list( 'ERROR: Failed to get aur_dep "{}"'.format(aur_dep), other_state=other_state, ) - sys.exit(1) + failure = True + break command_list.insert(2, "-I") command_list.insert(3, aur_dep_fullpath) + if failure: + continue if "ccache_dir" in pkg_state[pkg]: command_list.insert(2, "-d") command_list.insert(3, f'{pkg_state[pkg]["ccache_dir"]}:/ccache')