diff --git a/calm/package.py b/calm/package.py index 83deafe..4d9055b 100755 --- a/calm/package.py +++ b/calm/package.py @@ -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 diff --git a/calm/pkg2html.py b/calm/pkg2html.py index ab7591a..5f34bba 100755 --- a/calm/pkg2html.py +++ b/calm/pkg2html.py @@ -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