unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Ludovic Courtès" <ludo@gnu.org>
To: Mathieu Othacehe <othacehe@gnu.org>
Cc: Guix Devel <guix-devel@gnu.org>
Subject: Re: guix weather -m etc/sources-manifest.scm and CI?
Date: Sat, 02 Oct 2021 16:48:34 +0200	[thread overview]
Message-ID: <87sfxjwkhp.fsf@gnu.org> (raw)
In-Reply-To: <87r1d5ozip.fsf@gnu.org> (Mathieu Othacehe's message of "Fri, 01 Oct 2021 09:38:54 +0000")

[-- Attachment #1: Type: text/plain, Size: 586 bytes --]

Hi,

Mathieu Othacehe <othacehe@gnu.org> skribis:

> The issue is that (gnu ci) expects manifests of packages and not
> manifests of origins. Hence, the "job-name" procedure that calls
> "package-name" on an origin fails.

Ah, silly me.

> We could maybe generalize the manifests->packages to support packages
> and origins. The package-job procedure would also need some adjustment
> to call origin->derivation instead of package-derivation.

How about this change?  That will create jobs for manifests containing
any kind of file-like object.

Thanks!

Ludo’.


[-- Attachment #2: Type: text/x-patch, Size: 3524 bytes --]

diff --git a/gnu/ci.scm b/gnu/ci.scm
index ceb1b94af9..e1011355db 100644
--- a/gnu/ci.scm
+++ b/gnu/ci.scm
@@ -1,5 +1,5 @@
 ;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2012-2021 Ludovic Courtès <ludo@gnu.org>
 ;;; Copyright © 2017, 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
 ;;; Copyright © 2018, 2019 Clément Lassieur <clement@lassieur.org>
 ;;; Copyright © 2020 Julien Lepiller <julien@lepiller.eu>
@@ -86,7 +86,7 @@
 (define* (derivation->job name drv
                           #:key
                           (max-silent-time 3600)
-                          (timeout 3600))
+                          (timeout (* 5 3600)))
   "Return a Cuirass job called NAME and describing DRV.
 
 MAX-SILENT-TIME and TIMEOUT are build options passed to the daemon when
@@ -443,19 +443,40 @@ valid."
               (map channel-url channels)))
        arguments))
 
-(define (manifests->packages store manifests)
-  "Return the list of packages found in MANIFESTS."
+(define (manifests->jobs store manifests)
+  "Return the list of jobs for the entries in MANIFESTS, a list of file
+names."
   (define (load-manifest manifest)
     (save-module-excursion
      (lambda ()
        (set-current-module (make-user-module '((guix profiles) (gnu))))
        (primitive-load manifest))))
 
-  (delete-duplicates!
-   (map manifest-entry-item
-        (append-map (compose manifest-entries
-                             load-manifest)
-                    manifests))))
+  (define (manifest-entry-job-name entry)
+    (string-append (manifest-entry-name entry) "-"
+                   (manifest-entry-version entry)))
+
+  (define (manifest-entry->job entry)
+    (let* ((obj (manifest-entry-item entry))
+           (drv (parameterize ((%graft? #f))
+                  (run-with-store store
+                    (lower-object obj))))
+           (max-silent-time (or (and (package? obj)
+                                     (assoc-ref (package-properties obj)
+                                                'max-silent-time))
+                                3600))
+           (timeout (or (and (package? obj)
+                             (assoc-ref (package-properties obj) 'timeout))
+                        (* 5 3600))))
+      (derivation->job (manifest-entry-job-name entry) drv
+                       #:max-silent-time max-silent-time
+                       #:timeout timeout)))
+
+  (map manifest-entry->job
+       (delete-duplicates
+        (append-map (compose manifest-entries load-manifest)
+                    manifests)
+        manifest-entry=?)))
 
 (define (arguments->systems arguments)
   "Return the systems list from ARGUMENTS."
@@ -568,12 +589,8 @@ valid."
                  packages)))
          (('manifests . rest)
           ;; Build packages in the list of manifests.
-          (let* ((manifests (arguments->manifests rest channels))
-                 (packages (manifests->packages store manifests)))
-            (map (lambda (package)
-                   (package-job store (job-name package)
-                                package system))
-                 packages)))
+          (let ((manifests (arguments->manifests rest channels)))
+            (manifests->jobs store manifests)))
          (else
           (error "unknown subset" subset))))
      systems)))

  reply	other threads:[~2021-10-02 14:48 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-15 17:03 guix weather -m etc/sources-manifest.scm and CI? zimoun
2021-09-17  9:49 ` Christopher Baines
2021-09-21  8:32   ` zimoun
2021-09-21 20:36     ` Christopher Baines
2021-09-23 20:18 ` Ludovic Courtès
2021-09-23 20:36   ` zimoun
2021-09-28 12:28     ` Ludovic Courtès
2021-10-01  9:38       ` Mathieu Othacehe
2021-10-02 14:48         ` Ludovic Courtès [this message]
2021-10-02 17:08           ` Mathieu Othacehe

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=87sfxjwkhp.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=guix-devel@gnu.org \
    --cc=othacehe@gnu.org \
    /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).