~ruther/guix-local

4f024ef3181c5235ff11789e8c8f62722f974787 — Ludovic Courtès 8 years ago 894fc4e
build: Remove code to download the Guile bootstrap tarball.

* build-aux/download.scm: Remove.
* Makefile.am (EXTRA_DIST): Remove it.
(check-system): Remove dependency on $(BOOTSTRAP_GUILE_TARBALLS).
* gnu/local.mk (nodist_bootstrap_x86_64_linux_DATA)
(nodist_bootstrap_i686_linux_DATA, nodist_bootstrap_armhf_linux_DATA)
(nodist_bootstrap_aarch64_linux_DATA, nodist_bootstrap_mips64el_linux_DATA)
(BOOTSTRAP_GUILE_TARBALLS, DISTCLEANFILES, DOWNLOAD_FILE)
(%D%/packages/bootstrap/x86_64-linux/guile-2.0.9.tar.xz)
(%D%/packages/bootstrap/i686-linux/guile-2.0.9.tar.xz)
(%D%/packages/bootstrap/armhf-linux/guile-2.0.11.tar.xz)
(%D%/packages/bootstrap/aarch64-linux/guile-2.0.14.tar.xz)
(%D%/packages/bootstrap/mips64el-linux/guile-2.0.9.tar.xz): Remove.
* build-aux/test-env.in: Add "guix download" invocation when
gnu/packages/bootstrap/guile* exists.
4 files changed, 16 insertions(+), 125 deletions(-)

M Makefile.am
D build-aux/download.scm
M build-aux/test-env.in
M gnu/local.mk
M Makefile.am => Makefile.am +1 -2
@@ 388,7 388,7 @@ check-local:

endif !CAN_RUN_TESTS

check-system: $(GOBJECTS) $(BOOTSTRAP_GUILE_TARBALLS)
check-system: $(GOBJECTS)
	$(AM_V_at)$(top_builddir)/pre-inst-env			\
	   $(GUILE) --no-auto-compile				\
	   -e '(@@ (run-system-tests) run-system-tests)'	\


@@ 418,7 418,6 @@ EXTRA_DIST =						\
  build-aux/hydra/guix.scm				\
  build-aux/check-available-binaries.scm		\
  build-aux/check-final-inputs-self-contained.scm	\
  build-aux/download.scm				\
  build-aux/generate-authors.scm			\
  build-aux/test-driver.scm				\
  build-aux/update-guix-package.scm			\

D build-aux/download.scm => build-aux/download.scm +0 -73
@@ 1,73 0,0 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2012, 2013, 2017 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2014, 2015 Mark H Weaver <mhw@netris.org>
;;; Copyright © 2017 Efraim Flashner <efraim@flashner.co.il>
;;;
;;; 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/>.

;;;
;;; Download a binary file from an external source.
;;;

(use-modules (ice-9 match)
             (web uri)
             (web client)
             (rnrs io ports)
             (srfi srfi-11)
             (guix base16)
             (guix hash))

(define %url-base
  "http://alpha.gnu.org/gnu/guix/bootstrap"

  ;; Alternately:
  ;;"http://www.fdn.fr/~lcourtes/software/guix/packages"
  )

(define (file-name->uri file)
  "Return the URI for FILE."
  (match (string-tokenize file (char-set-complement (char-set #\/)))
    ((_ ... system basename)
     (string->uri
      (string-append %url-base "/" system
                     (match system
                       ("aarch64-linux"
                        "/20170217/")
                       ("armhf-linux"
                        "/20150101/")
                       (_
                        "/20131110/"))
                     basename)))))

(match (command-line)
  ((_ file expected-hash)
   (let ((uri (file-name->uri file)))
     (format #t "downloading file `~a'~%from `~a'...~%"
             file (uri->string uri))
     (let*-values (((resp data) (http-get uri #:decode-body? #f))
                   ((hash)      (bytevector->base16-string (sha256 data)))
                   ((part)      (string-append file ".part")))
       (if (string=? expected-hash hash)
           (begin
             (call-with-output-file part
               (lambda (port)
                 (put-bytevector port data)))
             (rename-file part file))
           (begin
             (format (current-error-port)
                     "file at `~a' has SHA256 ~a; expected ~a~%"
                     (uri->string uri) hash expected-hash)
             (exit 1)))))))

M build-aux/test-env.in => build-aux/test-env.in +15 -1
@@ 1,7 1,7 @@
#!/bin/sh

# GNU Guix --- Functional package management for GNU
# Copyright © 2012, 2013, 2014, 2015, 2016 Ludovic Courtès <ludo@gnu.org>
# Copyright © 2012, 2013, 2014, 2015, 2016, 2017 Ludovic Courtès <ludo@gnu.org>
#
# This file is part of GNU Guix.
#


@@ 110,6 110,20 @@ then

    daemon_pid=$!
    trap "kill $daemon_pid ; rm -rf $NIX_STATE_DIR" EXIT

    # The test suite expects the 'guile-bootstrap' package to be available.
    # Normally the Guile bootstrap tarball is downloaded by a fixed-output
    # derivation but when network access is missing we allow users to drop
    # the tarball in 'gnu/packages/bootstrap/SYSTEM' and "intern" it here.
    bootstrap_directory="@abs_top_builddir@/gnu/packages/bootstrap/@guix_system@"
    if [ -d "$bootstrap_directory" ]
    then
	for file in "$bootstrap_directory"/guile-*
	do
	    "@abs_top_builddir@/pre-inst-env"			\
		guix download "file://$file" > /dev/null
	done
    fi
fi

# Avoid issues that could stem from l10n, such as language/encoding

M gnu/local.mk => gnu/local.mk +0 -49
@@ 1159,56 1159,7 @@ dist_bootstrap_mips64el_linux_DATA =		\
  %D%/packages/bootstrap/mips64el-linux/tar	\
  %D%/packages/bootstrap/mips64el-linux/xz

# Big bootstrap binaries are not included in the tarball.  Instead, they
# are downloaded.
nodist_bootstrap_x86_64_linux_DATA =					\
  %D%/packages/bootstrap/x86_64-linux/guile-2.0.9.tar.xz
nodist_bootstrap_i686_linux_DATA =					\
  %D%/packages/bootstrap/i686-linux/guile-2.0.9.tar.xz
nodist_bootstrap_armhf_linux_DATA =					\
  %D%/packages/bootstrap/armhf-linux/guile-2.0.11.tar.xz
nodist_bootstrap_aarch64_linux_DATA =					\
  %D%/packages/bootstrap/aarch64-linux/guile-2.0.14.tar.xz
nodist_bootstrap_mips64el_linux_DATA =					\
  %D%/packages/bootstrap/mips64el-linux/guile-2.0.9.tar.xz

# Those files must remain executable, so they remain executable once
# imported into the store.
set-bootstrap-executable-permissions:
	chmod +x $(DESTDIR)$(bootstrapdir)/*/{bash,mkdir,tar,xz}

BOOTSTRAP_GUILE_TARBALLS =			\
  $(nodist_bootstrap_x86_64_linux_DATA)		\
  $(nodist_bootstrap_i686_linux_DATA)		\
  $(nodist_bootstrap_armhf_linux_DATA)		\
  $(nodist_bootstrap_aarch64_linux_DATA)	\
  $(nodist_bootstrap_mips64el_linux_DATA)

DISTCLEANFILES = $(BOOTSTRAP_GUILE_TARBALLS)

# Method to download a file from an external source.
DOWNLOAD_FILE =								\
  GUILE_LOAD_COMPILED_PATH="$(top_builddir):$$GUILE_LOAD_COMPILED_PATH"	\
  $(GUILE) --no-auto-compile -L "$(top_builddir)" -L "$(top_srcdir)"	\
           "$(top_srcdir)/build-aux/download.scm"

%D%/packages/bootstrap/x86_64-linux/guile-2.0.9.tar.xz:
	$(AM_V_DL)$(MKDIR_P) `dirname "$@"`;	\
	$(DOWNLOAD_FILE) "$@"			\
	  "037b103522a2d0d7d69c7ffd8de683dfe5bb4b59c1fafd70b4ffd397fd2f57f0"
%D%/packages/bootstrap/i686-linux/guile-2.0.9.tar.xz:
	$(AM_V_DL)$(MKDIR_P) `dirname "$@"`;	\
	$(DOWNLOAD_FILE) "$@"			\
	  "b757cd46bf13ecac83fb8e955fb50096ac2d17bb610ca8eb816f29302a00a846"
%D%/packages/bootstrap/armhf-linux/guile-2.0.11.tar.xz:
	$(AM_V_DL)$(MKDIR_P) `dirname "$@"`;	\
	$(DOWNLOAD_FILE) "$@"			\
	  "e551d05d4d385d6706ab8d574856a087758294dc90ab4c06e70a157a685e23d6"
%D%/packages/bootstrap/aarch64-linux/guile-2.0.14.tar.xz:
	$(AM_V_DL)$(MKDIR_P) `dirname "$@"`;	\
	$(DOWNLOAD_FILE) "$@"			\
	  "3939909f24dcb955621aa7f81ecde6844bea8a083969c2d275c55699af123ebe"
%D%/packages/bootstrap/mips64el-linux/guile-2.0.9.tar.xz:
	$(AM_V_DL)$(MKDIR_P) `dirname "$@"`;	\
	$(DOWNLOAD_FILE) "$@" 			\
	  "994680f0001346864aa2c2cc5110f380ee7518dcd701c614291682b8e948f73b"