Skip to content

Commit

Permalink
also check commits for rebuilds when building packages from cmdline
Browse files Browse the repository at this point in the history
or they may get skipped.
  • Loading branch information
lilydjwg committed Mar 31, 2024
1 parent dc3218d commit b6e62df
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 28 deletions.
48 changes: 23 additions & 25 deletions lilac
Original file line number Diff line number Diff line change
Expand Up @@ -528,18 +528,17 @@ def main_may_raise(

failed_info = D.get('failed', {})

if not pkgs_from_args:
U = set(REPO.lilacinfos)
last_commit = D.get('last_commit', EMPTY_COMMIT)
changed = get_changed_packages(last_commit, 'HEAD') & U

failed_prev = set(failed_info.keys())
# no update from upstream, but build instructions have changed; rebuild
# failed ones
need_rebuild_failed = failed_prev & changed
# if pkgrel is updated, build a new release
need_rebuild_pkgrel = {x for x in changed
if pkgrel_changed(last_commit, 'HEAD', x)} - unknown
U = set(REPO.lilacinfos)
last_commit = D.get('last_commit', EMPTY_COMMIT)
changed = get_changed_packages(last_commit, 'HEAD') & U

failed_prev = set(failed_info.keys())
# no update from upstream, but build instructions have changed; rebuild
# failed ones
need_rebuild_failed = failed_prev & changed
# if pkgrel is updated, build a new release
need_rebuild_pkgrel = {x for x in changed
if pkgrel_changed(last_commit, 'HEAD', x)} - unknown

nv_changed = {}
for p, vers in nvdata.items():
Expand Down Expand Up @@ -572,17 +571,17 @@ def main_may_raise(
if pkgs_from_args:
for p in pkgs_from_args:
build_reasons[p].append(BuildReason.Cmdline())
else:
for p in need_rebuild_pkgrel:
build_reasons[p].append(BuildReason.UpdatedPkgrel())

for p in need_rebuild_failed:
build_reasons[p].append(BuildReason.UpdatedFailed())
for p in need_rebuild_pkgrel:
build_reasons[p].append(BuildReason.UpdatedPkgrel())

for p in need_rebuild_failed:
build_reasons[p].append(BuildReason.UpdatedFailed())

for p, i in failed_info.items():
# p might have been removed
if p in REPO.lilacinfos and (deps := i['missing']):
build_reasons[p].append(BuildReason.FailedByDeps(deps))
for p, i in failed_info.items():
# p might have been removed
if p in REPO.lilacinfos and (deps := i['missing']):
build_reasons[p].append(BuildReason.FailedByDeps(deps))

if_this_then_those = defaultdict(set)
for p, info in REPO.lilacinfos.items():
Expand Down Expand Up @@ -630,10 +629,9 @@ def main_may_raise(
if x in failed_info:
del failed_info[x]
# cleanup removed package failed_info
if not pkgs_from_args:
for x in tuple(failed_info.keys()):
if x not in REPO.lilacinfos:
del failed_info[x]
for x in tuple(failed_info.keys()):
if x not in REPO.lilacinfos:
del failed_info[x]
D['failed'] = failed_info

if config['lilac']['rebuild_failed_pkgs']:
Expand Down
6 changes: 3 additions & 3 deletions lilac2/repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -333,14 +333,14 @@ def load_managed_lilac_and_report(self) -> dict[str, tuple[str, ...]]:
self.lilacinfos, errors = lilacyaml.load_managed_lilacinfos(self.repodir)
failed: dict[str, tuple[str, ...]] = {p: () for p in errors}
for name, exc_info in errors.items():
logger.error('error while loading lilac.py for %s', name, exc_info=exc_info)
logger.error('error while loading lilac.yaml for %s', name, exc_info=exc_info)
exc = exc_info[1]
if not isinstance(exc, Exception):
raise
self.send_error_report(name, exc=exc,
subject='为软件包 %s 载入 lilac.py 时失败')
subject='为软件包 %s 载入 lilac.yaml 时失败')
build_logger_old.error('%s failed', name)
build_logger.exception('lilac.py error', pkgbase = name, exc_info=exc_info)
build_logger.exception('lilac.yaml error', pkgbase = name, exc_info=exc_info)

return failed

Expand Down

0 comments on commit b6e62df

Please sign in to comment.