Subject: [bug#58660] [PATCH v2 2/3] etc: teams: Sort and itemize 'scope' field.

From: zimoun <[email-masked]>
Date: Mon, 21 Nov 2022 15:11:33 +0100

Hi Mathieu,

On Fri, 18 Nov 2022 at 18:23, Mathieu Othacehe <[email-masked]> wrote:

> Why not:
>
> (scope (format #f "scope:~%~{+ ~s ~}~%" scope))

Because this does not “itemize” correctly.  For instance, it outputs:

--8<---------------cut here---------------start------------->8---
id: python
name: Python team
description: Python, Python packages, the "pypi" importer, and the python-build-system.
scope:
+ "gnu/packages/django.scm" + "gnu/packages/jupyter.scm" + #<regexp 7f408800d500> + "gnu/packages/sphinx.scm" + "gnu/packages/tryton.scm" + "guix/build/pyproject-build-system.scm" + "guix/build-system/pyproject.scm" + "guix/build/python-build-system.scm" + "guix/build-system/python.scm" + "guix/import/pypi.scm" + "guix/scripts/import/pypi.scm" + "tests/pypi.scm" 
members:
+ Lars-Dominik Braun <[email-masked]>
+ jgart <[email-masked]>
--8<---------------cut here---------------end--------------->8---

When what we want is:

--8<---------------cut here---------------start------------->8---
scope:
+ "gnu/packages/django.scm"
+ "gnu/packages/jupyter.scm"
+ #<regexp 7f408800d500>
+ "gnu/packages/sphinx.scm"
+ "gnu/packages/tryton.scm"
+ "guix/build/pyproject-build-system.scm"
+ "guix/build-system/pyproject.scm"
+ "guix/build/python-build-system.scm"
+ "guix/build-system/python.scm"
+ "guix/import/pypi.scm"
+ "guix/scripts/import/pypi.scm"
+ "tests/pypi.scm" 
--8<---------------cut here---------------end--------------->8---

Well, the ’~%’ is included:

    (scope (format #f "scope:~%~{+ ~s~% ~}~%" scope))))

then there is one extra:

--8<---------------cut here---------------start------------->8---
id: python
name: Python team
description: Python, Python packages, the "pypi" importer, and the python-build-system.
scope:
+ "gnu/packages/django.scm"
 + "gnu/packages/jupyter.scm"
 + #<regexp 7f40de756500>
 + "gnu/packages/sphinx.scm"
 + "gnu/packages/tryton.scm"
 + "guix/build/pyproject-build-system.scm"
 + "guix/build-system/pyproject.scm"
 + "guix/build/python-build-system.scm"
 + "guix/build-system/python.scm"
 + "guix/import/pypi.scm"
 + "guix/scripts/import/pypi.scm"
 + "tests/pypi.scm"
 
members:
+ Lars-Dominik Braun <[email-masked]>
+ jgart <[email-masked]>
--8<---------------cut here---------------end--------------->8---

>> +                  string<=?)))))
>
> At that point, scope is not always a string:
>
> --8<---------------cut here---------------start------------->8---
> ERROR: In procedure string<=?:
> In procedure string<=: Wrong type argument in position 1 (expecting string): #<regexp 7fd842030980>
> --8<---------------cut here---------------end--------------->8---

Hum, I miss how you get that.  This,

    (map (lambda (scope) (format #f "+ ~a~%" scope)) scope-files)

transforms all as string.  For instance, applying this patch on the top
of the introduction of “./etc/teams.scm show”, I get:

--8<---------------cut here---------------start------------->8---
id: python
name: Python team
description: Python, Python packages, the "pypi" importer, and the python-build-system.
scope:
+ #<regexp 7fc05bdd6500>
+ gnu/packages/django.scm
+ gnu/packages/jupyter.scm
+ gnu/packages/sphinx.scm
+ gnu/packages/tryton.scm
+ guix/build-system/pyproject.scm
+ guix/build-system/python.scm
+ guix/build/pyproject-build-system.scm
+ guix/build/python-build-system.scm
+ guix/import/pypi.scm
+ guix/scripts/import/pypi.scm
+ tests/pypi.scm
members:
+ Lars-Dominik Braun <[email-masked]>
+ jgart <[email-masked]>
--8<---------------cut here---------------end--------------->8---

Cheers,
simon