unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
From: Aristide Doussot <aristide.doussot@obspm.fr>
To: help-guix@gnu.org
Subject: Add external data to a package
Date: Tue, 12 Nov 2024 17:14:15 +0100	[thread overview]
Message-ID: <96ca3ac8-5954-4ecf-8be2-345dab200bb5@obspm.fr> (raw)

Hello,

     I am new to Guix and want to add data from an external source to my 
package build. More precisely, I am trying to install the library 
casacore and need to add data in its subdirectory share/casacore/data. I 
can download these data as tar via ftp. For now, my code looks like this :

"
(defineWSRT_Measures
(origin
(method url-fetch)
(uri "[...not sure I can disclose...]/WSRT_Measures.ztar")
(sha256
(base32 "1d9qlcmkpsnw8wm7sidp17iwd2d771nsgjwwp568886g5f239a8k"))
)
)
(define-public casacore
(package
(name "casacore")
(version "3.5.0")
(source
(origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/casacore/casacore.git")
(recursive? #t)
(commit "v3.5.0")))
(file-name (git-file-name name version))
(sha256 (base32 "0zw70slc3681mnadg169avjg7d3jwn1x49xn0022207blcig8g2l"))))
(inputs
(listfftwf fftw openblas boost gcc-toolchain git gsl lapack 
gfortran-toolchain readline flex bison cfitsio wcslib python python-numpy
))
(build-system cmake-build-system)
(arguments (list
#:configure-flags #~(list"-DHELLO_WHO=Guix""-DBUILD_DYSCO=ON")
#:build-type "Release"
#:tests? #f;; some test are failing due to lack of data that are 
downloable via ftp for now testing is disable
#:parallel-build? #t;; TODO : check if it makes a difference in building 
time
#:phases
#~(modify-phases %standard-phases
(add-after 'install'install-data
(lambda* (#:key inputs outputs #:allow-other-keys)
(let*(
(out (assoc-ref outputs "out"))
(data (list-ref(find-files "/gnu/store""WSRT_Measures.ztar")0))
(share-dir (string-append out "/share/casacore/data/"))
)
(mkdir-p share-dir)
(invoke "tar""-xzf"data "-C"share-dir)
#t))))
))
(home-page "http://casacore.github.io/casacore/")
(synopsis "")
(description "A suite of C++ libraries for radio astronomy data 
processing.")
(license license:gpl2+)))

"


And it seems to work but I am sure there are far better ways to do this 
than my "take the first element of an overall find-files on 
/gnu/store/". Can someone teach me these better ways ?

Thanks,
Aristide Doussot

             reply	other threads:[~2024-11-12 16:15 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-12 16:14 Aristide Doussot [this message]
2024-11-12 19:30 ` Add external data to a package Julian Flake
2024-11-13  8:34   ` Parnikkapore via

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=96ca3ac8-5954-4ecf-8be2-345dab200bb5@obspm.fr \
    --to=aristide.doussot@obspm.fr \
    --cc=help-guix@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).