Skip to content

Commit

Permalink
Update package summary package when hints change as well
Browse files Browse the repository at this point in the history
  • Loading branch information
jon-turney committed Feb 1, 2025
1 parent 044baf7 commit b7df314
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 10 deletions.
1 change: 1 addition & 0 deletions calm/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -593,6 +593,7 @@ def read_one_package(packages, p, basedir, files, kind, strict):
hintobj = Hint()
hintobj.repopath = rp
hintobj.hints = pvr_hint
hintobj.mtime = os.path.getmtime(rp.abspath(basedir))

version_hints[ovr] = pvr_hint
hints[ovr] = hintobj
Expand Down
29 changes: 19 additions & 10 deletions calm/pkg2html.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,20 +183,29 @@ def linkify_package(pkg):
if summary in toremove:
toremove.remove(summary)

# if listing files were added or removed, or it doesn't already exist,
# or force, update the summary
if p in update_summary or not os.path.exists(summary) or args.force:
pos = arch_packages(packages, p)
if not pos:
continue

po = next(iter(pos.values()))
bv = po.best_version

# update summary if:
# - it doesn't already exist,
# - or, listing files (i.e packages versions) were added or removed,
# - or, hints have changed since it was written
# - or, forced
hint_mtime = po.hints[bv].mtime

summary_mtime = 0
if os.path.exists(summary):
summary_mtime = os.path.getmtime(summary)

if (p in update_summary) or (summary_mtime < hint_mtime) or args.force:
if not args.dryrun:
with utils.open_amifc(summary) as f:
os.fchmod(f.fileno(), 0o755)

pos = arch_packages(packages, p)
if not pos:
continue

po = next(iter(pos.values()))
bv = po.best_version

if po.kind == package.Kind.source:
pn = po.orig_name
title = "Cygwin Package Summary for %s (source)" % pn
Expand Down

0 comments on commit b7df314

Please sign in to comment.