https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/calm.git;h=b7df314fd31584cb24f1efce8e56f866e4eaca02

commit b7df314fd31584cb24f1efce8e56f866e4eaca02
Author: Jon Turney <[email protected]>
Date:   Sat Feb 1 18:05:08 2025 +0000

    Update package summary package when hints change as well

https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/calm.git;h=044baf7a6178a3e4ab0b2173dcd439f9b69e2230

commit 044baf7a6178a3e4ab0b2173dcd439f9b69e2230
Author: Jon Turney <[email protected]>
Date:   Wed Dec 18 17:20:46 2024 +0000

    CI: Drop testing on python 3.7
    
    Drop testing on python 3.7, not available on ubuntu-latest.

https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/calm.git;h=3e296bb4eb073e2a3eb3b4f9ad22d718852be79d

commit 3e296bb4eb073e2a3eb3b4f9ad22d718852be79d
Author: Jon Turney <[email protected]>
Date:   Wed Dec 18 17:09:08 2024 +0000

    Improve reliability of detecting upload available.
    
    Detecting a !ready file being placed into the upload directory is
    problematic, due to possible races in setting watches on a just created
    directory.
    
    So instead, we just watch for a file touched when the sftp session ends.
    
    This means we more reliably detect when a !ready file has been uploaded,
    at the cost of doing extra scans (in the probably rare case) when a sftp
    session hasn't uploaded a !ready file.

https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/calm.git;h=e8b2a999698ca91b1033547a0354a74866b876d0

commit e8b2a999698ca91b1033547a0354a74866b876d0
Author: Jon Turney <[email protected]>
Date:   Sun Mar 17 13:44:04 2024 +0000

    mkgitolite: Define a group for all packages
    
    Define a group of all package repositories, rather than just using @all,
    so gitolite can be used to control access to other cygwin repositories
    as well.
    
    Also define a per-repo post-recieve hook to perform package builds.
    
    Also rearrange things so comments in giolite configuration file
    consistently preceed the what they are commenting on.

https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/calm.git;h=eb2f972a1f028e2df5fd9793ee528fed4406f64c

commit eb2f972a1f028e2df5fd9793ee528fed4406f64c
Author: Jon Turney <[email protected]>
Date:   Sun Jul 21 12:24:18 2024 +0100

    Handle transient ConnectionRefusedError from repology
    
    Also: use a timeout on urlopen(), so we don't pause indefinitely if the
    far end drops the connection.
    
    Also: reuse the last successfully fetched data if fetching fails.
    
    v2:
    timeout on urlopen(), not Request()


Diff:
---
 calm/package.py  |  1 +
 calm/pkg2html.py | 29 +++++++++++++++++++----------
 calm/repology.py |  6 +++---
 3 files changed, 23 insertions(+), 13 deletions(-)

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 update_package_listings(args, packages):
         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
diff --git a/calm/repology.py b/calm/repology.py
index 8c63235..4ecefe5 100644
--- a/calm/repology.py
+++ b/calm/repology.py
@@ -63,11 +63,11 @@ def repology_fetch_versions():
             url = url + last_pn + '/'
         url += '?inrepo=cygwin'
 
-        request = urllib.request.Request(url, timeout=600)
+        request = urllib.request.Request(url)
         request.add_header('User-Agent', 'CygwinUpstreamVersionFetch/1.0 
+http://cygwin.com/')
 
         try:
-            r = urllib.request.urlopen(request)
+            r = urllib.request.urlopen(request, timeout=600)
         except urllib.error.URLError as e:
             logging.error("consulting repology for upstream versions failed: 
%s" % (e.reason))
             return {}
@@ -164,6 +164,6 @@ def annotate_packages(args, packages):
         spn = pn + '-src'
         for arch in packages:
             if spn in packages[arch]:
-                packages[arch][spn].upstream_version = uv[pn]
+                packages[arch][spn].upstream_version = last_data[pn]
 
     last_check = time.time()

Reply via email to