Subject: Re: bug#26346: [PATCH 16/17] build-system/asdf: Retain references to source files for binary outputs.

From: Ricardo Wurmus <[email-masked]>
Date: Tue, 16 May 2017 09:02:24 +0200

Andy Patterson <[email-masked]> writes:

> In support of long-running programs in which the users would like to be able
> to jump to the source of a definition of any of the dependencies (itself
> included) of the program.
>
> * guix/build/asdf-build-system.scm (library-outputs): Move from here ...
> * guix/build/lisp-utils.scm (library-outputs): ... to here.
> (build-program): Accept dependency-prefixes argument, to allow the caller to
> specify references which should be retained.  Default to the library's output.
> (build-image): Likewise.
> (generate-executable): Likewise.
> * gnu/packages/lisp.scm (sbcl-stumpwm+slynk, sbcl-slynk, sbcl-stumpwm): Adjust
> accordingly to the new interface.
> (sbcl-stumpwm+slynk)[native-inputs]: Move to ...
> [inputs]: ... here.
> ---
[…]
> @@ -361,5 +375,23 @@ executable."
>
>      (generate-executable-for-system type name)
>
> +    (let* ((third-slash-index
> +            (string-index out-file #\/
> +                          (1+ (string-length (%store-directory)))))
> +           (output (string-take out-file third-slash-index))
> +           (hidden-asd-links (string-append output "/.asd-files")))
> +
> +      (mkdir-p hidden-asd-links)
> +      (for-each
> +       (lambda (path)
> +         (for-each
> +          (lambda (asd-file)
> +            (symlink asd-file
> +                     (string-append hidden-asd-links
> +                                    "/" (basename asd-file))))
> +          (find-files (string-append path (%bundle-install-prefix))
> +                      "\\.asd$")))
> +       dependency-prefixes))
> +
>      (delete-file (string-append bin-directory "/" name "-exec.asd"))
>      (delete-file (string-append bin-directory "/" name "-exec.lisp"))))

The naming here implies that the package is at the third level, but
users can have a store an arbitrary number of directories deep.
“third-slash-index” is really just the position after the store prefix,
so I’m going to rename it before pushing.

I don’t really like the use of “dependency-prefixes”.  It seems
inelegant.  Can the build system not determine automatically what
references ought to be retained?

That said, I’m going to push this first, as it is an improvement.

--
Ricardo

GPG: BCA6 89B6 3655 3801 C3C6  2150 197A 5888 235F ACAC
https://elephly.net