diff options
author | Jon Turney <jon.turney@dronecode.org.uk> | 2019-06-14 20:57:17 +0300 |
---|---|---|
committer | Jon Turney <jon.turney@dronecode.org.uk> | 2019-06-15 01:29:59 +0300 |
commit | a650a81c43b11560a7c7b87660b9920c2858e285 (patch) | |
tree | 849e6ae2335b5a0b60db8b0616d2760548bef37f | |
parent | a81cbc6f04c43720b6f80b1f1c61ea5590bff0a0 (diff) |
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
-rw-r--r-- | calm/fix-skip-only-hint.py | 2 | ||||
-rwxr-xr-x | calm/package.py | 6 |
2 files changed, 5 insertions, 3 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 |