[calm - Cygwin server-side packaging maintenance script] branch master, updated. 20190530-23-ga650a81
jturney@sourceware.org
jturney@sourceware.org
Sat Jun 15 14:24:00 GMT 2019
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))
More information about the Cygwin-apps-cvs
mailing list