diff options
author | Ludovic Courtès <ludo@gnu.org> | 2022-03-14 18:20:31 +0100 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2022-04-04 22:58:03 +0200 |
commit | f54f2aa9df5047b348ca104f5145af50c1a482f6 (patch) | |
tree | 0cba8a8b405861fdabaefa4eba5276c47247599d /guix | |
parent | 4b451813f7c5677086772e29a66a8265ec0ca2c7 (diff) |
packages: Add 'package-unique-version-prefix'.
* gnu/packages.scm (package-unique-version-prefix): New procedure.
* guix/scripts/package.scm (manifest-entry-version-prefix): Use it.
* tests/packages.scm ("package-unique-version-prefix, gcc@8")
("package-unique-version-prefix, grep"): New tests.
Diffstat (limited to 'guix')
-rw-r--r-- | guix/scripts/package.scm | 20 |
1 files changed, 2 insertions, 18 deletions
diff --git a/guix/scripts/package.scm b/guix/scripts/package.scm index 9699c70c6d..22ee8a2485 100644 --- a/guix/scripts/package.scm +++ b/guix/scripts/package.scm @@ -334,24 +334,8 @@ Alternately, see @command{guix package --search-paths -p ~s}.") "Search among all the versions of ENTRY's package that are available, and return the shortest unambiguous version prefix for this package. If only one version of ENTRY's package is available, return the empty string." - (let ((name (manifest-entry-name entry))) - (match (map package-version (find-packages-by-name name)) - ((_) - ;; A single version of NAME is available, so do not specify the - ;; version number, even if the available version doesn't match ENTRY. - "") - (versions - ;; If ENTRY uses the latest version, don't specify any version. - ;; Otherwise return the shortest unique version prefix. Note that - ;; this is based on the currently available packages, which could - ;; differ from the packages available in the revision that was used - ;; to build MANIFEST. - (let ((current (manifest-entry-version entry))) - (if (every (cut version>? current <>) - (delete current versions)) - "" - (version-unique-prefix (manifest-entry-version entry) - versions))))))) + (package-unique-version-prefix (manifest-entry-name entry) + (manifest-entry-version entry))) (define* (export-manifest manifest #:optional (port (current-output-port))) |