From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id C5CDF1382C5 for ; Wed, 19 May 2021 20:57:45 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id CE918E0867; Wed, 19 May 2021 20:57:42 +0000 (UTC) Received: from smtp.gentoo.org (mail.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 7DC52E0831 for ; Wed, 19 May 2021 20:57:42 +0000 (UTC) Subject: [gentoo-dev] Re: [PATCH] go-module.eclass: add functions for use in custom src_unpack phase To: Zac Medico , William Hubbs , gentoo-dev@lists.gentoo.org References: <20210519194850.23356-1-williamh@gentoo.org> <26d048ba-2a62-4d16-6569-2996be5d3c67@gentoo.org> From: Zac Medico Autocrypt: addr=zmedico@gentoo.org; prefer-encrypt=mutual; keydata= mQINBFs7tmwBEADTzG+IcYtRfTfKryU7sUH7LlV1M+TdaCMfIkY4x6RyHXkaaqYuQ+U9HKn0 +m5FcZsZ1Ojik+We3Tz0F6kDbam6EWzBxmsLb/IHeUEsvsuLzuBQjiD9zzqGocZiPWr+uWJs AdbueS72R7FPXJPDUEPrJ9GdhGFyYARveY9cmdisOwcDOiSFfBjk3/89t4gROn4KUhezVuO9 VS14gVSns1561CJjlB47HkSBu4+FuzrfVygg4xitWAH119Ehw0vJcgkTw4Bqhk01Iw9us80m dFyU8JbJ0CVYe30gYKFFbnXoiT6xLLogKOkv0goPFxaXcMwWM9ei3SjAGVqgN6i8VnO7kquV LwkTe6ntEK0iY+l4qTKuyIOQLpCbWNI0eVwlx5b/pY2pt5TEGW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YoPwXdX9KunzZLudZ mU/4Tq4mbSyEmgKdC+RYvaRlU1MlKT767EC2l1BYB+j+LpR4n93awCjEZXD+hLCCyekpimr6 gT+rEMLg5cZgPkaVgBI2mlHZ4UE4Pm2fp3jHi8HioAReaa9387/90Ar9neXtIXR+5MhGxFjf HOTxhUStVVCgGbtOksu9xaYKpvx8e1mGtdXyEaELC/m29saPYYwbVPzAfmd8poEnkTnXdpP9 8DwBSqU6BS2TxA58GVxc49mWEq8MjJMDzEYHWrR4KiWUKKNG+obKOP5KDz8EbeXNRJm4HbZ9 WJoA7VGTOtBht/AeZ/AAZU2WafotIYwCp9X3YnXa3ykhgQIFmPVZlR3Rm8fRw2TjS0wpXorj BNQDMNEca3GBxj5yKYnZLCO8/shoHBc3j/OL/I9xT2Ru8cOliAYQduoiP9zShZGw4/lKr4d4 hxOBCEoWTwgydFXdsJEbINCWK5gvz7pNiOb09+Hi6uNyIYQ9vFSTTUaTKYVZwk0h55RcKXWe lW54GktnxxU0pszdAsxILi5A0/5yzNYazX16m3EYseCzwFQRM+PJ4/2lC/WKnbSelNnhbbhd lopMa4aFZs0j8mtbfh500sMp6uIcWsdTbrJEimM4LN4GgpSf Message-ID: <3b860916-18d1-cc5d-90c9-0bef307be0da@gentoo.org> Date: Wed, 19 May 2021 13:57:38 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.12.0 Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-dev@lists.gentoo.org Reply-to: gentoo-dev@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply MIME-Version: 1.0 In-Reply-To: <26d048ba-2a62-4d16-6569-2996be5d3c67@gentoo.org> Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="yHt7EluAp4lKTI5xUYpd38qCdzW4VkIwS" X-Archives-Salt: 94c3eddc-552e-4da4-b963-414293f1bd17 X-Archives-Hash: 33a35c768336b066e396e694e66a59f5 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --yHt7EluAp4lKTI5xUYpd38qCdzW4VkIwS Content-Type: multipart/mixed; boundary="plx2fvtEZrkUNrr06tbVdy5jvXeGy6duK" --plx2fvtEZrkUNrr06tbVdy5jvXeGy6duK Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable On 5/19/21 1:45 PM, Zac Medico wrote: >> +# @FUNCTION: go-module_setup_proxy >> +# @DESCRIPTION: >> +# If your ebuild redefines src_unpack and uses EGO_SUM you need to ca= ll >> +# this function in src_unpack. >> +# It sets up the go module proxy in the appropriate location and expo= rts >> +# the GOPROXY environment variable so that go calls will be able to >> +# locate the proxy directory. >> +go-module_setup_proxy() { >> + # shellcheck disable=3DSC2120 >> + debug-print-function "${FUNCNAME}" "$@" >> + >> + if [[ ! ${_GO_MODULE_SET_GLOBALS_CALLED} ]]; then >> + die "go-module_set_globals must be called in global scope" >> + fi >> + >> + local goproxy_dir=3D"${T}/go-proxy" >> + mkdir -p "${goproxy_dir}" || die >> + >> + # For each Golang module distfile, look up where it's supposed to go= and >> + # symlink it into place. >> + local f >> + local goproxy_mod_dir >> + for f in ${A}; do >> + goproxy_mod_path=3D"${_GOMODULE_GOSUM_REVERSE_MAP["${f}"]}" >> + if [[ -n "${goproxy_mod_path}" ]]; then >> + debug-print-function "Populating go proxy for ${goproxy_mod_path}"= >> + # Build symlink hierarchy >> + goproxy_mod_dir=3D$( dirname "${goproxy_dir}"/"${goproxy_mod_path}= " ) >> + mkdir -p "${goproxy_mod_dir}" || die >> + ln -sf "${DISTDIR}"/"${f}" "${goproxy_dir}/${goproxy_mod_path}" ||= >> + die "Failed to ln" >> + local v=3D${goproxy_mod_path} >> + v=3D"${v%.mod}" >> + v=3D"${v%.zip}" >> + v=3D"${v//*\/}" >> + _go-module_gosum_synthesize_files "${goproxy_mod_dir}" "${v}" >> + fi >> + done >> + export GOPROXY=3D"file://${goproxy_dir}" >> + >> + # Validate the gosum now >> + _go-module_src_unpack_verify_gosum >> +} >> + >> # @FUNCTION: go-module_src_unpack >> # @DESCRIPTION: >> # If EGO_SUM is set, unpack the base tarball(s) and set up the >> >=20 > The go-module_setup_proxy function solves bug 790851 nicely, since > sys-cluster/k3s ebuilds can call that instead of go-module_src_unpack. I do have one criticism of the go-module_setup_proxy, which is that it relies on the side-effect of the GOPROXY export for its operation. We can instead echo the GOPROXY value to stdout and force the caller to export it themselves, and provide a convenience wrapper function which works based on side-effects. --=20 Thanks, Zac --plx2fvtEZrkUNrr06tbVdy5jvXeGy6duK-- --yHt7EluAp4lKTI5xUYpd38qCdzW4VkIwS Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQKTBAEBCgB9FiEE8OgXaltWzqgSupCu0HX7jBBKPSAFAmCle8JfFIAAAAAALgAo aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldEYw RTgxNzZBNUI1NkNFQTgxMkJBOTBBRUQwNzVGQjhDMTA0QTNEMjAACgkQ0HX7jBBK PSCRYg/8CbzBfUq7wVHrEUkEH9m4hnYxG2R7Q82as2FK7dyz8IXj1L2Szs5v4lTt RUCgrmyKS/fpqW8Nl6PfTH510Ycde8Plp/2CqOJcCLxVUtVXImYIhC/zNTMBp/DB 98/+JkVK4/j33MEBSI3XkS+5QhkACu2j7YykmuVX7Ob8ugd5qSDtPEAHoTA38rRx vZeS9haVywU0pqDo29hGC/z/DT2CohhhTgaurMgF57n/T7/83To3Lg5+DRSX43P1 sWpNcIGGeociOGsiN8IwkhV5X+d8VBRwWP5H8h2fcRWW4cgd4PBO8ZEzuMFltDLH K1iCfrW7yFIcOKf2PIOHUWuP8CLBWoDQq5daaJ53LLA1mXTtVm8GxuAn/dDirP7r rawoyzjq1GZBlyCWS4CybwbA2Q960gH2prd+cYFV3uCeqf1VA1EOk/rtsBLxIbSv prSgjAnIxVrfPLzDOv8mSns8iO88vxoPeAtgJh9oT9Ds2inpkzfZacvE/vZK0dPA VXFioXtVzkXmOlU9x4UN/M7AV8LBtMrLKxaiKWQPHaCcqzdAjl3yXJ8eIZ41z8Io rM81PduxAdg95+MsduhPwYZeq9+abibiJY1xLJgxFwSzVQ5gplG7T2foqwZh8ok1 PEWTmJ8sj+LgOndyPLG+jQ6ttIrI1/S1zefafymtXGRcpVoHe4A= =TUbJ -----END PGP SIGNATURE----- --yHt7EluAp4lKTI5xUYpd38qCdzW4VkIwS--