Package: guix-patches;
Reported by: Romain GARBAGE <romain.garbage <at> inria.fr>
Date: Tue, 10 Dec 2024 16:09:02 UTC
Severity: normal
Tags: patch
Done: Ludovic Courtès <ludovic.courtes <at> inria.fr>
Bug is archived. No further changes may be made.
Message #29 received at 74769 <at> debbugs.gnu.org (full text, mbox):
From: Romain GARBAGE <romain.garbage <at> inria.fr> To: 74769 <at> debbugs.gnu.org Cc: ludovic.courtes <at> inria.fr, Romain GARBAGE <romain.garbage <at> inria.fr> Subject: [PATCH Cuirass v2 3/7] forges: Add module for common forges utilities. Date: Thu, 12 Dec 2024 16:57:51 +0100
* Makefile.am: Update module list. * src/cuirass/forges.scm: New module. * src/cuirass/gitlab.scm: Moved to src/cuirass/forges/gitlab.scm. * src/cuirass/http.scm, tests/gitlab.scm, tests/http.scm: Update module header. --- Makefile.am | 3 +- src/cuirass/forges.scm | 73 +++++++++++++++++++++++++++++ src/cuirass/{ => forges}/gitlab.scm | 41 ++-------------- src/cuirass/http.scm | 2 +- tests/gitlab.scm | 2 +- tests/http.scm | 2 +- 6 files changed, 81 insertions(+), 42 deletions(-) create mode 100644 src/cuirass/forges.scm rename src/cuirass/{ => forges}/gitlab.scm (80%) diff --git a/Makefile.am b/Makefile.am index 1123eb1..2de3419 100644 --- a/Makefile.am +++ b/Makefile.am @@ -52,7 +52,8 @@ dist_pkgmodule_DATA = \ src/cuirass/store.scm \ src/cuirass/base.scm \ src/cuirass/database.scm \ - src/cuirass/gitlab.scm \ + src/cuirass/forges.scm \ + src/cuirass/forges/gitlab.scm \ src/cuirass/http.scm \ src/cuirass/logging.scm \ src/cuirass/mail.scm \ diff --git a/src/cuirass/forges.scm b/src/cuirass/forges.scm new file mode 100644 index 0000000..c05e266 --- /dev/null +++ b/src/cuirass/forges.scm @@ -0,0 +1,73 @@ +;;; forges.scm -- Common forges utilities +;;; Copyright © 2024 Romain Garbage <romain.garbage <at> inria.fr> +;;; +;;; This file is part of Cuirass. +;;; +;;; Cuirass 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. +;;; +;;; Cuirass 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 Cuirass. If not, see <http://www.gnu.org/licenses/>. + +(define-module (cuirass forges) + #:use-module (cuirass specification) + #:use-module (json) + #:use-module (ice-9 match) + #:export (make-jobset-options + jobset-options? + json->jobset-options + jobset-options-name-prefix + jobset-options-build + jobset-options-period + jobset-options-priority + jobset-options-systems)) + +;;; Commentary: +;;; +;;; This module implements objects and default values used in the various +;;; forges modules. +;;; +;;; Code: + +;; This mapping defines a specific JSON dictionary used for tweaking Cuirass +;; options. It is not included in the JSON data sent by default by Gitlab and +;; must be used through the custom template mechanism (see documentation). +(define-json-mapping <jobset-options> + make-jobset-options + jobset-options? + json->jobset-options + (name-prefix jobset-options-name-prefix "name_prefix" + (lambda (v) + (if (unspecified? v) + #f + (string->symbol v)))) + (build jobset-options-build "build" + (match-lambda + ((? unspecified?) + #f) + (((key . val) _ ...) + (cons (string->symbol key) (vector->list val))) + (str + (string->symbol str)))) + (period jobset-options-period "period" + (lambda (v) + (if (unspecified? v) + #f + v))) + (priority jobset-options-priority "priority" + (lambda (v) + (if (unspecified? v) + #f + v))) + (systems jobset-options-systems "systems" + (lambda (v) + (if (unspecified? v) + #f + (vector->list v))))) diff --git a/src/cuirass/gitlab.scm b/src/cuirass/forges/gitlab.scm similarity index 80% rename from src/cuirass/gitlab.scm rename to src/cuirass/forges/gitlab.scm index fcb93bb..56e875a 100644 --- a/src/cuirass/gitlab.scm +++ b/src/cuirass/forges/gitlab.scm @@ -1,5 +1,5 @@ ;;;; gitlab.scm -- Gitlab JSON mappings -;;; Copyright © 2024 Romain Garbage <guix-devel <at> rgarbage.fr> +;;; Copyright © 2024 Romain Garbage <romain.garbage <at> inria.fr> ;;; ;;; This file is part of Cuirass. ;;; @@ -16,7 +16,8 @@ ;;; You should have received a copy of the GNU General Public License ;;; along with Cuirass. If not, see <http://www.gnu.org/licenses/>. -(define-module (cuirass gitlab) +(define-module (cuirass forges gitlab) + #:use-module (cuirass forges) #:use-module (cuirass specification) #:use-module (json) #:use-module (guix channels) @@ -60,42 +61,6 @@ (name gitlab-project-name "name" string->symbol)) -;; This mapping defines a specific JSON dictionary used for tweaking Cuirass -;; options. It is not included in the JSON data sent by default by Gitlab and -;; must be used through the custom template mechanism (see documentation). -(define-json-mapping <jobset-options> - make-jobset-options - jobset-options? - json->jobset-options - (name-prefix jobset-options-name-prefix "name_prefix" - (lambda (v) - (if (unspecified? v) - #f - (string->symbol v)))) - (build jobset-options-build "build" - (match-lambda - ((? unspecified?) - #f) - (((key . val) _ ...) - (cons (string->symbol key) (vector->list val))) - (str - (string->symbol str)))) - (period jobset-options-period "period" - (lambda (v) - (if (unspecified? v) - #f - v))) - (priority jobset-options-priority "priority" - (lambda (v) - (if (unspecified? v) - #f - v))) - (systems jobset-options-systems "systems" - (lambda (v) - (if (unspecified? v) - #f - (vector->list v))))) - (define-json-mapping <gitlab-merge-request> make-gitlab-merge-request gitlab-merge-request? diff --git a/src/cuirass/http.scm b/src/cuirass/http.scm index 881e803..8ea929f 100644 --- a/src/cuirass/http.scm +++ b/src/cuirass/http.scm @@ -27,7 +27,7 @@ #:use-module (cuirass config) #:use-module (cuirass database) #:use-module ((cuirass base) #:select (evaluation-log-file)) - #:use-module (cuirass gitlab) + #:use-module (cuirass forges gitlab) #:use-module (cuirass metrics) #:use-module (cuirass utils) #:use-module (cuirass logging) diff --git a/tests/gitlab.scm b/tests/gitlab.scm index 117a94d..df221bf 100644 --- a/tests/gitlab.scm +++ b/tests/gitlab.scm @@ -16,7 +16,7 @@ ;;; You should have received a copy of the GNU General Public License ;;; along with Cuirass. If not, see <http://www.gnu.org/licenses/>. -(use-modules (cuirass gitlab) +(use-modules (cuirass forges gitlab) (cuirass specification) (cuirass utils) (tests common) diff --git a/tests/http.scm b/tests/http.scm index 7b8ab03..541f30d 100644 --- a/tests/http.scm +++ b/tests/http.scm @@ -22,7 +22,7 @@ (use-modules ((cuirass base) #:select (%bridge-socket-file-name)) (cuirass http) (cuirass database) - (cuirass gitlab) + (cuirass forges gitlab) (cuirass specification) (cuirass utils) (tests common) -- 2.46.0
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.