public inbox for cygwin-apps-cvs@sourceware.org
help / color / mirror / Atom feed
* [calm - Cygwin server-side packaging maintenance script] branch master, updated. 20190530-23-ga650a81
@ 2019-06-15 14:24 jturney
  0 siblings, 0 replies; only message in thread
From: jturney @ 2019-06-15 14:24 UTC (permalink / raw)
  To: cygwin-apps-cvs




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

commit a650a81c43b11560a7c7b87660b9920c2858e285
Author: Jon Turney <jon.turney@dronecode.org.uk>
Date:   Fri Jun 14 18:57:17 2019 +0100

    Backup existing .hint in fix-skip-only-hint
    
    Also arrange for calm to ignore those .bak files
    
    Also fix a latent bug when more than one ignorable file exists for a
    package

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

commit a81cbc6f04c43720b6f80b1f1c61ea5590bff0a0
Author: Jon Turney <jon.turney@dronecode.org.uk>
Date:   Fri Jun 14 14:58:20 2019 +0100

    Log permission denied in utils.touch
    
    Log permission denied in utils.touch, rather than throwing an exception


Diff:
---
 calm/fix-skip-only-hint.py |    2 ++
 calm/package.py            |    6 +++---
 calm/utils.py              |    8 ++++++--
 3 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/calm/fix-skip-only-hint.py b/calm/fix-skip-only-hint.py
index 9f3c49c..4ea0b1b 100644
--- a/calm/fix-skip-only-hint.py
+++ b/calm/fix-skip-only-hint.py
@@ -30,6 +30,7 @@
 import argparse
 import os
 import re
+import shutil
 import sys
 
 from . import common_constants
@@ -169,6 +170,7 @@ def fix_one_hint(dirpath, hintfile, vr, later_vrs):
         hints['sdesc'] = '"' + sdesc + '"'
 
     print('writing invented hints for %s' % (hintfile))
+    shutil.copy2(os.path.join(dirpath, hintfile), os.path.join(dirpath, hintfile + '.bak'))
     hint_file_write(os.path.join(dirpath, hintfile), hints)
 
     return (1, 1)
diff --git a/calm/package.py b/calm/package.py
index 838e4fc..7e7bb6a 100755
--- a/calm/package.py
+++ b/calm/package.py
@@ -329,9 +329,9 @@ def read_package(packages, basedir, dirpath, files, remove=[]):
             hints[ovr] = hintobj
             actual_tars[ovr] = tars[vr]
 
-        # ignore dotfiles
-        for f in files:
-            if f.startswith('.'):
+        # ignore dotfiles and backup files
+        for f in files[:]:
+            if f.startswith('.') or f.endswith('.bak'):
                 files.remove(f)
 
         # warn about unexpected files, including tarfiles which don't match the
diff --git a/calm/utils.py b/calm/utils.py
index 07e45a0..7c33ac7 100644
--- a/calm/utils.py
+++ b/calm/utils.py
@@ -25,6 +25,7 @@
 # utility functions
 #
 
+import logging
 import os
 
 
@@ -32,5 +33,8 @@ import os
 # touch a file
 #
 def touch(fn, times=None):
-    with open(fn, 'a'):
-        os.utime(fn, times)
+    try:
+        with open(fn, 'a'):  # ensure fn exists
+            os.utime(fn, times)
+    except PermissionError:
+        logging.error("couldn't update mtime for %s" % (fn))


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

only message in thread, other threads:[~2019-06-15 14:24 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-15 14:24 [calm - Cygwin server-side packaging maintenance script] branch master, updated. 20190530-23-ga650a81 jturney

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).