etc: teams: Add scope support.
[jackhill/guix/guix.git] / etc / time-travel-manifest.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2022 Ludovic Courtès <ludo@gnu.org>
3 ;;;
4 ;;; This file is part of GNU Guix.
5 ;;;
6 ;;; GNU Guix is free software; you can redistribute it and/or modify it
7 ;;; under the terms of the GNU General Public License as published by
8 ;;; the Free Software Foundation; either version 3 of the License, or (at
9 ;;; your option) any later version.
10 ;;;
11 ;;; GNU Guix is distributed in the hope that it will be useful, but
12 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
13 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 ;;; GNU General Public License for more details.
15 ;;;
16 ;;; You should have received a copy of the GNU General Public License
17 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
18
19 ;;; This file returns a manifest containing entries to build past Guix
20 ;;; releases from the current Guix, as per 'guix time-machine'.
21
22 (use-modules (srfi srfi-9) (ice-9 match)
23 (guix channels) (guix gexp)
24 ((guix store) #:select (%store-monad))
25 ((guix monads) #:select (mparameterize return))
26 ((guix git) #:select (%repository-cache-directory))
27 ((guix build utils) #:select (mkdir-p)))
28
29 ;; Representation of the latest channels. This type exists just so we can
30 ;; refer to such records in a gexp.
31 (define-record-type <guix-instance>
32 (guix-instance channels)
33 guix-instance?
34 (channels guix-instance-channels))
35
36 (define-gexp-compiler (guix-instance-compiler (instance <guix-instance>)
37 system target)
38 (match instance
39 (($ <guix-instance> channels)
40 ;; When this manifest is evaluated by Cuirass, make sure it does not
41 ;; fiddle with the cached checkout that Cuirass is also using since
42 ;; concurrent accesses are unsafe.
43 (mparameterize %store-monad ((%repository-cache-directory
44 (string-append (%repository-cache-directory)
45 "/time-travel/" system)))
46 (return (mkdir-p (%repository-cache-directory)))
47 (latest-channel-derivation channels)))))
48
49 (define (guix-instance->manifest-entry instance)
50 "Return a manifest entry for INSTANCE."
51 (define (shorten commit)
52 (string-take commit 7))
53
54 (manifest-entry
55 (name "guix")
56 (version (string-join (map (compose shorten channel-commit)
57 (guix-instance-channels instance))
58 "-"))
59 (item instance)))
60
61 (define (commit->guix-instance commit)
62 "Return a Guix instance for COMMIT."
63 (guix-instance (list (channel
64 (inherit %default-guix-channel)
65 (commit commit)))))
66
67 (define %release-commits
68 ;; Release commits: the list of version/commit pairs.
69 '(("1.3.0" . "a0178d34f582b50e9bdbb0403943129ae5b560ff")
70 ("1.2.0" . "a099685659b4bfa6b3218f84953cbb7ff9e88063")
71 ("1.1.0" . "d62c9b2671be55ae0305bebfda17b595f33797f2")
72 ("1.0.1" . "d68de958b60426798ed62797ff7c96c327a672ac")
73 ("1.0.0" . "6298c3ffd9654d3231a6f25390b056483e8f407c")
74 ("0.16.0" . "4a0b87f0ec5b6c2dcf82b372dd20ca7ea6acdd9c")))
75
76 (manifest
77 (map (match-lambda
78 ((version . commit)
79 (let ((entry (guix-instance->manifest-entry
80 (commit->guix-instance commit))))
81 (manifest-entry
82 (inherit entry)
83 (version version)))))
84 %release-commits))