public inbox for cygwin-apps-cvs@sourceware.org
help / color / mirror / Atom feed
From: jturney@sourceware.org
To: cygwin-apps-cvs@sourceware.org
Subject: [calm - Cygwin server-side packaging maintenance script] branch master, updated. 20190530-23-ga650a81
Date: Sat, 15 Jun 2019 14:24:00 -0000	[thread overview]
Message-ID: <20190615142423.11138.qmail@sourceware.org> (raw)




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


                 reply	other threads:[~2019-06-15 14:24 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190615142423.11138.qmail@sourceware.org \
    --to=jturney@sourceware.org \
    --cc=cygwin-apps-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).