summaryrefslogtreecommitdiff
path: root/guix/scripts/hash.scm
Commit message (Collapse)AuthorAge
* guix hash: Allow '-r' as a non-deprecated alias.Ludovic Courtès2022-01-10
| | | | | | | | | | | This is a followup to 05c962594c346da21f201be72caadfa19060cc9d. Discussed at <https://issues.guix.gnu.org/51307#24>. * guix/scripts/hash.scm (%options): Warn about deprecation for "--recursive", but not for '-r' as it's a convenient shorthand. Mention '--serializer=nar' in the deprecation message. * doc/guix.texi (Invoking guix hash): Adjust accordingly.
* guix hash: Extract file hashing procedures.Sarah Morgensen2022-01-06
| | | | | | | | | | * guix/scripts/hash.scm (guix-hash)[vcs-file?] (nar-hash, default-hash): Extract hashing logic to... * guix/hash.scm (vcs-file?, file-hash*): ... these new procedures in this new file. Modified-by: Maxime Devos <maximedevos@telenet.be> Signed-off-by: Ludovic Courtès <ludo@gnu.org>
* guix hash: Allow '--exclude-vcs' option using 'git' serializer.zimoun2022-01-04
| | | | | | | | * guix/scripts/hash.scm (git-hash): Use '#:select?' with 'git-hash-directory'. * tests/guix-hash.sh: Adjust accordingly. Signed-off-by: Timothy Sample <samplet@ngyro.com>
* guix hash: Add git serializer.zimoun2021-12-17
| | | | | | | | | * guix/scripts/hash.scm (git-hash): New procedure. (%options): Use it. * tests/guix-hash.sh: Test it. * doc/guix.texi: Update. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
* guix hash: Add 'serializer' option.zimoun2021-12-17
| | | | | | | | | | | | | * guix/scripts/hash.scm (%options): Deprecate 'recursive', add 'serializer'. (%default-options): Add 'serializer'. (nar-hash): New procedure. (default-hash): New procedure. (guix-hash)[file-hash]: Use them. (show-help): Adjust. * tests/guix-hash.scm: Adjust. * doc/guix.texi: Update. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
* guix hash: Support several files.zimoun2021-12-17
| | | | | | | | | | * guix/scripts/hash.scm (guix-hash): Allow several files. [file-hash]: Catch system-error. [formatted-hash]: New procedure. * tests/guix-hash.sh: Add test. * doc/guix.texi (Invoking guix hash): Mention "one or more files". Co-authored-by: Ludovic Courtès <ludo@gnu.org>
* guix hash: Honor '-H' when used alongside '-r'.Ludovic Courtès2021-01-04
| | | | | | * guix/scripts/hash.scm (guix-hash): When 'recursive? is true, use 'open-hash-port' instead of 'open-sha256-port'. * tests/guix-hash.sh: Add test for 'guix hash -r -H sha512'.
* scripts: Use 'define-command' and have 'guix help' use that.Ludovic Courtès2020-09-10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This changes 'guix help' to print a short synopsis for each command and to group commands by category. * guix/scripts.scm (synopsis, category): New variables. (define-command-categories, define-command): New macros. (%command-categories): New variable. * guix/ui.scm (<command>): New record type. (source-file-command): New procedure. (command-files): Return absolute file names. (commands): Return a list of <command> records. (show-guix-help)[display-commands, category-predicate]: New procedures. Display commands grouped in three categories. * guix/scripts/archive.scm (guix-archive): Use 'define-command'. * guix/scripts/authenticate.scm (guix-authenticate): Likewise. * guix/scripts/build.scm (guix-build): Likewise. * guix/scripts/challenge.scm (guix-challenge): Likewise. * guix/scripts/container.scm (guix-container): Likewise. * guix/scripts/copy.scm (guix-copy): Likewise. * guix/scripts/deploy.scm (guix-deploy): Likewise. * guix/scripts/describe.scm (guix-describe): Likewise. * guix/scripts/download.scm (guix-download): Likewise. * guix/scripts/edit.scm (guix-edit): Likewise. * guix/scripts/environment.scm (guix-environment): Likewise. * guix/scripts/gc.scm (guix-gc): Likewise. * guix/scripts/git.scm (guix-git): Likewise. * guix/scripts/graph.scm (guix-graph): Likewise. * guix/scripts/hash.scm (guix-hash): Likewise. * guix/scripts/import.scm (guix-import): Likewise. * guix/scripts/install.scm (guix-install): Likewise. * guix/scripts/lint.scm (guix-lint): Likewise. * guix/scripts/offload.scm (guix-offload): Likewise. * guix/scripts/pack.scm (guix-pack): Likewise. * guix/scripts/package.scm (guix-package): Likewise. * guix/scripts/perform-download.scm (guix-perform-download): Likewise. * guix/scripts/processes.scm (guix-processes): Likewise. * guix/scripts/publish.scm (guix-publish): Likewise. * guix/scripts/pull.scm (guix-pull): Likewise. * guix/scripts/refresh.scm (guix-refresh): Likewise. * guix/scripts/remove.scm (guix-remove): Likewise. * guix/scripts/repl.scm (guix-repl): Likewise. * guix/scripts/search.scm (guix-search): Likewise. * guix/scripts/show.scm (guix-show): Likewise. * guix/scripts/size.scm (guix-size): Likewise. * guix/scripts/substitute.scm (guix-substitute): Likewise. * guix/scripts/system.scm (guix-system): Likewise. * guix/scripts/time-machine.scm (guix-time-machine): Likewise. * guix/scripts/upgrade.scm (guix-upgrade): Likewise. * guix/scripts/weather.scm (guix-weather): Likewise.
* guix hash, guix download: Support base64 format.Ludovic Courtès2020-05-22
| | | | | | | | * guix/scripts/download.scm (show-help, %options): Support "base64" format. * guix/scripts/hash.scm (show-help, %options): Likewise. * tests/guix-hash.sh: Test it. * doc/guix.texi (Invoking guix hash): Document it.
* guix hash, guix download: Add '--hash'.Ludovic Courtès2020-05-22
| | | | | | | | | | | | * guix/scripts/download.scm (%default-options): Add 'hash-algorithm'. (show-help, %options): Add "--hash". (guix-download): Honor it. * guix/scripts/hash.scm (%default-options): Add 'hash-algorithm'. (show-help, %options): Add "--hash". (guix-hash): Honor it. * tests/guix-hash.sh: Test '-H sha512'. * doc/guix.texi (Invoking guix download): Document it. (Invoking guix hash): Document it.
* guix hash: Fix version and help messagesTim Gesthuizen2018-11-28
| | | | | | | | | | | ca719424455465fca4b872c371daf2a46de88b33 changes the name of the executable to be displayed by the --version and --help commands of `guix hash` to "gcrypt hash". This is reverted by this commit. * guix/scripts/hash.scm (show-help): Change string literals Signed-off-by: Ludovic Courtès <ludo@gnu.org>
* Switch to Guile-Gcrypt.Ludovic Courtès2018-09-04
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This removes (guix hash) and (guix pk-crypto), which now live as part of Guile-Gcrypt (version 0.1.0.) * guix/gcrypt.scm, guix/hash.scm, guix/pk-crypto.scm, tests/hash.scm, tests/pk-crypto.scm: Remove. * configure.ac: Test for Guile-Gcrypt. Remove LIBGCRYPT and LIBGCRYPT_LIBDIR assignments. * m4/guix.m4 (GUIX_ASSERT_LIBGCRYPT_USABLE): Remove. * README: Add Guile-Gcrypt to the dependencies; move libgcrypt as "required unless --disable-daemon". * doc/guix.texi (Requirements): Likewise. * gnu/packages/bash.scm, guix/derivations.scm, guix/docker.scm, guix/git.scm, guix/http-client.scm, guix/import/cpan.scm, guix/import/cran.scm, guix/import/crate.scm, guix/import/elpa.scm, guix/import/gnu.scm, guix/import/hackage.scm, guix/import/texlive.scm, guix/import/utils.scm, guix/nar.scm, guix/pki.scm, guix/scripts/archive.scm, guix/scripts/authenticate.scm, guix/scripts/download.scm, guix/scripts/hash.scm, guix/scripts/pack.scm, guix/scripts/publish.scm, guix/scripts/refresh.scm, guix/scripts/substitute.scm, guix/store.scm, guix/store/deduplication.scm, guix/tests.scm, tests/base32.scm, tests/builders.scm, tests/challenge.scm, tests/cpan.scm, tests/crate.scm, tests/derivations.scm, tests/gem.scm, tests/nar.scm, tests/opam.scm, tests/pki.scm, tests/publish.scm, tests/pypi.scm, tests/store-deduplication.scm, tests/store.scm, tests/substitute.scm: Adjust imports. * gnu/system/vm.scm: Likewise. (guile-sqlite3&co): Rename to... (gcrypt-sqlite3&co): ... this. Add GUILE-GCRYPT. (expression->derivation-in-linux-vm)[config]: Remove. (iso9660-image)[config]: Remove. (qemu-image)[config]: Remove. (system-docker-image)[config]: Remove. * guix/scripts/pack.scm: Adjust imports. (guile-sqlite3&co): Rename to... (gcrypt-sqlite3&co): ... this. Add GUILE-GCRYPT. (self-contained-tarball)[build]: Call 'make-config.scm' without #:libgcrypt argument. (squashfs-image)[libgcrypt]: Remove. [build]: Call 'make-config.scm' without #:libgcrypt. (docker-image)[config, json]: Remove. [build]: Add GUILE-GCRYPT to the extensions Remove (guix config) from the imported modules. * guix/self.scm (specification->package): Remove "libgcrypt", add "guile-gcrypt". (compiled-guix): Remove #:libgcrypt. [guile-gcrypt]: New variable. [dependencies]: Add it. [*core-modules*]: Remove #:libgcrypt from 'make-config.scm' call. Add #:extensions. [*config*]: Remove #:libgcrypt from 'make-config.scm' call. (%dependency-variables): Remove %libgcrypt. (make-config.scm): Remove #:libgcrypt. * build-aux/build-self.scm (guile-gcrypt): New variable. (make-config.scm): Remove #:libgcrypt. (build-program)[fake-gcrypt-hash]: New variable. Add (gcrypt hash) to the imported modules. Adjust load path assignments. * gnu/packages/package-management.scm (guix)[propagated-inputs]: Add GUILE-GCRYPT. [arguments]: In 'wrap-program' phase, add GUILE-GCRYPT to the search path.
* scripts: Factorize option parsing sans 'GUIX_BUILD_OPTIONS'.Ludovic Courtès2017-10-28
| | | | | | | | | | | | | | * guix/scripts.scm (parse-command-line): Add #:build-options? parameter and honor it. * guix/scripts/challenge.scm (guix-challenge): Use 'parse-command-line' with #:build-options? #f instead of 'args-fold*'. * guix/scripts/gc.scm (guix-gc): Likewise. * guix/scripts/graph.scm (guix-graph): Likewise. * guix/scripts/hash.scm (guix-hash): Likewise. * guix/scripts/lint.scm (guix-lint): Likewise. * guix/scripts/refresh.scm (guix-refresh): Likewise. * guix/scripts/size.scm (guix-size): Likewise. * guix/scripts/weather.scm (guix-weather): Likewise.
* ui: Rename '_' to 'G_'.Ludovic Courtès2017-05-03
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This avoids collisions with '_' when the latter is used as a 'match' pattern for instance. See <https://lists.gnu.org/archive/html/guix-devel/2017-04/msg00464.html>. * guix/ui.scm: Rename '_' to 'G_'. * po/guix/Makevars (XGETTEXT_OPTIONS): Adjust accordingly. * build-aux/compile-all.scm (warnings): Remove 'format'. * gnu/packages.scm, gnu/services.scm, gnu/services/shepherd.scm, gnu/system.scm, gnu/system/shadow.scm, guix/gnupg.scm, guix/http-client.scm, guix/import/cpan.scm, guix/import/elpa.scm, guix/import/pypi.scm, guix/nar.scm, guix/scripts.scm, guix/scripts/archive.scm, guix/scripts/authenticate.scm, guix/scripts/build.scm, guix/scripts/challenge.scm, guix/scripts/container.scm, guix/scripts/container/exec.scm, guix/scripts/copy.scm, guix/scripts/download.scm, guix/scripts/edit.scm, guix/scripts/environment.scm, guix/scripts/gc.scm, guix/scripts/graph.scm, guix/scripts/hash.scm, guix/scripts/import.scm, guix/scripts/import/cpan.scm, guix/scripts/import/cran.scm, guix/scripts/import/crate.scm, guix/scripts/import/elpa.scm, guix/scripts/import/gem.scm, guix/scripts/import/gnu.scm, guix/scripts/import/hackage.scm, guix/scripts/import/nix.scm, guix/scripts/import/pypi.scm, guix/scripts/import/stackage.scm, guix/scripts/lint.scm, guix/scripts/offload.scm, guix/scripts/pack.scm, guix/scripts/package.scm, guix/scripts/perform-download.scm, guix/scripts/publish.scm, guix/scripts/pull.scm, guix/scripts/refresh.scm, guix/scripts/size.scm, guix/scripts/substitute.scm, guix/scripts/system.scm, guix/ssh.scm, guix/upstream.scm: Use 'G_' instead of '_'. Most of this change was obtained by running: "sed -i -e's/(_ "/(G_ "/g' `find -name \*.scm`".
* utils: Move base16 procedures to (guix base16).Ludovic Courtès2017-03-16
| | | | | | | | | | | | | | | * guix/utils.scm (bytevector->base16-string, base16-string->bytevector): Move to... * guix/base16.scm: ... here. New file. * tests/utils.scm ("bytevector->base16-string->bytevector"): Move to... * tests/base16.scm: ... here. New file. * Makefile.am (MODULES): Add guix/base16.scm. (SCM_TESTS): Add tests/base16.scm. * build-aux/download.scm, guix/derivations.scm, guix/docker.scm, guix/import/snix.scm, guix/pk-crypto.scm, guix/scripts/authenticate.scm, guix/scripts/download.scm, guix/scripts/hash.scm, guix/store.scm, tests/hash.scm, tests/pk-crypto.scm: Adjust imports accordingly.
* guix hash: '-x' excludes '.git' even when it is a regular file.Ludovic Courtès2017-01-02
| | | | | * guix/scripts/hash.scm (guix-hash)[vcs-file?]: Add case for '.git' regular files.
* guix hash: Interpret '-' as standard input.Ludovic Courtès2016-10-28
| | | | | | * guix/scripts/hash.scm (guix-hash)[file-hash]: Special-case "-". * tests/guix-hash.sh: Add test. * doc/guix.texi (Invoking guix hash): Document it.
* Use (ice-9 binary-ports) instead of (rnrs io ports).Ludovic Courtès2016-10-19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reduces the closure of (guix ui) from 123 to 106 modules. * guix/derivations.scm: Use (ice-9 binary-ports) instead of (rnrs io ports). (map-derivation)[substitute-file]: Use 'read-string' instead of 'get-string-all'. * guix/ftp-client.scm: Likewise. * guix/hash.scm: Likewise. * guix/http-client.scm: Likewise. * guix/pki.scm (ensure-acl, current-acl): Likewise. * guix/scripts/archive.scm (authorize-key)[read-key]: Likewise. * guix/scripts/authenticate.scm (read-canonical-sexp) (read-hash-data): Likewise. * guix/scripts/download.scm: Likewise. * guix/scripts/offload.scm (register-gc-root, remove-gc-roots) (send-files): Likewise. * guix/scripts/publish.scm (lazy-read-file-sexp): Likewise. * guix/scripts/refresh.scm: Likewise. * guix/scripts/substitute.scm (check-acl-initialized): Likewise. * guix/serialization.scm (read-maybe-utf8-string): Likewise. * guix/scripts/hash.scm (guix-hash): Use 'force-output' instead of 'flush-output-port'. * guix/store.scm (process-stderr): Likewise. * guix/tests.scm: Likewise. * guix/utils.scm: Use (ice-9 binary-ports) and autoload (rnrs io ports) for 'make-custom-binary-input-port'.
* ui: Do not shadow '_' where it's used as a literal syntax match.Ludovic Courtès2016-09-20
| | | | | | | | | | | | | | | | | | Fixes compilation with Guile 2.1. Reported by Mu Lei. * guix/ui.scm (report-load-error) (warn-about-load-error, read/eval-package-expression): Use 'rest' instead of '_' as the pattern variable name. * gnu/packages.scm (%find-package): Likewise. * guix/scripts/build.scm (transform-package-inputs): Likewise. * guix/scripts/hash.scm (guix-hash): Likewise. * guix/scripts/import/gnu.scm (%options, guix-import-gnu): Likewise. * guix/scripts/import/nix.scm (guix-import-nix): Likewise. * guix/scripts/offload.scm (build-machines): Likewise. * guix/scripts/refresh.scm (%options): Likewise. * guix/scripts/substitute.scm (narinfo-signature->canonical-sexp): Likewise.
* guix hash: Add --exclude-vcs option.Jan Nieuwenhuizen2016-09-07
| | | | | | | | | | * guix/scripts/hash.scm (show-help): Add help text for --exclude-vcs option. (%options): Add --exclude-vcs option. (guix-hash): Handle exclude-vcs option. * doc/guix.texi ("Invoking guix hash"): Update doc. * tests/guix-hash.sh: Add test. Co-authored-by: Ludovic Courtès <ludo@gnu.org>
* Add (guix scripts).Alex Kost2015-09-18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * guix/ui.scm: Add missing copyright lines. (args-fold*, environment-build-options, %default-argument-handler, parse-command-line): Move to ... * guix/scripts.scm: ...here. New file. * guix/scripts/archive.scm: Use it. * guix/scripts/build.scm: Likewise. * guix/scripts/download.scm: Likewise. * guix/scripts/edit.scm: Likewise. * guix/scripts/environment.scm: Likewise. * guix/scripts/gc.scm: Likewise. * guix/scripts/graph.scm: Likewise. * guix/scripts/hash.scm: Likewise. * guix/scripts/import/cpan.scm: Likewise. * guix/scripts/import/cran.scm: Likewise. * guix/scripts/import/elpa.scm: Likewise. * guix/scripts/import/gem.scm: Likewise. * guix/scripts/import/gnu.scm: Likewise. * guix/scripts/import/hackage.scm: Likewise. * guix/scripts/import/nix.scm: Likewise. * guix/scripts/import/pypi.scm: Likewise. * guix/scripts/lint.scm: Likewise. * guix/scripts/package.scm: Likewise. * guix/scripts/publish.scm: Likewise. * guix/scripts/pull.scm: Likewise. * guix/scripts/refresh.scm: Likewise. * guix/scripts/size.scm: Likewise. * guix/scripts/system.scm: Likewise. * tests/ui.scm (with-environment-variable, "parse-command-line", "parse-command-line and --no options"): Move to ... * tests/scripts.scm: ...here. New file. * Makefile.am (MODULES): Add guix/scripts.scm. (SCM_TESTS): Add tests/scripts.scm. * po/guix/POTFILES.in: Add guix/scripts.scm.
* Break module cycle involving (guix store) and (guix ui).Ludovic Courtès2014-10-09
| | | | | | | | | | | | | | | | | | | | Before, there was a cycle along the lines of: (guix store) -> (guix nar) -> (guix ui) -> (guix store) This caused problems, as discussed at: http://lists.gnu.org/archive/html/guix-devel/2014-10/msg00109.html This patch removes cycles in the (guix ...) modules. * guix/nar.scm (&nar-error, &nar-read-error, dump, write-contents, read-contents, %archive-version-1, write-file, restore-file): Move to... * guix/serialization.scm: ... here. * guix/store.scm: Remove dependency on (guix nar). * guix/scripts/hash.scm, guix/scripts/offload.scm, guix/scripts/substitute-binary.scm, tests/nar.scm, tests/store.scm, tests/substitute-binary.scm: Adjust accordingly.
* guix hash: Add '--recursive'.Ludovic Courtès2014-02-21
| | | | | | | | | | | | * guix/scripts/hash.scm (show-help): Add --recursive. (%options): Likewise. (guix-hash)[file-hash]: New procedure. Honor --recursive. Use it. * guix/nar.scm (write-file): Add missing field to the &nar-error condition raised upon unsupported file type; change its message to be more descriptive. * tests/guix-hash.sh: Add tests with -r. * doc/guix.texi (Invoking guix hash): Document --recursive.
* guix hash: Don't load the whole file in memory.Ludovic Courtès2014-02-20
| | | | | | * guix/scripts/hash.scm (guix-hash)[eof->null]: Remove. (guix-hash): Use 'port-sha256' to compute the hash instead of 'get-bytevector-all' and co.
* Move `sha256' to (guix hash).Ludovic Courtès2013-07-01
| | | | | | | | | * guix/utils.scm (sha256): Move to... * guix/hash.scm: ... here. New file. * Makefile.am (MODULES): Add it. * guix/derivations.scm, guix/scripts/download.scm, guix/scripts/hash.scm, guix/scripts/refresh.scm, tests/base32.scm, tests/derivations.scm, tests/store.scm: Use (guix hash).
* tests: Add `guix hash' test.Ludovic Courtès2013-05-11
| | | | | | | * guix/scripts/hash.scm (guix-hash)[eof->null]: New procedure. Use it to convert the EOF object to the empty bytevector. * tests/guix-hash.sh: New file. * Makefile.am (SH_TESTS): Add it.
* ui: Add `args-fold*' and use it.Ludovic Courtès2013-04-27
| | | | | | | | * guix/ui.scm (args-fold*): New procedure. * guix/scripts/build.scm, guix/scripts/download.scm, guix/scripts/gc.scm, guix/scripts/hash.scm, guix/scripts/import.scm, guix/scripts/package.scm, guix/scripts/pull.scm, guix/scripts/refresh.scm: Use `args-fold*' instead of `args-fold'.
* Add 'guix hash'.Nikita Karetnikov2013-04-21
* guix/scripts/hash.scm: New file. * Makefile.am (MODULES): Add it. * po/POTFILES.in: Add it. * doc/guix.texi (Invoking guix hash): New node. (Defining Packages): Add a cross-reference to the 'Invoking guix hash' node.