Subject: [PATCH 07/11] utils: Don’t re-export ‘call-with-temporary-output-file’.

From: Ludovic Courtès <[email-masked]>
Date: Mon, 1 Apr 2024 22:25:19 +0200

* guix/utils.scm: Remove re-export of ‘call-with-temporary-output-file’.
Autoload a number of modules.
* guix/download.scm, guix/import/hackage.scm,
guix/import/hexpm.scm, guix/import/opam.scm,
guix/import/pypi.scm, tests/cpio.scm, tests/egg.scm,
tests/opam.scm, tests/publish.scm, tests/store-database.scm,
tests/utils.scm: Adjust imports accordingly.

Change-Id: I3f5e94631397996a30be2ea4ff8b50a3371e8ee7
---
 guix/download.scm        |  2 +-
 guix/import/hackage.scm  |  4 ++--
 guix/import/hexpm.scm    |  7 ++++---
 guix/import/opam.scm     |  7 ++++---
 guix/import/pypi.scm     |  5 +++--
 guix/utils.scm           | 17 ++++++++---------
 tests/cpio.scm           |  6 +++---
 tests/egg.scm            |  5 +++--
 tests/opam.scm           |  5 +++--
 tests/publish.scm        |  5 +++--
 tests/store-database.scm |  6 +++---
 tests/utils.scm          |  3 ++-
 12 files changed, 39 insertions(+), 33 deletions(-)

diff --git a/guix/download.scm b/guix/download.scm
index 3dfe143e9f..192c47f113 100644
--- a/guix/download.scm
+++ b/guix/download.scm
@@ -31,7 +31,7 @@ (define-module (guix download)
   #:autoload   (guix build download) (url-fetch)
   #:use-module (guix monads)
   #:use-module (guix gexp)
-  #:use-module (guix utils)
+  #:autoload   (guix build utils) (call-with-temporary-output-file)
   #:use-module (web uri)
   #:use-module (srfi srfi-1)
   #:use-module (srfi srfi-26)
diff --git a/guix/import/hackage.scm b/guix/import/hackage.scm
index bbaee73a06..79a51d3300 100644
--- a/guix/import/hackage.scm
+++ b/guix/import/hackage.scm
@@ -8,7 +8,7 @@
 ;;; Copyright © 2021 Sarah Morgensen <[email-masked]>
 ;;; Copyright © 2019 Simon Tournier <[email-masked]>
 ;;; Copyright © 2022 Hartmut Goebel <[email-masked]>
-;;; Copyright © 2023 Ludovic Courtès <[email-masked]>
+;;; Copyright © 2023-2024 Ludovic Courtès <[email-masked]>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -47,7 +47,7 @@ (define-module (guix import hackage)
   #:use-module (guix upstream)
   #:use-module (guix packages)
   #:autoload   (guix build-system haskell) (hackage-uri)
-  #:use-module ((guix utils) #:select (call-with-temporary-output-file))
+  #:autoload   (guix build utils) (call-with-temporary-output-file)
   #:export (%hackage-url
             hackage->guix-package
             hackage-recursive-import
diff --git a/guix/import/hexpm.scm b/guix/import/hexpm.scm
index 628a44ff24..71a54ba973 100644
--- a/guix/import/hexpm.scm
+++ b/guix/import/hexpm.scm
@@ -1,7 +1,7 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2015 Cyril Roelandt <[email-masked]>
 ;;; Copyright © 2016 David Craven <[email-masked]>
-;;; Copyright © 2017, 2019-2021 Ludovic Courtès <[email-masked]>
+;;; Copyright © 2017, 2019-2021, 2024 Ludovic Courtès <[email-masked]>
 ;;; Copyright © 2019 Martin Becze <[email-masked]>
 ;;; Copyright © 2019 Maxim Cournoyer <[email-masked]>
 ;;; Copyright © 2020-2022 Hartmut Goebel <[email-masked]>
@@ -28,10 +28,11 @@ (define-module (guix import hexpm)
   #:use-module ((guix build utils)
                 #:select ((package-name->name+version
                            . hyphen-package-name->name+version)
-                          dump-port))
+                          dump-port
+                          call-with-temporary-output-file))
   #:use-module (guix packages)
   #:use-module (guix upstream)
-  #:use-module (guix utils)
+  #:autoload   (guix utils) (version>? file-sans-extension)
   #:use-module (ice-9 match)
   #:use-module (srfi srfi-1)
   #:use-module (srfi srfi-26)
diff --git a/guix/import/opam.scm b/guix/import/opam.scm
index 86e82cde59..a7f8092507 100644
--- a/guix/import/opam.scm
+++ b/guix/import/opam.scm
@@ -31,7 +31,9 @@ (define-module (guix import opam)
   #:use-module ((srfi srfi-26) #:select (cut))
   #:use-module (srfi srfi-34)
   #:use-module ((web uri) #:select (string->uri uri->string))
-  #:use-module ((guix build utils) #:select (dump-port find-files mkdir-p))
+  #:use-module ((guix build utils)
+                #:select (dump-port find-files mkdir-p
+                          call-with-temporary-output-file))
   #:use-module (guix build-system)
   #:use-module (guix i18n)
   #:use-module (guix diagnostics)
@@ -39,8 +41,7 @@ (define-module (guix import opam)
   #:use-module (guix packages)
   #:use-module (guix upstream)
   #:use-module ((guix utils) #:select (cache-directory
-                                       version>?
-                                       call-with-temporary-output-file))
+                                       version>?))
   #:use-module ((guix import utils) #:select (beautify-description
                                               guix-hash-url
                                               recursive-import
diff --git a/guix/import/pypi.scm b/guix/import/pypi.scm
index 1a3070fb36..6719fde330 100644
--- a/guix/import/pypi.scm
+++ b/guix/import/pypi.scm
@@ -1,7 +1,7 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2014 David Thompson <[email-masked]>
 ;;; Copyright © 2015 Cyril Roelandt <[email-masked]>
-;;; Copyright © 2015-2017, 2019-2023 Ludovic Courtès <[email-masked]>
+;;; Copyright © 2015-2017, 2019-2024 Ludovic Courtès <[email-masked]>
 ;;; Copyright © 2017 Mathieu Othacehe <[email-masked]>
 ;;; Copyright © 2018, 2023 Ricardo Wurmus <[email-masked]>
 ;;; Copyright © 2019 Maxim Cournoyer <[email-masked]>
@@ -52,7 +52,8 @@ (define-module (guix import pypi)
                 #:select ((package-name->name+version
                            . hyphen-package-name->name+version)
                           find-files
-                          invoke))
+                          invoke
+                          call-with-temporary-output-file))
   #:use-module (guix import utils)
   #:use-module (guix import json)
   #:use-module (json)
diff --git a/guix/utils.scm b/guix/utils.scm
index 29ad09d9f7..d8ce6ed886 100644
--- a/guix/utils.scm
+++ b/guix/utils.scm
@@ -1,5 +1,5 @@
 ;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2012-2022 Ludovic Courtès <[email-masked]>
+;;; Copyright © 2012-2022, 2024 Ludovic Courtès <[email-masked]>
 ;;; Copyright © 2013, 2014, 2015 Mark H Weaver <[email-masked]>
 ;;; Copyright © 2014 Eric Bavier <[email-masked]>
 ;;; Copyright © 2014 Ian Denhardt <[email-masked]>
@@ -47,11 +47,12 @@ (define-module (guix utils)
   #: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
-                          call-with-temporary-output-file %xz-parallel-args))
-  #:use-module ((guix build syscalls) #:select (mkdtemp! fdatasync))
-  #:use-module ((guix combinators) #:select (fold2))
+  #:autoload   (guix build utils) (dump-port
+                                   mkdir-p
+                                   delete-file-recursively
+                                   %xz-parallel-args)
+  #:autoload   (guix build syscalls) (mkdtemp! fdatasync)
+  #:autoload   (guix combinators) (fold2)
   #:use-module (guix diagnostics)           ;<location>, &error-location, etc.
   #:use-module (ice-9 format)
   #:use-module ((ice-9 iconv) #:prefix iconv:)
@@ -76,9 +77,7 @@ (define-module (guix utils)
 
                &fix-hint
                fix-hint?
-               condition-fix-hint
-
-               call-with-temporary-output-file)
+               condition-fix-hint)
   #:export (strip-keyword-arguments
             default-keyword-arguments
             substitute-keyword-arguments
diff --git a/tests/cpio.scm b/tests/cpio.scm
index 832101d1bb..35a704822b 100644
--- a/tests/cpio.scm
+++ b/tests/cpio.scm
@@ -1,5 +1,5 @@
 ;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2015, 2022 Ludovic Courtès <[email-masked]>
+;;; Copyright © 2015, 2022, 2024 Ludovic Courtès <[email-masked]>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -19,8 +19,8 @@
 (define-module (test-cpio)
   #:use-module (guix cpio)
   #:use-module (guix tests)
-  #:use-module ((guix build utils) #:select (which))
-  #:use-module ((guix utils) #:select (call-with-temporary-output-file))
+  #:use-module ((guix build utils)
+                #:select (which call-with-temporary-output-file))
   #:use-module (ice-9 match)
   #:use-module (ice-9 popen)
   #:use-module (rnrs io ports)
diff --git a/tests/egg.scm b/tests/egg.scm
index a7d3378dd7..c74f954683 100644
--- a/tests/egg.scm
+++ b/tests/egg.scm
@@ -24,8 +24,9 @@ (define-module (test-eggs)
   #:use-module (gcrypt hash)
   #:use-module (guix tests)
   #:use-module ((guix build syscalls) #:select (mkdtemp!))
-  #:use-module ((guix build utils) #:select (delete-file-recursively mkdir-p which))
-  #:use-module ((guix utils) #:select (call-with-temporary-output-file))
+  #:use-module ((guix build utils)
+                #:select (delete-file-recursively mkdir-p which
+                          call-with-temporary-output-file))
   #:use-module (srfi srfi-1)
   #:use-module (srfi srfi-64)
   #:use-module (web uri)
diff --git a/tests/opam.scm b/tests/opam.scm
index 832fea1d9b..f444ef302e 100644
--- a/tests/opam.scm
+++ b/tests/opam.scm
@@ -24,8 +24,9 @@ (define-module (test-opam)
   #:use-module (gcrypt hash)
   #:use-module (guix tests)
   #:use-module ((guix build syscalls) #:select (mkdtemp!))
-  #:use-module ((guix build utils) #:select (delete-file-recursively mkdir-p which))
-  #:use-module ((guix utils) #:select (call-with-temporary-output-file))
+  #:use-module ((guix build utils)
+                #:select (delete-file-recursively mkdir-p which
+                          call-with-temporary-output-file))
   #:use-module (srfi srfi-1)
   #:use-module (srfi srfi-64)
   #:use-module (web uri)
diff --git a/tests/publish.scm b/tests/publish.scm
index efb5698bed..d5ec3c954f 100644
--- a/tests/publish.scm
+++ b/tests/publish.scm
@@ -1,7 +1,7 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2015 David Thompson <[email-masked]>
 ;;; Copyright © 2020 by Amar M. Singh <[email-masked]>
-;;; Copyright © 2016-2022 Ludovic Courtès <[email-masked]>
+;;; Copyright © 2016-2022, 2024 Ludovic Courtès <[email-masked]>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -25,7 +25,8 @@ (define-module (test-publish)
   #:use-module (guix scripts publish)
   #:use-module (guix tests)
   #:use-module (guix config)
-  #:use-module (guix utils)
+  #:use-module ((guix utils) #:select (call-with-temporary-directory))
+  #:use-module ((guix build utils) #:select (call-with-temporary-output-file))
   #:use-module (gcrypt hash)
   #:use-module (guix store)
   #:use-module (guix derivations)
diff --git a/tests/store-database.scm b/tests/store-database.scm
index d8f3ce8070..0f44d33191 100644
--- a/tests/store-database.scm
+++ b/tests/store-database.scm
@@ -1,5 +1,5 @@
 ;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2017, 2018, 2020, 2021 Ludovic Courtès <[email-masked]>
+;;; Copyright © 2017-2018, 2020-2021, 2024 Ludovic Courtès <[email-masked]>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -21,9 +21,9 @@ (define-module (test-store-database)
   #:use-module (guix store)
   #:use-module (guix store database)
   #:use-module (guix build store-copy)
-  #:use-module ((guix utils) #:select (call-with-temporary-output-file))
   #:use-module ((guix build utils)
-                #:select (mkdir-p delete-file-recursively))
+                #:select (mkdir-p delete-file-recursively
+                          call-with-temporary-output-file))
   #:use-module (srfi srfi-26)
   #:use-module (srfi srfi-64))
 
diff --git a/tests/utils.scm b/tests/utils.scm
index 52f3b58ede..462e43e2b1 100644
--- a/tests/utils.scm
+++ b/tests/utils.scm
@@ -1,5 +1,5 @@
 ;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021 Ludovic Courtès <[email-masked]>
+;;; Copyright © 2012-2021, 2024 Ludovic Courtès <[email-masked]>
 ;;; Copyright © 2014 Eric Bavier <[email-masked]>
 ;;; Copyright © 2016 Mathieu Lirzin <[email-masked]>
 ;;; Copyright © 2021 Simon Tournier <[email-masked]>
@@ -25,6 +25,7 @@
 (define-module (test-utils)
   #:use-module ((guix config) #:select (%gzip))
   #:use-module (guix utils)
+  #:use-module ((guix build utils) #:select (call-with-temporary-output-file))
   #:use-module ((guix store) #:select (%store-prefix store-path-package-name))
   #:use-module ((guix search-paths) #:select (string-tokenize*))
   #:use-module (srfi srfi-1)
-- 
2.41.0