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 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
if f.name.endswith(PKG_SUFFIX):
for _ in range(10):
timeout = rrun('push_start', args=(f.name, size)) 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,12 +181,12 @@ 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:

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_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/'

View file

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

View file

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