From patchwork Mon Apr 19 19:04:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: M X-Patchwork-Id: 28685 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 8DA9C27BC6C; Mon, 19 Apr 2021 20:13:54 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL, SPF_HELO_PASS,T_DKIM_INVALID,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 6799F27BC79 for ; Mon, 19 Apr 2021 20:13:46 +0100 (BST) Received: from localhost ([::1]:39090 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lYZL7-0000zC-JE for patchwork@mira.cbaines.net; Mon, 19 Apr 2021 15:13:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45092) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lYZCg-00061b-OF for guix-patches@gnu.org; Mon, 19 Apr 2021 15:05:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:40553) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lYZCg-0003wb-Du for guix-patches@gnu.org; Mon, 19 Apr 2021 15:05:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lYZCg-0000ab-8C for guix-patches@gnu.org; Mon, 19 Apr 2021 15:05:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#47869] [PATCH v2 core-updates] various cross-compilation fixes in guix/build/utils.scm References: In-Reply-To: Resent-From: Maxime Devos Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 19 Apr 2021 19:05:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 47869 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 47869@debbugs.gnu.org Received: via spool by 47869-submit@debbugs.gnu.org id=B47869.16188590932246 (code B ref 47869); Mon, 19 Apr 2021 19:05:02 +0000 Received: (at 47869) by debbugs.gnu.org; 19 Apr 2021 19:04:53 +0000 Received: from localhost ([127.0.0.1]:52100 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lYZCX-0000aA-Cj for submit@debbugs.gnu.org; Mon, 19 Apr 2021 15:04:53 -0400 Received: from laurent.telenet-ops.be ([195.130.137.89]:42398) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lYZCV-0000a1-Ea for 47869@debbugs.gnu.org; Mon, 19 Apr 2021 15:04:52 -0400 Received: from ptr-bvsjgyjmffd7q9timvx.18120a2.ip6.access.telenet.be ([IPv6:2a02:1811:8c09:9d00:aaf1:9810:a0b8:a55d]) by laurent.telenet-ops.be with bizsmtp id uj4p2400H0mfAB401j4peo; Mon, 19 Apr 2021 21:04:49 +0200 Message-ID: <0892bdfbc097b07631190c8526a41d57b456d343.camel@telenet.be> From: Maxime Devos Date: Mon, 19 Apr 2021 21:04:40 +0200 User-Agent: Evolution 3.34.2 MIME-Version: 1.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telenet.be; s=r21; t=1618859090; bh=IWuSk+2IdJU3T882AObu6UuK/dPmAtll16NBAgX6/IE=; h=Subject:From:To:Date; b=NJquxHHf5PMVAHCB6/2IFS8BBUtGBkCEXc0feEhPxM4hSInU+A6p+6S1r0ekubhjk MnTbv5ocVT75rc9c6SUTHw0ohuLewY5mpAll5elQuqAM/eMlXE8r0tI9c5qzUDNxmn h2j0A1IerKubBcxtrcvyfPZB0kD+hqIMMvJB1OnFHnqjdiebFZLRorYgbq9rUJbzy/ W4Si4XzGtNpQLi+vBr14flwdefQ7tPMSTU/2zMd5xq29p7fukHGQ2n2hyuuQ6T+T3i 9j6lcZIfWedET+ubKk6u/HXvKAcgLObUQJCSs32hmmPL01a3VmmpDlOLQXWEXz/wbQ e70muqr24oUfg== 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+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches This is version two of the patch series, removing a 'pk' that I added for debugging, and also fixing 'wrap-script' and 'wrap-program'. To fix 'wrap-script' and 'wrap-program', I added a required 'inputs' argument. All callers have been adjusted to pass it. Perhaps 'patch-shebang' can be fixed and needs to be fixed, but I don't have investigated that closely yet. ('patch-shebangs' (with a #\s) works properly IIUC). Greetings, Maxime. From cdd45bc0aef8b6cb60d351a8fded18700804e8db Mon Sep 17 00:00:00 2001 From: Maxime Devos Date: Mon, 19 Apr 2021 19:54:53 +0200 Subject: [PATCH 7/7] doc: Document 'wrap-program'. * doc/guix.texi (Wrapping Code)[wrap-program]: Copy docstring from guix/build/utils.scm and use Texinfo markup. --- doc/guix.texi | 37 ++++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/doc/guix.texi b/doc/guix.texi index a2ff13fe0f..6235ae9bf7 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -8703,7 +8703,42 @@ Here is an example using the @code{which} procedure in a build phase: This section documents procedures that create ‘wrappers’ around existing binaries, that e.g. set environment variables required during execution. -@c TODO document wrap-program +@deffn {Scheme Procedure} wrap-program @var{prog} @var{inputs} @var{vars} +Make a wrapper for @var{prog}. @var{vars} should look like this: + +@lisp + '(VARIABLE DELIMITER POSITION LIST-OF-DIRECTORIES) +@end lisp + +where @var{delimiter} is optional. @samp{:} will be used if @var{delimiter} +is not given. + +For example, this command: + +@lisp + (wrap-program "foo" + '("PATH" ":" = ("/gnu/.../bar/bin")) + '("CERT_PATH" suffix ("/gnu/.../baz/certs" + "/qux/certs"))) +@end lisp + +will copy @file{foo} to @file{.foo-real} and create the file @file{foo} with +the following contents: + +@example + #!location/of/bin/bash + export PATH="/gnu/.../bar/bin" + export CERT_PATH="$CERT_PATH$@{CERT_PATH:+:@}/gnu/.../baz/certs:/qux/certs" + exec -a $0 location/of/.foo-real "$@@" +@end example + +This is useful for scripts that expect particular programs to be in @env{PATH}, +for programs that expect particular shared libraries to be in +@env{LD_LIBRARY_PATH}, or modules in @env{GUILE_LOAD_PATH}, etc. + +If @var{prog} has previously been wrapped by @code{wrap-program} the wrapper is +extended with definitions for @var{vars}. +@end deffn @deffn {Scheme Procedure} wrap-script @var{prog} @var{inputs} @var{vars} Wrap the script @var{prog} such that @var{vars} are set first. The format -- 2.31.1