aboutsummaryrefslogtreecommitdiff
path: root/build-aux/update-guix-package.scm
blob: 9598872dfd0a44bb253627de0cc35ed9ec5a9a3c (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2017 Ludovic Courtès <ludo@gnu.org>
;;;
;;; This file is part of GNU Guix.
;;;
;;; GNU Guix 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.
;;;
;;; GNU Guix 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 GNU Guix.  If not, see <http://www.gnu.org/licenses/>.

;;; Commentary:
;;;
;;; This scripts updates the definition of the 'guix' package in Guix for the
;;; current commit.  It requires Git to be installed.
;;;
;;; Code:

(use-modules (guix)
             (guix git-download)
             (guix upstream)
             (guix utils)
             (guix base32)
             (guix build utils)
             (gnu packages package-management)
             (ice-9 match))

(define %top-srcdir
  (string-append (current-source-directory) "/.."))

(define version-controlled?
  (git-predicate %top-srcdir))

(define (package-definition-location)
  "Return the source properties of the definition of the 'guix' package."
  (call-with-input-file (location-file (package-location guix))
    (lambda (port)
      (let loop ()
        (match (read port)
          ((? eof-object?)
           (error "definition of 'guix' package could not be found"
                  (port-filename port)))
          (('define-public 'guix value)
           (source-properties value))
          (_
           (loop)))))))

(define* (update-definition commit hash
                            #:key version old-hash)
  "Return a one-argument procedure that takes a string, the definition of the
'guix' package, and returns a string, the update definition for VERSION,
COMMIT."
  (define (linear-offset str line column)
    ;; Return the offset in characters to reach LINE and COLUMN (both
    ;; zero-indexed) in STR.
    (call-with-input-string str
      (lambda (port)
        (let loop ((offset 0))
          (cond ((and (= (port-column port) column)
                      (= (port-line port) line))
                 offset)
                ((eof-object? (read-char port))
                 (error "line and column not reached!"
                        str))
                (else
                 (loop (+ 1 offset))))))))

  (define (update-hash str)
    ;; Replace OLD-HASH with HASH in STR.
    (string-replace-substring str
                              (bytevector->nix-base32-string old-hash)
                              (bytevector->nix-base32-string hash)))

  (lambda (str)
    (match (call-with-input-string str read)
      (('let (('version old-version)
              ('commit old-commit)
              ('revision old-revision))
         defn)
       (let* ((location (source-properties defn))
              (line     (assq-ref location 'line))
              (column   0)
              (offset   (linear-offset str line column)))
         (string-append (format #f "(let ((version \"~a\")
        (commit \"~a\")
        (revision ~a))\n"
                                (or version old-version)
                                commit
                                (if (and version
                                         (not (string=? version old-version)))
                                    0
                                    (+ 1 old-revision)))
                        (string-drop (update-hash str) offset))))
      (exp
       (error "'guix' package definition is not as expected" exp)))))


(define (main . args)
  (match args
    ((commit version)
     (with-store store
       (let* ((source   (add-to-store store
                                      "guix-checkout" ;dummy name
                                      #t "sha256" %top-srcdir
                                      #:select? version-controlled?))
              (hash     (query-path-hash store source))
              (location (package-definition-location))
              (old-hash (origin-sha256 (package-source guix))))
         (edit-expression location
                          (update-definition commit hash
                                             #:old-hash old-hash
                                             #:version version))

         ;; Re-add SOURCE to the store, but this time under the real name used
         ;; in the 'origin'.  This allows us to build the package without
         ;; having to make a real checkout; thus, it also works when working
         ;; on a private branch.
         (reload-module
          (resolve-module '(gnu packages package-management)))

         (let* ((source (add-to-store store
                                      (origin-file-name (package-source guix))
                                      #t "sha256" source))
                (root   (store-path-package-name source)))

           ;; Add an indirect GC root for SOURCE in the current directory.
           (false-if-exception (delete-file root))
           (symlink source root)
           (add-indirect-root store root)

           (format #t "source code for commit ~a: ~a (GC root: ~a)~%"
                   commit source root)))))
    ((commit)
     ;; Automatically deduce the version and revision numbers.
     (main commit #f))))

(apply main (cdr (command-line)))
-08-25gnu: Drop gobject-introspection 1.73.1....The actual gobject-introspection has been newer than its "next" variant for some while. * gnu/packages/glib.scm (gobject-introspection-next): Remove variable. * gnu/packages/gtk.scm (gtksourceview)[native-inputs]: Replace gobject-introspection-next with gobject-introspection. * gnu/packages/guile-xyz.scm (guile-g-golf)[native-inputs]: Likewise. Liliana Marie Prikler 2024-08-18Revert "gnu: at-spi2-core: Remove unnecessary test timeout."...This reverts commit 58a839273d1e4fac2b3a0ec456aabdf82deaa124. Hello I am new here: <cbaines>nckx, 58a839273d1e4fac2b3a0ec456aabdf82deaa124 leads to nearly 4000 rebuilds Tobias Geerinckx-Rice 2024-08-18gnu: at-spi2-core: Remove unnecessary test timeout....Guix provides its own superior-quality time-outs. * gnu/packages/gtk.scm (at-spi2-core)[arguments]: Remove the ‘timeout’ argument from the test invocation. Change-Id: Ic324c5992d48cafa4b6b9856b381d461083d8de2 Signed-off-by: Tobias Geerinckx-Rice <me@tobias.gr> Nikola 2024-07-31gnu: gtk-layer-shell: Update to 0.8.0....* gnu/packages/gtk.scm (gtk-layer-shell): Update to 0.8.0. [native-inputs]: Add vala. Change-Id: Iadf1a502eaac3f5f82ed0624c4e8b80d96e5cea0 Danny Milosavljevic 2024-07-26gnu: gtk: Fix build on aarch64....* gnu/packages/gtk.scm (gtk)[arguments]<#:test-options>: Rename failing test suite to match upstream change on aarch64-linux. Change-Id: Ibdf03a94e71f72283a093cba6d5a328004defa5c Co-authored-by: Ludovic Courtès <ludo@gnu.org> Timotej Lazar 2024-07-07gnu: webp-pixbuf-loader: Update to 0.2.4....* gnu/packages/gtk.scm (webp-pixbuf-loader): Update to 0.2.4. Liliana Marie Prikler 2024-06-24gnu: volctl: Update to 0.9.4....* gnu/packages/gtk.scm (volctl): Update to 0.9.4. Change-Id: I70e85592405d574b692398e6d71d235219fb6fe9 Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com> Sergiu Ivanov 2024-06-03gnu: gtk: Fix build on i686-linux....* gnu/packages/gtk.scm (gtk)[#:phases]<patch>: Add section dedicated to failures on i686-linux. Reviewed-by: Maxim Cournoyer <maxim.cournoyer@gmail.com> Liliana Marie Prikler 2024-06-03gnu: gtk: Update to 4.14.2....* gnu/packages/gtk.scm (gtk): Update to 4.14.2. [#:phases]<patch>: Disable new test failures. [inputs]: Add shaderc. Liliana Marie Prikler 2024-06-03gnu: gtkmm@3: Update to 3.24.9....* gnu/packages/gtk.scm (gtkmm-3): Update to 3.24.9. Change-Id: I63e4cf6d040ff7d147965d5320ab818ff553456b Signed-off-by: Liliana Marie Prikler <liliana.prikler@gmail.com> Vivien Kraus 2024-05-14gnu: cairo: Fix cross-compilation....* gnu/packages/gtk.scm (cairo)[arguments]: Add ‘fix-cross-compilation’ phase when cross-compiling. Change-Id: I3579bb1249c749ee5f164bb4dd47f585b181c2bc Signed-off-by: Zheng Junjie <zhengjunjie@iscas.ac.cn> Zheng Junjie 2024-05-06gnu: graphene: Fix build on armhf-linux....* gnu/packages/gtk.scm (graphene)[arguments]: When building for armhf-linux add a configure-flag to disable neon optimizations. Change-Id: I42b412d3f7536180e959e268b68f2c292edda749 Efraim Flashner 2024-04-09Merge remote-tracking branch 'savannah/master' into mesa-updates...Change-Id: Iad185e2ced97067b3dff8fd722435a6c5e2c00e5 Christopher Baines 2024-04-02gnu: gtk: Fix tests on aarch64....* gnu/packages/gtk.scm (gtk)[arguments]<#:configure-flags>: Skip more failing tests known to fail. Signed-off-by: Efraim Flashner <efraim@flashner.co.il> Change-Id: I34d0f7521224b41072fcc0c35321935d1db927e0 Leo Nikkilä 2024-04-02Revert "gnu: gtk: Skip failing tests on aarch64-linux."...This reverts commit 76ed1e886ea790fc8562b355a0768a0f04889abb. The next commit does a better job of skipping the tests. Efraim Flashner 2024-03-31gnu: cairo: Update to 1.18.0....With this new release of cairo many old configure options were removed and now meson is used to build it. The defaults include the tee backend which we had previously enabled while the xml backend has been dropped from cairo completely. Old configure options where were commented out to be enabled have been removed as they no longer apply to version 1.18.0. The variable 'cairo' is now a hidden package to work around a dependency cycle where gtk-doc is needed to build the documentation (which itself depends on cairo). The new variable 'cairo-with-documentation' is now the public package and the module exports 'cairo' for use in other packages. This follows what was done for glib. * gnu/packages/gtk.scm: Export 'cairo'. (cairo): Update to 1.18.0. [source]: Remove 'patches' field. [properties]: Hide package. [outputs]: Remove (doc output is now in cairo-with-documentation). [build-system]: Change to meson-build-system. [arguments]: Add #:glib-or-gtk?. Remove old flags from #:configure-flags and add '-Dtests=disabled' to match #:tests?. [propagated-inputs]: Remove commented out packages. (cairo-with-documentation): New variable. (cairo-sans-poppler)[properties]: No longer set hidden as it is now inherited from cairo. (cairo-xcb)[properties]: Unhide (inherited from cairo). [arguments]: Remove obsolete #:configure-flags and properly inherit from cairo. * gnu/packages/patches/cairo-CVE-2018-19876.patch: Remove. * gnu/packages/patches/cairo-CVE-2020-35492.patch: Remove. * gnu/local.mk (dist_patch_DATA): Remove them. Change-Id: I2f4c953b23c6b32b1fafaf03db89d7a475fc6956 John Kehayias 2024-03-31gnu: python-pycairo: Update to 1.26.0....* gnu/packages/gtk.scm (python-pycairo): Update to 1.26.0. Change-Id: I7349bd0c68b061d0f3fe46db52b7fdc63acbd69b John Kehayias 2024-03-31gnu: gtk: Skip failing tests on aarch64-linux....* gnu/packages/gtk.scm (gtk)[arguments]: When building for aarch64-linux add a phase to skip a test which can't find the zink driver. Change-Id: I7b596309f1cbd555bd7ba889379d5b0bb245eabc Efraim Flashner 2024-03-24gnu: pango-1.90: Disable failing test....* gnu/packages/gtk.scm (pango-1.90)[source]: Disable failing test. Change-Id: Ib0f6dcd42c9475c4b543400f43836c2f3f8db16f Signed-off-by: Christopher Baines <mail@cbaines.net> Vivien Kraus 2024-03-16gnu: girara: Build with json-glib....* gnu/packages/gtk.scm (girara) [propagated-inputs]: Add json-glib. Change-Id: I5bfe5a516885153014fce1c6643ac5799f0100e1 Signed-off-by: Christopher Baines <mail@cbaines.net> Vivien Kraus 2024-03-10Merge branch 'master' into gnome-teamLiliana Marie Prikler 2024-03-09gnu: girara: Update to 0.4.3....* gnu/packages/gtk.scm (girara): Update to 0.4.3. Change-Id: I3c977cd33fa6d20fce3bb575ae2ad887b3061966 Signed-off-by: Liliana Marie Prikler <liliana.prikler@gmail.com> Reviewed-by: Maxim Cournoyer <maxim.cournoyer@gmail> Vivien Kraus 2024-03-09gnu: girara: Update style....* gnu/packages/gtk.scm (girara)[arguments]: Convert to list of G-Expressions. [native-inputs]: Move after arguments. [propagated-inputs]: Move after arguments. Change-Id: I79a6f59f6ea671433f1a66a10cb79203f0b9bbae Signed-off-by: Liliana Marie Prikler <liliana.prikler@gmail.com> Reviewed-by: Maxim Cournoyer <maxim.cournoyer@gmail> Vivien Kraus 2024-03-03gnu: girara: Update to 0.4.2....* gnu/packages/gtk.scm (girara): Update to 0.4.2. Change-Id: Ib7daa73b5802c98b653f4513f6111dcad786b65f Efraim Flashner 2024-02-23gnu: gtk+: Update to 3.24.41....* gnu/packages/gtk.scm (gtk+): Update to 3.24.41. Change-Id: I3dcaecb7485fa91e23fb6231f9fb51ef916da10e Reviewed-by: Maxim Cournoyer <maxim.cournoyer@gmail.com> Signed-off-by: Liliana Marie Prikler <liliana.prikler@gmail.com> Vivien Kraus 2024-02-23gnu: pangomm@2.46: Update to 2.46.4....* gnu/packages/gtk.scm (pangomm-2.46): Update to 2.46.4. Change-Id: Ia1dcb94f35eb80a7cd79cae5245acbc4069e006b Reviewed-by: Maxim Cournoyer <maxim.cournoyer@gmail.com> Signed-off-by: Liliana Marie Prikler <liliana.prikler@gmail.com> Vivien Kraus 2024-02-23gnu: atkmm@2.28: Update to 2.28.4....* gnu/packages/gtk.scm (atkmm-2.28): Update to 2.28.4. Change-Id: If4b333b02785c9a5712816ea048b1943b582c2e3 Reviewed-by: Maxim Cournoyer <maxim.cournoyer@gmail.com> Signed-off-by: Liliana Marie Prikler <liliana.prikler@gmail.com> Vivien Kraus 2024-02-23gnu: glibmm-2.64: Rename and update to 2.66.6....* gnu/packages/glib.scm (glibmm-2.64): Rename to ... (glibmm-2.66): ... this. Update to 2.66.6. * gnu/packages/animation.scm (etl)[inputs]: Adjust accordingly. (synfig)[propagated-inputs]: Likewise. * gnu/packages/electronics.scm (libsigrok)[propagated-inputs]: Likewise. * gnu/packages/gnome-xyz.scm (eiciel)[inputs]: Likewise. * gnu/packages/gnome.scm (libxml++-3, libxml++-2)[propagated-inputs]: Likewise. * gnu/packages/gtk.scm (pangomm-2.46, atkmm-2.28, gtkmm-2)[propagated-inputs]: Likewise. Change-Id: I878e740e085a483970a4ef6e0fa7dd19000863eb Signed-off-by: Liliana Marie Prikler <liliana.prikler@gmail.com> John Kehayias