Adjust module autoloads.

In Guile < 2.9.7, autoloading a module would give you access to all its
bindings.  In future versions, autoloading a module gives access only to
the listed bindings, as per #:select (see <https://bugs.gnu.org/38895>).

This commit adjusts autoloads to the new semantics, allowing Guix to be
built with Guile 2.9.7/2.9.8.

* guix/build/download.scm <top level>: Remove call to 'module-autoload!'.
(load-gnutls): New procedure.
(tls-wrap): Call it.
* guix/git.scm <top level>: Remove call to 'module-autoload!'.
(load-git-submodules): New procedure.
(update-submodules): Call it instead of 'resolve-interface'.
* gnu/bootloader/grub.scm: Replace #:autoload with #:use-module.
* gnu/packages.scm: Likewise.
* gnu/packages/ssh.scm: Likewise.
* gnu/packages/tex.scm: Likewise.
* gnu/services/cuirass.scm: Likewise.
* gnu/services/mcron.scm: Likewise.
* guix/lint.scm: Augment list of bindings in #:autoload.
* guix/scripts/build.scm: Likewise.
* guix/scripts/gc.scm: Likewise.
* guix/scripts/pack.scm: Likewise.
* guix/scripts/publish.scm: Likewise.
* guix/scripts/pull.scm: Likewise.
* guix/utils.scm: Remove unnecessary #:autoload clauses; replace one
of them with #:use-module.
This commit is contained in:
Ludovic Courtès 2020-01-06 15:14:09 +01:00
parent 9961cde383
commit 6a7c4636d4
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5
15 changed files with 54 additions and 42 deletions

View file

@ -28,7 +28,7 @@ (define-module (gnu bootloader grub)
#:use-module (gnu system uuid)
#:use-module (gnu system file-systems)
#:use-module (gnu system keyboard)
#:autoload (gnu packages bootloaders) (grub)
#:use-module (gnu packages bootloaders)
#:autoload (gnu packages gtk) (guile-cairo guile-rsvg)
#:autoload (gnu packages xorg) (xkeyboard-config)
#:use-module (ice-9 match)

View file

@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2013 Mark H Weaver <mhw@netris.org>
;;; Copyright © 2014 Eric Bavier <bavier@member.fsf.org>
;;; Copyright © 2016, 2017 Alex Kost <alezost@gmail.com>
@ -30,12 +30,12 @@ (define-module (gnu packages)
#:select ((package-name->name+version
. hyphen-separated-name->name+version)
mkdir-p))
#:autoload (guix profiles) (packages->manifest)
#:use-module (guix profiles)
#:use-module (guix describe)
#:use-module (guix deprecation)
#:use-module (ice-9 vlist)
#:use-module (ice-9 match)
#:autoload (ice-9 binary-ports) (put-bytevector)
#:use-module (ice-9 binary-ports)
#:autoload (system base compile) (compile)
#:use-module (srfi srfi-1)
#:use-module (srfi srfi-11)

View file

@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2013, 2014 Andreas Enge <andreas@enge.fr>
;;; Copyright © 2014, 2015, 2016 Mark H Weaver <mhw@netris.org>
;;; Copyright © 2015, 2016, 2018, 2019 Efraim Flashner <efraim@flashner.co.il>
@ -32,7 +32,7 @@ (define-module (gnu packages ssh)
#:use-module (gnu packages)
#:use-module (gnu packages autotools)
#:use-module (gnu packages base)
#:autoload (gnu packages boost) (boost)
#:use-module (gnu packages boost)
#:use-module (gnu packages compression)
#:use-module (gnu packages crypto)
#:use-module (gnu packages elf)
@ -51,7 +51,7 @@ (define-module (gnu packages ssh)
#:use-module (gnu packages perl)
#:use-module (gnu packages pkg-config)
#:use-module (gnu packages popt)
#:autoload (gnu packages protobuf) (protobuf)
#:use-module (gnu packages protobuf)
#:use-module (gnu packages python)
#:use-module (gnu packages python-xyz)
#:use-module (gnu packages readline)

View file

@ -71,7 +71,7 @@ (define-module (gnu packages tex)
#:use-module (gnu packages xml)
#:use-module (gnu packages xorg)
#:use-module (gnu packages xdisorg)
#:autoload (gnu packages texinfo) (texinfo)
#:use-module (gnu packages texinfo)
#:use-module (ice-9 ftw)
#:use-module (ice-9 match)
#:use-module ((srfi srfi-1) #:hide (zip)))

View file

@ -1,6 +1,6 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2016 Mathieu Lirzin <mthl@gnu.org>
;;; Copyright © 2016, 2017, 2018, 2019 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2016, 2017, 2018, 2019, 2020 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2017 Mathieu Othacehe <m.othacehe@gmail.com>
;;; Copyright © 2017 Jan Nieuwenhuizen <janneke@gnu.org>
;;; Copyright © 2018, 2019 Ricardo Wurmus <rekado@elephly.net>
@ -25,8 +25,8 @@ (define-module (gnu services cuirass)
#:use-module (guix gexp)
#:use-module (guix records)
#:use-module (gnu packages admin)
#:autoload (gnu packages ci) (cuirass)
#:autoload (gnu packages version-control) (git)
#:use-module (gnu packages ci)
#:use-module (gnu packages version-control)
#:use-module (gnu services)
#:use-module (gnu services base)
#:use-module (gnu services shepherd)

View file

@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2016, 2017, 2018, 2019 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2016, 2017, 2018, 2019, 2020 Ludovic Courtès <ludo@gnu.org>
;;;
;;; This file is part of GNU Guix.
;;;
@ -19,7 +19,7 @@
(define-module (gnu services mcron)
#:use-module (gnu services)
#:use-module (gnu services shepherd)
#:autoload (gnu packages guile-xyz) (mcron)
#:use-module (gnu packages guile-xyz)
#:use-module (guix deprecation)
#:use-module (guix records)
#:use-module (guix gexp)

View file

@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2015 Mark H Weaver <mhw@netris.org>
;;; Copyright © 2017 Tobias Geerinckx-Rice <me@tobias.gr>
;;;
@ -155,11 +155,11 @@ (define* (ftp-fetch uri file #:key timeout print-build-trace?)
;; be bound if we need them, because (guix download) adds GnuTLS as an
;; input in that case.
(define (load-gnutls)
;; XXX: Use this hack instead of #:autoload to avoid compilation errors.
;; See <http://bugs.gnu.org/12202>.
(module-autoload! (current-module)
'(gnutls)
'(make-session connection-end/client))
(module-use! (current-module) (resolve-interface '(gnutls)))
(set! load-gnutls (const #t)))
(define %x509-certificate-directory
;; The directory where X.509 authority PEM certificates are stored.
@ -245,6 +245,7 @@ (define (log level str)
(format (current-error-port)
"gnutls: [~a|~a] ~a" (getpid) level str))
(load-gnutls)
(let ((session (make-session connection-end/client))
(ca-certs (%x509-certificate-directory)))

View file

@ -1,6 +1,6 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2017 Mathieu Othacehe <m.othacehe@gmail.com>
;;; Copyright © 2018, 2019 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2018, 2019, 2020 Ludovic Courtès <ludo@gnu.org>
;;;
;;; This file is part of GNU Guix.
;;;
@ -48,11 +48,6 @@ (define-module (guix git)
git-checkout-url
git-checkout-branch))
;; XXX: Use this hack instead of #:autoload to avoid compilation errors.
;; See <http://bugs.gnu.org/12202>.
(module-autoload! (current-module)
'(git submodule) '(repository-submodules))
(define %repository-cache-directory
(make-parameter (string-append (cache-directory #:ensure? #f)
"/checkouts")))
@ -200,11 +195,23 @@ (define-syntax-rule (with-repository directory repository exp ...)
(call-with-repository directory
(lambda (repository) exp ...)))
(define (load-git-submodules)
"Attempt to load (git submodules), which was missing until Guile-Git 0.2.0.
Return true on success, false on failure."
(match (false-if-exception (resolve-interface '(git submodule)))
(#f
(set! load-git-submodules (const #f))
#f)
(iface
(module-use! (current-module) iface)
(set! load-git-submodules (const #t))
#t)))
(define* (update-submodules repository
#:key (log-port (current-error-port)))
"Update the submodules of REPOSITORY, a Git repository object."
;; Guile-Git < 0.2.0 did not have (git submodule).
(if (false-if-exception (resolve-interface '(git submodule)))
(if (load-git-submodules)
(for-each (lambda (name)
(let ((submodule (submodule-lookup repository name)))
(format log-port (G_ "updating submodule '~a'...~%")

View file

@ -45,7 +45,8 @@ (define-module (guix lint)
#:use-module (guix gnu-maintenance)
#:use-module (guix cve)
#:use-module ((guix swh) #:hide (origin?))
#:autoload (guix git-download) (git-reference?)
#:autoload (guix git-download) (git-reference?
git-reference-url git-reference-commit)
#:use-module (ice-9 match)
#:use-module (ice-9 regex)
#:use-module (ice-9 format)

View file

@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2013 Mark H Weaver <mhw@netris.org>
;;;
;;; This file is part of GNU Guix.
@ -45,8 +45,8 @@ (define-module (guix scripts build)
#:use-module (srfi srfi-37)
#:autoload (gnu packages) (specification->package %package-module-path)
#:autoload (guix download) (download-to-store)
#:autoload (guix git-download) (git-reference?)
#:autoload (guix git) (git-checkout?)
#:autoload (guix git-download) (git-reference? git-reference-url)
#:autoload (guix git) (git-checkout? git-checkout-url)
#:use-module ((guix status) #:select (with-status-verbosity))
#:use-module ((guix progress) #:select (current-terminal-columns))
#:use-module ((guix build syscalls) #:select (terminal-columns))

View file

@ -22,7 +22,7 @@ (define-module (guix scripts gc)
#:use-module (guix store)
#:use-module (guix store roots)
#:autoload (guix build syscalls) (free-disk-space)
#:autoload (guix profiles) (generation-profile)
#:autoload (guix profiles) (generation-profile profile-generations)
#:autoload (guix scripts package) (delete-generations)
#:use-module (ice-9 match)
#:use-module (ice-9 regex)

View file

@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2015, 2017, 2018, 2019 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2015, 2017, 2018, 2019, 2020 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2017, 2018 Ricardo Wurmus <rekado@elephly.net>
;;; Copyright © 2018 Konrad Hinsen <konrad.hinsen@fastmail.net>
;;; Copyright © 2018 Chris Marusich <cmmarusich@gmail.com>
@ -29,7 +29,9 @@ (define-module (guix scripts pack)
#:use-module ((guix status) #:select (with-status-verbosity))
#:use-module ((guix self) #:select (make-config.scm))
#:use-module (guix grafts)
#:autoload (guix inferior) (inferior-package?)
#:autoload (guix inferior) (inferior-package?
inferior-package-name
inferior-package-version)
#:use-module (guix monads)
#:use-module (guix modules)
#:use-module (guix packages)

View file

@ -1,6 +1,6 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2015 David Thompson <davet@gnu.org>
;;; Copyright © 2015, 2016, 2017, 2018, 2019 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2015, 2016, 2017, 2018, 2019, 2020 Ludovic Courtès <ludo@gnu.org>
;;;
;;; This file is part of GNU Guix.
;;;
@ -51,7 +51,9 @@ (define-module (guix scripts publish)
#:use-module (guix store)
#:use-module ((guix serialization) #:select (write-file))
#:use-module (guix zlib)
#:autoload (guix lzlib) (lzlib-available?)
#:autoload (guix lzlib) (lzlib-available?
call-with-lzip-output-port
make-lzip-output-port)
#:use-module (guix cache)
#:use-module (guix ui)
#:use-module (guix scripts)

View file

@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2013, 2014, 2015, 2017, 2018, 2019 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2013, 2014, 2015, 2017, 2018, 2019, 2020 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2017 Marius Bakke <mbakke@fastmail.com>
;;;
;;; This file is part of GNU Guix.
@ -33,7 +33,9 @@ (define-module (guix scripts pull)
#:use-module (guix memoization)
#:use-module (guix monads)
#:use-module (guix channels)
#:autoload (guix inferior) (open-inferior)
#:autoload (guix inferior) (open-inferior
inferior-available-packages
close-inferior)
#:use-module (guix scripts build)
#:autoload (guix build utils) (which)
#:use-module ((guix build syscalls)

View file

@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2013, 2014, 2015 Mark H Weaver <mhw@netris.org>
;;; Copyright © 2014 Eric Bavier <bavier@member.fsf.org>
;;; Copyright © 2014 Ian Denhardt <ian@zenhack.net>
@ -31,16 +31,13 @@ (define-module (guix utils)
#:use-module (srfi srfi-26)
#:use-module (srfi srfi-35)
#:use-module (srfi srfi-39)
#:use-module (ice-9 binary-ports)
#:use-module (ice-9 ftw)
#:autoload (rnrs io ports) (make-custom-binary-input-port)
#:use-module (rnrs io ports) ;need 'port-position' etc.
#:use-module ((rnrs bytevectors) #:select (bytevector-u8-set!))
#:use-module (guix memoization)
#:use-module ((guix build utils) #:select (dump-port mkdir-p delete-file-recursively))
#:use-module ((guix build syscalls) #:select (mkdtemp! fdatasync))
#:use-module (ice-9 format)
#:autoload (ice-9 popen) (open-pipe*)
#:autoload (ice-9 rdelim) (read-line)
#:use-module (ice-9 regex)
#:use-module (ice-9 match)
#:use-module (ice-9 format)