From 50b2db40ea03d8b3c78b3a774e057ebab0f98790 Mon Sep 17 00:00:00 2001 From: Liliana Marie Prikler Date: Sat, 19 Aug 2023 01:37:20 +0200 Subject: guix: emacs-utils: Add ert-number-tests. * guix/build/utils.scm (ert-number-tests): New variable. --- guix/build/emacs-utils.scm | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'guix') diff --git a/guix/build/emacs-utils.scm b/guix/build/emacs-utils.scm index 850b1f5f2a..ac3dac57d1 100644 --- a/guix/build/emacs-utils.scm +++ b/guix/build/emacs-utils.scm @@ -40,6 +40,7 @@ emacs-byte-compile-directory emacs-compile-directory emacs-header-parse + ert-number-tests as-display emacs-substitute-sexps @@ -183,6 +184,19 @@ If native code is not supported, compile to bytecode instead." (insert " ") (insert ,(format #f "~s" replacement)))))) +(define (ert-number-tests file test-name) + "Add a numerically increasing suffix to tests of the same name. +This fixes test errors of the pattern \"Test TEST_NAME redefined\"." + (emacs-batch-edit-file file + `(let ((i 0)) + (while (re-search-forward ,(string-append "ert-deftest " test-name) + nil t) + (goto-char (match-beginning 0)) + (kill-region (match-beginning 0) (match-end 0)) + (insert (format "ert-deftest %s-%d" ,test-name i)) + (setq i (+ i 1))) + (basic-save-buffer)))) + (define-syntax emacs-substitute-sexps (syntax-rules () "Substitute the S-expression immediately following the first occurrence of -- cgit v1.2.3 From 4a00fa9beaa671d6eb354e5e12826ae261e7e57b Mon Sep 17 00:00:00 2001 From: Hilton Chain Date: Sat, 2 Sep 2023 00:15:29 +0800 Subject: =?UTF-8?q?build:=20emacs-utils:=20Adjust=20=E2=80=98emacs-compile?= =?UTF-8?q?-directory=E2=80=99=20for=20Emacs=2029.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * guix/build/emacs-utils.scm (emacs-compile-directory): After native compilation, write the bytecode file with ‘comp-write-bytecode-file’. Signed-off-by: Liliana Marie Prikler --- guix/build/emacs-utils.scm | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'guix') diff --git a/guix/build/emacs-utils.scm b/guix/build/emacs-utils.scm index ac3dac57d1..8e12b5b6d4 100644 --- a/guix/build/emacs-utils.scm +++ b/guix/build/emacs-utils.scm @@ -139,7 +139,7 @@ If native code is not supported, compile to bytecode instead." (files (directory-files-recursively ,dir "\\.el$"))) (mapc (lambda (file) - (let (byte-to-native-output-file + (let (byte-to-native-output-buffer-file ;; First entry is the eln-cache of the homeless shelter, ;; second entry is the install directory. (eln-dir (and (native-comp-available-p) @@ -148,13 +148,9 @@ If native code is not supported, compile to bytecode instead." (native-compile file (comp-el-to-eln-filename file eln-dir)) (byte-compile-file file)) - ;; Sadly, we can't use pcase because quasiquote works different in - ;; Emacs. See `batch-byte+native-compile' in comp.el for the - ;; actual shape of byte-to-native-output-file. - (unless (null byte-to-native-output-file) - (rename-file (car byte-to-native-output-file) - (cdr byte-to-native-output-file) - t)))) + ;; After native compilation, write the bytecode file. + (unless (null byte-to-native-output-buffer-file) + (comp-write-bytecode-file nil)))) files)) #:dynamic? #t)) -- cgit v1.2.3 From 19b617370844ad48eab68e6fc4b9e47665f71710 Mon Sep 17 00:00:00 2001 From: Jean-Pierre De Jesus DIAZ Date: Wed, 26 Jul 2023 17:37:29 +0200 Subject: transformations: tuned-package: Use target on cross-compile. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * guix/transformations.scm (tuned-package): Use either bag-target if available or bag-system to select the CPU architecture of the package that is going to be tuned. This enables the tuning of cross-compiled packages. Signed-off-by: Ludovic Courtès --- guix/transformations.scm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'guix') diff --git a/guix/transformations.scm b/guix/transformations.scm index ede914456f..9cba6bedab 100644 --- a/guix/transformations.scm +++ b/guix/transformations.scm @@ -529,8 +529,9 @@ system that builds code for MICRO-ARCHITECTURE; otherwise raise an error." ;; leading to an obscure build error, check whether the compiler is known ;; to support MICRO-ARCHITECTURE. If not, bail out. (let* ((lowered (apply lower args)) - (architecture (match (string-tokenize (bag-system lowered) - %not-hyphen) + (target (or (bag-target lowered) + (bag-system lowered))) + (architecture (match (string-tokenize target %not-hyphen) ((arch _ ...) arch))) (compiler (any (match-lambda ((label (? package? p) . _) -- cgit v1.2.3 From 658de25e990a56265e2398a3737e9cf1eb57af68 Mon Sep 17 00:00:00 2001 From: Janneke Nieuwenhuizen Date: Thu, 22 Jun 2023 08:30:25 +0200 Subject: self: Build directories in chunks of max 25 files at a time. This increases the chances of a successful `guix pull' on the Hurd, see . * guix/self.scm (compiled-modules)[process-directory]: Split building of directories into chunks of max 25 files. Also call gc. --- guix/self.scm | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) (limited to 'guix') diff --git a/guix/self.scm b/guix/self.scm index 81a36e007f..d2300052d8 100644 --- a/guix/self.scm +++ b/guix/self.scm @@ -1,6 +1,7 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2017-2023 Ludovic Courtès ;;; Copyright © 2020 Martin Becze +;;; Copyright © 2023 Janneke Nieuwenhuizen ;;; ;;; This file is part of GNU Guix. ;;; @@ -1210,7 +1211,8 @@ containing MODULE-FILES and possibly other files as well." '((guix build compile) (guix build utils))) #~(begin - (use-modules (srfi srfi-26) + (use-modules (srfi srfi-1) + (srfi srfi-26) (ice-9 match) (ice-9 format) (ice-9 threads) @@ -1244,12 +1246,23 @@ containing MODULE-FILES and possibly other files as well." (force-output)) (define (process-directory directory files output) - ;; Hide compilation warnings. - (parameterize ((current-warning-port (%make-void-port "w"))) - (compile-files directory #$output files - #:workers (parallel-job-count) - #:report-load report-load - #:report-compilation report-compilation))) + (let* ((size 25) ;compile max 25 files a time + (chunks (unfold + (lambda (seed) (< (length seed) size)) ;p + (cute take <> size) ;f + (cute drop <> size) ;g + files ;seed + list))) ;tail + (for-each + (lambda (chunk) + ;; Hide compilation warnings. + (parameterize ((current-warning-port (%make-void-port "w"))) + (compile-files directory output chunk + #:workers (parallel-job-count) + #:report-load report-load + #:report-compilation report-compilation) + (gc))) + chunks))) (setvbuf (current-output-port) 'line) (setvbuf (current-error-port) 'line) -- cgit v1.2.3 From 15c5f1a2c20b21de0f19f42db1ccab4c42117ebb Mon Sep 17 00:00:00 2001 From: Janneke Nieuwenhuizen Date: Mon, 18 Sep 2023 08:09:50 +0200 Subject: self: Compile guix-packages-base in chunks of 10 files. This fixes or greatly increases the chances for `guix pull' to succeed on the Hurd, see . * guix/self.scm (compiled-modules)[process-directory]: Move hardcoded size to keyword parameter #:size. Set it to 10 when compiling "guix-packages-base". --- guix/self.scm | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'guix') diff --git a/guix/self.scm b/guix/self.scm index d2300052d8..b8b9b9fe37 100644 --- a/guix/self.scm +++ b/guix/self.scm @@ -1245,14 +1245,13 @@ containing MODULE-FILES and possibly other files as well." (* 100. (/ completed total)) total) (force-output)) - (define (process-directory directory files output) - (let* ((size 25) ;compile max 25 files a time - (chunks (unfold - (lambda (seed) (< (length seed) size)) ;p - (cute take <> size) ;f - (cute drop <> size) ;g - files ;seed - list))) ;tail + (define* (process-directory directory files output #:key (size 25)) + (let ((chunks (unfold + (lambda (seed) (< (length seed) size)) ;p + (cute take <> size) ;f + (cute drop <> size) ;g + files ;seed + list))) ;tail (for-each (lambda (chunk) ;; Hide compilation warnings. @@ -1290,7 +1289,8 @@ containing MODULE-FILES and possibly other files as well." (mkdir #$output) (chdir #+module-tree) - (process-directory "." '#+module-files #$output) + (let ((size (if (equal? #$name "guix-packages-base") 10 25))) + (process-directory "." '#+module-files #$output #:size size)) (newline)))) (computed-file name build -- cgit v1.2.3 From e5ed1712da049b1c3dcf01e0a7e02e48a8aff012 Mon Sep 17 00:00:00 2001 From: Mathieu Othacehe Date: Sat, 9 Sep 2023 17:57:25 +0200 Subject: image: Introduce the mbr-hybrid-raw image type. Until 209204e23b39af09e0ea92540b6fa00a60e6a0ae and d57cab764122af69d52d8cc9c843456044e5d7bc, the default image type used by "guix system image" was an MBR image with an ESP partition. Having both an MBR image and an ESP partition is handy because the image will boot on most x86 based systems using legacy BIOS and/or UEFI. We now have a distinction between MBR images and EFI images. Introduce a new MBR hybrid image type and default to it to restore the default behaviour. This also fixes the images section of (gnu ci) that was trying to install a BIOS bootloader on an EFI, GPT image and failing to do so. Signed-off-by: Mathieu Othacehe --- guix/scripts/system.scm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'guix') diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm index ec331809ef..547387d5e1 100644 --- a/guix/scripts/system.scm +++ b/guix/scripts/system.scm @@ -1169,7 +1169,7 @@ Some ACTIONS support additional ARGS.\n")) (debug . 0) (verbosity . #f) ;default (validate-reconfigure . ,ensure-forward-reconfigure) - (image-type . mbr-raw) + (image-type . mbr-hybrid-raw) (image-size . guess) (install-bootloader? . #t) (label . #f) -- cgit v1.2.3 From 6d33c1f8061e86d63ab5c9ec75df9c58130c7264 Mon Sep 17 00:00:00 2001 From: Simon Tournier Date: Wed, 6 Sep 2023 15:01:00 +0200 Subject: git: Avoid touching the network unless needed in 'reference-available?'. Follow-up of 756e336fa008c2469b4a7317ad5c641ed48f25d6 fixing the issue. * guix/git/scm (reference-available?): Address case by case to determine whether the reference exists in the local Git checkout. --- guix/git.scm | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) (limited to 'guix') diff --git a/guix/git.scm b/guix/git.scm index 1cb87a4560..1b3355109e 100644 --- a/guix/git.scm +++ b/guix/git.scm @@ -5,6 +5,7 @@ ;;; Copyright © 2021 Marius Bakke ;;; Copyright © 2022 Maxime Devos ;;; Copyright © 2023 Tobias Geerinckx-Rice +;;; Copyright © 2023 Simon Tournier ;;; ;;; This file is part of GNU Guix. ;;; @@ -360,21 +361,16 @@ dynamic extent of EXP." (define (reference-available? repository ref) "Return true if REF, a reference such as '(commit . \"cabba9e\"), is definitely available in REPOSITORY, false otherwise." - ;; Note: this must not rely on 'resolve-reference', as that procedure always - ;; resolves the references for branch names such as master. The semantic we - ;; want here is that unless the reference is exact (e.g. a commit), the - ;; reference should not be considered available, as it could have changed on - ;; the remote. (match ref - ((or ('commit . commit) - ('tag-or-commit . (? commit-id? commit))) - (let ((len (string-length commit)) - (oid (string->oid commit))) - (false-if-git-not-found - (->bool (if (< len 40) - (object-lookup-prefix repository oid len OBJ-COMMIT) - (commit-lookup repository oid)))))) + (('commit . (? commit-id? commit)) + (let ((oid (string->oid commit))) + (->bool (commit-lookup repository oid)))) + ((or ('tag . str) + ('tag-or-commit . str)) + (false-if-git-not-found + (->bool (resolve-reference repository ref)))) (_ + ;; For the others REF as branch or symref, the REF cannot be available #f))) (define (clone-from-swh url tag-or-commit output) -- cgit v1.2.3