aboutsummaryrefslogtreecommitdiff
# GNU Guix --- Functional package management for GNU
# Copyright © 2013, 2014, 2015, 2019, 2020 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/>.

#
# Test the 'guix archive' command-line utility.
#

guix archive --version

archive="t-archive-$$"
archive_alt="t-archive-alt-$$"
tmpdir="t-archive-dir-$$"
rm -f "$archive" "$archive_alt"
rm -rf "$tmpdir"

trap 'rm -f "$archive" "$archive_alt"; chmod -R +w "$tmpdir"; rm -rf "$tmpdir"' EXIT

guix archive --export guile-bootstrap > "$archive"
guix archive --export guile-bootstrap:out > "$archive_alt"
cmp "$archive" "$archive_alt"

guix archive --export							\
    -e '(@ (gnu packages bootstrap) %bootstrap-guile)' > "$archive_alt"
cmp "$archive" "$archive_alt"

guix archive --export `guix build guile-bootstrap` > "$archive_alt"
cmp "$archive" "$archive_alt"

# Check the exit value upon import.
guix archive --import < "$archive"

guix archive --export something-that-does-not-exist && false

# This one must not be listed as missing.
guix build guile-bootstrap > "$archive"
guix archive --missing < "$archive"
test "`guix archive --missing < "$archive"`" = ""

# Two out of three should be listed as missing.
echo "$NIX_STORE_DIR/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa-foo" >> "$archive"
echo "$NIX_STORE_DIR/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa-bar" >> "$archive"
guix archive --missing < "$archive" > "$archive_alt"
echo "$NIX_STORE_DIR/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa-foo" > "$archive"
echo "$NIX_STORE_DIR/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa-bar" >> "$archive"
cmp "$archive" "$archive_alt"

# This is not a valid store file name, so an error.
echo something invalid > "$archive"
guix archive --missing < "$archive" && false

# Check '--extract'.
guile -c "(use-modules (guix serialization))
  (call-with-output-file \"$archive\"
    (lambda (port)
      (write-file \"$(guix build guile-bootstrap)\" port)))"
guix archive -x "$tmpdir" < "$archive"
test -x "$tmpdir/bin/guile"
test -d "$tmpdir/lib/guile"

# Check '--list'.
guix archive -t < "$archive" | grep "^D /share/guile"
guix archive -t < "$archive" | grep "^x /bin/guile"
guix archive -t < "$archive" | grep "^r /share/guile.*/boot-9\.scm"

echo foo | guix archive --authorize && false

exit 0
atesMarius Bakke 2020-05-05image: Add a new API....Mathieu Othacehe 2020-04-08Merge branch 'master' into core-updates...Marius Bakke 2020-04-07ci: Remove "mips64el-linux-gnuabi64" from '%cross-targets'....Ludovic Courtès 2020-03-14Merge branch 'master' into core-updatesMarius Bakke 2020-03-13maint: Add 'etc/release-manifest.scm'....Ludovic Courtès 2020-03-10Merge branch 'master' into core-updatesMarius Bakke 2020-03-05ci: Adjust 'channel-build-system' for when the source is a file name....Ludovic Courtès 2020-03-05tests: "make check-system" no longer interns source upfront....Ludovic Courtès 2020-03-05ci: Move 'cross-jobs' procedure to the top level....Ludovic Courtès 2020-02-24ci: Don't cross build bootstrap tarballs to MinGW....Ludovic Courtès 2020-01-31ci: Cross-build for riscv64-linux-gnu....Ludovic Courtès 2019-12-01ci: Make sure the Guix checkout is the one providing Cuirass proc....Clément Lassieur 2019-11-13tests: "make check-system" uses Guix built with (guix self)....Ludovic Courtès 2019-08-26ci: Try hard to build package replacements....Ludovic Courtès 2019-08-14gnu: mingw: Add x86_64 support....Carl Dong 2019-07-06ci: 'channel-build-system' honors the target system....Ludovic Courtès