Content-Security-Policy: default-src 'none'
Content-Type: text/plain; charset=UTF-8
Content-Length: 3181
Content-Disposition: inline; filename="nettle.scm"
Last-Modified: Sat, 07 Dec 2024 05:06:09 GMT
Expires: Tue, 05 Dec 2034 05:06:09 GMT
ETag: "d1203dfe753eafc5cafdea1d670c98fb0029e10a"

;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2012, 2013, 2014, 2015 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2016 Mark H Weaver <mhw@netris.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/>.

(define-module (gnu packages nettle)
  #:use-module (guix utils)
  #:use-module (guix licenses)
  #:use-module (guix packages)
  #:use-module (guix download)
  #:use-module (guix build-system gnu)
  #:use-module (gnu packages multiprecision)
  #:use-module (gnu packages m4))

(define-public nettle-2
  (package
    (name "nettle")
    (version "2.7.1")
    (source (origin
             (method url-fetch)
             (uri (string-append "mirror://gnu/nettle/nettle-"
                                 version ".tar.gz"))
             (sha256
              (base32
               "0h2vap31yvi1a438d36lg1r1nllfx3y19r4rfxv7slrm6kafnwdw"))))
    (build-system gnu-build-system)
    (arguments
     ;; 'sexp-conv' and other programs need to have their RUNPATH point to
     ;; $libdir, which is not the case by default.  Work around it.
     '(#:configure-flags (list (string-append "LDFLAGS=-Wl,-rpath="
                                              (assoc-ref %outputs "out")
                                              "/lib"))))
    (outputs '("out" "debug"))
    (native-inputs `(("m4" ,m4))<pre>
# GNU Guix --- Functional package management for GNU
# Copyright © 2012, 2015-2016, 2024 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;.

# Define some files/folders needed for the tests.
output=&quot;t-download-$$&quot;
test_git_repo=&quot;$(mktemp -d)&quot;
output_dir=&quot;t-archive-dir-$$&quot;
trap &apos;rm -rf &quot;$test_git_repo&quot; ; rm -f &quot;$output&quot; ; rm -rf &quot;$output_dir&quot;&apos; EXIT

#
# Test the `guix download&apos; command-line utility.
#

guix download --version

# Make sure it fails here.
guix download http://does.not/exist &amp;&amp; false

guix download unknown://some/where &amp;&amp; false

guix download /does-not-exist &amp;&amp; false

# This one should succeed.
guix download &quot;file://$abs_top_srcdir/README&quot;

# And this one, without the URI scheme.
guix download &quot;$abs_top_srcdir/README&quot;

# This one too, even if it cannot talk to the daemon.
GUIX_DAEMON_SOCKET=&quot;/nowhere&quot; guix download -o &quot;$output&quot; \
		  &quot;file://$abs_top_srcdir/README&quot;
cmp &quot;$output&quot; &quot;$abs_top_srcdir/README&quot;

# This one should fail.
guix download &quot;file:///does-not-exist&quot; &quot;file://$abs_top_srcdir/README&quot; &amp;&amp; false

# Test git support with local repository.
# First, create a dummy git repo in the temporary directory.
(
    # Avoid interference with user config.
    GIT_CONFIG_GLOBAL=/dev/null
    GIT_CONFIG_SYSTEM=/dev/null
    export GIT_CONFIG_SYSTEM GIT_CONFIG_GLOBAL

    cd $test_git_repo
    git init
    touch test
    git config user.name &quot;User&quot;
    git config user.email &quot;user@domain&quot;
    git add test
    git commit -m &quot;Commit&quot;
    git tag -a -m &quot;v1&quot; v1
)

# Extract commit number.
commit=$((cd $test_git_repo &amp;&amp; git log) | head -n 1 | cut -f2 -d&apos; &apos;)

# We expect that guix hash is working properly or at least that the output of
# &apos;guix download&apos; is consistent with &apos;guix hash&apos;.
expected_hash=$(guix hash -rx $test_git_repo)

# Test the different options
for option in &quot;&quot; &quot;--commit=$commit&quot; &quot;--commit=v1&quot; &quot;--branch=master&quot;
do
    command_output=&quot;$(guix download --git $option &quot;file://$test_git_repo&quot;)&quot;
    computed_hash=&quot;$(echo $command_output | cut -f2 -d&apos; &apos;)&quot;
    store_path=&quot;$(echo $command_output | cut -f1 -d&apos; &apos;)&quot;
    [ &quot;$expected_hash&quot; = &quot;$computed_hash&quot; ]
    diff -r -x &quot;.git&quot; $test_git_repo $store_path
done

# Should fail.
guix download --git --branch=non_existent &quot;file://$test_git_repo&quot; &amp;&amp; false

# Same but download to file instead of store.
guix download --git &quot;file://$test_git_repo&quot; -o $output_dir
diff -r -x &quot;.git&quot; $test_git_repo $output_dir

exit 0
</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>
