aboutsummaryrefslogtreecommitdiff
# GNU Guix --- Functional package management for GNU
# Copyright © 2018, 2019 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 pack --localstatedir' command-line utility.
#

guix pack --version

# 'guix pack --localstatedir' produces derivations that depend on
# guile-sqlite3 and guile-gcrypt.  To make that relatively inexpensive, run
# the test in the user's global store if possible, on the grounds that
# binaries may already be there or can be built or downloaded inexpensively.

storedir="`guile -c '(use-modules (guix config))(display %storedir)'`"
localstatedir="`guile -c '(use-modules (guix config))(display %localstatedir)'`"
NIX_STORE_DIR="$storedir"
GUIX_DAEMON_SOCKET="$localstatedir/guix/daemon-socket/socket"
export NIX_STORE_DIR GUIX_DAEMON_SOCKET

if ! guile -c '(use-modules (guix)) (exit (false-if-exception (open-connection)))'
then
    exit 77
fi

# Build a tarball with '--localstatedir'
the_pack="`guix pack -C none --localstatedir --profile-name=current-guix \
            guile-bootstrap`"
test_directory="`mktemp -d`"
trap 'chmod -Rf +w "$test_directory"; rm -rf "$test_directory"' EXIT

cd "$test_directory"
tar -xf "$the_pack"

profile="`find -name current-guix`"
test "`readlink $profile`" = "current-guix-1-link"
test -s "`dirname $profile`/../../../db/db.sqlite"
test -x ".`guix build guile-bootstrap`/bin/guile"
cd -

# Make sure the store database is not completely bogus.
guile -c "(use-modules (sqlite3) (guix config) (ice-9 match))

  (define db
    (sqlite-open (string-append \"$test_directory\"
                                %localstatedir
                               \"/guix/db/db.sqlite\")
                 SQLITE_OPEN_READONLY))

  (define stmt
    (sqlite-prepare db \"SELECT * FROM ValidPaths;\"))

  (match (sqlite-fold cons '() stmt)
    ((#(ids paths hashes times derivers sizes) ...)
     (exit (member \"`guix build guile-bootstrap`\" paths))))"
e='2017-01-23 17:23:05 -0500'>2017-01-23gnu: ffmpeg: Don't replace 'sh' reference with 'bash'....Leo Famulari 2017-01-23gnu: avidemux: Don't replace 'sh' reference with 'bash'....Leo Famulari 2017-01-20gnu: obs: Update to 17.0.2....Efraim Flashner 2017-01-15gnu: youtube-dl: Update to 2017.01.14....Tobias Geerinckx-Rice 2017-01-10gnu: youtube-dl: Update to 2017.01.10....Ludovic Courtès 2017-01-07gnu: gnome-mpv: Update to 0.11....Alex Griffin 2017-01-02gnu: mpv: Update to 0.23.0....Efraim Flashner 2017-01-02gnu: ffmpeg@2.8: Update to 2.8.10....Efraim Flashner 2016-12-21gnu: mlt: Update to 6.4.1....Tobias Geerinckx-Rice 2016-12-17gnu: youtube-dl: Update to 2016.12.15....Leo Famulari 2016-12-10gnu: ffmpeg@2.8: Update to 2.8.9....Efraim Flashner 2016-12-07gnu: libx264: Update to 20161205-2245....Efraim Flashner 2016-12-06gnu: ffmpeg: Update to 3.2.2....Efraim Flashner 2016-12-06gnu: Add openh264....Jan Nieuwenhuizen 2016-11-26gnu: ffmpeg: Update to 3.2.1....Efraim Flashner 2016-11-21gnu: obs: Update to 0.16.6....Efraim Flashner 2016-11-21gnu: mpv: Update to 0.22.0....Efraim Flashner 2016-11-18gnu: mps-youtube: Disable tests....ng0 2016-11-17gnu: obs: Update to 0.16.5....Efraim Flashner 2016-11-16gnu: Add Handbrake....Eric Bavier 2016-11-14gnu: mpv: Use lua@5.2....Andy Patterson 2016-11-06Merge branch 'master' into core-updatesMark H Weaver 2016-11-05gnu: Add mps-youtube....ng0 2016-10-29Merge branch 'master' into core-updatesLeo Famulari 2016-10-29gnu: ffmpeg: Update to 3.2....Efraim Flashner 2016-10-29gnu: vapoursynth: Update to 35....Efraim Flashner 2016-10-26Merge branch 'master' into core-updatesLeo Famulari 2016-10-26gnu: vlc: Add x265 support....Efraim Flashner 2016-10-26gnu: ffmpeg: Add x265 support....Efraim Flashner 2016-10-26gnu: Add x265....Efraim Flashner 2016-10-23Merge branch 'master' into core-updatesMark H Weaver 2016-10-23gnu: ffmpeg: Update to 3.1.5....Efraim Flashner 2016-10-21gnu: mpv: Update to 0.21.0....Leo Famulari 2016-10-19Merge branch 'master' into core-updatesMark H Weaver 2016-10-18gnu: vapoursynth: Update to 34....Efraim Flashner 2016-10-15gnu: youtube-dl: Disable the tests....Leo Famulari 2016-10-15gnu: youtube-dl: Update to 2016-10-16....Leo Famulari 2016-10-15gnu: youtube-dl: Update to 2016-10-16....Leo Famulari 2016-10-12Merge branch 'master' into core-updatesMark H Weaver 2016-10-10gnu: obs: Update to 0.16.2....Efraim Flashner 2016-10-05Merge branch 'master' into core-updatesLeo Famulari