From af6c91ce6e25b5c04c92dd2b86ad70c72aebb2f8 Mon Sep 17 00:00:00 2001 From: Jerry Date: Sun, 7 Apr 2019 22:19:06 +0800 Subject: [PATCH] fix bugs --- buildbot.py | 7 ++++++- config.py | 2 +- utils.py | 3 ++- yamlparse.py | 2 ++ 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/buildbot.py b/buildbot.py index 20ab7bb..d5ee34c 100755 --- a/buildbot.py +++ b/buildbot.py @@ -163,6 +163,7 @@ class updateManager: assert pkgdir.exists() pkglist = nspawn_shell(arch, MAKEPKG_PKGLIST_CMD, cwd=pkgdir) pkglist = pkglist.split('\n') + pkglist = [line for line in pkglist if not line.startswith('+')] return pkglist def __get_new_ver(self, dirname, arch): pkgfiles = self.__get_package_list(dirname, arch) @@ -201,7 +202,11 @@ updmgr = updateManager() @background def __main(): while True: - jobsmgr.tick() + try: + jobsmgr.tick() + except: + print_exc_plus() + sleep(60) diff --git a/config.py b/config.py index f1587df..0d02196 100644 --- a/config.py +++ b/config.py @@ -50,7 +50,7 @@ MAKEPKG_MAKE_CMD_CLEAN = 'makepkg --syncdeps --noextract --clean --cleanbuild' MAKEPKG_PKGLIST_CMD = f'{MAKEPKG} --packagelist' -CONTAINER_BUILDBOT_ROOT = '~/shared/buildbot' +CONTAINER_BUILDBOT_ROOT = 'shared/buildbot' # single quote may cause problem here SHELL_ARCH_X64 = 'sudo machinectl --quiet shell build@archlinux /bin/bash -c \'{command}\'' SHELL_ARCH_ARM64 = 'sudo machinectl --quiet shell root@alarm /bin/bash -c $\'su -l alarm -c \\\'{command}\\\'\'' diff --git a/utils.py b/utils.py index 8b92c27..e50c2c5 100644 --- a/utils.py +++ b/utils.py @@ -69,6 +69,7 @@ def run_cmd(cmd, cwd=None, keepalive=False, KEEPALIVE_TIMEOUT=30, RUN_CMD_TIMEOU self.__file = open(logfile, 'w') else: self.__file = None + return self def __exit__(self, type, value, traceback): if self.__file: self.__file.close() @@ -187,7 +188,7 @@ def get_pkg_details_from_name(name): def get_arch_from_pkgbuild(fpath): assert issubclass(type(fpath), os.PathLike) with open(fpath, 'r') as f: - for line in f.readline(): + for line in f.read().split('\n'): if line.startswith('arch='): matches = re.findall('[\'\"]([^\'\"]+)[\'\"]', line) if not matches: diff --git a/yamlparse.py b/yamlparse.py index c91af65..057510e 100644 --- a/yamlparse.py +++ b/yamlparse.py @@ -48,6 +48,8 @@ class pkgConfig: stages = ('prebuild', 'postbuild', 'update', 'failure') for stage in stages: setattr(self, stage, list()) + if not self.__extra: + return for entry in self.__extra: assert type(entry) is dict and len(entry) == 1 for k in entry: