From 3b8e7fa8fbd58e7e164e3730c708419f612b8549 Mon Sep 17 00:00:00 2001 From: "B. Wilson" Date: Sun, 16 Jan 2022 23:54:51 +0900 Subject: [PATCH 1/2] packages: Expand range of objects 'add-input-label' can label To: guix-patches@gnu.org * guix/packages.scm (%auxiliary-files-subpath-dir): New variable. (add-input-label): Support labels from the name property of objects that have one. Also, name auxiliary files from their subpath. --- guix/packages.scm | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/guix/packages.scm b/guix/packages.scm index 9d5b23eb8a..4feea8ad5f 100644 --- a/guix/packages.scm +++ b/guix/packages.scm @@ -7,6 +7,7 @@ ;;; Copyright © 2019 Marius Bakke ;;; Copyright © 2020, 2021 Maxim Cournoyer ;;; Copyright © 2021 Chris Marusich +;;; Copyright © 2022 B. Wilson ;;; ;;; This file is part of GNU Guix. ;;; @@ -569,6 +570,10 @@ (define-record-type* (default (current-definition-location)) (innate))) +;; Note: This morally imports from gnu/packages.scm, but since they import us, +;; we define here instead. +(define %auxiliary-files-subdir-path "/gnu/packages/aux-files") + (define (add-input-label input) "Add an input label to INPUT." (match input @@ -576,7 +581,24 @@ (define (add-input-label input) (list (package-name package) package)) (((? package? package) output) ;XXX: ugly? (list (package-name package) package output)) - ((? gexp-input?) ;XXX: misplaced because 'native?' field is ignored? + ((? local-file? local-file) + (list (local-file-name local-file) local-file)) + ((? plain-file? plain-file) + (list (plain-file-name plain-file) plain-file)) + ((? computed-file? computed-file) + (list (computed-file-name computed-file) computed-file)) + ((? program-file? program-file) + (list (program-file-name program-file) program-file)) + ((? scheme-file? scheme-file) + (list (scheme-file-name scheme-file) scheme-file)) + ((? string? path) + (let* ((regex (string-append %auxiliary-files-subdir-path "/(.*)")) + (match (string-match regex input))) + `(,(if match + (match:substring match 1) + "_") + ,input))) + ((? gexp-input?) ;XXX: misplaced because 'native?' field is ignored? (let ((obj (gexp-input-thing input)) (output (gexp-input-output input))) `(,(if (package? obj) -- 2.34.0