On 22/05/2024 01:35, Christoph Anton Mitterer wrote:
From: Christoph Anton Mitterer <m...@christoph.anton.mitterer.name>

Thanks very much for this patch.

Both, package names and version numbers, are allowed to contain `-`, which makes
the output of `cygcheck --find-package` not parseable.

So, this isn't really true, per the rules [1]. However, there are some historical exceptions [2], which ideally we'd remove or replace.

Even with those exceptions, I think the heuristic of (i) split PVR on the leftmost hyphen followed by a digit, to split P and VR, (ii) then split VR on the rightmost hyphen, to split V and R, always gives the right answer.

[1] https://cygwin.com/packaging-package-files.html
[2] https://cygwin.com/cgit/cygwin-apps/calm/tree/calm/past_mistakes.py#n30

This changes the separator between package name and version to be a space, which
is not allowed in package names.

That's not to say something like this isn't a good idea, but I think it would perhaps be better to have an option explicitly produce something machine readable (as csv or whatever...)


Signed-off-by: Christoph Anton Mitterer <m...@christoph.anton.mitterer.name>
---
  winsup/utils/mingw/dump_setup.cc | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/winsup/utils/mingw/dump_setup.cc b/winsup/utils/mingw/dump_setup.cc
index 050679a0d..e30f0f8ed 100644
--- a/winsup/utils/mingw/dump_setup.cc
+++ b/winsup/utils/mingw/dump_setup.cc
@@ -590,7 +590,7 @@ package_find (int verbose, char **argv)
                {
                  if (verbose)
                    printf ("%s: found in package ", filename);
-                 printf ("%s-%s\n", packages[i].name, packages[i].ver);
+                 printf ("%s %s\n", packages[i].name, packages[i].ver);
                }
            }
        }

Reply via email to