From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id uK+zKqeMJGMOdAAAbAwnHQ (envelope-from ) for ; Fri, 16 Sep 2022 16:48:07 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id eAe1KqeMJGOtLwAA9RJhRA (envelope-from ) for ; Fri, 16 Sep 2022 16:48:07 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 1C5B0115CB for ; Fri, 16 Sep 2022 16:48:07 +0200 (CEST) Received: from localhost ([::1]:52280 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oZCdR-0004Oe-Rb for larch@yhetil.org; Fri, 16 Sep 2022 10:48:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52880) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oZBRJ-0002QT-VO for help-guix@gnu.org; Fri, 16 Sep 2022 09:31:30 -0400 Received: from freeshell.de ([116.202.128.144]:40474) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oZBRH-0000AL-S1 for help-guix@gnu.org; Fri, 16 Sep 2022 09:31:29 -0400 Received: from freeshell.de (cst-prg-14-102.cust.vodafone.cz [46.135.14.102]) (Authenticated sender: wz) by freeshell.de (Postfix) with ESMTPSA id 5C6D4B3613DA for ; Fri, 16 Sep 2022 15:21:35 +0200 (CEST) Date: Fri, 16 Sep 2022 15:21:34 +0200 From: Wiktor =?utf-8?Q?=C5=BBelazny?= To: help-guix@gnu.org Subject: Reconstructing pandoc share/ path from arch, os, compilerName (and versions) in a package definition with copy-build-system Message-ID: <20220916132134.a3odxhicwasf2kk7@nibiowz> Mail-Followup-To: help-guix@gnu.org MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="nzm6qmymhoa6zkep" Content-Disposition: inline Received-SPF: pass client-ip=116.202.128.144; envelope-from=wz@freeshell.de; helo=freeshell.de X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Fri, 16 Sep 2022 10:47:23 -0400 X-BeenThere: help-guix@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-guix-bounces+larch=yhetil.org@gnu.org Sender: "Help-Guix" X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1663339687; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:list-id:list-help:list-unsubscribe: list-subscribe:list-post; bh=p+1RVmT17ktOjtOZj5wELpPI0gsJaneP00PlTKtd6mA=; b=qcHG6JyLh15Mov3MgufdAQbOGsljJxzkLBTfkYbOsaQaUiL7GoxNFstLavQXZPifTiFNwr SPgj8WFJTXlljAdEtNHJ5JYxKGTYPlfEBUQy/VekATPfiOlkPk1lYDuj2l7csJ1S7O7Bsi q5Pe+3k9/wplp2sp0Syr3A5cd/t/JqkFHMP76sd5q3UPht/cQYqgKEnuvsXepPN/sci9b4 pcqEA009bV/ceYDf5TAmRN3WQRDP+kuvfYswgcJi89AmmEW4KO6A05Lka7kzDBY3+i1fbW K5XVo/Sm6JihARCWZz/CCwqcnoj4w0M+Kv8+v8G4EOmkTKKVdTBmql7blfiidQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1663339687; a=rsa-sha256; cv=none; b=IX0kb6ZAny+rxF6lkh/AqLyyXh9y8D+WjAW2q97xqeveV5xWQVW0gga/Q7c2Y8jm9JBWAd O5iLJht04frEMJO4EMPcZDVoiXvETZH7OVcHVAwugtifiyrRzlodShhd4erBeUZb4PAlNZ ZmotH2xjq85iAaT38ksHzUMPplXeU6Mpck/Pmx5Us5XX6HnPLVA7s6ATHIab/3lKZzM5OZ YSoaR43SXyYUdoufNz6Zv4miKIGfSYOTY47irzCBIb2kzHlqK8SjxhktbfzjJdj22Jwenw 2JDefB5g/wZicTuEE43aK7tygrSikBpEOSL33trZAwQb/PGIKMtRfNGVuiKF6A== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=freeshell.de (policy=none); spf=pass (aspmx1.migadu.com: domain of "help-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="help-guix-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: 0.97 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=freeshell.de (policy=none); spf=pass (aspmx1.migadu.com: domain of "help-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="help-guix-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 1C5B0115CB X-Spam-Score: 0.97 X-Migadu-Scanner: scn0.migadu.com X-TUID: jzxg7g9dzwba --nzm6qmymhoa6zkep Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable (and versions) in a package definition with copy-build-system Reply-To: X-PGP-Key: https://freeshell.de/~wz/pubkey.asc X-PGP-Fingerprint: BDC9 74CD D9C9 BA7D 761A 573D C735 A8C6 AB60 79D5 Hi Guix, I=E2=80=99m trying to package pandoc-letter [1], which provides a letter template for Pandoc. The working idea has been to use copy-build-system and copy template-letter.tex, which is in the pandoc-letter repository (there are no tarballs), to the directory where Pandoc keeps its default templates. For a start, I adapted some code from gnu/packages/vim.scm where an analogous approach is common for Vim plugins: (define-public pandoc-letter (let ((commit "b0fd7342b352ebb87aea17614ec014f68d48747f") (revision "1")) (package (name "pandoc-letter") (version (string-append "0.0.0-" revision "." (string-take commit 7))) (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/aaronwolen/pandoc-letter") (commit commit))) (file-name (string-append name "-" version "-checkout")) (sha256 (base32 "1868vs95l0alprvbhwjc60xik2rd7zbpdcysbp2ci81gqffx6r78"= )))) (build-system copy-build-system) (arguments '(#:install-plan '(("template-letter.tex" "share/pandoc/data/templates/")))) (synopsis "Simple letter template for Pandoc") (description "This template allows you to write letters in Markdown and conver= t them to nice looking PDFs using Pandoc and LaTeX. It accepts arguments used in = the LaTeX letter class, all of which can be specified in a YAML metadata blo= ck. Additional Pandoc/LaTeX options can be configured directly in the metada= ta block.") (home-page "https://github.com/aaronwolen/pandoc-letter") (license license:gpl3)))) This builds, but the actual templates directory is not share/pandoc/data/templates, but something more dynamic. For example, on my machine it is share/x86_64-linux-ghc-8.10.7/pandoc-2.14.0.3/data/templates. Apparently, this path is constructed in Paths_pandoc.hs file, with its contents defined in the pandoc Guix package. The relevant snippet is datadir :: FilePath datadir =3D \"~a/share/\" ++ arch ++ \"-\" ++ os ++ \"-\" ++ compilerName ++ \"-~a/pandoc-~a\" I don=E2=80=99t know what the motivation for this is. Anyway, I decided to = try to reconstruct the target path, starting from the Pandoc version string (hidden in this ~a? well, whatever). The definition of the blender package in Guix gave me some inspiration: (arguments (let ((ghc-pandoc-version (version-major+minor (package-version ghc= -pandoc)))) '(#:install-plan '(("template-letter.tex" (string-append "share/pandoc-" ghc-pandoc-version "/data/templates/")))))) While building this, I got the error with the suggestion to load the (gnu packages haskell-xyz) module, which was promising. Unfortunately, after fixing that, I=E2=80=99m getting ice-9/boot-9.scm:1685:16: In procedure raise-exception: In procedure string-append: Wrong type (expecting string): (string-appen= d "share/pandoc-" ghc-pandoc-version "/data/templates/") Normally, I would inspect the type and value of ghc-pandoc-version at this point via =E2=80=9Cprint debugging=E2=80=9D, but I have no idea how to= do that in Guile in the context of package definition development. If you could help me to get unstuck, I would be grateful. Or, maybe you can suggest a wholly different approach, superior to my path-reconstruction idea. [1]: https://github.com/aaronwolen/pandoc-letter Have a nice weekend, W=C5=BB --nzm6qmymhoa6zkep Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQKTBAABCgB9FiEEvcl0zdnJun12Glc9xzWoxqtgedUFAmMkeEVfFIAAAAAALgAo aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldEJE Qzk3NENERDlDOUJBN0Q3NjFBNTczREM3MzVBOEM2QUI2MDc5RDUACgkQxzWoxqtg edVacBAAsuJzSAcz9dthRFS7f/3GxGEZOhbeiTzHZNGSzTk+GGLng4feBthF9dhW S7r+dPhB4ASlOeoLdJkgBKlWeL4vN3tQNPD5Q21aSFA0cy/SUEkSsSXPJKybfFOQ oJ+2edauHsuQ2wVwlM46YmaUQB5YtzlG1q2QqpJWwer6dao+sTWXorkIHmJ7+mnZ O9JwSjsGe7I7s4x32twZhjtCYnxXJEOtr+5nS0TegA8OTE+7n2oqplmsoX0JHg3I MAPpXMcu4fbta8iuzV3fEkU1A6f9b9aQzdxPIP5zQBWi5nRXF65yb+xNJGUsDVpo Wm3cHSIgDZt9SQTONR13Hsxs8d1UjAggWfa2wzOBOastimwziGqUbbFovd5afddM rdavDnjccbM/1K9d15ujL0nF2w5DGdbCD5KdxUgrW+Vn7rVg10p39Ob7Yaxt31RL TrN//bT/0BXqR/YxvcP2PUK0i3b0Hw3jmSbdr55bPh7BwC+J8Fh39cMjulSVz/n7 EcfARXrG66+kdfab0f22tISRD5CteeiJN08VltKWMpNPloNxn5T9/z6VeUU7RIBs AafNs8HzQvzdGZ1jJ60XMseIKxjHCkG/Yrjp48bocBOyPBSMqs9z30C+YB+OMg8z LP6Xcc1AcKx2fzZTv6lRwUCg0tUUsH0+WiVGps2nRIDjIEIOsMs= =pNl+ -----END PGP SIGNATURE----- --nzm6qmymhoa6zkep--