[calm - Cygwin server-side packaging maintenance script] branch master, updated. 20190530-3-g364bbc4

jturney-9JcytcrH/[email protected]
Newsgroups gmane.os.cygwin.cvs.apps
Message-ID <[email protected]>


https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/calm.git;h=364bbc4fd6d43fda32ebc5711df4d584eec0d65d

commit 364bbc4fd6d43fda32ebc5711df4d584eec0d65d
Author: Jon Turney <[email protected]>
Date:   Fri May 31 18:24:18 2019 +0100

    Include subpackage category in package metadata dump

https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/calm.git;h=156e26806ea0f70e35da9e8836e421097dc52f4c

commit 156e26806ea0f70e35da9e8836e421097dc52f4c
Author: Jon Turney <[email protected]>
Date:   Thu May 30 15:05:54 2019 +0100

    Improve handling of multiline ldesc in package summary page

https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/calm.git;h=f1ea4f74a4c1ec9953fa350fef9e7a1338218f21

commit f1ea4f74a4c1ec9953fa350fef9e7a1338218f21
Author: Jon Turney <[email protected]>
Date:   Thu May 30 16:06:04 2019 +0100

    Use subtest in test_html_write to identify different file


Diff:
---
 calm/package.py   |   10 ++++++++--
 calm/pkg2html.py  |    9 +++++++--
 test/test_calm.py |   17 +++++++++--------
 3 files changed, 24 insertions(+), 12 deletions(-)

diff --git a/calm/package.py b/calm/package.py
index 95ea7cb..502547e 100755
--- a/calm/package.py
+++ b/calm/package.py
@@ -1008,6 +1008,12 @@ def write_repo_json(args, packages, f):
                 po = packages[arch][pn]
                 arches.append(arch)
 
+        def package(p):
+            for arch in common_constants.ARCHES:
+                if p in packages[arch]:
+                    return packages[arch][p]
+            return None
+
         bv = po.best_version
 
         if po.version_hints[bv].get('external-source', None):
@@ -1022,8 +1028,8 @@ def write_repo_json(args, packages, f):
             'name': pn,
             'versions': versions,
             'summary': po.version_hints[bv].get('sdesc', '').strip('"'),
-            'categories': po.version_hints[bv].get('category', '').split(),
-            'subpackages': [{'name': sp} for sp in po.is_used_by],
+            'categories': po.version_hints[bv].get('category', '').split(),  # to be removed
+            'subpackages': [{'name': sp, 'categories': package(sp).version_hints[package(sp).best_version].get('category', '').split()} for sp in po.is_used_by],
             'arches': arches,
         }
 
diff --git a/calm/pkg2html.py b/calm/pkg2html.py
index 1e817a6..c12d811 100755
--- a/calm/pkg2html.py
+++ b/calm/pkg2html.py
@@ -70,7 +70,7 @@ def sdesc(packages, p, bv):
     else:
         header = p
 
-    return header.replace('"', '')
+    return header.strip('"')
 
 
 # ditto for ldesc
@@ -81,7 +81,12 @@ def ldesc(packages, p, bv):
     else:
         header = p
 
-    return header.replace('"', '')
+    header = header.strip('"')
+    header = header.replace('\n\n', '\n<br>\n')
+    # try to recognize things which look like bullet points
+    header = re.sub(r'\n(\s*[*-]\s)', r'<br>\n\1', header)
+
+    return header
 
 
 # ensure a directory exists
diff --git a/test/test_calm.py b/test/test_calm.py
index 48a6020..9fefa19 100755
--- a/test/test_calm.py
+++ b/test/test_calm.py
@@ -173,14 +173,15 @@ class CalmTest(unittest.TestCase):
         for (dirpath, subdirs, files) in os.walk(htdocs):
             relpath = os.path.relpath(dirpath, htdocs)
             for f in files:
-                results = os.path.join(htdocs, relpath, f)
-                expected = os.path.join('testdata/htdocs.expected', relpath, f)
-                if not filecmp.cmp(results, expected, shallow=False):
-                    logging.info("%s different", os.path.join(relpath, f))
-                    with open(results) as r, open(expected) as e:
-                        self.assertMultiLineEqual(e.read(), r.read())
-                else:
-                    logging.info("%s identical", os.path.join(relpath, f))
+                with self.subTest(file=os.path.join(relpath, f)):
+                    results = os.path.join(htdocs, relpath, f)
+                    expected = os.path.join('testdata/htdocs.expected', relpath, f)
+                    if not filecmp.cmp(results, expected, shallow=False):
+                        logging.info("%s different", os.path.join(relpath, f))
+                        with open(results) as r, open(expected) as e:
+                            self.assertMultiLineEqual(e.read(), r.read())
+                    else:
+                        logging.info("%s identical", os.path.join(relpath, f))
 
     def test_version_sort(self):
         test_data = [
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.