diff options
author | Jon Turney <jon.turney@dronecode.org.uk> | 2022-09-14 15:21:58 +0300 |
---|---|---|
committer | Jon Turney <jon.turney@dronecode.org.uk> | 2022-09-14 18:57:08 +0300 |
commit | a01c7c3edc8f13a1c8e13238912381cec50c752d (patch) | |
tree | e6d9f9cc65cb9b391024e6154e63db2562307c5e | |
parent | e8fa4d84eb7fd1547bdf4bc63681c096b20ce147 (diff) |
Warn if license: is missing in uploads
-rwxr-xr-x | calm/hint.py | 8 | ||||
-rw-r--r-- | test/testdata/uploads/pkglist.expected | 6 |
2 files changed, 12 insertions, 2 deletions
diff --git a/calm/hint.py b/calm/hint.py index ace6ecd..8990a25 100755 --- a/calm/hint.py +++ b/calm/hint.py @@ -333,6 +333,14 @@ def hint_file_parse(fn, kind, strict=False): if k not in hints: errors.append("required key '%s' missing" % (k)) + suggested = [] + if (kind == spvr) and strict: + suggested.append('license') + + for k in suggested: + if k not in hints: + warnings.append("key '%s' missing" % (k)) + # warn if ldesc and sdesc seem transposed # # (Unfortunately we can't be totally strict about this, as some diff --git a/test/testdata/uploads/pkglist.expected b/test/testdata/uploads/pkglist.expected index 837e898..ae70bb4 100644 --- a/test/testdata/uploads/pkglist.expected +++ b/test/testdata/uploads/pkglist.expected @@ -12,7 +12,8 @@ 'Like it’s you’re Markup Language™ Nokogiri’s tool―that ' 'Bézier."', 'category': 'Devel', - 'homepage': 'http://homepage.url'}}, {}, False), + 'homepage': 'http://homepage.url', + 'parse-warnings': ["key 'license' missing"]}}, {}, False), 'testpackage-subpackage': Package('testpackage/testpackage-subpackage', {'1.0-1': Tar('testpackage-subpackage-1.0-1.tar.bz2', 'x86/release/testpackage/testpackage-subpackage', 'aff488008bee3486e25b539fe6ccd1397bd3c5c0ba2ee2cf34af279554baa195af7493ee51d6f8510735c9a2ea54436d776a71e768165716762aec286abbbf83', 195, False)}, {'1.0-1': {'sdesc': '"A test subpackage"', 'ldesc': '"A test subpackage"', 'category': 'Devel', @@ -27,7 +28,8 @@ 'sdesc': '"test package (zstd compressed)"', 'ldesc': '"test package (zstd compressed)"', 'homepage': 'http://zstd.testpkg.invalid', - 'skip': ''}}, {}, False), + 'skip': '', + 'parse-warnings': ["key 'license' missing"]}}, {}, False), 'testpackage2-subpackage': Package('testpackage2/testpackage2-subpackage', {'1.0-1': Tar('testpackage2-subpackage-1.0-1.tar.bz2', 'x86/release/testpackage2/testpackage2-subpackage', 'c4bf8e28d71b532e2b741e2931906dec0f0a70d4d051c0503476f864a5228f43765ae3342aafcebfd5a1738073537726b2bfbbd89c6da939a5f46d95aca3feaf', 46, True)}, {'1.0-1': {'sdesc': '"A test subpackage 2"', 'ldesc': '"A test subpackage 2"', 'category': 'Devel'}}, {}, False)} |