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>2018-03-01 19:13:01 +0300
committerJon Turney <jon.turney@dronecode.org.uk>2019-05-29 14:30:44 +0300
commit9088dbed4223bfc2ba47c1971c44d7b699268ef4 (patch)
tree3dc418987b0dbeb102a4d1c005031e6df65550a2
parent0089c50d8bb9338941ac56c82d571721adfa7597 (diff)
Remove reading setup.hint files
-rwxr-xr-xcalm/hint.py53
-rwxr-xr-xcalm/package.py56
-rw-r--r--calm/uploads.py6
3 files changed, 22 insertions, 93 deletions
diff --git a/calm/hint.py b/calm/hint.py
index e32d095..6e1a948 100755
--- a/calm/hint.py
+++ b/calm/hint.py
@@ -29,15 +29,6 @@ from collections import OrderedDict
import re
import argparse
-
-# helper function to merge dicts
-def merge_dicts(x, *y):
- z = x.copy()
- for i in y:
- z.update(i)
- return z
-
-
# types of key:
# 'multilineval' - always have a value, which may be multiline
# 'val' - always have a value
@@ -46,24 +37,32 @@ def merge_dicts(x, *y):
keytypes = ['multilineval', 'val', 'optval', 'noval']
# kinds of hint file, and their allowed keys
-setup, pvr, override = range(3)
+pvr, override = range(2)
+
+hintkeys = {}
-commonkeys = {
+hintkeys[pvr] = {
'ldesc': 'multilineval',
'message': 'multilineval',
'category': 'val',
'external-source': 'val',
'sdesc': 'val',
'skip': 'noval',
+ 'requires': 'optval',
+ 'depends': 'optval',
+ 'build-depends': 'optval',
+ 'obsoletes': 'optval',
+ 'test': 'noval', # mark the package as a test version
+ 'version': 'val', # version override
+ 'disable-check': 'val',
+ 'provides': 'val',
+ 'conflicts': 'val',
}
-versionkeys = {
+hintkeys[override] = {
'curr': 'val',
'prev': 'val',
'test': 'val',
-}
-
-overridekeys = {
'keep': 'val',
'keep-count': 'val',
'keep-days': 'val',
@@ -71,26 +70,6 @@ overridekeys = {
'replace-versions': 'val',
}
-hintkeys = {}
-
-hintkeys[setup] = merge_dicts(commonkeys, versionkeys, {
- 'requires': 'optval',
-})
-
-hintkeys[pvr] = merge_dicts(commonkeys, {
- 'requires': 'optval',
- 'depends': 'optval',
- 'build-depends': 'optval',
- 'obsoletes': 'optval',
- 'test': 'noval', # mark the package as a test version
- 'version': 'val', # version override
- 'disable-check': 'val',
- 'provides': 'val',
- 'conflicts': 'val',
-})
-
-hintkeys[override] = merge_dicts(versionkeys, overridekeys)
-
# valid categories
categories = ['accessibility',
'admin',
@@ -291,10 +270,10 @@ def hint_file_parse(fn, kind):
else:
errors.append("unknown construct '%s' at line %d" % (item, i))
- # for setup and pvr kinds, if 'skip' isn't present, 'category' and
+ # for the pvr kind, if 'skip' isn't present, 'category' and
# 'sdesc' must be
# XXX: genini also requires 'requires' but that seems wrong
- if 'skip' not in hints and kind != override:
+ if 'skip' not in hints and kind == pvr:
mandatory = ['category', 'sdesc']
for k in mandatory:
if k not in hints:
diff --git a/calm/package.py b/calm/package.py
index 5710185..95ea7cb 100755
--- a/calm/package.py
+++ b/calm/package.py
@@ -162,7 +162,7 @@ def clean_hints(p, hints, warnings):
#
# read a single package
#
-def read_package(packages, basedir, dirpath, files, remove=[], upload=False):
+def read_package(packages, basedir, dirpath, files, remove=[]):
relpath = os.path.relpath(dirpath, basedir)
warnings = False
@@ -180,21 +180,8 @@ def read_package(packages, basedir, dirpath, files, remove=[], upload=False):
(dirpath, packages[p].path))
return True
- # 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:
- logging.error("error parsing %s" % (os.path.join(dirpath, 'setup.hint')))
- return True
- warnings = clean_hints(p, hints, warnings)
- files.remove('setup.hint')
- else:
- hints = {}
-
# determine version overrides
- note_absent = ('override.hint' in remove) or ('override.hint' in files) or legacy
+ note_absent = ('override.hint' in remove) or ('override.hint' in files)
if 'override.hint' in files:
# read override.hint
@@ -206,12 +193,6 @@ def read_package(packages, basedir, dirpath, files, remove=[], upload=False):
else:
override_hints = {}
- # if we didn't have a version override hint, extract any version
- # override from legacy hints
- for level in ['test', 'curr', 'prev']:
- if level in hints:
- override_hints[level] = hints[level]
-
# if override.hint exists or is being removed, explicitly note absent
# stability level hints
if note_absent:
@@ -219,12 +200,6 @@ def read_package(packages, basedir, dirpath, files, remove=[], upload=False):
if level not in override_hints:
override_hints[level] = None
- # after we have migrated them to override hints, remove stability
- # level hints from legacy hints
- for level in ['test', 'curr', 'prev']:
- if level in hints:
- del hints[level]
-
# read sha512.sum
sha512 = {}
if 'sha512.sum' not in files:
@@ -318,14 +293,9 @@ def read_package(packages, basedir, dirpath, files, remove=[], upload=False):
return True
warnings = clean_hints(p, pvr_hint, warnings)
files.remove(hint_fn)
- elif legacy:
- # otherwise, use setup.hint
- pvr_hint = hints.copy()
- legacy_used = True
- hint_fn = None
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))
+ # it's an error to not have a pvr.hint
+ logging.error("package %s has packages for version %s, but no %s" % (p, vr, hint_fn))
return True
# apply a version override
@@ -335,8 +305,7 @@ def read_package(packages, basedir, dirpath, files, remove=[], upload=False):
ovr = vr
version_hints[ovr] = pvr_hint
- if hint_fn:
- hint_files[ovr] = hint_fn
+ hint_files[ovr] = hint_fn
actual_tars[ovr] = tars[vr]
# ignore dotfiles
@@ -350,13 +319,8 @@ def read_package(packages, basedir, dirpath, files, remove=[], upload=False):
logging.error("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
packages[p].tars = actual_tars
packages[p].hint_files = hint_files
packages[p].path = relpath
@@ -1129,16 +1093,6 @@ def merge(a, *l):
logging.warning("package '%s' version '%s' hints changed\n%s" % (p, vr, diff))
- # XXX: we should really do something complex here, like
- # assign the legacy hints from b to all vr in a which didn't
- # have a pvr.hint. Instead, just report if it's going to
- # change and let things get sorted out later on...
- if a[p].legacy_hints and b[p].legacy_hints and a[p].legacy_hints != b[p].legacy_hints:
- diff = '\n'.join(difflib.ndiff(
- pprint.pformat(a[p].legacy_hints).splitlines(),
- pprint.pformat(b[p].legacy_hints).splitlines()))
- logging.warning("package '%s' hints changed\n%s" % (p, diff))
-
# overrides from b take precedence
c[p].override_hints.update(b[p].override_hints)
diff --git a/calm/uploads.py b/calm/uploads.py
index 1d8c1bf..69951cf 100644
--- a/calm/uploads.py
+++ b/calm/uploads.py
@@ -197,9 +197,6 @@ def scan(m, all_packages, arch, args):
elif os.path.getsize(fn) != 0:
logging.error("remove file %s is not empty" % fn)
error = True
- elif f == '-setup.hint':
- logging.error("remove file %s is not permitted" % fn)
- error = True
else:
vault[relpath].append(f[1:])
remove_success.append(fn)
@@ -260,8 +257,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, remove=removed_files, upload=True):
+ if package.read_package(packages, m.homedir(), dirpath, files, remove=removed_files):
error = True
# always consider timestamp as checked during a dry-run, so it is never