This commit is contained in:
JerryXiao 2019-04-09 21:15:03 +08:00
parent c2859dff0a
commit c2dbc25673
Signed by: Jerry
GPG Key ID: 9D9CE43650FF2BAA
4 changed files with 27 additions and 15 deletions

View File

@ -119,6 +119,7 @@ class jobsManager:
'''
wip
'''
suc = True
cwd = REPO_ROOT / job.pkgconfig.dirname
f_to_upload = list()
for fpath in cwd.iterdir():
@ -130,17 +131,27 @@ class jobsManager:
f_to_upload.append(fpath)
for f in f_to_upload:
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')
assert timeout > 0
mon_bash(f'{UPLOAD_CMD} \"{f}\"', seconds=timeout)
mon_bash(UPLOAD_CMD.format(src=f), seconds=timeout)
if f.name.endswith(PKG_SUFFIX):
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:
logger.info(f'Update success for {f.name}')
else:
logger.error(f'Update failed for {f.name}, reason: {res}')
suc = False
return suc
def tick(self):
'''
check for updates,
@ -170,16 +181,16 @@ class jobsManager:
if job.multiarch:
self.__clean(job, remove_pkg=True)
self.__sign(job)
self.__upload(job)
self.__clean(job, remove_pkg=True)
if self.__upload(job):
self.__clean(job, remove_pkg=True)
else:
self.__makepkg(job)
self.__sign(job)
self.__upload(job)
if job.pkgconfig.cleanbuild:
self.__clean(job, remove_pkg=True)
else:
self.__clean(job, rm_src=False, remove_pkg=True)
if self.__upload(job):
if job.pkgconfig.cleanbuild:
self.__clean(job, remove_pkg=True)
else:
self.__clean(job, rm_src=False, remove_pkg=True)
self.__finish_job(job.pkgconfig.dirname)
jobsmgr = jobsManager()

View File

@ -58,4 +58,4 @@ SHELL_ARCH_ARM64 = ['/usr/bin/sudo', 'machinectl', '--quiet', 'shell', 'root@ala
SHELL_ARM64_ADDITIONAL = 'set -e; set -x'
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/'

View File

@ -34,7 +34,7 @@ repocwd = Path(abspath).parent / 'repo'
repocwd.mkdir(mode=0o755, exist_ok=True)
os.chdir(repocwd)
logger = logging.getLogger(f'buildbot.{__name__}')
logger = logging.getLogger('buildbot')
def symlink(dst, src, exist_ok=True):

View File

@ -27,7 +27,7 @@ abspath=os.path.abspath(__file__)
abspath=os.path.dirname(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)
class pushFm:
@ -75,7 +75,8 @@ class pushFm:
'''
if fname == self.fname:
try:
update_path = Path('updates')
REPO_ROOT = Path('repo')
update_path = REPO_ROOT / 'updates'
pkg_found = False
sig_found = False
for fpath in update_path.iterdir():