it v1.2.3'/>
<meta name='robots' content='noindex, nofollow'/>
<link rel='stylesheet' type='text/css' href='/cgit-static/cgit.css'/>
<link rel='stylesheet' type='text/css' href='/cgit-static/better-cgit-markdown-heading-color.css'/>
<link rel='shortcut icon' href='/cgit-static/favicon.ico'/>
<link rel='alternate' title='Atom feed' href='https://git.koszko.org/guix/atom/?h=koszko' type='application/atom+xml'/>
</head>
<body>
<div id='cgit'><table id='header'>
<tr>
<td class='logo' rowspan='2'><a href='/'><img src='https://git.koszko.org/cgit-static/cgit.png' alt='cgit logo'/></a></td>
<td class='main'><a href='/'>index</a> : <a href='/guix/'>guix</a></td><td class='form'><form method='get'>
<input type='hidden' name='id' value='028959236dee5e2f851218ea6418675531b400cd'/><select name='h' onchange='this.form.submit();'>
<option value='koszko' selected='selected'>koszko</option>
<option value='koszko-scripts'>koszko-scripts</option>
</select> <input type='submit' value='switch'/></form></td></tr>
<tr><td class='sub'>Wojtek's customized Guix</td><td class='sub right'></td></tr></table>
<table class='tabs'><tr><td>
<a class='active' href='/guix/about/'>about</a><a href='/guix/'>summary</a><a href='/guix/refs/?id=028959236dee5e2f851218ea6418675531b400cd'>refs</a><a href='/guix/log/'>log</a><a href='/guix/tree/?id=028959236dee5e2f851218ea6418675531b400cd'>tree</a><a href='/guix/commit/?id=028959236dee5e2f851218ea6418675531b400cd'>commit</a><a href='/guix/diff/?id=028959236dee5e2f851218ea6418675531b400cd'>diff</a></td><td class='form'><form class='right' method='get' action='/guix/log/'>
<input type='hidden' name='id' value='028959236dee5e2f851218ea6418675531b400cd'/><select name='qt'>
<option value='grep'>log msg</option>
<option value='author'>author</option>
<option value='committer'>committer</option>
<option value='range'>range</option>
</select>
<input class='txt' type='search' size='10' name='q' value=''/>
<input type='submit' value='search'/>
</form>
</td></tr></table>
<div class='content'><div id='summary'><pre>
# GNU Guix --- Functional package management for GNU
# Copyright © 2018, 2019 Ludovic Courtès &lt;ludo@gnu.org&gt;
#
# 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 &lt;http://www.gnu.org/licenses/&gt;.

#
# Test the &apos;guix pack --localstatedir&apos; command-line utility.
#

guix pack --version

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

storedir=&quot;`guile -c &apos;(use-modules (guix config))(display %storedir)&apos;`&quot;
localstatedir=&quot;`guile -c &apos;(use-modules (guix config))(display %localstatedir)&apos;`&quot;
NIX_STORE_DIR=&quot;$storedir&quot;
GUIX_DAEMON_SOCKET=&quot;$localstatedir/guix/daemon-socket/socket&quot;
export NIX_STORE_DIR GUIX_DAEMON_SOCKET

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

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

cd &quot;$test_directory&quot;
tar -xf &quot;$the_pack&quot;

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

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

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

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

  (match (sqlite-fold cons &apos;() stmt)
    ((#(ids paths hashes times derivers sizes) ...)
     (exit (member \&quot;`guix build guile-bootstrap`\&quot; paths))))&quot;
</pre>
</div></div> <!-- class=content -->
                         <div class=footer>generated by
                             <a href="https://git.zx2c4.com/cgit/about/">
                                 cgit
                             </a>
                         </div>
                        </div> <!-- id=cgit -->
</body>
</html>
