This is the mail archive of the cygwin-apps-cvs mailing list for the cygwin-apps project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[calm - Cygwin server-side packaging maintenance script] branch master, updated. 20160705-71-g289c4f8




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

commit 289c4f88e7e883a336cd6898dfeaa20afb0e4414
Author: Jon Turney <jon.turney@dronecode.org.uk>
Date:   Thu Apr 20 22:45:09 2017 +0100

    Add a grace period before warning about !ready-less files

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

commit f48f38ac221833c00ce52e47672e9ec529cb2ace
Author: Jon Turney <jon.turney@dronecode.org.uk>
Date:   Fri Apr 21 14:19:37 2017 +0100

    Check for and fix pep8 E241 multiple spaces after ','

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

commit 6b88baf0819dc7cc2715790b93b2e289585ae8cf
Author: Jon Turney <jon.turney@dronecode.org.uk>
Date:   Tue Apr 11 14:57:07 2017 +0100

    Warn if curr: isn't the most recent non-test: version


Diff:
---
 calm/maintainers.py   |    2 +-
 calm/package.py       |   21 +++++++++++++++++----
 calm/past_mistakes.py |   20 ++++++++++++++++++++
 calm/uploads.py       |    9 +++++++--
 pep8                  |    2 +-
 5 files changed, 46 insertions(+), 8 deletions(-)

diff --git a/calm/maintainers.py b/calm/maintainers.py
index d8f7c46..b1b43dc 100644
--- a/calm/maintainers.py
+++ b/calm/maintainers.py
@@ -132,7 +132,7 @@ class Maintainer(object):
     # add maintainers from the package maintainers list, with the packages they
     # maintain
     @staticmethod
-    def add_packages(mlist,  pkglist, orphanMaint=None):
+    def add_packages(mlist, pkglist, orphanMaint=None):
         with open(pkglist) as f:
             for (i, l) in enumerate(f):
                 l = l.rstrip()
diff --git a/calm/package.py b/calm/package.py
index 82dca12..81069f2 100755
--- a/calm/package.py
+++ b/calm/package.py
@@ -287,7 +287,7 @@ def read_package(packages, basedir, dirpath, files, strict=False, remove=[], upl
             hint_fn = '%s-%s.hint' % (p, vr)
             if hint_fn in files:
                 # is there a PVR.hint file?
-                pvr_hint = read_hints(p, os.path.join(dirpath,  hint_fn), hint.pvr)
+                pvr_hint = read_hints(p, os.path.join(dirpath, hint_fn), hint.pvr)
                 if not pvr_hint:
                     return True
                 warnings = clean_hints(p, pvr_hint, strict_lvl, warnings)
@@ -420,7 +420,7 @@ def validate_packages(args, packages):
         has_install = False
         has_nonempty_install = False
 
-        for t in packages[p].tars:
+        for (t, tar) in packages[p].tars.items():
             # categorize each tarfile as either 'source' or 'install'
             if re.search(r'-src\.tar', t):
                 category = 'source'
@@ -444,6 +444,7 @@ def validate_packages(args, packages):
 
             # store tarfile corresponding to this version and category
             packages[p].vermap[v][category] = t
+            packages[p].vermap[v]['mtime'] = tar.mtime
 
         obsolete = any(['_obsolete' in packages[p].version_hints[vr].get('category', '') for vr in packages[p].version_hints])
 
@@ -536,6 +537,7 @@ def validate_packages(args, packages):
 
             # assign version to level
             packages[p].stability[l] = v
+            packages[p].version_hints[v][l] = ''
             # and remove from list of unallocated levels
             levels.remove(l)
 
@@ -554,6 +556,17 @@ def validate_packages(args, packages):
         elif 'curr' not in packages[p].stability and 'curr' not in getattr(args, 'okmissing', []):
             logging.warning("package '%s' doesn't have a curr version" % (p))
 
+        # warn if the curr: version isn't the most recent non-test: version
+        for v in sorted(packages[p].vermap.keys(), key=lambda v: packages[p].vermap[v]['mtime'], reverse=True):
+            if 'test' in packages[p].version_hints[v]:
+                continue
+
+            if packages[p].stability['curr'] != v:
+                lvl = logging.WARNING if p not in past_mistakes.mtime_anomalies else logging.DEBUG
+                logging.log(lvl, "package '%s' version '%s' is most recent non-test version, but version '%s' is curr:" % (p, v, packages[p].stability['curr']))
+
+            break
+
         # identify a 'best' version to take certain information from: this is
         # the curr version, if we have one, otherwise, the highest version.
         if 'curr' in packages[p].stability:
@@ -994,10 +1007,10 @@ def stale_packages(packages):
 
         # clean up freshness mark
         for v in po.vermap:
-            for c in po.vermap[v]:
+            for c in ['source', 'install']:
                 try:
                     delattr(po.tars[po.vermap[v][c]], 'fresh')
-                except AttributeError:
+                except (KeyError, AttributeError):
                     pass
 
     return stale
diff --git a/calm/past_mistakes.py b/calm/past_mistakes.py
index e69d988..3baa848 100644
--- a/calm/past_mistakes.py
+++ b/calm/past_mistakes.py
@@ -140,3 +140,23 @@ empty_but_not_obsolete = [
     'libpopt-devel',   #
     'mutt-debuginfo',  # version 1.7.2-1 has empty debuginfo
 ]
+
+# packages with timestamp anomalies
+mtime_anomalies = [
+    'gcc-tools-epoch2-autoconf',
+    'glproto',
+    'gv-debuginfo',
+    'python-gtk2.0',
+    'python-gtk2.0-demo',
+    'python-gtk2.0-devel',
+    'subversion',
+    'subversion-debuginfo',
+    'subversion-devel',
+    'subversion-gnome',
+    'subversion-httpd',
+    'subversion-perl',
+    'subversion-python',
+    'subversion-ruby',
+    'subversion-tools',
+    'xextproto',
+]
diff --git a/calm/uploads.py b/calm/uploads.py
index db1a23b..29fc379 100644
--- a/calm/uploads.py
+++ b/calm/uploads.py
@@ -38,6 +38,8 @@ from . import package
 
 # reminders will be issued daily
 REMINDER_INTERVAL = 60*60*24
+# reminders don't start to be issued until an hour after upload
+REMINDER_GRACE = 60*60
 
 # a named tuple type to hold the result of scan
 ScanResult = namedtuple('ScanResult', 'error,packages,to_relarea,to_vault,remove_always,remove_success')
@@ -133,14 +135,17 @@ def scan(m, all_packages, arch, args):
                 continue
 
             # only process files newer than !ready
-            if os.path.getmtime(fn) > mtime:
+            file_mtime = os.path.getmtime(fn)
+            if file_mtime > mtime:
                 if mtime == 0:
                     m.reminders_timestamp_checked = True
                     lvl = logging.DEBUG
 
+                    # don't warn until file is at least REMINDER_GRACE old, and
                     # if more than REMINDER_INTERVAL has elapsed since we warned
                     # about files being ignored, warn again
-                    if time.time() > (m.reminder_time + REMINDER_INTERVAL):
+                    if ((file_mtime < (time.time() - REMINDER_GRACE)) and
+                        (time.time() > (m.reminder_time + REMINDER_INTERVAL))):
                         lvl = logging.WARNING
                         if not args.dryrun:
                             m.reminders_issued = True
diff --git a/pep8 b/pep8
index 88158d7..0fc53ec 100755
--- a/pep8
+++ b/pep8
@@ -1,2 +1,2 @@
 #!/bin/sh
-grep -s -l '^#!/usr/bin/env python' calm/* tests/* | xargs python3 -m pep8 --count --show-source --max-line-length=240
+grep -s -l '^#!/usr/bin/env python' calm/* tests/* | xargs python3 -m pep8 --count --show-source --max-line-length=240 --ignore=E129,E226


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]