;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2024 Liliana Marie Prikler ;;; ;;; 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 . (define-module (gnu tests emacs) #:use-module (gnu tests) #:use-module (gnu packages emacs) #:use-module (gnu packages vim) #:use-module (gnu services) #:use-module (gnu system) #:use-module (gnu system vm) #:use-module (guix packages) #:use-module (guix gexp) #:use-module (srfi srfi-1) #:export (%test-emacs-native-comp-replacable)) (define (run-native-comp-replacable-test old-emacs new-emacs) (define vm (virtual-machine (marionette-operating-system %simple-os))) (define test (with-imported-modules '((gnu build marionette)) #~(begin (use-modules (gnu build marionette) (srfi srfi-1) (srfi srfi-64)) (define marionette (make-marionette (list #$vm))) (define (marionette-emacs-eval emacs code) (marionette-eval `(begin (use-modules (ice-9 rdelim) (ice-9 popen)) (read-line (open-pipe* OPEN_READ ,emacs "--batch" ,(string-append "--eval=" code)))) marionette)) (define (emacs-native-comp-dir emacs) (marionette-emacs-eval emacs "(princ comp-native-version-dir)")) (define (emacs-abi-hash emacs) (marionette-emacs-eval emacs "(princ comp-abi-hash)")) (define (emacs-effective-version emacs) (marionette-emacs-eval emacs "(princ (format \"%s.%s\" emacs-major-version emacs-minor-version))")) (define old-emacs-bin #$(file-append old-emacs "/bin/emacs")) (define new-emacs-bin #$(file-append new-emacs "/bin/emacs")) (test-runner-current (system-test-runner #$output)) (test-begin "emacs-native-comp-replacable") (test-equal "comp-abi-hash" (emacs-abi-hash old-emacs-bin) (emacs-abi-hash new-emacs-bin)) (test-equal "native-comp-dir" (emacs-native-comp-dir old-emacs-bin) (emacs-native-comp-dir new-emacs-bin)) (test-assert "old emacs has hierarchical layout" (file-exists? (string-append #$old-emacs "/lib/emacs/" (emacs-effective-version old-emacs-bin) "/native-lisp/" (emacs-native-comp-dir old-emacs-bin) "/preloaded/emacs-lisp/comp.eln"))) (test-assert "new emacs has hierarchical layout" (file-exists? (string-append #$new-emacs "/lib/emacs/" (emacs-effective-version new-emacs-bin) "/native-lisp/" (emacs-native-comp-dir new-emacs-bin) "/preloaded/emacs-lisp/comp.eln"))) (test-end)))) (gexp->derivation "emacs-native-comp-compatible" test)) (define (package-without-replacement pkg) (package (inherit pkg) (replacement #f))) (define %test-emacs-native-comp-replacable (system-test (name "emacs-native-comp") (description "Test whether an emacs replacement (if any) is valid.") (value (run-native-comp-replacable-test (package-without-replacement emacs) emacs)))) f6d93ae1fc8b03d80b47b18b5749a51f1fde17b Signed-off-by: Christopher Baines <mail@cbaines.net> 2021-11-16daemon: Do not deduplicate files smaller than 8 KiB.Ludovic Courtès Files smaller than 8 KiB typically represent ~70% of the entries in /gnu/store/.links but only contribute to ~4% of the space savings afforded by deduplication. Not considering these files for deduplication speeds up file insertion in the store and, more importantly, leaves 'removeUnusedLinks' with fewer entries to traverse, thereby speeding it up proportionally. Partly fixes <https://issues.guix.gnu.org/24937>. * config-daemon.ac: Remove symlink hard link check and CAN_LINK_SYMLINK definition. * guix/store/deduplication.scm (%deduplication-minimum-size): New variable. (deduplicate)[loop]: Do not recurse when FILE's size is below %DEDUPLICATION-MINIMUM-SIZE. (dump-port): New procedure. (dump-file/deduplicate)[hash]: Turn into... [dump-and-compute-hash]: ... this thunk. Call 'deduplicate' only when SIZE is greater than %DEDUPLICATION-MINIMUM-SIZE; otherwise call 'dump-port'. * nix/libstore/gc.cc (LocalStore::removeUnusedLinks): Drop files where st.st_size < deduplicationMinSize. * nix/libstore/local-store.hh (deduplicationMinSize): New declaration. * nix/libstore/optimise-store.cc (deduplicationMinSize): New variable. (LocalStore::optimisePath_): Return when PATH is a symlink or smaller than 'deduplicationMinSize'. * tests/derivations.scm ("identical files are deduplicated"): Produce files bigger than %DEDUPLICATION-MINIMUM-SIZE. * tests/nar.scm ("restore-file-set with directories (signed, valid)"): Likewise. * tests/store-deduplication.scm ("deduplicate, below %deduplication-minimum-size"): New test. ("deduplicate", "deduplicate, ENOSPC"): Produce files bigger than %DEDUPLICATION-MINIMUM-SIZE. * tests/store.scm ("substitute, deduplication"): Likewise. 2021-06-18Start enabling substitutes from bordeaux.guix.gnu.org.Christopher Baines In addition to substitutes from ci.guix.gnu.org. There are more changes that can be made in the future, but these changes seem like a good start. * config-daemon.ac (guix_substitute_urls): Add https://bordeaux.guix.gnu.org. * guix/scripts/substitute.scm (%default-substitute-urls): Add http://bordeaux.guix.gnu.org. * guix/store.scm (%default-substitute-urls): Add bordeaux.guix.gnu.org. * doc/guix.texi: Adjust accordingly. * doc/contributing.texi: Adjust accordingly.