From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11192 invoked by alias); 15 Jun 2019 14:24:23 -0000 Mailing-List: contact cygwin-apps-cvs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: cygwin-apps-cvs-owner@sourceware.org Received: (qmail 11149 invoked by uid 9795); 15 Jun 2019 14:24:23 -0000 Date: Sat, 15 Jun 2019 14:24:00 -0000 Message-ID: <20190615142423.11138.qmail@sourceware.org> From: jturney@sourceware.org To: cygwin-apps-cvs@sourceware.org Subject: [calm - Cygwin server-side packaging maintenance script] branch master, updated. 20190530-23-ga650a81 X-Git-Refname: refs/heads/master X-Git-Reftype: branch X-Git-Oldrev: 0c3affa71ccf8965269f2c4eaab54f7aa189ddb1 X-Git-Newrev: a650a81c43b11560a7c7b87660b9920c2858e285 X-SW-Source: 2019-q2/txt/msg00022.txt.bz2 https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/calm.git;h=a650a81c43b11560a7c7b87660b9920c2858e285 commit a650a81c43b11560a7c7b87660b9920c2858e285 Author: Jon Turney 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 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))