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-68-gd46156e




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

commit d46156e37b30826a949b4bbe3b5576672b98fbb3
Author: Jon Turney <jon.turney@dronecode.org.uk>
Date:   Sun Apr 16 20:19:03 2017 +0100

    Downgrade signal logging to debug

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

commit 58a8b6d4b8759f2db8c2003694a1cf6db68fd45b
Author: Jon Turney <jon.turney@dronecode.org.uk>
Date:   Thu Apr 6 12:47:31 2017 +0100

    Try to use fewer long paths in file move logging

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

commit 5c05a598d8230e55417f94b6615900a704d231d2
Author: Jon Turney <jon.turney@dronecode.org.uk>
Date:   Thu Apr 6 12:46:47 2017 +0100

    Append a summary of severities to log email


Diff:
---
 calm/buffering_smtp_handler.py |    9 +++++++++
 calm/calm.py                   |    8 ++++----
 calm/uploads.py                |    8 ++++++--
 3 files changed, 19 insertions(+), 6 deletions(-)

diff --git a/calm/buffering_smtp_handler.py b/calm/buffering_smtp_handler.py
index 0025a5b..81a107b 100644
--- a/calm/buffering_smtp_handler.py
+++ b/calm/buffering_smtp_handler.py
@@ -52,6 +52,15 @@ class BufferingSMTPHandler(logging.handlers.BufferingHandler):
                 s = self.format(record)
                 msg = msg + s + "\r\n"
 
+            # append a summary of severities
+            summary = {}
+
+            for record in self.buffer:
+                summary[record.levelname] = summary.get(record.levelname, 0) + 1
+
+            msg = msg + 'SUMMARY: ' + ', '.join(['%d %s(s)' % (v, k) for (k, v) in summary.items()]) + "\r\n"
+
+            # build the email
             m = email.message.Message()
             m['From'] = self.fromaddr
             m['To'] = ','.join(self.toaddrs)
diff --git a/calm/calm.py b/calm/calm.py
index 0a66074..afb98bd 100755
--- a/calm/calm.py
+++ b/calm/calm.py
@@ -455,24 +455,24 @@ def do_daemon(args, state):
 
     # signals! the first, and best, interprocess communications mechanism! :)
     def sigusr1(signum, frame):
-        logging.info("SIGUSR1")
+        logging.debug("SIGUSR1")
         nonlocal read_uploads
         read_uploads = True
 
     def sigusr2(signum, frame):
-        logging.info("SIGUSR2")
+        logging.debug("SIGUSR2")
         nonlocal read_relarea
         read_relarea = True
 
     def sigalrm(signum, frame):
-        logging.info("SIGALRM")
+        logging.debug("SIGALRM")
         nonlocal read_relarea
         read_relarea = True
         nonlocal read_uploads
         read_uploads = True
 
     def sigterm(signum, frame):
-        logging.info("SIGTERM")
+        logging.debug("SIGTERM")
         nonlocal running
         running = False
 
diff --git a/calm/uploads.py b/calm/uploads.py
index d9a172d..db1a23b 100644
--- a/calm/uploads.py
+++ b/calm/uploads.py
@@ -252,10 +252,10 @@ def move(args, movelist, fromdir, todir):
                 os.makedirs(os.path.join(todir, p), exist_ok=True)
             except FileExistsError:
                 pass
-        logging.info("move from '%s' to '%s':" % (os.path.join(fromdir, p), os.path.join(todir, p)))
+        logging.debug("move from '%s' to '%s':" % (os.path.join(fromdir, p), os.path.join(todir, p)))
         for f in sorted(movelist[p]):
             if os.path.exists(os.path.join(fromdir, p, f)):
-                logging.info("%s" % (f))
+                logging.info("%s" % os.path.join(p, f))
                 if not args.dryrun:
                     os.rename(os.path.join(fromdir, p, f), os.path.join(todir, p, f))
             else:
@@ -263,6 +263,8 @@ def move(args, movelist, fromdir, todir):
 
 
 def move_to_relarea(m, args, movelist):
+    if movelist:
+        logging.info("move from %s's upload area to release area:" % (m.name))
     move(args, movelist, m.homedir(), args.rel_area)
     # XXX: Note that there seems to be a separate process, not run from
     # cygwin-admin's crontab, which changes the ownership of files in the
@@ -270,6 +272,8 @@ def move_to_relarea(m, args, movelist):
 
 
 def move_to_vault(args, movelist):
+    if movelist:
+        logging.info("move from release area to vault:")
     move(args, movelist, args.rel_area, args.vault)
 
 


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