2013-02-20 23:46:38 +01:00
|
|
|
|
;;; GNU Guix --- Functional package management for GNU
|
2018-05-30 17:50:21 +02:00
|
|
|
|
;;; Copyright © 2013, 2014, 2015, 2017, 2018 Ludovic Courtès <ludo@gnu.org>
|
2017-03-01 22:11:02 +01:00
|
|
|
|
;;; Copyright © 2017 Marius Bakke <mbakke@fastmail.com>
|
2013-02-20 23:46:38 +01:00
|
|
|
|
;;;
|
|
|
|
|
;;; 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/>.
|
|
|
|
|
|
|
|
|
|
(define-module (guix scripts pull)
|
|
|
|
|
#:use-module (guix ui)
|
2015-10-26 22:17:25 +01:00
|
|
|
|
#:use-module (guix utils)
|
2015-09-10 11:37:36 +02:00
|
|
|
|
#:use-module (guix scripts)
|
2013-02-20 23:46:38 +01:00
|
|
|
|
#:use-module (guix store)
|
|
|
|
|
#:use-module (guix config)
|
|
|
|
|
#:use-module (guix packages)
|
|
|
|
|
#:use-module (guix derivations)
|
2018-05-30 17:50:21 +02:00
|
|
|
|
#:use-module (guix profiles)
|
2014-09-18 18:42:39 +02:00
|
|
|
|
#:use-module (guix gexp)
|
2017-08-01 23:38:07 +02:00
|
|
|
|
#:use-module (guix grafts)
|
2018-07-10 16:06:32 +02:00
|
|
|
|
#:use-module (guix memoization)
|
2014-09-18 18:42:39 +02:00
|
|
|
|
#:use-module (guix monads)
|
2018-08-27 18:05:49 +02:00
|
|
|
|
#:use-module (guix channels)
|
2018-07-10 16:06:32 +02:00
|
|
|
|
#:autoload (guix inferior) (open-inferior)
|
2017-05-09 15:45:04 +02:00
|
|
|
|
#:use-module (guix scripts build)
|
2018-08-27 23:05:27 +02:00
|
|
|
|
#:use-module (guix git)
|
|
|
|
|
#:use-module (git)
|
2018-07-13 16:59:15 +02:00
|
|
|
|
#:use-module (gnu packages)
|
2018-05-30 17:50:21 +02:00
|
|
|
|
#:use-module ((guix scripts package) #:select (build-and-use-profile))
|
2013-02-20 23:46:38 +01:00
|
|
|
|
#:use-module (gnu packages base)
|
gnu: Split (gnu packages base), adding (gnu packages commencement).
* gnu/packages/base.scm (gnu-make-boot0, diffutils-boot0,
findutils-boot0, %boot0-inputs, nix-system->gnu-triplet, boot-triplet,
binutils-boot0, gcc-boot0, perl-boot0, linux-libre-headers-boot0,
texinfo-boot0, %boot1-inputs, glibc-final-with-bootstrap-bash,
cross-gcc-wrapper, static-bash-for-glibc, glibc-final,
gcc-boot0-wrapped, %boot2-inputs, binutils-final, libstdc++,
gcc-final, ld-wrapper-boot3, %boot3-inputs, bash-final, %boot4-inputs,
guile-final, gnu-make-final, ld-wrapper, coreutils-final, grep-final,
%boot5-inputs, %final-inputs, canonical-package, gcc-toolchain,
gcc-toolchain-4.8, gcc-toolchain-4.9): Move to...
* gnu/packages/commencement.scm: ... here. New file.
* gnu-system.am (GNU_SYSTEM_MODULES): Add it.
* build-aux/check-final-inputs-self-contained.scm: Adjust accordingly.
* gnu/packages/cross-base.scm: Likewise.
* gnu/packages/make-bootstrap.scm: Likewise.
* guix/build-system/cmake.scm (cmake-build): Likewise.
* guix/build-system/gnu.scm (standard-packages, gnu-build,
gnu-cross-build): Likewise.
* guix/build-system/perl.scm (perl-build): Likewise.
* guix/build-system/python.scm (python-build): Likewise.
* guix/build-system/trivial.scm (guile-for-build): Likewise.
* guix/download.scm (url-fetch): Likewise.
* guix/gexp.scm (default-guile): Likewise.
* guix/git-download.scm (git-fetch): Likewise.
* guix/monads.scm (run-with-store): Likewise.
* guix/packages.scm (default-guile): Likewise.
* guix/scripts/package.scm (guix-package): Likewise.
* guix/scripts/refresh.scm: Likewise.
* guix/svn-download.scm (svn-fetch): Likewise.
* tests/builders.scm (%bootstrap-inputs, %bootstrap-search-paths):
Likewise.
* tests/packages.scm ("GNU Make, bootstrap"): Likewise.
* tests/guix-package.sh: Likewise.
* gnu/services/base.scm: Use 'canonical-package' instead of xxx-final.
* gnu/services/xorg.scm: Likewise.
* gnu/system/vm.scm: Likewise.
* guix/scripts/pull.scm (guix-pull): Likewise.
2014-08-27 00:25:17 +02:00
|
|
|
|
#:use-module (gnu packages guile)
|
2013-02-20 23:46:38 +01:00
|
|
|
|
#:use-module ((gnu packages bootstrap)
|
|
|
|
|
#:select (%bootstrap-guile))
|
2017-03-01 22:11:02 +01:00
|
|
|
|
#:use-module ((gnu packages certs) #:select (le-certs))
|
2013-02-20 23:46:38 +01:00
|
|
|
|
#:use-module (srfi srfi-1)
|
2018-07-10 16:06:32 +02:00
|
|
|
|
#:use-module (srfi srfi-26)
|
2018-06-13 23:39:24 +02:00
|
|
|
|
#:use-module (srfi srfi-35)
|
2013-02-20 23:46:38 +01:00
|
|
|
|
#:use-module (srfi srfi-37)
|
2014-11-09 22:32:21 +01:00
|
|
|
|
#:use-module (ice-9 match)
|
2018-07-10 16:06:32 +02:00
|
|
|
|
#:use-module (ice-9 vlist)
|
2018-09-03 15:03:33 +02:00
|
|
|
|
#:export (display-profile-content
|
|
|
|
|
guix-pull))
|
2013-02-20 23:46:38 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;;
|
|
|
|
|
;;; Command-line options.
|
|
|
|
|
;;;
|
|
|
|
|
|
|
|
|
|
(define %default-options
|
|
|
|
|
;; Alist of default option values.
|
2018-08-27 18:05:49 +02:00
|
|
|
|
`((system . ,(%current-system))
|
2017-05-09 15:45:04 +02:00
|
|
|
|
(substitutes? . #t)
|
2017-12-07 22:49:08 +01:00
|
|
|
|
(build-hook? . #t)
|
2017-05-09 15:45:04 +02:00
|
|
|
|
(graft? . #t)
|
|
|
|
|
(verbosity . 0)))
|
2013-02-20 23:46:38 +01:00
|
|
|
|
|
|
|
|
|
(define (show-help)
|
ui: Rename '_' to 'G_'.
This avoids collisions with '_' when the latter is used as a 'match'
pattern for instance. See
<https://lists.gnu.org/archive/html/guix-devel/2017-04/msg00464.html>.
* guix/ui.scm: Rename '_' to 'G_'.
* po/guix/Makevars (XGETTEXT_OPTIONS): Adjust accordingly.
* build-aux/compile-all.scm (warnings): Remove 'format'.
* gnu/packages.scm,
gnu/services.scm,
gnu/services/shepherd.scm,
gnu/system.scm,
gnu/system/shadow.scm,
guix/gnupg.scm,
guix/http-client.scm,
guix/import/cpan.scm,
guix/import/elpa.scm,
guix/import/pypi.scm,
guix/nar.scm,
guix/scripts.scm,
guix/scripts/archive.scm,
guix/scripts/authenticate.scm,
guix/scripts/build.scm,
guix/scripts/challenge.scm,
guix/scripts/container.scm,
guix/scripts/container/exec.scm,
guix/scripts/copy.scm,
guix/scripts/download.scm,
guix/scripts/edit.scm,
guix/scripts/environment.scm,
guix/scripts/gc.scm,
guix/scripts/graph.scm,
guix/scripts/hash.scm,
guix/scripts/import.scm,
guix/scripts/import/cpan.scm,
guix/scripts/import/cran.scm,
guix/scripts/import/crate.scm,
guix/scripts/import/elpa.scm,
guix/scripts/import/gem.scm,
guix/scripts/import/gnu.scm,
guix/scripts/import/hackage.scm,
guix/scripts/import/nix.scm,
guix/scripts/import/pypi.scm,
guix/scripts/import/stackage.scm,
guix/scripts/lint.scm,
guix/scripts/offload.scm,
guix/scripts/pack.scm,
guix/scripts/package.scm,
guix/scripts/perform-download.scm,
guix/scripts/publish.scm,
guix/scripts/pull.scm,
guix/scripts/refresh.scm,
guix/scripts/size.scm,
guix/scripts/substitute.scm,
guix/scripts/system.scm,
guix/ssh.scm,
guix/upstream.scm: Use 'G_' instead of '_'. Most of this change was
obtained by running: "sed -i -e's/(_ "/(G_ "/g' `find -name \*.scm`".
2017-05-03 15:57:02 +02:00
|
|
|
|
(display (G_ "Usage: guix pull [OPTION]...
|
2013-02-20 23:46:38 +01:00
|
|
|
|
Download and deploy the latest version of Guix.\n"))
|
ui: Rename '_' to 'G_'.
This avoids collisions with '_' when the latter is used as a 'match'
pattern for instance. See
<https://lists.gnu.org/archive/html/guix-devel/2017-04/msg00464.html>.
* guix/ui.scm: Rename '_' to 'G_'.
* po/guix/Makevars (XGETTEXT_OPTIONS): Adjust accordingly.
* build-aux/compile-all.scm (warnings): Remove 'format'.
* gnu/packages.scm,
gnu/services.scm,
gnu/services/shepherd.scm,
gnu/system.scm,
gnu/system/shadow.scm,
guix/gnupg.scm,
guix/http-client.scm,
guix/import/cpan.scm,
guix/import/elpa.scm,
guix/import/pypi.scm,
guix/nar.scm,
guix/scripts.scm,
guix/scripts/archive.scm,
guix/scripts/authenticate.scm,
guix/scripts/build.scm,
guix/scripts/challenge.scm,
guix/scripts/container.scm,
guix/scripts/container/exec.scm,
guix/scripts/copy.scm,
guix/scripts/download.scm,
guix/scripts/edit.scm,
guix/scripts/environment.scm,
guix/scripts/gc.scm,
guix/scripts/graph.scm,
guix/scripts/hash.scm,
guix/scripts/import.scm,
guix/scripts/import/cpan.scm,
guix/scripts/import/cran.scm,
guix/scripts/import/crate.scm,
guix/scripts/import/elpa.scm,
guix/scripts/import/gem.scm,
guix/scripts/import/gnu.scm,
guix/scripts/import/hackage.scm,
guix/scripts/import/nix.scm,
guix/scripts/import/pypi.scm,
guix/scripts/import/stackage.scm,
guix/scripts/lint.scm,
guix/scripts/offload.scm,
guix/scripts/pack.scm,
guix/scripts/package.scm,
guix/scripts/perform-download.scm,
guix/scripts/publish.scm,
guix/scripts/pull.scm,
guix/scripts/refresh.scm,
guix/scripts/size.scm,
guix/scripts/substitute.scm,
guix/scripts/system.scm,
guix/ssh.scm,
guix/upstream.scm: Use 'G_' instead of '_'. Most of this change was
obtained by running: "sed -i -e's/(_ "/(G_ "/g' `find -name \*.scm`".
2017-05-03 15:57:02 +02:00
|
|
|
|
(display (G_ "
|
2013-02-20 23:46:38 +01:00
|
|
|
|
--verbose produce verbose output"))
|
2018-08-27 18:05:49 +02:00
|
|
|
|
(display (G_ "
|
|
|
|
|
-C, --channels=FILE deploy the channels defined in FILE"))
|
ui: Rename '_' to 'G_'.
This avoids collisions with '_' when the latter is used as a 'match'
pattern for instance. See
<https://lists.gnu.org/archive/html/guix-devel/2017-04/msg00464.html>.
* guix/ui.scm: Rename '_' to 'G_'.
* po/guix/Makevars (XGETTEXT_OPTIONS): Adjust accordingly.
* build-aux/compile-all.scm (warnings): Remove 'format'.
* gnu/packages.scm,
gnu/services.scm,
gnu/services/shepherd.scm,
gnu/system.scm,
gnu/system/shadow.scm,
guix/gnupg.scm,
guix/http-client.scm,
guix/import/cpan.scm,
guix/import/elpa.scm,
guix/import/pypi.scm,
guix/nar.scm,
guix/scripts.scm,
guix/scripts/archive.scm,
guix/scripts/authenticate.scm,
guix/scripts/build.scm,
guix/scripts/challenge.scm,
guix/scripts/container.scm,
guix/scripts/container/exec.scm,
guix/scripts/copy.scm,
guix/scripts/download.scm,
guix/scripts/edit.scm,
guix/scripts/environment.scm,
guix/scripts/gc.scm,
guix/scripts/graph.scm,
guix/scripts/hash.scm,
guix/scripts/import.scm,
guix/scripts/import/cpan.scm,
guix/scripts/import/cran.scm,
guix/scripts/import/crate.scm,
guix/scripts/import/elpa.scm,
guix/scripts/import/gem.scm,
guix/scripts/import/gnu.scm,
guix/scripts/import/hackage.scm,
guix/scripts/import/nix.scm,
guix/scripts/import/pypi.scm,
guix/scripts/import/stackage.scm,
guix/scripts/lint.scm,
guix/scripts/offload.scm,
guix/scripts/pack.scm,
guix/scripts/package.scm,
guix/scripts/perform-download.scm,
guix/scripts/publish.scm,
guix/scripts/pull.scm,
guix/scripts/refresh.scm,
guix/scripts/size.scm,
guix/scripts/substitute.scm,
guix/scripts/system.scm,
guix/ssh.scm,
guix/upstream.scm: Use 'G_' instead of '_'. Most of this change was
obtained by running: "sed -i -e's/(_ "/(G_ "/g' `find -name \*.scm`".
2017-05-03 15:57:02 +02:00
|
|
|
|
(display (G_ "
|
2017-07-28 17:38:19 +02:00
|
|
|
|
--url=URL download from the Git repository at URL"))
|
|
|
|
|
(display (G_ "
|
|
|
|
|
--commit=COMMIT download the specified COMMIT"))
|
|
|
|
|
(display (G_ "
|
|
|
|
|
--branch=BRANCH download the tip of the specified BRANCH"))
|
2018-06-13 23:39:24 +02:00
|
|
|
|
(display (G_ "
|
|
|
|
|
-l, --list-generations[=PATTERN]
|
|
|
|
|
list generations matching PATTERN"))
|
2018-09-03 12:46:40 +02:00
|
|
|
|
(display (G_ "
|
|
|
|
|
-p, --profile=PROFILE use PROFILE instead of ~/.config/guix/current"))
|
ui: Rename '_' to 'G_'.
This avoids collisions with '_' when the latter is used as a 'match'
pattern for instance. See
<https://lists.gnu.org/archive/html/guix-devel/2017-04/msg00464.html>.
* guix/ui.scm: Rename '_' to 'G_'.
* po/guix/Makevars (XGETTEXT_OPTIONS): Adjust accordingly.
* build-aux/compile-all.scm (warnings): Remove 'format'.
* gnu/packages.scm,
gnu/services.scm,
gnu/services/shepherd.scm,
gnu/system.scm,
gnu/system/shadow.scm,
guix/gnupg.scm,
guix/http-client.scm,
guix/import/cpan.scm,
guix/import/elpa.scm,
guix/import/pypi.scm,
guix/nar.scm,
guix/scripts.scm,
guix/scripts/archive.scm,
guix/scripts/authenticate.scm,
guix/scripts/build.scm,
guix/scripts/challenge.scm,
guix/scripts/container.scm,
guix/scripts/container/exec.scm,
guix/scripts/copy.scm,
guix/scripts/download.scm,
guix/scripts/edit.scm,
guix/scripts/environment.scm,
guix/scripts/gc.scm,
guix/scripts/graph.scm,
guix/scripts/hash.scm,
guix/scripts/import.scm,
guix/scripts/import/cpan.scm,
guix/scripts/import/cran.scm,
guix/scripts/import/crate.scm,
guix/scripts/import/elpa.scm,
guix/scripts/import/gem.scm,
guix/scripts/import/gnu.scm,
guix/scripts/import/hackage.scm,
guix/scripts/import/nix.scm,
guix/scripts/import/pypi.scm,
guix/scripts/import/stackage.scm,
guix/scripts/lint.scm,
guix/scripts/offload.scm,
guix/scripts/pack.scm,
guix/scripts/package.scm,
guix/scripts/perform-download.scm,
guix/scripts/publish.scm,
guix/scripts/pull.scm,
guix/scripts/refresh.scm,
guix/scripts/size.scm,
guix/scripts/substitute.scm,
guix/scripts/system.scm,
guix/ssh.scm,
guix/upstream.scm: Use 'G_' instead of '_'. Most of this change was
obtained by running: "sed -i -e's/(_ "/(G_ "/g' `find -name \*.scm`".
2017-05-03 15:57:02 +02:00
|
|
|
|
(display (G_ "
|
2013-02-20 23:46:38 +01:00
|
|
|
|
--bootstrap use the bootstrap Guile to build the new Guix"))
|
|
|
|
|
(newline)
|
2017-05-09 15:45:04 +02:00
|
|
|
|
(show-build-options-help)
|
ui: Rename '_' to 'G_'.
This avoids collisions with '_' when the latter is used as a 'match'
pattern for instance. See
<https://lists.gnu.org/archive/html/guix-devel/2017-04/msg00464.html>.
* guix/ui.scm: Rename '_' to 'G_'.
* po/guix/Makevars (XGETTEXT_OPTIONS): Adjust accordingly.
* build-aux/compile-all.scm (warnings): Remove 'format'.
* gnu/packages.scm,
gnu/services.scm,
gnu/services/shepherd.scm,
gnu/system.scm,
gnu/system/shadow.scm,
guix/gnupg.scm,
guix/http-client.scm,
guix/import/cpan.scm,
guix/import/elpa.scm,
guix/import/pypi.scm,
guix/nar.scm,
guix/scripts.scm,
guix/scripts/archive.scm,
guix/scripts/authenticate.scm,
guix/scripts/build.scm,
guix/scripts/challenge.scm,
guix/scripts/container.scm,
guix/scripts/container/exec.scm,
guix/scripts/copy.scm,
guix/scripts/download.scm,
guix/scripts/edit.scm,
guix/scripts/environment.scm,
guix/scripts/gc.scm,
guix/scripts/graph.scm,
guix/scripts/hash.scm,
guix/scripts/import.scm,
guix/scripts/import/cpan.scm,
guix/scripts/import/cran.scm,
guix/scripts/import/crate.scm,
guix/scripts/import/elpa.scm,
guix/scripts/import/gem.scm,
guix/scripts/import/gnu.scm,
guix/scripts/import/hackage.scm,
guix/scripts/import/nix.scm,
guix/scripts/import/pypi.scm,
guix/scripts/import/stackage.scm,
guix/scripts/lint.scm,
guix/scripts/offload.scm,
guix/scripts/pack.scm,
guix/scripts/package.scm,
guix/scripts/perform-download.scm,
guix/scripts/publish.scm,
guix/scripts/pull.scm,
guix/scripts/refresh.scm,
guix/scripts/size.scm,
guix/scripts/substitute.scm,
guix/scripts/system.scm,
guix/ssh.scm,
guix/upstream.scm: Use 'G_' instead of '_'. Most of this change was
obtained by running: "sed -i -e's/(_ "/(G_ "/g' `find -name \*.scm`".
2017-05-03 15:57:02 +02:00
|
|
|
|
(display (G_ "
|
2013-02-20 23:46:38 +01:00
|
|
|
|
-h, --help display this help and exit"))
|
ui: Rename '_' to 'G_'.
This avoids collisions with '_' when the latter is used as a 'match'
pattern for instance. See
<https://lists.gnu.org/archive/html/guix-devel/2017-04/msg00464.html>.
* guix/ui.scm: Rename '_' to 'G_'.
* po/guix/Makevars (XGETTEXT_OPTIONS): Adjust accordingly.
* build-aux/compile-all.scm (warnings): Remove 'format'.
* gnu/packages.scm,
gnu/services.scm,
gnu/services/shepherd.scm,
gnu/system.scm,
gnu/system/shadow.scm,
guix/gnupg.scm,
guix/http-client.scm,
guix/import/cpan.scm,
guix/import/elpa.scm,
guix/import/pypi.scm,
guix/nar.scm,
guix/scripts.scm,
guix/scripts/archive.scm,
guix/scripts/authenticate.scm,
guix/scripts/build.scm,
guix/scripts/challenge.scm,
guix/scripts/container.scm,
guix/scripts/container/exec.scm,
guix/scripts/copy.scm,
guix/scripts/download.scm,
guix/scripts/edit.scm,
guix/scripts/environment.scm,
guix/scripts/gc.scm,
guix/scripts/graph.scm,
guix/scripts/hash.scm,
guix/scripts/import.scm,
guix/scripts/import/cpan.scm,
guix/scripts/import/cran.scm,
guix/scripts/import/crate.scm,
guix/scripts/import/elpa.scm,
guix/scripts/import/gem.scm,
guix/scripts/import/gnu.scm,
guix/scripts/import/hackage.scm,
guix/scripts/import/nix.scm,
guix/scripts/import/pypi.scm,
guix/scripts/import/stackage.scm,
guix/scripts/lint.scm,
guix/scripts/offload.scm,
guix/scripts/pack.scm,
guix/scripts/package.scm,
guix/scripts/perform-download.scm,
guix/scripts/publish.scm,
guix/scripts/pull.scm,
guix/scripts/refresh.scm,
guix/scripts/size.scm,
guix/scripts/substitute.scm,
guix/scripts/system.scm,
guix/ssh.scm,
guix/upstream.scm: Use 'G_' instead of '_'. Most of this change was
obtained by running: "sed -i -e's/(_ "/(G_ "/g' `find -name \*.scm`".
2017-05-03 15:57:02 +02:00
|
|
|
|
(display (G_ "
|
2013-02-20 23:46:38 +01:00
|
|
|
|
-V, --version display version information and exit"))
|
|
|
|
|
(newline)
|
|
|
|
|
(show-bug-report-information))
|
|
|
|
|
|
|
|
|
|
(define %options
|
|
|
|
|
;; Specifications of the command-line options.
|
2017-05-09 15:45:04 +02:00
|
|
|
|
(cons* (option '("verbose") #f #f
|
|
|
|
|
(lambda (opt name arg result)
|
|
|
|
|
(alist-cons 'verbose? #t result)))
|
2018-08-27 18:05:49 +02:00
|
|
|
|
(option '(#\C "channels") #t #f
|
|
|
|
|
(lambda (opt name arg result)
|
|
|
|
|
(alist-cons 'channel-file arg result)))
|
2018-06-13 23:39:24 +02:00
|
|
|
|
(option '(#\l "list-generations") #f #t
|
|
|
|
|
(lambda (opt name arg result)
|
|
|
|
|
(cons `(query list-generations ,(or arg ""))
|
|
|
|
|
result)))
|
2017-05-09 15:45:04 +02:00
|
|
|
|
(option '("url") #t #f
|
|
|
|
|
(lambda (opt name arg result)
|
2017-07-28 17:38:19 +02:00
|
|
|
|
(alist-cons 'repository-url arg
|
|
|
|
|
(alist-delete 'repository-url result))))
|
|
|
|
|
(option '("commit") #t #f
|
|
|
|
|
(lambda (opt name arg result)
|
|
|
|
|
(alist-cons 'ref `(commit . ,arg) result)))
|
|
|
|
|
(option '("branch") #t #f
|
|
|
|
|
(lambda (opt name arg result)
|
|
|
|
|
(alist-cons 'ref `(branch . ,(string-append "origin/" arg))
|
|
|
|
|
result)))
|
2018-09-03 12:46:40 +02:00
|
|
|
|
(option '(#\p "profile") #t #f
|
|
|
|
|
(lambda (opt name arg result)
|
|
|
|
|
(alist-cons 'profile (canonicalize-profile arg)
|
|
|
|
|
result)))
|
2017-05-09 15:45:04 +02:00
|
|
|
|
(option '(#\n "dry-run") #f #f
|
|
|
|
|
(lambda (opt name arg result)
|
|
|
|
|
(alist-cons 'dry-run? #t (alist-cons 'graft? #f result))))
|
|
|
|
|
(option '("bootstrap") #f #f
|
|
|
|
|
(lambda (opt name arg result)
|
|
|
|
|
(alist-cons 'bootstrap? #t result)))
|
2013-02-20 23:46:38 +01:00
|
|
|
|
|
2017-05-09 15:45:04 +02:00
|
|
|
|
(option '(#\h "help") #f #f
|
|
|
|
|
(lambda args
|
|
|
|
|
(show-help)
|
|
|
|
|
(exit 0)))
|
|
|
|
|
(option '(#\V "version") #f #f
|
|
|
|
|
(lambda args
|
|
|
|
|
(show-version-and-exit "guix pull")))
|
|
|
|
|
|
|
|
|
|
%standard-build-options))
|
2013-02-20 23:46:38 +01:00
|
|
|
|
|
2014-09-18 18:42:39 +02:00
|
|
|
|
(define what-to-build
|
|
|
|
|
(store-lift show-what-to-build))
|
2017-11-21 23:51:59 +01:00
|
|
|
|
(define indirect-root-added
|
|
|
|
|
(store-lift add-indirect-root))
|
2014-09-18 18:42:39 +02:00
|
|
|
|
|
2018-07-13 16:59:15 +02:00
|
|
|
|
(define (display-profile-news profile)
|
|
|
|
|
"Display what's up in PROFILE--new packages, and all that."
|
|
|
|
|
(match (memv (generation-number profile)
|
|
|
|
|
(reverse (profile-generations profile)))
|
|
|
|
|
((current previous _ ...)
|
|
|
|
|
(newline)
|
|
|
|
|
(let ((old (fold-packages (lambda (package result)
|
|
|
|
|
(alist-cons (package-name package)
|
|
|
|
|
(package-version package)
|
|
|
|
|
result))
|
|
|
|
|
'()))
|
|
|
|
|
(new (profile-package-alist
|
|
|
|
|
(generation-file-name profile current))))
|
|
|
|
|
(display-new/upgraded-packages old new
|
|
|
|
|
#:heading (G_ "New in this revision:\n"))))
|
|
|
|
|
(_ #t)))
|
|
|
|
|
|
2018-09-03 12:46:40 +02:00
|
|
|
|
(define* (build-and-install instances profile
|
2018-08-27 18:05:49 +02:00
|
|
|
|
#:key verbose?)
|
2018-09-03 12:46:40 +02:00
|
|
|
|
"Build the tool from SOURCE, and install it in PROFILE."
|
2018-05-30 17:50:21 +02:00
|
|
|
|
(define update-profile
|
|
|
|
|
(store-lift build-and-use-profile))
|
|
|
|
|
|
2018-08-27 18:05:49 +02:00
|
|
|
|
(mlet %store-monad ((manifest (channel-instances->manifest instances)))
|
2018-07-13 16:59:15 +02:00
|
|
|
|
(mbegin %store-monad
|
2018-08-27 18:05:49 +02:00
|
|
|
|
(update-profile profile manifest)
|
2018-07-13 16:59:15 +02:00
|
|
|
|
(return (display-profile-news profile)))))
|
2014-09-18 18:42:39 +02:00
|
|
|
|
|
2017-07-28 17:38:19 +02:00
|
|
|
|
(define (honor-lets-encrypt-certificates! store)
|
|
|
|
|
"Tell Guile-Git to use the Let's Encrypt certificates."
|
|
|
|
|
(let* ((drv (package-derivation store le-certs))
|
|
|
|
|
(certs (string-append (derivation->output-path drv)
|
|
|
|
|
"/etc/ssl/certs")))
|
|
|
|
|
(build-derivations store (list drv))
|
|
|
|
|
|
|
|
|
|
;; In the past Guile-Git would not provide this procedure.
|
|
|
|
|
(if (module-defined? (resolve-interface '(git))
|
|
|
|
|
'set-tls-certificate-locations!)
|
|
|
|
|
(set-tls-certificate-locations! certs)
|
|
|
|
|
(begin
|
|
|
|
|
;; In this case we end up using whichever certificates OpenSSL
|
|
|
|
|
;; chooses to use: $SSL_CERT_FILE, $SSL_CERT_DIR, or /etc/ssl/certs.
|
|
|
|
|
(warning (G_ "cannot enforce use of the Let's Encrypt \
|
|
|
|
|
certificates~%"))
|
|
|
|
|
(warning (G_ "please upgrade Guile-Git~%"))))))
|
|
|
|
|
|
|
|
|
|
(define (report-git-error error)
|
|
|
|
|
"Report the given Guile-Git error."
|
|
|
|
|
;; Prior to Guile-Git commit b6b2760c2fd6dfaa5c0fedb43eeaff06166b3134,
|
|
|
|
|
;; errors would be represented by integers.
|
|
|
|
|
(match error
|
|
|
|
|
((? integer? error) ;old Guile-Git
|
|
|
|
|
(leave (G_ "Git error ~a~%") error))
|
|
|
|
|
((? git-error? error) ;new Guile-Git
|
|
|
|
|
(leave (G_ "Git error: ~a~%") (git-error-message error)))))
|
|
|
|
|
|
|
|
|
|
(define-syntax-rule (with-git-error-handling body ...)
|
|
|
|
|
(catch 'git-error
|
|
|
|
|
(lambda ()
|
|
|
|
|
body ...)
|
|
|
|
|
(lambda (key err)
|
|
|
|
|
(report-git-error err))))
|
|
|
|
|
|
2018-06-13 23:39:24 +02:00
|
|
|
|
|
|
|
|
|
;;;
|
|
|
|
|
;;; Queries.
|
|
|
|
|
;;;
|
|
|
|
|
|
|
|
|
|
(define (display-profile-content profile number)
|
|
|
|
|
"Display the packages in PROFILE, generation NUMBER, in a human-readable
|
|
|
|
|
way and displaying details about the channel's source code."
|
2018-07-10 16:06:32 +02:00
|
|
|
|
(display-generation profile number)
|
2018-06-13 23:39:24 +02:00
|
|
|
|
(for-each (lambda (entry)
|
|
|
|
|
(format #t " ~a ~a~%"
|
|
|
|
|
(manifest-entry-name entry)
|
|
|
|
|
(manifest-entry-version entry))
|
|
|
|
|
(match (assq 'source (manifest-entry-properties entry))
|
|
|
|
|
(('source ('repository ('version 0)
|
|
|
|
|
('url url)
|
|
|
|
|
('branch branch)
|
|
|
|
|
('commit commit)
|
|
|
|
|
_ ...))
|
|
|
|
|
(format #t (G_ " repository URL: ~a~%") url)
|
|
|
|
|
(when branch
|
|
|
|
|
(format #t (G_ " branch: ~a~%") branch))
|
|
|
|
|
(format #t (G_ " commit: ~a~%") commit))
|
|
|
|
|
(_ #f)))
|
|
|
|
|
|
|
|
|
|
;; Show most recently installed packages last.
|
|
|
|
|
(reverse
|
|
|
|
|
(manifest-entries
|
|
|
|
|
(profile-manifest (generation-file-name profile number))))))
|
|
|
|
|
|
2018-07-10 16:06:32 +02:00
|
|
|
|
(define (indented-string str indent)
|
|
|
|
|
"Return STR with each newline preceded by IDENT spaces."
|
|
|
|
|
(define indent-string
|
|
|
|
|
(make-list indent #\space))
|
|
|
|
|
|
|
|
|
|
(list->string
|
|
|
|
|
(string-fold-right (lambda (chr result)
|
|
|
|
|
(if (eqv? chr #\newline)
|
|
|
|
|
(cons chr (append indent-string result))
|
|
|
|
|
(cons chr result)))
|
|
|
|
|
'()
|
|
|
|
|
str)))
|
|
|
|
|
|
|
|
|
|
(define profile-package-alist
|
|
|
|
|
(mlambda (profile)
|
|
|
|
|
"Return a name/version alist representing the packages in PROFILE."
|
|
|
|
|
(fold (lambda (package lst)
|
|
|
|
|
(alist-cons (inferior-package-name package)
|
|
|
|
|
(inferior-package-version package)
|
|
|
|
|
lst))
|
|
|
|
|
'()
|
|
|
|
|
(let* ((inferior (open-inferior profile))
|
|
|
|
|
(packages (inferior-packages inferior)))
|
|
|
|
|
(close-inferior inferior)
|
|
|
|
|
packages))))
|
|
|
|
|
|
2018-07-13 16:59:15 +02:00
|
|
|
|
(define* (display-new/upgraded-packages alist1 alist2
|
|
|
|
|
#:key (heading ""))
|
2018-07-10 16:06:32 +02:00
|
|
|
|
"Given the two package name/version alists ALIST1 and ALIST2, display the
|
2018-07-13 16:59:15 +02:00
|
|
|
|
list of new and upgraded packages going from ALIST1 to ALIST2. When ALIST1
|
|
|
|
|
and ALIST2 differ, display HEADING upfront."
|
2018-07-10 16:06:32 +02:00
|
|
|
|
(let* ((old (fold (match-lambda*
|
|
|
|
|
(((name . version) table)
|
|
|
|
|
(vhash-cons name version table)))
|
|
|
|
|
vlist-null
|
|
|
|
|
alist1))
|
|
|
|
|
(new (remove (match-lambda
|
|
|
|
|
((name . _)
|
|
|
|
|
(vhash-assoc name old)))
|
|
|
|
|
alist2))
|
|
|
|
|
(upgraded (filter-map (match-lambda
|
|
|
|
|
((name . new-version)
|
|
|
|
|
(match (vhash-fold* cons '() name old)
|
|
|
|
|
(() #f)
|
|
|
|
|
((= (cut sort <> version>?) old-versions)
|
|
|
|
|
(and (version>? new-version
|
|
|
|
|
(first old-versions))
|
|
|
|
|
(string-append name "@"
|
|
|
|
|
new-version))))))
|
|
|
|
|
alist2)))
|
2018-07-13 16:59:15 +02:00
|
|
|
|
(unless (and (null? new) (null? upgraded))
|
|
|
|
|
(display heading))
|
|
|
|
|
|
2018-07-10 16:06:32 +02:00
|
|
|
|
(match (length new)
|
|
|
|
|
(0 #t)
|
|
|
|
|
(count
|
|
|
|
|
(format #t (N_ " ~h new package: ~a~%"
|
|
|
|
|
" ~h new packages: ~a~%" count)
|
|
|
|
|
count
|
|
|
|
|
(indented-string
|
|
|
|
|
(fill-paragraph (string-join (sort (map first new) string<?)
|
|
|
|
|
", ")
|
|
|
|
|
(- (%text-width) 4) 30)
|
|
|
|
|
4))))
|
|
|
|
|
(match (length upgraded)
|
|
|
|
|
(0 #t)
|
|
|
|
|
(count
|
|
|
|
|
(format #t (N_ " ~h package upgraded: ~a~%"
|
|
|
|
|
" ~h packages upgraded: ~a~%" count)
|
|
|
|
|
count
|
|
|
|
|
(indented-string
|
|
|
|
|
(fill-paragraph (string-join (sort upgraded string<?) ", ")
|
|
|
|
|
(- (%text-width) 4) 35)
|
|
|
|
|
4))))))
|
|
|
|
|
|
|
|
|
|
(define (display-profile-content-diff profile gen1 gen2)
|
|
|
|
|
"Display the changes in PROFILE GEN2 compared to generation GEN1."
|
|
|
|
|
(define (package-alist generation)
|
|
|
|
|
(profile-package-alist (generation-file-name profile generation)))
|
|
|
|
|
|
|
|
|
|
(display-profile-content profile gen2)
|
|
|
|
|
(display-new/upgraded-packages (package-alist gen1)
|
|
|
|
|
(package-alist gen2)))
|
|
|
|
|
|
2018-06-13 23:39:24 +02:00
|
|
|
|
(define (process-query opts)
|
|
|
|
|
"Process any query specified by OPTS."
|
|
|
|
|
(define profile
|
|
|
|
|
(string-append (config-directory) "/current"))
|
|
|
|
|
|
|
|
|
|
(match (assoc-ref opts 'query)
|
|
|
|
|
(('list-generations pattern)
|
2018-07-10 16:06:32 +02:00
|
|
|
|
(define (list-generations profile numbers)
|
|
|
|
|
(match numbers
|
|
|
|
|
((first rest ...)
|
|
|
|
|
(display-profile-content profile first)
|
|
|
|
|
(let loop ((numbers numbers))
|
|
|
|
|
(match numbers
|
|
|
|
|
((first second rest ...)
|
|
|
|
|
(display-profile-content-diff profile
|
|
|
|
|
first second)
|
|
|
|
|
(loop (cons second rest)))
|
|
|
|
|
((_) #t)
|
|
|
|
|
(() #t))))))
|
2018-06-13 23:39:24 +02:00
|
|
|
|
|
|
|
|
|
(leave-on-EPIPE
|
|
|
|
|
(cond ((not (file-exists? profile)) ; XXX: race condition
|
|
|
|
|
(raise (condition (&profile-not-found-error
|
|
|
|
|
(profile profile)))))
|
|
|
|
|
((string-null? pattern)
|
2018-07-10 16:06:32 +02:00
|
|
|
|
(list-generations profile (profile-generations profile)))
|
2018-06-13 23:39:24 +02:00
|
|
|
|
((matching-generations pattern profile)
|
|
|
|
|
=>
|
|
|
|
|
(match-lambda
|
|
|
|
|
(()
|
|
|
|
|
(exit 1))
|
|
|
|
|
((numbers ...)
|
2018-07-10 16:06:32 +02:00
|
|
|
|
(list-generations profile numbers)))))))))
|
2018-06-13 23:39:24 +02:00
|
|
|
|
|
2018-08-27 18:05:49 +02:00
|
|
|
|
(define (channel-list opts)
|
|
|
|
|
"Return the list of channels to use. If OPTS specify a channel file,
|
|
|
|
|
channels are read from there; otherwise, if ~/.config/guix/channels.scm
|
|
|
|
|
exists, read it; otherwise %DEFAULT-CHANNELS is used. Apply channel
|
|
|
|
|
transformations specified in OPTS (resulting from '--url', '--commit', or
|
|
|
|
|
'--branch'), if any."
|
|
|
|
|
(define file
|
|
|
|
|
(assoc-ref opts 'channel-file))
|
|
|
|
|
|
|
|
|
|
(define default-file
|
|
|
|
|
(string-append (config-directory) "/channels.scm"))
|
|
|
|
|
|
|
|
|
|
(define (load-channels file)
|
|
|
|
|
(let ((result (load* file (make-user-module '((guix channels))))))
|
|
|
|
|
(if (and (list? result) (every channel? result))
|
|
|
|
|
result
|
|
|
|
|
(leave (G_ "'~a' did not return a list of channels~%") file))))
|
|
|
|
|
|
|
|
|
|
(define channels
|
|
|
|
|
(cond (file
|
|
|
|
|
(load-channels file))
|
|
|
|
|
((file-exists? default-file)
|
|
|
|
|
(load-channels default-file))
|
|
|
|
|
(else
|
|
|
|
|
%default-channels)))
|
|
|
|
|
|
|
|
|
|
(define (environment-variable)
|
|
|
|
|
(match (getenv "GUIX_PULL_URL")
|
|
|
|
|
(#f #f)
|
|
|
|
|
(url
|
|
|
|
|
(warning (G_ "The 'GUIX_PULL_URL' environment variable is deprecated.
|
|
|
|
|
Use '~/.config/guix/channels.scm' instead."))
|
|
|
|
|
url)))
|
|
|
|
|
|
|
|
|
|
(let ((ref (assoc-ref opts 'ref))
|
|
|
|
|
(url (or (assoc-ref opts 'repository-url)
|
|
|
|
|
(environment-variable))))
|
|
|
|
|
(if (or ref url)
|
|
|
|
|
(match channels
|
|
|
|
|
((one)
|
|
|
|
|
;; When there's only one channel, apply '--url', '--commit', and
|
|
|
|
|
;; '--branch' to this specific channel.
|
|
|
|
|
(let ((url (or url (channel-url one))))
|
|
|
|
|
(list (match ref
|
|
|
|
|
(('commit . commit)
|
|
|
|
|
(channel (inherit one)
|
|
|
|
|
(url url) (commit commit) (branch #f)))
|
|
|
|
|
(('branch . branch)
|
|
|
|
|
(channel (inherit one)
|
|
|
|
|
(url url) (commit #f) (branch branch)))
|
|
|
|
|
(#f
|
|
|
|
|
(channel (inherit one) (url url)))))))
|
|
|
|
|
(_
|
|
|
|
|
;; Otherwise bail out.
|
|
|
|
|
(leave
|
|
|
|
|
(G_ "'--url', '--commit', and '--branch' are not applicable~%"))))
|
|
|
|
|
channels)))
|
|
|
|
|
|
2017-05-09 15:45:04 +02:00
|
|
|
|
|
2013-02-20 23:46:38 +01:00
|
|
|
|
(define (guix-pull . args)
|
2013-03-07 19:29:12 +01:00
|
|
|
|
(with-error-handling
|
2017-07-28 17:38:19 +02:00
|
|
|
|
(with-git-error-handling
|
2018-08-27 18:05:49 +02:00
|
|
|
|
(let* ((opts (parse-command-line args %options
|
|
|
|
|
(list %default-options)))
|
|
|
|
|
(cache (string-append (cache-directory) "/pull"))
|
2018-09-03 12:46:40 +02:00
|
|
|
|
(channels (channel-list opts))
|
|
|
|
|
(profile (or (assoc-ref opts 'profile)
|
|
|
|
|
(string-append (config-directory) "/current"))))
|
2018-08-27 18:05:49 +02:00
|
|
|
|
|
2018-06-13 23:39:24 +02:00
|
|
|
|
(cond ((assoc-ref opts 'query)
|
|
|
|
|
(process-query opts))
|
|
|
|
|
((assoc-ref opts 'dry-run?)
|
|
|
|
|
#t) ;XXX: not very useful
|
|
|
|
|
(else
|
|
|
|
|
(with-store store
|
2018-08-27 18:05:49 +02:00
|
|
|
|
(parameterize ((%graft? (assoc-ref opts 'graft?))
|
|
|
|
|
(%repository-cache-directory cache))
|
2018-06-13 23:39:24 +02:00
|
|
|
|
(set-build-options-from-command-line store opts)
|
|
|
|
|
|
2018-08-27 18:05:49 +02:00
|
|
|
|
;; When certificates are already installed, use them.
|
|
|
|
|
;; Otherwise, use the Let's Encrypt certificates, which we
|
|
|
|
|
;; know Savannah uses.
|
|
|
|
|
(let ((certs (or (getenv "SSL_CERT_DIR") "/etc/ssl/certs")))
|
|
|
|
|
(unless (file-exists? certs)
|
|
|
|
|
(honor-lets-encrypt-certificates! store)))
|
2018-06-13 23:39:24 +02:00
|
|
|
|
|
2018-08-27 18:05:49 +02:00
|
|
|
|
(let ((instances (latest-channel-instances store channels)))
|
2018-06-13 23:39:24 +02:00
|
|
|
|
(format (current-error-port)
|
2018-08-27 18:05:49 +02:00
|
|
|
|
(N_ "Building from this channel:~%"
|
|
|
|
|
"Building from these channels:~%"
|
|
|
|
|
(length instances)))
|
|
|
|
|
(for-each (lambda (instance)
|
|
|
|
|
(let ((channel
|
|
|
|
|
(channel-instance-channel instance)))
|
|
|
|
|
(format (current-error-port)
|
|
|
|
|
" ~10a~a\t~a~%"
|
|
|
|
|
(channel-name channel)
|
|
|
|
|
(channel-url channel)
|
|
|
|
|
(string-take
|
|
|
|
|
(channel-instance-commit instance)
|
|
|
|
|
7))))
|
|
|
|
|
instances)
|
2018-06-13 23:39:24 +02:00
|
|
|
|
(parameterize ((%guile-for-build
|
|
|
|
|
(package-derivation
|
|
|
|
|
store
|
|
|
|
|
(if (assoc-ref opts 'bootstrap?)
|
|
|
|
|
%bootstrap-guile
|
|
|
|
|
(canonical-package guile-2.2)))))
|
|
|
|
|
(run-with-store store
|
2018-09-03 12:46:40 +02:00
|
|
|
|
(build-and-install instances profile
|
2018-06-13 23:39:24 +02:00
|
|
|
|
#:verbose?
|
|
|
|
|
(assoc-ref opts 'verbose?)))))))))))))
|
2014-11-09 22:32:21 +01:00
|
|
|
|
|
|
|
|
|
;;; pull.scm ends here
|