public inbox for cygwin-apps-cvs@sourceware.org
help / color / mirror / Atom feed
* [calm - Cygwin server-side packaging maintenance script] branch master, updated. 20230209-79-g886e9b7
@ 2024-03-31 14:45 Jon Turney
  0 siblings, 0 replies; only message in thread
From: Jon Turney @ 2024-03-31 14:45 UTC (permalink / raw)
  To: cygwin-apps-cvs




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

commit 886e9b7b74ccfa0d70faf14f4eca90a29dd6ce16
Author: Jon Turney <jon.turney@dronecode.org.uk>
Date:   Sun Mar 31 15:24:29 2024 +0100

    Expire python34 left-overs

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

commit 27a2ad89d1a7be564ae4e8965b6c3dd087c04499
Author: Jon Turney <jon.turney@dronecode.org.uk>
Date:   Sat Mar 30 20:20:08 2024 +0000

    Ignore InotifyError exceptions

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

commit 56719ceaa0ce8dba4d7d2a24430fd697909fe0ef
Author: Jon Turney <jon.turney@dronecode.org.uk>
Date:   Wed Mar 27 13:46:56 2024 +0000

    Only consider files in fix-requires-by-path
    
    This makes it practical to use complex regex e.g. ending with a negative
    lookahead.


Diff:
---
 calm/calm.py                 | 51 ++++++++++++++++++++++++--------------------
 calm/fix-requires-by-path.py |  8 +++++--
 calm/package.py              |  7 +++---
 calm/past_mistakes.py        |  3 +--
 4 files changed, 38 insertions(+), 31 deletions(-)

diff --git a/calm/calm.py b/calm/calm.py
index cf4e397..ab118ee 100755
--- a/calm/calm.py
+++ b/calm/calm.py
@@ -745,29 +745,34 @@ def do_daemon(args, state):
                 saw_events = False
                 depth = args.rel_area.count(os.path.sep) + 1
 
-                # It would be nice to use inotify.adaptor's timeout feature so
-                # we go at least a few seconds without events, to ensure that we
-                # don't start processing in the middle of a flurry of events.
-                # Unfortunately, that goes back to waiting for the full
-                # block_duration_s if timeout hasn't expired...
-                for event in i.event_gen(yield_nones=True):
-                    if event is not None:
-                        logging.debug("inotify event %s" % str(event))
-                        saw_events = True
-                        (_, type_names, path, filename) = event
-                        if path.startswith(args.rel_area):
-                            # ignore sha512.sum and modifications to setup.*
-                            # files in the arch directory
-                            if (filename != 'sha512.sum') and ((path.count(os.path.sep) > depth) or filename == ".touch"):
-                                action |= Event.read_relarea
-                        elif path.startswith(args.stagingdir):
-                            action |= Event.read_uploads
-                        elif (path.startswith(args.homedir)) and (filename == "!ready"):
-                            action |= Event.read_uploads
-                    else:
-                        # None means no more events are currently available, so
-                        # break to process actions
-                        break
+                try:
+                    # It would be nice to use inotify.adaptor's timeout feature so
+                    # we go at least a few seconds without events, to ensure that we
+                    # don't start processing in the middle of a flurry of events.
+                    # Unfortunately, that goes back to waiting for the full
+                    # block_duration_s if timeout hasn't expired...
+                    for event in i.event_gen(yield_nones=True):
+                        if event is not None:
+                            logging.debug("inotify event %s" % str(event))
+                            saw_events = True
+                            (_, type_names, path, filename) = event
+                            if path.startswith(args.rel_area):
+                                # ignore sha512.sum and modifications to setup.*
+                                # files in the arch directory
+                                if (filename != 'sha512.sum') and ((path.count(os.path.sep) > depth) or filename == ".touch"):
+                                    action |= Event.read_relarea
+                            elif path.startswith(args.stagingdir) and (filename != 'tmp'):
+                                action |= Event.read_uploads
+                            elif (path.startswith(args.homedir)) and (filename == "!ready"):
+                                action |= Event.read_uploads
+                        else:
+                            # None means no more events are currently available, so
+                            # break to process actions
+                            break
+                except inotify.calls.InotifyError:
+                    # can occur if a just created directory is (re)moved before
+                    # we set a watch on it
+                    pass
 
                 if not saw_events:
                     if time.time() > next_scan_time:
diff --git a/calm/fix-requires-by-path.py b/calm/fix-requires-by-path.py
index 4fa9e65..0efe087 100644
--- a/calm/fix-requires-by-path.py
+++ b/calm/fix-requires-by-path.py
@@ -42,6 +42,10 @@ from . import hint
 def fix_one_hint(args, dirpath, hintfile, tf):
     pn = os.path.join(dirpath, hintfile)
 
+    # avoid pointlessly checking to add a self-dependency
+    if pn == args.requires:
+        return
+
     hints = hint.hint_file_parse(pn, hint.pvr)
 
     hints.pop('parse-warnings', None)
@@ -57,13 +61,13 @@ def fix_one_hint(args, dirpath, hintfile, tf):
         if args.requires in requires:
             return
 
-    # check if this package installs anything with the specified path, and if
+    # check if this package installs any files with the specified path, and if
     # so, add to the requires, if not already present
     ivp = False
 
     try:
         with xtarfile.open(os.path.join(dirpath, tf), mode='r') as a:
-            ivp = any(re.match(args.path, m) for m in a.getnames())
+            ivp = any((m.isfile() and re.match(args.path, m.name)) for m in a.getmembers())
     except tarfile.ReadError:
         pass
 
diff --git a/calm/package.py b/calm/package.py
index 3b530cb..860bc64 100755
--- a/calm/package.py
+++ b/calm/package.py
@@ -1636,10 +1636,9 @@ def mark_fn(packages, po, v, certain_age, vault_requests):
     # - if package depends on anything in expired_provides
     #
     requires = po.version_hints[v].get('depends', '').split(', ')
-    if re.match(r'^python(|2|27)[-_]', pn):
-        if any(ep in requires for ep in past_mistakes.expired_provides) or po.obsolete:
-            logging.debug("package '%s' version '%s' not retained as it requires a provide known to be expired" % (pn, v))
-            return Freshness.stale
+    if any(ep in requires for ep in past_mistakes.expired_provides):
+        logging.debug("package '%s' version '%s' not retained as it requires a provide known to be expired" % (pn, v))
+        return Freshness.conditional
 
     # - explicitly marked as 'noretain'
     #
diff --git a/calm/past_mistakes.py b/calm/past_mistakes.py
index e1bef6b..7f4e8ea 100644
--- a/calm/past_mistakes.py
+++ b/calm/past_mistakes.py
@@ -256,8 +256,7 @@ substitute_dependency = {
 
 # provides: which don't exist and packages which require them should be expired
 expired_provides = [
-    'python2',
-    'python27',
+    'python34',
 ]
 
 # empty source packages


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-03-31 14:45 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-31 14:45 [calm - Cygwin server-side packaging maintenance script] branch master, updated. 20230209-79-g886e9b7 Jon Turney

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).