mirror of
https://github.com/archlinux-jerry/buildbot
synced 2024-11-22 13:00:40 +08:00
fix bugs
This commit is contained in:
parent
c2859dff0a
commit
c2dbc25673
4 changed files with 27 additions and 15 deletions
33
buildbot.py
33
buildbot.py
|
@ -119,6 +119,7 @@ class jobsManager:
|
||||||
'''
|
'''
|
||||||
wip
|
wip
|
||||||
'''
|
'''
|
||||||
|
suc = True
|
||||||
cwd = REPO_ROOT / job.pkgconfig.dirname
|
cwd = REPO_ROOT / job.pkgconfig.dirname
|
||||||
f_to_upload = list()
|
f_to_upload = list()
|
||||||
for fpath in cwd.iterdir():
|
for fpath in cwd.iterdir():
|
||||||
|
@ -130,17 +131,27 @@ class jobsManager:
|
||||||
f_to_upload.append(fpath)
|
f_to_upload.append(fpath)
|
||||||
for f in f_to_upload:
|
for f in f_to_upload:
|
||||||
size = f.stat().st_size / 1000 / 1000
|
size = f.stat().st_size / 1000 / 1000
|
||||||
timeout = rrun('push_start', args=(f.name, size))
|
if f.name.endswith(PKG_SUFFIX):
|
||||||
|
for _ in range(10):
|
||||||
|
timeout = rrun('push_start', args=(f.name, size))
|
||||||
|
if timeout > 0:
|
||||||
|
break
|
||||||
|
else:
|
||||||
|
logger.warning('Remote is busy (-1), wait 1 min x10')
|
||||||
|
sleep(60)
|
||||||
|
else:
|
||||||
|
timeout = 60
|
||||||
logger.info(f'Uploading {f}, timeout in {timeout}s')
|
logger.info(f'Uploading {f}, timeout in {timeout}s')
|
||||||
assert timeout > 0
|
mon_bash(UPLOAD_CMD.format(src=f), seconds=timeout)
|
||||||
mon_bash(f'{UPLOAD_CMD} \"{f}\"', seconds=timeout)
|
|
||||||
if f.name.endswith(PKG_SUFFIX):
|
if f.name.endswith(PKG_SUFFIX):
|
||||||
logger.info(f'Requesting repo update for {f.name}')
|
logger.info(f'Requesting repo update for {f.name}')
|
||||||
res = rrun('push_done', kwargs={'overwrite': False,})
|
res = rrun('push_done', args=(f.name,), kwargs={'overwrite': False,})
|
||||||
if res is None:
|
if res is None:
|
||||||
logger.info(f'Update success for {f.name}')
|
logger.info(f'Update success for {f.name}')
|
||||||
else:
|
else:
|
||||||
logger.error(f'Update failed for {f.name}, reason: {res}')
|
logger.error(f'Update failed for {f.name}, reason: {res}')
|
||||||
|
suc = False
|
||||||
|
return suc
|
||||||
def tick(self):
|
def tick(self):
|
||||||
'''
|
'''
|
||||||
check for updates,
|
check for updates,
|
||||||
|
@ -170,16 +181,16 @@ class jobsManager:
|
||||||
if job.multiarch:
|
if job.multiarch:
|
||||||
self.__clean(job, remove_pkg=True)
|
self.__clean(job, remove_pkg=True)
|
||||||
self.__sign(job)
|
self.__sign(job)
|
||||||
self.__upload(job)
|
if self.__upload(job):
|
||||||
self.__clean(job, remove_pkg=True)
|
self.__clean(job, remove_pkg=True)
|
||||||
else:
|
else:
|
||||||
self.__makepkg(job)
|
self.__makepkg(job)
|
||||||
self.__sign(job)
|
self.__sign(job)
|
||||||
self.__upload(job)
|
if self.__upload(job):
|
||||||
if job.pkgconfig.cleanbuild:
|
if job.pkgconfig.cleanbuild:
|
||||||
self.__clean(job, remove_pkg=True)
|
self.__clean(job, remove_pkg=True)
|
||||||
else:
|
else:
|
||||||
self.__clean(job, rm_src=False, remove_pkg=True)
|
self.__clean(job, rm_src=False, remove_pkg=True)
|
||||||
self.__finish_job(job.pkgconfig.dirname)
|
self.__finish_job(job.pkgconfig.dirname)
|
||||||
jobsmgr = jobsManager()
|
jobsmgr = jobsManager()
|
||||||
|
|
||||||
|
|
|
@ -58,4 +58,4 @@ SHELL_ARCH_ARM64 = ['/usr/bin/sudo', 'machinectl', '--quiet', 'shell', 'root@ala
|
||||||
SHELL_ARM64_ADDITIONAL = 'set -e; set -x'
|
SHELL_ARM64_ADDITIONAL = 'set -e; set -x'
|
||||||
SHELL_TRAP = 'trap \'echo ++ exit $?\' ERR EXIT'
|
SHELL_TRAP = 'trap \'echo ++ exit $?\' ERR EXIT'
|
||||||
|
|
||||||
UPLOAD_CMD = 'rsync -avPh {src} repoupload:/srv/repo/buildbot/repo/updates/'
|
UPLOAD_CMD = 'rsync -avPh \"{src}\" repoupload:/srv/repo/buildbot/repo/updates/'
|
||||||
|
|
2
repo.py
2
repo.py
|
@ -34,7 +34,7 @@ repocwd = Path(abspath).parent / 'repo'
|
||||||
repocwd.mkdir(mode=0o755, exist_ok=True)
|
repocwd.mkdir(mode=0o755, exist_ok=True)
|
||||||
os.chdir(repocwd)
|
os.chdir(repocwd)
|
||||||
|
|
||||||
logger = logging.getLogger(f'buildbot.{__name__}')
|
logger = logging.getLogger('buildbot')
|
||||||
|
|
||||||
|
|
||||||
def symlink(dst, src, exist_ok=True):
|
def symlink(dst, src, exist_ok=True):
|
||||||
|
|
5
repod.py
5
repod.py
|
@ -27,7 +27,7 @@ abspath=os.path.abspath(__file__)
|
||||||
abspath=os.path.dirname(abspath)
|
abspath=os.path.dirname(abspath)
|
||||||
os.chdir(abspath)
|
os.chdir(abspath)
|
||||||
|
|
||||||
logger = logging.getLogger(f'buildbot.{__name__}')
|
logger = logging.getLogger('buildbot')
|
||||||
configure_logger(logger, logfile='repod.log', rotate_size=1024*1024*10)
|
configure_logger(logger, logfile='repod.log', rotate_size=1024*1024*10)
|
||||||
|
|
||||||
class pushFm:
|
class pushFm:
|
||||||
|
@ -75,7 +75,8 @@ class pushFm:
|
||||||
'''
|
'''
|
||||||
if fname == self.fname:
|
if fname == self.fname:
|
||||||
try:
|
try:
|
||||||
update_path = Path('updates')
|
REPO_ROOT = Path('repo')
|
||||||
|
update_path = REPO_ROOT / 'updates'
|
||||||
pkg_found = False
|
pkg_found = False
|
||||||
sig_found = False
|
sig_found = False
|
||||||
for fpath in update_path.iterdir():
|
for fpath in update_path.iterdir():
|
||||||
|
|
Loading…
Reference in a new issue