Subject: Re: bug#52181: [core-update-frozen] many rust package can't build because them source file-name use ".crate" suffix.

From: Maxime Devos <[email-masked]>
Date: Mon, 29 Nov 2021 19:16:29 +0000

Z572 via Bug reports for GNU Guix schreef op ma 29-11-2021 om 22:31
[+0800]:
> I think have 2 option:
> 
>  1. change suffix from ".crate" to ".tar.gz".
>  2. maybe let "tarball?" check file like command-line program "file",
> no
>  just check filename suffix.

A third option: let tarball? recognise ".crate" suffixes.
A hacky fourth option (to avoid a full world-rebuild):
in cargo-build, do:

;; Untested, might not work due to inlining.

;; XXX: modify tarball? on the next world-rebuild
(define tarball?/fixed
  (let ((tarball?/old tarball?))
    (lambda (filename)
      (or (tarball? filename)
          (string-suffix? ".crate" filename)))))

(define* (cargo-build ...)
  (set! tarball? tarball?/fixed)
  (apply gnu:gnu-build ...))

The second option would be a bit complicated to do efficiently, because
the tar would be wrapped inside a gzip/xzip/..., unless it is
acceptable for tarball? to assume that every gzipped/... file is a
gzipped/... tarball.

Greetings,
Maxime.