From: Romain GARBAGE <romain.garbage@inria.fr>
To: 74769@debbugs.gnu.org
Cc: ludovic.courtes@inria.fr, Romain GARBAGE <romain.garbage@inria.fr>
Subject: [bug#74769] [PATCH Cuirass v2 3/7] forges: Add module for common forges utilities.
Date: Thu, 12 Dec 2024 16:57:51 +0100 [thread overview]
Message-ID: <20241212155845.27344-3-romain.garbage@inria.fr> (raw)
In-Reply-To: <20241212155845.27344-1-romain.garbage@inria.fr>
* 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@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@rgarbage.fr>
+;;; Copyright © 2024 Romain Garbage <romain.garbage@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
next prev parent reply other threads:[~2024-12-12 16:00 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-10 16:01 [bug#74769] [PATCH Cuirass 0/4] Forgejo event support Romain GARBAGE
2024-12-10 16:09 ` [bug#74769] [PATCH Cuirass 1/4] tests: Move procedure definition Romain GARBAGE
2024-12-10 16:09 ` [bug#74769] [PATCH Cuirass 2/4] forgejo: Add module for Forgejo JSON objects definition Romain GARBAGE
2024-12-12 13:34 ` Ludovic Courtès
2024-12-10 16:09 ` [bug#74769] [PATCH Cuirass 3/4] tests: Explicit Gitlab endpoint related variables Romain GARBAGE
2024-12-10 16:09 ` [bug#74769] [PATCH Cuirass 4/4] http: Add admin/forgejo/event Romain GARBAGE
2024-12-12 15:57 ` [bug#74769] [PATCH Cuirass v2 1/7] tests: Move procedure definition Romain GARBAGE
2024-12-12 15:57 ` [bug#74769] [PATCH Cuirass v2 2/7] tests: Rename specifications-equal? procedure Romain GARBAGE
2024-12-12 15:57 ` Romain GARBAGE [this message]
2024-12-12 15:57 ` [bug#74769] [PATCH Cuirass v2 4/7] forges: Define default values for specifications Romain GARBAGE
2024-12-12 15:57 ` [bug#74769] [PATCH Cuirass v2 5/7] forgejo: Add module for Forgejo JSON objects definition Romain GARBAGE
2024-12-12 15:57 ` [bug#74769] [PATCH Cuirass v2 6/7] tests: Explicit Gitlab endpoint related variables Romain GARBAGE
2024-12-12 15:57 ` [bug#74769] [PATCH Cuirass v2 7/7] http: Add admin/forgejo/event Romain GARBAGE
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241212155845.27344-3-romain.garbage@inria.fr \
--to=romain.garbage@inria.fr \
--cc=74769@debbugs.gnu.org \
--cc=ludovic.courtes@inria.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).