From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:306:2d92::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id AL1xHL0HzmT8OAEASxT56A (envelope-from ) for ; Sat, 05 Aug 2023 10:26:37 +0200 Received: from aspmx1.migadu.com ([2001:41d0:306:2d92::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id mDs9HL0HzmSGXQAAauVa8A (envelope-from ) for ; Sat, 05 Aug 2023 10:26:37 +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 35C2F49B83 for ; Sat, 5 Aug 2023 10:26:37 +0200 (CEST) Authentication-Results: aspmx1.migadu.com; dkim=none; spf=pass (aspmx1.migadu.com: domain of "guix-devel-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-devel-bounces+larch=yhetil.org@gnu.org"; dmarc=none ARC-Seal: i=1; s=key1; d=yhetil.org; t=1691223997; a=rsa-sha256; cv=none; b=F7G055FwQJ7if7JUKaqmV6hZok0SXjriQR/vx7FGyLAY3FSfuW3BrakYEOUE1BbQW8TNGU PFwbU2gIz3vvg/2bzC+O+Qtw4x/GT/bbgVVq77MkStNkPx+0Jg8WAdVG53vZAtEV0ObeeU 9dF3eEn9TZCAmWoCRF6PjM+Q+1+SylCOYAe+zSIuz1f7sBIeRvbdRbxL9jdrfSqSho3NDD TirP5HONET6gntoTu+tbgxe9VGOG7V/0Dj8j9117h425kUbQSd1+7Vasy94W0K7IAakg87 2AWgpfBb0QTqyCRDqRDGBCK4/9hxb0TX/BiVrlfC1v7upfus/rfhP9sGMB4Yng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1691223997; 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: content-transfer-encoding:content-transfer-encoding:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=/sEX9zUCTfRgYmdg1/GV9ygOLjWx99WaFu0yve6ESIQ=; b=s3yVAFsORCSiE8Icn8o27YThh7gYbIeT7D7HJzUOf1NZA2bSEQwY4CRkPHpwl4eqYvnNXj tlYGYPsffnhURsuCNA7NbA7A6gebevEvQri9/ghOi6oe3skZQz+MsMiFOm0QtSefven8Ah QjZ99mD5knfgR+h3TZ0A/CU5jNxY2pnIngD/UTG3H7lc/XvSGOKwc6lbnUZF1Oobjwz65L DJR/JrBle1VfaRbDCSm9rmlWZVxLbDhB9iwGB0KvEOA0aE6OvCAJD15rr2vq33XvcZHdt7 XUtVKkmfPYwKkEK0pa3iWNCHcAXjfzeVYTX4Lx3BPT3eRLV6dqwlwBr7xH2H9w== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; spf=pass (aspmx1.migadu.com: domain of "guix-devel-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-devel-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 1qSCc0-0001up-Jz; Sat, 05 Aug 2023 04:26:12 -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 1qSCby-0001uZ-8W for guix-devel@gnu.org; Sat, 05 Aug 2023 04:26:10 -0400 Received: from mout.kundenserver.de ([212.227.126.130]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qSCbw-00034B-A7 for guix-devel@gnu.org; Sat, 05 Aug 2023 04:26:10 -0400 Received: from hermia.goebel-consult.de ([79.211.182.88]) by mrelayeu.kundenserver.de (mreue009 [212.227.15.167]) with ESMTPSA (Nemesis) id 1MI5YN-1qe4Rp3vUd-00FAfn for ; Sat, 05 Aug 2023 10:26:02 +0200 Received: from [127.0.0.1] (hermia.goebel-consult.de [192.168.110.7]) by hermia.goebel-consult.de (Postfix) with ESMTP id 2C25D66E70 for ; Sat, 5 Aug 2023 10:26:00 +0200 (CEST) Message-ID: <68aacdad-ecd3-2e82-db4b-c9c85bb8e520@crazy-compilers.com> Date: Sat, 5 Aug 2023 10:25:45 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.12.0 From: Hartmut Goebel Content-Language: de-DE, en-US Organization: crazy-compilers.com To: Guix-devel Subject: Reusing code for a build-phase? Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Provags-ID: V03:K1:oeNgcBex62o1zOpKbtnVdnbojnp7rTk/uJNHvm0v9TIb2JSd35u I//AykLOC6K5FBOJVbWSvtOvEyCByiiG6O6oLiT/Zt9uhws4dtolOueoxQWTaFaa2hnEDuN i4eZ6tIudxviuDX7473rEimWuN+ufZnbEsskRRUd/PCDMh99e5dlIHKYeWYpgzqESGcIL3G KRll0TSv4xLt95JzJGUgQ== UI-OutboundReport: notjunk:1;M01:P0:t+wMHCn5dM4=;ewnZoC137iE5l8hLd/itDUGEUqk sfKvMLsuuYK1SB8TxDOywUSaOk0G5vdrIGhB6t9OVKUnXuPT6wmN9AuHe4HJO6l6ZbkojgyTx 0X/nd/BvqHRR/r9wpSKpIt1+Vm/OneWqYQBkP9vQnY8L3+PX68Bs7ijxg6UqVW8udmpa+MJp5 Vz4u9D5b/SwudDqD/CAz1Ox1ZxwSIZrbUu+f0sBCOftE6/iZKgjO2trldWQDi8XLgc2PDcqlC S4cMvvSwbzixU2OIxZ7zeoFZ9nOe1ueq1/SmeAv9/RqQv+GvgKrwTluG6g6PtEX16uCgPBvvf NdYi9vLZDiXaiUIU0ukLFppqW5+tCdQVCgmMEnvYUtarYqI+j2l0isfnZLxDY5BragH08p61c Le1zCzg55YZ/s+kNtVXNtJCc7YP0YQg9ms8oyNJJR/pN41Iqa0xD7oA1fIuBae6vmUQj1aeoj GHSkz0F9qS5BiLPr8iibJ2CFg/GN45T7GYLxGx+0cLHaGUD3bVT5LWmWvm0NvuFvmxBlHQLwr O+7hSrTckyV5mHBdOxodGuBoKCLQFGQ+HRkkMhmZJScHVPJwqlQ+El6/9yg0BpV16RKcIT8+D pttHSWFRKTHHWqFpswdiFSbgTmfG1z7lwsJhdMkZ8eQ81a4PMlmExPgJTWSI3gELmFuYkIJFR oAGGoAhB/n4SZpQakgS/9fbqRSt08g3sXYvglSQoxNbvVPNr0g2yheWjgyWRz1cUkmiXBqW0T t1tbohe1ZY4xY/44J/J5uODi3a7E2al/PcXTE6k101khM8d7eM7Dbg+It929jnRUfGpY9/txC vi131i+ywkr75yStnq0OkNY6ozRvCgCwzJBOf06NSLaUn1AaFPTLrFLRwJDgdSbwiaWHapR/v Yj6+PzZvfMj12hg== Received-SPF: pass client-ip=212.227.126.130; envelope-from=h.goebel@crazy-compilers.com; helo=mout.kundenserver.de X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, HTML_MESSAGE=0.001, MIME_HTML_ONLY=0.1, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: guix-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+larch=yhetil.org@gnu.org Sender: guix-devel-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Spam-Score: -4.84 X-Migadu-Scanner: mx2.migadu.com X-Migadu-Queue-Id: 35C2F49B83 X-Spam-Score: -4.84 X-TUID: yfpCqMWkDnLb

Hi,

I'm currently packaging vagrant and some plugins. For all plugins an additional phase is required, generating a json file, see below. Since this is quite some code, I'd like to put it into some definition or some wrapper. Since it uses (this-package-verion), my attempts failed.

At best, a plugin would then be defined like

  (define-public vagrant-abc (vagrant-plugin-wrapper (package …

Anyhow I'd be happy to when being able to use some function in the phase instead of duplicating the code.

Any ideas? Many thanks in advance

    (arguments
     (list
      #:tests? #f ; tests involve running vagrant and downloading a box
      #:phases
      #~(modify-phases %standard-phases
          (add-after 'install 'install-plugin.json
            (lambda _
              (let* ((plugins.d (string-append
                                 #$output "/share/vagrant-plugins/plugins.d"))
                     (plugin.json (string-append
                                   plugins.d "/" #$name ".json")))
                (mkdir-p plugins.d)
                #$(with-extensions (list guile-json-4)
                    #~(begin
                        (use-modules (json))
                        (call-with-output-file plugin.json
                          (lambda (port)
                            (scm->json
                             '((#$name
                                .
                                (("ruby_version"
                                  . #$(package-version (this-package-input "ruby")))
                                 ("vagrant_version"
                                  . #$(package-version (this-package-input "vagrant")))
                                 ("gem_version" .  "")
                                 ("require" . "")
                                 ("sources" . #()))))
                             port)))))))))))

-- 
Regards
Hartmut Goebel

| Hartmut Goebel          | h.goebel@crazy-compilers.com               |
| www.crazy-compilers.com | compilers which you thought are impossible |