aboutsummaryrefslogtreecommitdiff
path: root/tests/guix-hash.sh
blob: 8b03c7985da9d42eb97da2c03e0891d937262c4e (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# GNU Guix --- Functional package management for GNU
# Copyright © 2013, 2014, 2016, 2020, 2021 Ludovic Courtès <ludo@gnu.org>
# Copyright © 2016 Jan Nieuwenhuizen <janneke@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 hash' command-line utility.
#

guix hash --version

tmpdir="guix-hash-$$"
trap 'rm -rf "$tmpdir"' EXIT

test `guix hash /dev/null` = 0mdqa9w1p6cmli6976v4wi0sw9r4p5prkj7lzfd1877wk11c9c73
test `echo -n | guix hash -` = 0mdqa9w1p6cmli6976v4wi0sw9r4p5prkj7lzfd1877wk11c9c73
test `guix hash -f nix-base32 /dev/null` = 0mdqa9w1p6cmli6976v4wi0sw9r4p5prkj7lzfd1877wk11c9c73
test `guix hash -f hex /dev/null` = e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
test `guix hash -f base32 /dev/null` = 4oymiquy7qobjgx36tejs35zeqt24qpemsnzgtfeswmrw6csxbkq
test `guix hash -H sha512 -f hex /dev/null` = cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e
test `guix hash -H sha1 -f base64 /dev/null` = "2jmj7l5rSw0yVb/vlWAYkK/YBwk="

# Several files.
test "`guix hash /dev/null "$abs_top_srcdir/README"`" = "`guix hash /dev/null ; guix hash "$abs_top_srcdir/README"`"

# Zero files.
! guix hash

# idem as `cat /dev/null | git hash-object --stdin`
test `guix hash -S git -H sha1 -f hex  /dev/null` = e69de29bb2d1d6434b8b29ae775ad8c2e48c5391

! guix hash -H abcd1234 /dev/null

mkdir "$tmpdir"
echo -n executable > "$tmpdir/exe"
chmod +x "$tmpdir/exe"
( cd "$tmpdir" ; ln -s exe symlink )
mkdir "$tmpdir/subdir"

test `guix hash -S nar "$tmpdir"` = 10k1lw41wyrjf9mxydi0is5nkpynlsvgslinics4ppir13g7d74p
test `guix hash -S nar "$tmpdir" -H sha512` = 301ra58c2vahczzxiyfin41mpyb0ljh4dh9zn3ijvwviaw1j40sfzw5skh9x945da88n3785ggifzig7acd6k72h0mpsc20m1f66m9n
test `guix hash -S git "$tmpdir"` = 1m9yxz99g7askm88h6hzyv4g2bfv57rp5wvwp3iq5ypsplq1xkkk
test `guix hash -S git "$tmpdir" -H sha512` = 158b10d1bsdk4pm8ym9cg9ckfak1b0cgpw7365cl6s341ir380mh2f4ylicyh8khyrfnwq5cn9766d7m8fbfwwl94ndkv456v6a8knr

# Deprecated --recursive option
test `guix hash -r "$tmpdir" 2>/dev/null` = 10k1lw41wyrjf9mxydi0is5nkpynlsvgslinics4ppir13g7d74p
test `guix hash -r "$tmpdir" -H sha512 2>/dev/null` = 301ra58c2vahczzxiyfin41mpyb0ljh4dh9zn3ijvwviaw1j40sfzw5skh9x945da88n3785ggifzig7acd6k72h0mpsc20m1f66m9n

# Without '-r', this should fail.
! guix hash "$tmpdir"

# This should fail because /dev/null is a character device, which
# the archive format doesn't support.
! guix hash -S nar /dev/null

# Adding a .git directory
mkdir "$tmpdir/.git"
touch "$tmpdir/.git/foo"

# ...changes the hash
test `guix hash -S nar $tmpdir` = 0a50z04zyzf7pidwxv0nwbj82pgzbrhdy9562kncnvkcfvb48m59
test `guix hash -S git $tmpdir` = 0ghlpca9xaswa1ay1g55dknwd9q899mi3ahfr43pq083v8wisjc7

# ...but remains the same when using `-x'
test `guix hash -S nar $tmpdir -x` = 10k1lw41wyrjf9mxydi0is5nkpynlsvgslinics4ppir13g7d74p
test `guix hash -S git $tmpdir -x` = 1m9yxz99g7askm88h6hzyv4g2bfv57rp5wvwp3iq5ypsplq1xkkk

# Without '-r', this should fail.
! guix hash "$tmpdir"

d> 2024-07-23gnu: Add ghc-hclip....gnu/packages/haskell-xyz.scm (ghc-hclip): New variable. Change-Id: I2d1a2d6e1983eb89a5e61eb05204c2e1c0dc3634 Romain GARBAGE 2024-07-23gnu: Add ghc-vty-6....* gnu/packages/haskell-xyz.scm (ghc-vty-6): New variable. Change-Id: I2e2dbbe0e99d26f38494fb6bdb51bc6d67e5c02c Romain GARBAGE 2024-07-23gnu: Add ghc-vty-unix....gnu/packages/haskell-xyz.scm (ghc-vty-unix): New variable. Change-Id: Idf8e550a5d7b645d19af177dd65c5956ba3ab478 Romain GARBAGE 2024-07-23gnu: Add ghc-vty-crossplatform....* gnu/packages/haskell-xyz.scm (ghc-vty-crossplatform): New variable. Change-Id: Icbd33d9bbd7561bdb6178b3431edef6a1db92fcb Romain GARBAGE 2024-07-23gnu: Add ghc-unix-compat-7....* gnu/packages/haskell-xyz.scm (ghc-unix-compat-7): New variable. Change-Id: I28e8e4924d4f829dd07059aa205d894803409320 Romain GARBAGE 2024-07-23gnu: Add ghc-unique....* gnu/packages/haskell-xyz.scm (ghc-unique): New variable. * gnu/packages/patches/ghc-unique-support-newer-hashable.patch: New file. * gnu/local.mk (dist_patch_DATA): Add it. Change-Id: Id9876b8018f5f8b3bcb82ab0bb13616ed298c31b Romain GARBAGE 2024-07-23gnu: Add ghc-stm-delay....* gnu/packages/haskell-xyz.scm (ghc-stm-delay): New variable. Change-Id: If9e20a2c103549de9b4b7d63158fe34165f6036a Romain GARBAGE 2024-07-23gnu: ghc-text-zipper: Update to 0.13....* gnu/packages/haskell-xyz.scm (ghc-text-zipper): Update to 0.13. Change-Id: I0ae9154713d799b48f9f0772a7c7ee2210493095 Romain GARBAGE 2024-07-23gnu: Add ghc-monad-parallel....* gnu/packages/haskell-xyz.scm (ghc-monad-parallel): New variable. Change-Id: I39a5b5392a50fb4f6e9e15ed107705486362d021 Romain GARBAGE 2024-07-23gnu: Add ghc-checkers....* gnu/packages/haskell-xyz.scm (ghc-checkers): New variable. Change-Id: I4228398238a169e49e68ead60cbe69ef0437e3e9 Romain GARBAGE 2024-07-23gnu: Add ghc-bimap....* gnu/packages/haskell-xyz.scm (ghc-bimap): New variable. Change-Id: Ib6ffebff5417273afaa3a08005aae3445606d6d2 Romain GARBAGE 2024-07-23gnu: Add ghc-aspell-pipe....* gnu/packages/haskell-xyz.scm (ghc-aspell-pipe): New variable. Change-Id: I0d31c9c457ce33b45c0fb6589413208796843920 Romain GARBAGE 2024-06-29gnu: Upgrade to Stackage 20.26....* guix/import/stackage.scm (%default-lts-version): Upgrade to Stackage 20.26. * gnu/packages/patches/ghc-aeson-encodeDouble.patch: New file. * gnu/packages/patches/ghc-clock-realfrag.patch: New file. * gnu/local.mk: Register them. * gnu/packages/haskell-check.scm (ghc-tasty-hedgehog): Update. (ghc-tasty-hspec): Update. (ghc-tasty-expected-failure): Update. (ghc-quickcheck-instances): Update. (ghc-quickcheck-io): Update. (ghc-hspec-contrib): Update. * gnu/packages/haskell-crypto.scm (ghc-curve25519): Update. (ghc-tls): Update. * gnu/packages/haskell-web.scm (ghc-tagsoup): Update. (ghc-http2): Update. (ghc-wai-websockets): Update. (ghc-aeson): Update. (ghc-clientsession): Update. (ghc-yesod-core): Update. (ghc-yesod-persistent): Update. (ghc-wai-cors): Update. * gnu/packages/haskell-xyz.scm (ghc-abstract-par): Update. (ghc-adjunctions): Update. (ghc-aeson-diff): Update. (ghc-base16-bytestring): Update. (ghc-base-compat): Update. (ghc-base-compat-batteries): Update. (ghc-basement): Update. (ghc-bencode): Update. (ghc-bytestring-handle): Update. (ghc-c2hs): Update. (ghc-cassava-megaparsec): Update. (ghc-cborg): Update. (ghc-charset): Update. (ghc-chasingbottoms): Update. (ghc-clock): Update. (ghc-cmark-gfm): Update. (ghc-concurrent-extra): Update. (ghc-concurrent-output): Update. (ghc-conduit-extra): Update. (ghc-constraints): Update. (ghc-convertible): Update. (ghc-csv): Update. (ghc-data-accessor): Update. (ghc-data-ordlist): Update. (ghc-dense-linear-algebra): Update. (ghc-diagrams-core): Update. (ghc-diff): Update. (ghc-dual-tree): Update. (ghc-either): Update. (ghc-errors): Update. (ghc-esqueleto): Update. (ghc-exactprint): Update. (ghc-extensible-exceptions): Update. (ghc-fail): Update. (ghc-filepath-bytestring): Update. (ghc-fingertree): Update. (ghc-fmlist): Update. (ghc-foldl): Update. (ghc-free): Update. (ghc-fsnotify): Update. (ghc-generic-random): Update. (ghc-genvalidity-property): Update. (ghc-groups): Update. (ghc-hackage-security): Update. (ghc-half): Update. (ghc-hashtables): Update. (ghc-haskell-src): Update. (ghc-haskell-src-exts-util): Update. (ghc-hourglass): Update. (ghc-hpack): Update. (ghc-hslua): Update. (ghc-hslua-module-system): Update. (ghc-http-api-data): Update. (ghc-ini): Update. (ghc-inline-c): Update. (ghc-inline-c-cpp): Update. (ghc-interpolate): Update. (ghc-intervals): Update. (ghc-invariant): Update. (ghc-io-streams): Update. (ghc-ipynb): Update. (ghc-kan-extensions): Update. (ghc-lens): Update. (ghc-libmpd): Update. (ghc-libyaml): Update. (ghc-lifted-async): Update. (ghc-linear): Update. (ghc-listlike): Update. (ghc-logict): Update. (ghc-lucid): Update. (ghc-lzma-conduit): Update. (ghc-magic): Update. (ghc-microlens-ghc): Update. (ghc-microlens-mtl): Update. (ghc-microlens-platform): Update. (ghc-missingh): Update. (ghc-mmorph): Update. (ghc-monad-control): Update. (ghc-monad-logger): Update. (ghc-monoid-extras): Update. (ghc-murmur-hash): Update. (ghc-ncurses): Update. (ghc-network-info): Update. (ghc-newtype-generics): Update. (ghc-openglraw): Update. (ghc-text-conversions): Update. (ghc-text-icu): Update. (ghc-text-short): Update. (ghc-text-zipper): Update. (ghc-parsers): Update. (ghc-path): Update. (ghc-peano): Update. (ghc-persistent): Update. (ghc-persistent-sqlite): Update. (ghc-process-extras): Update. (ghc-indexed-profunctors): Update. (ghc-project-template): Update. (ghc-psqueues): Update. (ghc-random): Update. (ghc-reducers): Update. (ghc-refact): Update. (ghc-regex-posix): Update. (ghc-resourcet): Update. (ghc-sdl): Update. (ghc-sdl2-image): Update. (ghc-sdl2-mixer): Update. (ghc-sdl2-ttf): Update. (ghc-sdl2-gfx): Update. (ghc-semigroupoids): Update. (ghc-semigroups): Update. (ghc-shakespeare): Update. (ghc-shelly): Update. (ghc-simple-reflect): Update. (ghc-size-based): Update. (ghc-skylighting-format-latex): Update. (ghc-skylighting-format-ansi): Update. (ghc-skylighting): Update. (ghc-sop-core): Update. (ghc-split): Update. (ghc-splitmix): Update. (ghc-statevar): Update. (ghc-statistics): Update. (ghc-stm-conduit): Update. (ghc-storable-complex): Update. (ghc-storablevector): Update. (ghc-svg-builder): Update. (ghc-temporary-rc): Update. (ghc-terminal-size): Update. (ghc-text-manipulate): Update. (ghc-th-abstraction): Update. (ghc-th-expand-syns): Update. (ghc-th-lift-instances): Update. (ghc-th-orphans): Update. (ghc-timezone-series): Update. (ghc-timezone-olson): Update. (ghc-tldr): Update. (ghc-transformers-compat): Update. (ghc-exception-transformers): Update. (ghc-trifecta): Update. (ghc-turtle): Update. (ghc-unagi-chan): Update. (ghc-unexceptionalio): Update. (ghc-unicode-transforms): Update. (ghc-unix-compat): Update. (ghc-unix-time): Update. (ghc-unliftio): Update. (ghc-commutative-semigroups): Update. (ghc-utf8-string): Update. (ghc-void): Update. (ghc-wl-pprint-text): Update. (ghc-x11-xft): Update. (ghc-xml): Update. (ghc-xml-hamlet): Update. (ghc-yaml): Update. (ghc-zip-archive): Update. (ghc-zlib): Update. (ghc-zstd): Update. (ghc-keys): Update. (ghc-pointed): Update. (ghc-lift-type): Update. (ghc-unicode-collation): Update. (ghc-citeproc): Update. (ghc-commonmark): Update. (ghc-commonmark-extensions): Update. (ghc-genvalidity-hspec): Update. (ghc-netlink): Update. (ghc-doctest-driver-gen): Update. (ghc-mysql): Update. (ghc-persistent-qq): Update. (ghc-persistent-mysql): Update. (ghc-string-conversions): Update. (ghc-postgresql-simple): Update. (ghc-persistent-postgresql): Update. (ghc-filtrable): Update. (ghc-hsyaml-aeson): Update. (ghc-singleton-bool): Update. (ghc-git-lfs): Update. (ghc-nothunks): Update. (ghc-onetuple): Update. (ghc-doctest-parallel): Update. (ghc-ordered-containers): Update. (ghc-hslua-marshalling): Update. (ghc-gridtables): Update. (ghc-should-not-typecheck): Update. (ghc-servant-server): Update. (ghc-recv): Update. (ghc-glib): Update. (ghc-pango): Update. (ghc-monoidal-containers): Update. (ghc-newtype): Update. (ghc-random-shuffle): Update. (ghc-ref-tf): Update. * gnu/packages/irc.scm (glirc): Update. * gnu/packages/purescript.scm (purescript): Update. * gnu/packages/wm.scm (icewm): Update. (ghc-xmobar): Update. Change-Id: I26ef7c2ef06e3075eba3da21947f16708c437f98 Lars-Dominik Braun 2024-04-04gnu: ghc-hmatrix: Switch to openblas....* gnu/packages/haskell-xyz.scm (ghc-hmatrix): Switch input dependency from lapack to openblas. Add configure flags. Change-Id: Ic8924b1fb9fa61af16abd1ac2a22c82a352a8e1b Signed-off-by: Ludovic Courtès <ludo@gnu.org> Romain GARBAGE 2023-11-21Merge branch 'master' into mesa-updates...Change-Id: I94c6874e5fdf916e3eb911f1a7df610cd3275474 John Kehayias 2023-11-19gnu: Add ghc-fdo-notify....* gnu/packages/haskell-xyz.scm (ghc-fdo-notify): New variable. Change-Id: I0722f9765c4ef02f6a9953b5f4824c60854e9a9d Efraim Flashner 2023-11-19gnu: Add ghc-git-lfs....* gnu/packages/haskell-xyz.scm (ghc-git-lfs): New variable. Change-Id: I3470899cbf9e5b3170abb6cc89d4029cad8aa182 Efraim Flashner 2023-11-15gnu: pandoc: Install bash completions, man page....* gnu/packages/haskell-xyz.scm (pandoc)[arguments]: Add a phase to install the bash completions and the man page. Change-Id: I3e5c18971e06cc3b69ed49a15ab8da11e809e532 Efraim Flashner 2023-11-15gnu: ghc-pandoc: Skip failing tests from i686-linux....* gnu/packages/haskell-xyz.scm (ghc-pandoc)[source]: Adjust snippet to remove two tests. Change-Id: I05476c0bc2f50328efb30ce26d446850321bad6d Efraim Flashner 2023-11-15gnu: ghc-persistent: Fix build on i686-linux....* gnu/packages/haskell-xyz.scm (ghc-persistent)[source]: Add patch. * gnu/packages/patches/ghc-persistent-fix-32bit.patch: New file. * gnu/local.mk (dist_patch_DATA): Register it. Change-Id: I1b2c8419f3136d6c9df772d7c7abdc83a80d6112 Efraim Flashner 2023-11-15gnu: ghc-memory: Fix building on i686-linux....* gnu/packages/haskell-xyz.scm (ghc-memory)[source]: Add patch. * gnu/packages/patches/ghc-memory-fix-32bit.patch: New file. * gnu/local.mk (dist_patch_DATA): Register it. Change-Id: I8dc7a13a94ce37021ad402b4e2d0cd061220f670 Efraim Flashner 2023-11-15gnu: ghc-bloomfilter: Update to 2.0.1.2....* gnu/packages/haskell-xyz.scm (ghc-bloomfilter): Update to 2.0.1.2. [source]: Remove patch. Add snippet to fix building on 32-bit systems. [arguments]: Remove field. [home-page]: Update to new home-page. * gnu/packages/patches/ghc-bloomfilter-ghc9.2.patch: Remove file. * gnu/local.mk (dist_patch_DATA): Remove it. Change-Id: Ie61d079b001f804fd28acaca2acd3127b88935d4 Efraim Flashner 2023-11-15gnu: ghc-base64: Skip tests on i686-linux....* gnu/packages/haskell-xyz.scm (ghc-base64)[arguments]: Skip tests when building for i686-linux. Change-Id: I2de264eb0a0b1ae3d6ca1e29c9b1dce589104aa1 Efraim Flashner 2023-11-15gnu: ghc-base64: Update to Cabal revision 4....* gnu/packages/haskell-xyz.scm (ghc-base64)[arguments]: Update to Cabal revision 4. [synopsis]: Satisfy linter. Change-Id: I3e234f85371865dfc45a4f004b442209fd68091a Efraim Flashner 2023-11-15gnu: ghc-basement: Fix build on i686-linux....* gnu/packages/haskell-xyz.scm (ghc-basement)[source]: Add patch. * gnu/packages/patches/ghc-basement-fix-32bit.patch: New file. * gnu/local.mk (dist_patch_DATA): Register it. Change-Id: Ife75c651d4b9cffa14ec1c5165a9254cfee3f09f Efraim Flashner 2023-11-14gnu: Add ghc-text-icu....* gnu/packages/haskell-xyz.scm (ghc-text-icu): New variable. Change-Id: I553f1fef4e76aeea6d09901917fd5d6032c23d46 Josselin Poiret 2023-07-23gnu: Add ghc-vty....* gnu/packages/haskell-xyz.scm (ghc-vty): New public variable. Tobias Geerinckx-Rice 2023-07-23gnu: Add ghc-irc-core....* gnu/packages/haskell-xyz.scm (ghc-irc-core): New public variable. Tobias Geerinckx-Rice 2023-07-23gnu: Add ghc-hookup....* gnu/packages/haskell-xyz.scm (ghc-hookup): New public variable. Tobias Geerinckx-Rice 2023-07-23gnu: Add ghc-config-schema....* gnu/packages/haskell-xyz.scm (ghc-config-schema): New public variable. Tobias Geerinckx-Rice 2023-07-23gnu: Add ghc-config-value....* gnu/packages/haskell-xyz.scm (ghc-config-value): New public variable. Tobias Geerinckx-Rice