transformations: Preserve transformation order in package property.

Fixes <https://issues.guix.gnu.org/54942>.
Reported by SeerLite <seerlite@nixnet.email>.

* guix/transformations.scm (options->transformation)
[package-with-transformation-properties]: Add call to 'reverse'.
* tests/transformations.scm ("options->transformation, property order"):
New test.
This commit is contained in:
Ludovic Courtès 2022-05-05 23:42:36 +02:00
parent 0780164f1f
commit 0f024554e6
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5
2 changed files with 14 additions and 2 deletions

View file

@ -959,7 +959,7 @@ (define (package-with-transformation-properties p)
. ,(map (match-lambda . ,(map (match-lambda
((key value _) ((key value _)
(cons key value))) (cons key value)))
applicable)) (reverse applicable))) ;preserve order
,@(package-properties p))))) ,@(package-properties p)))))
(lambda (obj) (lambda (obj)

View file

@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU ;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2016, 2017, 2019, 2020, 2021 Ludovic Courtès <ludo@gnu.org> ;;; Copyright © 2016-2017, 2019-2022 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2021 Marius Bakke <marius@gnu.org> ;;; Copyright © 2021 Marius Bakke <marius@gnu.org>
;;; ;;;
;;; This file is part of GNU Guix. ;;; This file is part of GNU Guix.
@ -451,6 +451,18 @@ (define (package-name* obj)
(string=? (local-file-file input) patch))) (string=? (local-file-file input) patch)))
inputs)))))))) inputs))))))))
(test-equal "options->transformation, property order"
;; See <https://issues.guix.gnu.org/54942>.
'((with-debug-info . "does-not-exist")
(with-commit . "does-not-exist=aaaaaaa")
(without-tests . "does-not-exist"))
(let* ((t (options->transformation
'((with-debug-info . "does-not-exist")
(with-commit . "does-not-exist=aaaaaaa")
(without-tests . "does-not-exist")))))
(let ((new (t coreutils)))
(assq-ref (package-properties new) 'transformations))))
(test-equal "options->transformation, with-latest" (test-equal "options->transformation, with-latest"
"42.0" "42.0"
(mock ((guix upstream) %updaters (mock ((guix upstream) %updaters