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>2020-02-18 23:54:06 +0300
committerJon Turney <jon.turney@dronecode.org.uk>2020-03-26 17:25:24 +0300
commit93c56730ba3f297e3a83b99d9ceabd77da7afbf3 (patch)
treeb293df43a1891309c7768d3da696a281e669afb5
parentc2e8e9abc448e040ed93f58d6ec2238f30f54613 (diff)
Add support for a homepage: key in source package hint
Report it in json dump Report it on package summary package
-rwxr-xr-xcalm/hint.py9
-rwxr-xr-xcalm/package.py5
-rwxr-xr-xcalm/pkg2html.py3
3 files changed, 14 insertions, 3 deletions
diff --git a/calm/hint.py b/calm/hint.py
index 19b16ff..6e709f0 100755
--- a/calm/hint.py
+++ b/calm/hint.py
@@ -37,7 +37,7 @@ import argparse
keytypes = ['multilineval', 'val', 'optval', 'noval']
# kinds of hint file, and their allowed keys
-pvr, override = range(2)
+pvr, override, spvr = range(3)
hintkeys = {}
@@ -60,6 +60,11 @@ hintkeys[pvr] = {
'notes': 'val', # tool notes; not significant to calm itself
}
+hintkeys[spvr] = hintkeys[pvr].copy()
+hintkeys[spvr].update({
+ 'homepage': 'val',
+})
+
hintkeys[override] = {
'curr': 'val',
'keep': 'val',
@@ -281,7 +286,7 @@ def hint_file_parse(fn, kind):
# for the pvr kind, 'category' and 'sdesc' must be present
# XXX: genini also requires 'requires' but that seems wrong
- if kind == pvr:
+ if kind != override:
mandatory = ['category', 'sdesc']
for k in mandatory:
if k not in hints:
diff --git a/calm/package.py b/calm/package.py
index 99a76e5..c57ad91 100755
--- a/calm/package.py
+++ b/calm/package.py
@@ -378,7 +378,7 @@ def read_one_package(packages, p, relpath, dirpath, files, remove, kind):
hint_fn = '%s-%s%s.hint' % (p, vr, '-src' if kind == Kind.source else '')
if hint_fn in files:
# is there a PVR.hint file?
- pvr_hint = read_hints(p, os.path.join(dirpath, hint_fn), hint.pvr)
+ pvr_hint = read_hints(p, os.path.join(dirpath, hint_fn), hint.pvr if kind == Kind.binary else hint.spvr)
if not pvr_hint:
logging.error("error parsing %s" % (os.path.join(dirpath, hint_fn)))
return True
@@ -1190,6 +1190,9 @@ def write_repo_json(args, packages, f):
'arches': arches,
}
+ if 'homepage' in po.version_hints[bv]:
+ d['homepage'] = po.version_hints[bv]['homepage']
+
if pkg_maintainers[po.orig_name] and ('ORPHANED' not in pkg_maintainers[po.orig_name]):
d['maintainers'] = sorted(pkg_maintainers[po.orig_name])
diff --git a/calm/pkg2html.py b/calm/pkg2html.py
index b6c5490..f554f39 100755
--- a/calm/pkg2html.py
+++ b/calm/pkg2html.py
@@ -233,6 +233,9 @@ def update_package_listings(args, packages):
if po.kind == package.Kind.source:
es = p
print('<span class="detail">install package(s)</span>: %s<br><br>' % ', '.join([linkify_package(p) for p in sorted(po.is_used_by)]), file=f)
+ homepage = po.version_hints[po.best_version].get('homepage', None)
+ if homepage:
+ print('<span class="detail">homepage</span>: <a href="%s">%s</a><br><br>' % (homepage, homepage), file=f)
else:
es = po.version_hints[bv].get('external-source', p + '-src')
print('<span class="detail">source package</span>: %s<br><br>' % linkify_package(es), file=f)