;;; guix-entry.el --- 'Entry' type -*- lexical-binding: t -*- ;; Copyright © 2015 Alex Kost ;; 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 this program. If not, see . ;;; Commentary: ;; This file provides an API for 'entry' type which is just an alist of ;; KEY/VALUE pairs (KEY should be a symbol) with the required 'id' KEY. ;;; Code: (require 'cl-lib) (require 'guix-utils) (defalias 'guix-entry-value #'guix-assq-value) (defun guix-entry-id (entry) "Return ENTRY ID." (guix-entry-value entry 'id)) (defun guix-entry-by-id (id entries) "Return an entry from ENTRIES by its ID." (cl-find-if (lambda (entry) (equal (guix-entry-id entry) id)) entries)) (defun guix-entries-by-ids (ids entries) "Return entries with IDS (a list of identifiers) from ENTRIES." (cl-remove-if-not (lambda (entry) (member (guix-entry-id entry) ids)) entries)) (defun guix-replace-entry (id new-entry entries) "Replace an entry with ID from ENTRIES by NEW-ENTRY. Return a list of entries with the replaced entry." (cl-substitute-if new-entry (lambda (entry) (equal id (guix-entry-id entry))) entries :count 1)) (provide 'guix-entry) ;;; guix-entry.el ends here value='range'>range
AgeCommit message (Expand)Author
2023-04-21tests: Relax two tests that expected a non-zero error code....* tests/guix-package-aliases.sh: "guix upgrade foo bar" has always returned zero; adjust accordingly. * tests/guix-refresh.sh: "guix refresh -t test idutils" and similar return zero; adjust accordingly. Ludovic Courtès
2023-04-21tests: Fix checks for expected failures....Addresses <https://issues.guix.gnu.org/62406>. With 'set -e', a return status inverted with '!' does not cause the shell to exit immediately. Instead use '&& false' to indicate an expected failure. * tests/guix-archive.sh, tests/guix-build-branch.sh, tests/guix-build.sh, tests/guix-daemon.sh, tests/guix-download.sh, tests/guix-environment-container.sh, tests/guix-environment.sh, tests/guix-gc.sh, tests/guix-git-authenticate.sh, tests/guix-graph.sh, tests/guix-hash.sh, tests/guix-home.sh, tests/guix-pack-relocatable.sh, tests/guix-pack.sh, tests/guix-package-aliases.sh, tests/guix-package-net.sh, tests/guix-package.sh, tests/guix-refresh.sh, tests/guix-shell.sh, tests/guix-style.sh, tests/guix-system.sh: Replace uses of '! ...' with '... && false' or `test ! ...` as appropriate. Signed-off-by: Ludovic Courtès <ludo@gnu.org> Eric Bavier