~abcdw/rde-devel

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
3 2

[PATCH 1/2] rde: predicates: Improve list-of-elisp-packages? predicate.

Details
Message ID
<20230326100002.10164-1-jgart@dismail.de>
DKIM signature
missing
Download raw message
Patch: +7 -1
---

hi, this improves the list-of-elisp-packages? predicate...or so i hope ;()

wdyt

 src/rde/features/predicates.scm | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/rde/features/predicates.scm b/src/rde/features/predicates.scm
index d5fecf4..2d6c6f4 100644
--- a/src/rde/features/predicates.scm
+++ b/src/rde/features/predicates.scm
@@ -8,6 +8,7 @@
  #:use-module (gnu system mapped-devices)

  #:use-module (srfi srfi-1)
  #:use-module (guix build-system)
  #:use-module (guix packages)
  #:use-module (guix inferior)
  #:use-module (guix gexp)
@@ -64,8 +65,13 @@
(define-public (list-of-packages? lst)
  (and (list? lst) (every any-package? lst)))

(define (elisp-package? x)
  (equal? 'emacs
          (build-system-name (package-build-system x))))

(define-public (list-of-elisp-packages? lst)
  (list-of-packages? lst))
  (and (list-of-packages? lst)
       (map elisp-package? lst)))

(define-public (list-of-services? lst)
  (and (list? lst) (every service? lst)))
-- 
2.39.2

[PATCH 2/2] tests: Add a test for list-of-elisp-packages?.

Details
Message ID
<20230326100002.10164-2-jgart@dismail.de>
In-Reply-To
<20230326100002.10164-1-jgart@dismail.de> (view parent)
DKIM signature
missing
Download raw message
Patch: +33 -0
---
 tests/rde/tests/predicates.scm | 33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)
 create mode 100644 tests/rde/tests/predicates.scm

diff --git a/tests/rde/tests/predicates.scm b/tests/rde/tests/predicates.scm
new file mode 100644
index 0000000..36d3ff3
--- /dev/null
+++ b/tests/rde/tests/predicates.scm
@@ -0,0 +1,33 @@
;;; rde --- Reproducible development environment.
;;;
;;; Copyright © 2023 jgart <jgart@dismail.de>
;;;
;;; This file is part of rde.
;;;
;;; rde is free software; you can redistribute it and/or modify it
;;; under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or (at
;;; your option) any later version.
;;;
;;; rde is distributed in the hope that it will be useful, but
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with rde.  If not, see <http://www.gnu.org/licenses/>.

(define-module (rde tests predicates)
  #:use-module (rde features predicates)
  #:use-module (gnu packages admin)
  #:use-module (gnu packages emacs-xyz)
  #:use-module (srfi srfi-64)
  #:use-module (ice-9 match))

(define-test package-predicates
  (test-group "list-of-elisp-packages"
    (test-equal "booleans"
      '(#t #f #t #t #f)
      (list-of-elisp-packages?
        `(emacs-magit nnn emacs-denote emacs-corfu tcpdump)))))

-- 
2.39.2
Details
Message ID
<877cuyae89.fsf@trop.in>
In-Reply-To
<20230326100002.10164-1-jgart@dismail.de> (view parent)
DKIM signature
missing
Download raw message
On 2023-03-26 05:00, jgart wrote:

> ---
>
> hi, this improves the list-of-elisp-packages? predicate...or so i hope ;()
>
> wdyt

Unfortunately, it won't work, because some emacs packages are built with
build-systems other than emacs-build-system :)  For example emacs-howm.

>
> src/rde/features/predicates.scm | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/src/rde/features/predicates.scm b/src/rde/features/predicates.scm
> index d5fecf4..2d6c6f4 100644
> --- a/src/rde/features/predicates.scm
> +++ b/src/rde/features/predicates.scm
> @@ -8,6 +8,7 @@
>    #:use-module (gnu system mapped-devices)
>  
>    #:use-module (srfi srfi-1)
> +  #:use-module (guix build-system)
>    #:use-module (guix packages)
>    #:use-module (guix inferior)
>    #:use-module (guix gexp)
> @@ -64,8 +65,13 @@
>  (define-public (list-of-packages? lst)
>    (and (list? lst) (every any-package? lst)))
>  
> +(define (elisp-package? x)
> +  (equal? 'emacs
> +          (build-system-name (package-build-system x))))
> +
>  (define-public (list-of-elisp-packages? lst)
> -  (list-of-packages? lst))
> +  (and (list-of-packages? lst)
> +       (map elisp-package? lst)))
>  
>  (define-public (list-of-services? lst)
>    (and (list? lst) (every service? lst)))

-- 
Best regards,
Andrew Tropin

Re: [PATCH 2/2] tests: Add a test for list-of-elisp-packages?.

Details
Message ID
<874jq2adwj.fsf@trop.in>
In-Reply-To
<20230326100002.10164-2-jgart@dismail.de> (view parent)
DKIM signature
missing
Download raw message
On 2023-03-26 05:00, jgart wrote:

> ---
>  tests/rde/tests/predicates.scm | 33 +++++++++++++++++++++++++++++++++
>  1 file changed, 33 insertions(+)
>  create mode 100644 tests/rde/tests/predicates.scm
>
> diff --git a/tests/rde/tests/predicates.scm b/tests/rde/tests/predicates.scm
> new file mode 100644
> index 0000000..36d3ff3
> --- /dev/null
> +++ b/tests/rde/tests/predicates.scm
> @@ -0,0 +1,33 @@
> +;;; rde --- Reproducible development environment.
> +;;;
> +;;; Copyright © 2023 jgart <jgart@dismail.de>
> +;;;
> +;;; This file is part of rde.
> +;;;
> +;;; rde is free software; you can redistribute it and/or modify it
> +;;; under the terms of the GNU General Public License as published by
> +;;; the Free Software Foundation; either version 3 of the License, or (at
> +;;; your option) any later version.
> +;;;
> +;;; rde is distributed in the hope that it will be useful, but
> +;;; WITHOUT ANY WARRANTY; without even the implied warranty of
> +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> +;;; GNU General Public License for more details.
> +;;;
> +;;; You should have received a copy of the GNU General Public License
> +;;; along with rde.  If not, see <http://www.gnu.org/licenses/>.
> +
> +(define-module (rde tests predicates)
> +  #:use-module (rde features predicates)
> +  #:use-module (gnu packages admin)
> +  #:use-module (gnu packages emacs-xyz)
> +  #:use-module (srfi srfi-64)
> +  #:use-module (ice-9 match))
> +
> +(define-test package-predicates

Probably it won't work, as define-test is provided by (rde tests), which
is not imported here.

Also, it's better not to use srfi-64 directly, but use symbols
re-exported by (rde tests) as we can change underlying implementation
someday (maybe never, but still).

> +  (test-group "list-of-elisp-packages"
> +    (test-equal "booleans"
> +      '(#t #f #t #t #f)
> +      (list-of-elisp-packages?
> +        `(emacs-magit nnn emacs-denote emacs-corfu tcpdump)))))
> +

Thank you for the patch and it's really cool that you added a test, but
marking it as REJECTED due to the reason mentioned in a previous reply.

-- 
Best regards,
Andrew Tropin
Reply to thread Export thread (mbox)