From a127e52f601ee73f675d5d28eac2388bb1ad11b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Thu, 30 Jul 2020 16:37:19 +0200 Subject: [PATCH] packages: 'generate-package-cache' is deterministic. Fixes . Reported by Marinus . * gnu/packages.scm (generate-package-cache)[entry-key, entrybool (supported-package? package)) - ,(->bool (package-superseded package)) - ,@(let ((loc (package-location package))) - (if loc - `(,(location-file loc) - ,(location-line loc) - ,(location-column loc)) - '(#f #f #f)))) - result) - (vhash-consq package #t seen)))))) - (_ - result+seen))) + (define expand-cache + (match-lambda* + (((module symbol variable) (result . seen)) + (let ((package (variable-ref variable))) + (if (or (vhash-assq package seen) + (hidden-package? package)) + (cons result seen) + (cons (cons `#(,(package-name package) + ,(package-version package) + ,(module-name module) + ,symbol + ,(package-outputs package) + ,(->bool (supported-package? package)) + ,(->bool (package-superseded package)) + ,@(let ((loc (package-location package))) + (if loc + `(,(location-file loc) + ,(location-line loc) + ,(location-column loc)) + '(#f #f #f)))) + result) + (vhash-consq package #t seen))))))) - (define exp - (first - (fold-module-public-variables* expand-cache - (cons '() vlist-null) + (define entry-key + (match-lambda + ((module symbol variable) + (let ((value (variable-ref variable))) + (string-append (package-name value) (package-version value) + (object->string module) + (symbol->string symbol)))))) + + (define (entry