From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:403:478a::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id gGmoCQSy+GTvIwAAauVa8A:P1 (envelope-from ) for ; Wed, 06 Sep 2023 19:08:20 +0200 Received: from aspmx1.migadu.com ([2001:41d0:403:478a::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id gGmoCQSy+GTvIwAAauVa8A (envelope-from ) for ; Wed, 06 Sep 2023 19:08:20 +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 EEE9C43A78 for ; Wed, 6 Sep 2023 19:08:19 +0200 (CEST) Authentication-Results: aspmx1.migadu.com; dkim=none; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1694020100; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:resent-cc:resent-from:resent-sender: resent-message-id:in-reply-to:in-reply-to:references:references: list-id:list-help:list-unsubscribe:list-subscribe:list-post; bh=xhHQ5GgSd8qYhx7UPMtZD4N2nVguFw8z1i8Y+CY3jYs=; b=h3sB7cLaNRZzt6oxS0nNtLprTPYRcHmSxajBp5Dkd2ynRNzIgnHjFx/8EOeK6wdLd0SQba FLkiM8ofqpU2Tm0hcUX2iP5AofknnBt8Z+vVhc477escYpEKFHFQjO40YU3E5pVvCYtxoU 4ABdpq0c4ZXrhOWWGmLOZlZB5SHzceaJif8aQZJtcgrR8CpjYNYSrT0O/MwG5YHkLGUiyZ yruRQiv0fE1MUidEt+uxxz57qVCM1YRAwteYnNVXjnWi6uYUM4KFioxzPQeoBWU7U7nC36 dct7yd9xr+wH6G5akib+pRWwGhGKSytNVFhOy2s79jzm5toWsSt3b+FYwEcQOg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1694020100; a=rsa-sha256; cv=none; b=MpyugG4rbTHA0Tx2GuU8smBlW7j8btXt9cv1xOYjpXGvziE32UYa0FuCrHg/BVEOJiebbi NnMCEDQFY9b9Nlw210fOs9CgAg1tGVSIKjMBnMnkqgnrgOXJewZGQiL5sAfQtxvDHxtS+B 4+xVW+a7c6if01k+OZFs2r3aNjmQLwTBchD+5eAZk+v6XzQzh8TmJ4tlQdbhlVDognfUg+ Xt6D16Aw7SP34IbR9c6eHsOH4f8aObcOh4mBRAilCojwcA613v4cry20By4uqZez+D1A1z vfz58+2PNtiN1w9bm2twQ40JG0mEXGEtrM1L7PesfskOjyv3i8tVB9ixYXsV3Q== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=none Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qdw0Y-0001Jk-SC; Wed, 06 Sep 2023 13:08:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qdw0X-0001JX-AQ for guix-patches@gnu.org; Wed, 06 Sep 2023 13:08:01 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qdw0X-0001JF-2d for guix-patches@gnu.org; Wed, 06 Sep 2023 13:08:01 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qdw0Y-0007hh-7Q for guix-patches@gnu.org; Wed, 06 Sep 2023 13:08:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#65313] [PATCH 0/1] gnu: Add erlang-lfe. Resent-From: Tim Johann Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 06 Sep 2023 17:08:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 65313 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Maxim Cournoyer Cc: 65313@debbugs.gnu.org Received: via spool by 65313-submit@debbugs.gnu.org id=B65313.169402002729532 (code B ref 65313); Wed, 06 Sep 2023 17:08:02 +0000 Received: (at 65313) by debbugs.gnu.org; 6 Sep 2023 17:07:07 +0000 Received: from localhost ([127.0.0.1]:37400 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qdvzf-0007gA-4Z for submit@debbugs.gnu.org; Wed, 06 Sep 2023 13:07:07 -0400 Received: from ms-10.1blu.de ([178.254.4.101]:34504) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qdvza-0007ff-Lo for 65313@debbugs.gnu.org; Wed, 06 Sep 2023 13:07:05 -0400 Received: from [46.114.105.21] (helo=dolos) by ms-10.1blu.de with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1qdvzW-002g1k-Rc; Wed, 06 Sep 2023 19:06:59 +0200 From: Tim Johann Date: Wed, 06 Sep 2023 17:53:42 +0200 References: <874jk8lot5.fsf_-_@gmail.com> User-agent: mu4e 1.10.5; emacs 29.0.92 In-reply-to: <874jk8lot5.fsf_-_@gmail.com> Message-ID: <87tts7i633.fsf@phrogstar.de> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Con-Id: 303810 X-Con-U: 0-timjohann X-Originating-IP: 46.114.105.21 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN X-Migadu-Scanner: mx0.migadu.com X-Migadu-Spam-Score: -5.23 X-Spam-Score: -5.23 X-Migadu-Queue-Id: EEE9C43A78 X-TUID: Z93gAgcW6pe+ --=-=-= Content-Type: text/plain Content-Disposition: inline Hi Maxim, Thanks for the review. I learned a lot. Is there more documentation on the #:modules specification? I would like to know if there is a variable containing the modules added to the builder file when not specifying #:modules in the arguments? Or do I need to repeat them there, as I have done so far: #:modules '((ice-9 ftw) (srfi srfi-26) (guix build gnu-build-system) (guix build utils)) The (guix build _) modules are the ones that are present when I don't use the #:modules argument. ftw is for 'scandir' and srfi-26 - as you suggested - for 'cut' Other than that, I have a working package declaration for erlang-lfe with your suggestions incorporated. I would just like to know the answer to above question, before I submit the revision. Thank you very much indeed. - Tim Maxim Cournoyer writes: > tags 65313 + moreinfo > quit > > Hello, > > Tim Johann writes: > >> --- >> gnu/packages/erlang.scm | 77 +++++++++++++++++++++++++++++++++++++++++ >> 1 file changed, 77 insertions(+) >> >> diff --git a/gnu/packages/erlang.scm b/gnu/packages/erlang.scm >> index a7f161647b..df7212b0e5 100644 >> --- a/gnu/packages/erlang.scm >> +++ b/gnu/packages/erlang.scm >> @@ -738,3 +738,80 @@ (define-public rebar3-proper >> (description "This plugin allows running PropEr test suites from within >> rebar3.") >> (license license:bsd-3))) >> + >> +(define-public erlang-lfe >> + (package >> + (name "erlang-lfe") >> + (version "2.1.2") >> + (source >> + (origin >> + (method git-fetch) >> + ;; The tarball from contains many >> + ;; pre-compiled files, so we use this snapshot of the source >> + ;; repository. >> + (uri (git-reference >> + (url "") >> + (commit "v2.1.2"))) >> + (file-name (git-file-name name version)) >> + (sha256 >> + (base32 >> + "180hz1p2v3vb6yyzcfwircmljlnd86ln8z80lzy3mwlyrcxblvxy")))) >> + (build-system gnu-build-system) >> + (native-inputs >> + (list rebar3 rebar3-proper erlang-proper)) >> + (propagated-inputs >> + (list erlang)) > > Nitpick: less than 5 dependencies can fit be formatted on the same line, > if it fits, e.g. > > (native-inputs (list rebar3 rebar3-proper erlang-proper)) > > Otherwise the convention is to use something like > > (native-inputs > (list package1 > package2 > ...)) > > Or let 'guix style' take care of it. > >> + (arguments >> + `(#:phases > > New packages should use gexps for arguments, so something like > (arguments > (list #:phases #~(modify-phases %standard-phases > ...))) > >> + (modify-phases %standard-phases >> + (delete 'configure) >> + >> + ;; The following is inspired by rebar-build-system.scm >> + (add-before 'check 'erlang-depends >> + (lambda* (#:key inputs #:allow-other-keys) >> + (use-modules (ice-9 ftw)) >> + (define input-directories >> + (map (lambda (p) (cdr (assoc p inputs))) >> + '("rebar3-proper" "erlang-proper"))) > > It's not typically safe to call use-modules elsewhere than at the top > level (it would cause problems with macros). For imports, you should > use the #:modules build argument. Here you could also simply use > > (define input-directories (list #$(this-package-input "rebar3-proper") > #$(this-package-input "erlang-proper"))) > > since there are only 2 items. > > >> + (mkdir-p "_checkouts") >> + (for-each >> + (lambda (input-dir) >> + (let ((elibdir (string-append input-dir "/lib/erlang/lib"))) >> + (when (directory-exists? elibdir) >> + (for-each >> + (lambda (dirname) >> + (let ((src (string-append elibdir "/" dirname)) >> + (dest (string-append "_checkouts/" dirname))) >> + (when (not (file-exists? dest)) >> + ;; symlinking will not work, since rebar3 will try >> + ;; to overwrite the _build directory several times >> + ;; with the contents of _checkout, so we copy the >> + ;; directory tree to _checkout and make it writeable. >> + (copy-recursively src dest #:follow-symlinks? #t) >> + (for-each >> + (lambda (file) >> + (chmod file #o777)) >> + (find-files dest))))) > > If you add (srfi srfi-26) to #:modules, you can express this more > succintly with: > > (for-each (cut chmod <> #o777) > (find-files dest)) > >> + (scandir elibdir >> + (lambda (file) >> + (and (not (member file '("." ".."))) >> + (file-is-directory? (string-append elibdir "/" file))))))))) > > Please format the code to stay within 80 columns of text. 'guix lint' > should report that. > >> + input-directories))) >> + >> + (replace 'check >> + (lambda* (#:key tests? #:allow-other-keys) >> + (when tests? >> + (begin >> + ;;(setenv "DEBUG" "1") >> + (setenv "REBAR_CACHE_DIR" "/tmp") >> + (invoke "make" "tests")))))) > > If the tests take time and they can not in parallel, the "-j" option > should be provided with the (number->string (parallel-job-count)) value. > >> + #:make-flags >> + (list (string-append "PREFIX=" (assoc-ref %outputs "out")) >> + "CC=gcc"))) > > This should use gexps as well, replacing the assoc-ref above with just > #$output. ------------------------------------------------------------------------ Tim Johann AIH Staff Scientist Klaus-Tschira-Institute for Computational Cardiology, Bioinformatics, Internal Medicine III University Hospital Heidelberg Im Neuenheimer Feld 669 D-69120 Heidelberg Tel.: (+49) 6221 56 39 12 6 *AI Health innovation Cluster* A collaboration of DKFZ, EMBL, Heidelberg University, Heidelberg University Hospital, University Hospital Mannheim, Central Institute of Mental Health, and the Max Planck Institute for Medical Research ------------------------------------------------------------------------ --=-=-=--