Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/cygwin-apps/calm.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJon Turney <jon.turney@dronecode.org.uk>2017-04-05 22:31:23 +0300
committerJon Turney <jon.turney@dronecode.org.uk>2017-04-07 13:28:38 +0300
commita0f957c7f24fa0492a5149ce6119e2418540fc89 (patch)
treec193a8b5cc66e5fd20ccb521c606bb23bbdd9b4e
parentd752429b9a02d32305c46ca13b90ef65fd27eb01 (diff)
Clean setup.hint files which aren't used by any version
Should be controlled by --dry-run, but isn't We avoid doing this for uploads, since setup.hint uploads are treated specially, to allow the hint to be changed
-rwxr-xr-xcalm/package.py8
-rw-r--r--calm/uploads.py2
2 files changed, 8 insertions, 2 deletions
diff --git a/calm/package.py b/calm/package.py
index 5d58ddc..ed96085 100755
--- a/calm/package.py
+++ b/calm/package.py
@@ -149,7 +149,7 @@ def clean_hints(p, hints, strict_lvl, warnings):
#
# read a single package
#
-def read_package(packages, basedir, dirpath, files, strict=False, remove=[]):
+def read_package(packages, basedir, dirpath, files, strict=False, remove=[], upload=False):
strict_lvl = logging.ERROR if strict else logging.WARNING
relpath = os.path.relpath(dirpath, basedir)
warnings = False
@@ -170,6 +170,7 @@ def read_package(packages, basedir, dirpath, files, strict=False, remove=[]):
# read setup.hint
legacy = 'setup.hint' in files
+ legacy_used = False
if legacy:
hints = read_hints(p, os.path.join(dirpath, 'setup.hint'), hint.setup)
if not hints:
@@ -295,6 +296,7 @@ def read_package(packages, basedir, dirpath, files, strict=False, remove=[]):
elif legacy:
# otherwise, use setup.hint
pvr_hint = hints
+ legacy_used = True
else:
# it's an error to not have either a setup.hint or a pvr.hint
logging.error("package %s has packages for version %s, but no %s or setup.hint" % (p, vr, hint_fn))
@@ -313,6 +315,10 @@ def read_package(packages, basedir, dirpath, files, strict=False, remove=[]):
logging.log(strict_lvl, "unexpected files in %s: %s" % (p, ', '.join(files)))
warnings = True
+ if not upload and legacy and not legacy_used:
+ logging.warning("package '%s' has a setup.hint which no version uses, removing it" % (p))
+ os.unlink(os.path.join(dirpath, 'setup.hint'))
+
packages[p].version_hints = version_hints
packages[p].override_hints = override_hints
packages[p].legacy_hints = hints
diff --git a/calm/uploads.py b/calm/uploads.py
index 15a6c3c..fea5b55 100644
--- a/calm/uploads.py
+++ b/calm/uploads.py
@@ -214,7 +214,7 @@ def scan(m, all_packages, arch, args):
# read and validate package
if files:
# strict means we consider warnings as fatal for upload
- if package.read_package(packages, m.homedir(), dirpath, files, strict=True, remove=removed_files):
+ if package.read_package(packages, m.homedir(), dirpath, files, strict=True, remove=removed_files, upload=True):
error = True
# always consider timestamp as checked during a dry-run, so it is never