This commit is contained in:
JerryXiao 2019-04-07 22:19:06 +08:00
parent e4e81062fd
commit af6c91ce6e
Signed by: Jerry
GPG key ID: 9D9CE43650FF2BAA
4 changed files with 11 additions and 3 deletions

View file

@ -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:
try:
jobsmgr.tick()
except:
print_exc_plus()
sleep(60)

View file

@ -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}\\\'\''

View file

@ -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:

View file

@ -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: