time-travel-manifest.scm 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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. ;;; This file returns a manifest containing entries to build past Guix
  19. ;;; releases from the current Guix, as per 'guix time-machine'.
  20. (use-modules (srfi srfi-9) (ice-9 match)
  21. (guix channels) (guix gexp)
  22. ((guix store) #:select (%store-monad))
  23. ((guix monads) #:select (mparameterize return))
  24. ((guix git) #:select (%repository-cache-directory))
  25. ((guix build utils) #:select (mkdir-p)))
  26. ;; Representation of the latest channels. This type exists just so we can
  27. ;; refer to such records in a gexp.
  28. (define-record-type <guix-instance>
  29. (guix-instance channels)
  30. guix-instance?
  31. (channels guix-instance-channels))
  32. (define-gexp-compiler (guix-instance-compiler (instance <guix-instance>)
  33. system target)
  34. (match instance
  35. (($ <guix-instance> channels)
  36. ;; When this manifest is evaluated by Cuirass, make sure it does not
  37. ;; fiddle with the cached checkout that Cuirass is also using since
  38. ;; concurrent accesses are unsafe.
  39. (mparameterize %store-monad ((%repository-cache-directory
  40. (string-append (%repository-cache-directory)
  41. "/time-travel/" system)))
  42. (return (mkdir-p (%repository-cache-directory)))
  43. (latest-channel-derivation channels)))))
  44. (define (guix-instance->manifest-entry instance)
  45. "Return a manifest entry for INSTANCE."
  46. (define (shorten commit)
  47. (string-take commit 7))
  48. (manifest-entry
  49. (name "guix")
  50. (version (string-join (map (compose shorten channel-commit)
  51. (guix-instance-channels instance))
  52. "-"))
  53. (item instance)))
  54. (define (commit->guix-instance commit)
  55. "Return a Guix instance for COMMIT."
  56. (guix-instance (list (channel
  57. (inherit %default-guix-channel)
  58. (commit commit)))))
  59. (define %release-commits
  60. ;; Release commits: the list of version/commit pairs.
  61. '(("1.3.0" . "a0178d34f582b50e9bdbb0403943129ae5b560ff")
  62. ("1.2.0" . "a099685659b4bfa6b3218f84953cbb7ff9e88063")
  63. ("1.1.0" . "d62c9b2671be55ae0305bebfda17b595f33797f2")
  64. ("1.0.1" . "d68de958b60426798ed62797ff7c96c327a672ac")
  65. ("1.0.0" . "6298c3ffd9654d3231a6f25390b056483e8f407c")
  66. ("0.16.0" . "4a0b87f0ec5b6c2dcf82b372dd20ca7ea6acdd9c")))
  67. (manifest
  68. (map (match-lambda
  69. ((version . commit)
  70. (let ((entry (guix-instance->manifest-entry
  71. (commit->guix-instance commit))))
  72. (manifest-entry
  73. (inherit entry)
  74. (version version)))))
  75. %release-commits))