* [bug#73299] [PATCH] build/go: Replace symlinks with a copy of the file.
@ 2024-09-16 15:38 Efraim Flashner
2024-09-16 20:09 ` Sharlatan Hellseher
` (3 more replies)
0 siblings, 4 replies; 7+ messages in thread
From: Efraim Flashner @ 2024-09-16 15:38 UTC (permalink / raw)
To: 73299
Cc: Sharlatan Hellseher, Efraim Flashner, Katherine Cox-Buday,
Sharlatan Hellseher
* guix/build/go-build-system.scm (fix-embed-files): New procedure.
(%standard-phases): Add 'fix-embed-files after 'unpack.
Co-authored-by: Sharlatan Hellseher <sharlatanus@gmail.com>
Change-Id: I27bc46fa1a3f4675ff73b6cba4ef5c3d177c22b1
---
I saw this pattern coming up a couple of times in the go-team branch so
I figured I could factor it out, as the comment said. I figure later we
can adjust it to match other symlinked files.
guix/build/go-build-system.scm | 21 ++++++++++++++++++++-
1 file changed, 20 insertions(+), 1 deletion(-)
diff --git a/guix/build/go-build-system.scm b/guix/build/go-build-system.scm
index 3f0f5700a1e..c953976b485 100644
--- a/guix/build/go-build-system.scm
+++ b/guix/build/go-build-system.scm
@@ -4,10 +4,11 @@
;;; Copyright © 2019 Maxim Cournoyer <maxim.cournoyer@gmail.com>
;;; Copyright © 2020 Jack Hill <jackhill@jackhill.us>
;;; Copyright © 2020 Jakub Kądziołka <kuba@kadziolka.net>
-;;; Copyright © 2020, 2021, 2023 Efraim Flashner <efraim@flashner.co.il>
+;;; Copyright © 2020, 2021, 2023, 2024 Efraim Flashner <efraim@flashner.co.il>
;;; Copyright © 2021 Sarah Morgensen <iskarian@mgsn.dev>
;;; Copyright © 2024 Ekaitz Zarraga <ekaitz@elenq.tech>
;;; Copyright © 2024 Picnoir <picnoir@alternativebit.fr>
+;;; Copyright © 2024 Sharlatan Hellseher <sharlatanus@gmail.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -201,6 +202,23 @@ (define* (setup-go-environment #:key inputs outputs goos goarch #:allow-other-ke
(delete-file-recursively tmpdir))
#t)
+(define* (fix-embed-files #:rest args)
+ "Golang can't determine the valid directory of the module of embed file
+which is symlinked during setup environment phase, but easy resolved after
+coping file from the store to the build directory of the current package."
+;; see details in Golang source:
+;;
+;; - URL: <https://github.com/golang/go/blob/>
+;; - commit: 82c14346d89ec0eeca114f9ca0e88516b2cda454
+;; - file: src/cmd/go/internal/load/pkg.go#L2059
+ (for-each (lambda (file)
+ (when (eq? (stat:type (lstat file))
+ 'symlink)
+ (let ((file-store-path (readlink file)))
+ (delete-file file)
+ (copy-recursively file-store-path file))))
+ (find-files "src" ".*(editions_defaults.binpb)$")))
+
(define* (unpack #:key source import-path unpack-path #:allow-other-keys)
"Relative to $GOPATH, unpack SOURCE in UNPACK-PATH, or IMPORT-PATH when
UNPACK-PATH is unset. If the SOURCE archive has a single top level directory,
@@ -321,6 +339,7 @@ (define %standard-phases
(delete 'patch-generated-file-shebangs)
(add-before 'unpack 'setup-go-environment setup-go-environment)
(replace 'unpack unpack)
+ (add-after 'unpack 'fix-embed-files fix-embed-files)
(replace 'build build)
(replace 'check check)
(replace 'install install)
base-commit: 0091fa2cc2ac2104d7945b585e4eaec908ca742f
--
Efraim Flashner <efraim@flashner.co.il> רנשלפ םירפא
GPG key = A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [bug#73299] [PATCH] build/go: Replace symlinks with a copy of the file.
2024-09-16 15:38 [bug#73299] [PATCH] build/go: Replace symlinks with a copy of the file Efraim Flashner
@ 2024-09-16 20:09 ` Sharlatan Hellseher
2024-09-19 13:26 ` bug#73299: " Sharlatan Hellseher
` (2 subsequent siblings)
3 siblings, 0 replies; 7+ messages in thread
From: Sharlatan Hellseher @ 2024-09-16 20:09 UTC (permalink / raw)
To: 73299; +Cc: Efraim Flashner
[-- Attachment #1: Type: text/plain, Size: 9572 bytes --]
Hi Efraim,
Thank you for implementing it as a procedure! I've slightly modifed your
patch to have an optional list of other embed files or patterns which
will be copied. It started appearing more and more during updates where
project needs embed file(s) and Golang can't detect it location.
Changes in v2:
- implement #:embed-files key
- implement building match pattern based on it
- add documentation
- add missing copyright for Troy, who implemented #:test-flags key
- include 2 examples on how it solves for the case where go could not
find more files
I can apply it on go-team and clean up all TODOs.
The branch would need some review as it contains adjustments to importer
an build system. I do not want to push more changes for now and it would
be great to merge it to master after resolving all potential build
issues.
Efraim Flashner (1):
build/go: Replace symlinks with a copy of the file.
Sharlatan Hellseher (2):
gnu: go-github-com-prometheus-statsd-exporter: Remove redundant phase.
gnu: go-github-com-golang-protobuf: Remove redundant phase.
doc/guix.texi | 8 ++++++++
gnu/packages/golang-build.scm | 18 ------------------
gnu/packages/prometheus.scm | 24 +-----------------------
guix/build-system/go.scm | 6 ++++++
guix/build/go-build-system.scm | 30 ++++++++++++++++++++++++++++--
5 files changed, 43 insertions(+), 43 deletions(-)
base-commit: f5449685143be0805a8a9b54ddecee94e368c6e9
prerequisite-patch-id: bf5c64d8c918f491f55da888b016e6a3f71119fc
prerequisite-patch-id: 37d4fcd80049a0d2f23e4a2823be899ac9ba5a92
prerequisite-patch-id: df0368ad227844a04e5ee1c7f950629aa78261a4
prerequisite-patch-id: 7f84b54ceeed4e876b80c9719d01c4ac46107bc0
prerequisite-patch-id: 0296a60d5c71c1c0340dafc71805d73c1ecfd842
prerequisite-patch-id: 2d94a9caf8da756a9d7db97c05dd4bb389b8229e
prerequisite-patch-id: 492ab0bbf944adbaa9781a5c5e52244f2b8658fe
prerequisite-patch-id: 6f971b174a8ad69e9f3961ad9b85417e45623bb6
prerequisite-patch-id: dd63d8b78cd9683db737967abddd37bca9a6e857
prerequisite-patch-id: a32b4ef3062548909d14a0828e45df1394a3219b
prerequisite-patch-id: 011f3c12c5c5982faf524c28778fb903426feaa2
prerequisite-patch-id: c38e1756dccf87c74efe631f64a1c7f441d11641
prerequisite-patch-id: 00e7d1dc1e39e512a4e2e9714f080291425dcfc8
prerequisite-patch-id: 28134b8dffa9d27fca725ba9f85e167c1274034a
prerequisite-patch-id: 509868ff5c4a3a67b03d6a57e02a539e348284ee
prerequisite-patch-id: 7ca3232011da5c664f65ba802b6786cab561bbad
prerequisite-patch-id: 0ba03d80347c47d2c9f744d20bfd29912e40f318
prerequisite-patch-id: e3a8892e61c618e1d3920cf988d88554092dd8a8
prerequisite-patch-id: 6e9876b605b9ce55c6183614b1bfebcf26e59430
prerequisite-patch-id: b299291ef134206cfe8ad45c7a9a8010bb87f36a
prerequisite-patch-id: e7729b0615445695d3f875a835824d73e02402fa
prerequisite-patch-id: a684974f9b28cd9e77728a2701397ec43eb1b924
prerequisite-patch-id: 907c96345848d2412a52e3c819a2e7f23dadf2e8
prerequisite-patch-id: 743555a609ce940d60bef70239f3a343e7728538
prerequisite-patch-id: 02a0aecd4f35b17cf18fe2bbefb8351b002f0758
prerequisite-patch-id: 100395e419ab8f34297a225b09790ab164503819
prerequisite-patch-id: a643606e91d3d9e26c201ac548781c3dd681cfbf
prerequisite-patch-id: 6251c5780a23f465765c0fe99dff91c1b650bc4d
prerequisite-patch-id: a93ecc6c9fea0f862a25ae1905b15c6e3019de67
prerequisite-patch-id: 39a686620fec6dd9f0dc5dee02492391b40c5784
prerequisite-patch-id: bfb191d2c2e504d6f5d3aba89dac4c092b41b4c6
prerequisite-patch-id: ad344284c5c86bb7165e31e74613016ea88dd350
prerequisite-patch-id: ce8004b812d523cee9a164492958084660b862de
prerequisite-patch-id: 0a15c680f1915b9c393f37a940ef5250dd378a1d
prerequisite-patch-id: e7bfa7e3dcaf1e007fe55690e0a649b40bd02ff4
prerequisite-patch-id: 91b5c05f4ed9de44ca6eedb6955076a3c7721cdd
prerequisite-patch-id: 94b5b61881f77c643a0d974a8716aa38feba6f7f
prerequisite-patch-id: 12496373563bece7cbc951fda0f9544662f97746
prerequisite-patch-id: 94fd500b9a233a8b98592b68c01726d2c379debd
prerequisite-patch-id: 76f762b24e013aabe2da2d5f8d4705b4d93b4970
prerequisite-patch-id: e4a4048a05a33eb8014250c4750159f6f9aa9884
prerequisite-patch-id: bae47578a5b697a3a74af34bf8e32d42ff1467aa
prerequisite-patch-id: 5fb108815c9dedd829e7b124f0217eebe55d4858
prerequisite-patch-id: 149f495240146f7e24b611452db0e9013143056a
prerequisite-patch-id: 459e11365cd3a343570a908a22c0e2aba3a58f09
prerequisite-patch-id: 5c88c28af5317f5342448b30267c4423726167f2
prerequisite-patch-id: 4d0443def5d0bc8aab514e0df86f001dda19ba2b
prerequisite-patch-id: 9d1ad455f0cfdf22eade1c469a3c5b700603cad7
prerequisite-patch-id: 60c4b855690f700c6fc9edc6e0c61bd553fb20fb
prerequisite-patch-id: 8f3af07731497a073f5bc421a26bc9889bbb62ce
prerequisite-patch-id: b464542aee48a0ae9593185074cc7b66d75b36ed
prerequisite-patch-id: b838bdbeceeec178d52cf544b4c1c784b458ae7d
prerequisite-patch-id: 0f3961d4fea2f6b2d305e2ad500284c84b8d10dc
prerequisite-patch-id: 26f6a0af3443ca07e0c20e5913c334aca3c209d6
prerequisite-patch-id: 4cd07ca6b74c163c3c762a5e956447b47b580369
prerequisite-patch-id: 4d34cd2070170fdbd86c84a455526bd12d941964
prerequisite-patch-id: d5f5089cf771ba0b76bfe6805abfe631d07c29dc
prerequisite-patch-id: 9c13e9b901aa38db4cc150f227ddc9557ec5e511
prerequisite-patch-id: 9f5a14c05bb1a6dff24936d0f6702ca4993d775b
prerequisite-patch-id: 458f5f792f7a019572a33ab49fc11c12ecb42472
prerequisite-patch-id: d93592a3623b23e76eb4cb37661d029433257eec
prerequisite-patch-id: 068ca74f1ff9a38d4a3fedd6d91df582082e5ef4
prerequisite-patch-id: b940c60f2bf310201d566eab1b2e8a359a9bbaf4
prerequisite-patch-id: d628e14aeb629e70c99bd4c010a88a162ecbd5c0
prerequisite-patch-id: 5d6eddbbdfdd8fa4c8ea8d9621f0c2a23e130743
prerequisite-patch-id: 62332e6f9cefb59b437fe48f776221efa7281040
prerequisite-patch-id: 88bc78415d0c4b8a8323e20dcf511fa66af330c4
prerequisite-patch-id: fcbfc689c5711d222caa29c07053bf31eb4b91cd
prerequisite-patch-id: da204ba21e647383281cfaf2a6c70ee1fa58e5a5
prerequisite-patch-id: 63b677332671f61d07929b9095bd0a74f3efe60e
prerequisite-patch-id: 62d7b58ff66835200f5d83c3d4c0672b2633049a
prerequisite-patch-id: dcd16fdaa2af61501818a4ea4323ca5c91a1127b
prerequisite-patch-id: dc36b4bf9fd3ded6a39706107b265f93b80fe370
prerequisite-patch-id: 770a07cac55179ba07166ad048c97e86f4b13670
prerequisite-patch-id: 8d34c2ba148b861bec3a485a6543135698296886
prerequisite-patch-id: cc88568c0587fd723bdfa4c5358a5a9d6984457e
prerequisite-patch-id: 1f016e814fb174e06d6b33ec07b0f95471cabf19
prerequisite-patch-id: 2c69132dce6ba24fa402a2b1c379a5b5c387dd7b
prerequisite-patch-id: 2c5168b75d80a01bf0d6815f0055ff3ec30caa44
prerequisite-patch-id: e615055c1c3090731090aed42f05eb5d1fb6564a
prerequisite-patch-id: 4caa2472b4c06ae0c8011b049197bedad5f5228e
prerequisite-patch-id: 452f33dd740f65beb7e22e0ca81baef5457c82ab
prerequisite-patch-id: c74579d2771af9098e24557c10ab3e4140746b75
prerequisite-patch-id: 7e84e3d0892975c807f3773d07424237c9639483
prerequisite-patch-id: 712126549fa65ec1babbb8710314319d5875362d
prerequisite-patch-id: 43441e3a86f3c1711afcbf14df5ecd7a0b0343be
prerequisite-patch-id: cae4bd98106f640d76904270244b1bf1315bcb1d
prerequisite-patch-id: c9bf6829217ab6b460b522fb1252dcb6b39a71e3
prerequisite-patch-id: 59b16e880553456851031fde64db1060f36bb125
prerequisite-patch-id: 61cf441c09658a605c09e2afdfe6a0ed644153a5
prerequisite-patch-id: 20920fe50dbd3a4f8b28d8c08a18011efc020d0d
prerequisite-patch-id: 408b7758d3decd92387ff19446590f6339c948c7
prerequisite-patch-id: 7bcb962bbbfb07ae864e005276b7629f5dd2a2a5
prerequisite-patch-id: 53d89343a81a8ef4a47b9ec5c34a7795930f3221
prerequisite-patch-id: 50a2ff5650b9bbbb111333e72a3180c9220c93b1
prerequisite-patch-id: e5587d038c63f97f5821c7d64e64968f6d23f18b
prerequisite-patch-id: ebec5c6bcebd6ee0b34e02efb63e16e0c689e96e
prerequisite-patch-id: e58d6eb187ba7a726cfc8fcbc02c636c63eeb01f
prerequisite-patch-id: ff82775fa0be79e3ca23e91e15cf8b6d3934261a
prerequisite-patch-id: 6cffdf3b490683f50f1478b02d7ec50982b52443
prerequisite-patch-id: 9f76593f3984482bb0c191a3c1753a8bc74a1bb5
prerequisite-patch-id: 91dd68bc14f8c88f82515077f229f67a91c47c98
prerequisite-patch-id: 564f47441f415c0f6a31ba97c4993824868a4c51
prerequisite-patch-id: 0f8321acaae45c42001a03f64fbda7c7789da377
prerequisite-patch-id: 9f529cf0218c6d6241bd1702b4be370fc30a71fa
prerequisite-patch-id: 7bf436492ad84783eceb860aaada2f2820c205cc
prerequisite-patch-id: b2dd4888a77f0d7e5da5be8ad13561913e818c9f
prerequisite-patch-id: a18a8ee540d5ddd13367e0dc4a5a4608f9f87410
prerequisite-patch-id: a7de718aa40a43dffc015eea1c9aabe54ad853b4
prerequisite-patch-id: 3b7026bcb6dc9045ffcd88003ae80a969840b17b
prerequisite-patch-id: 827b7210126c3e4af59768f027e8d9f0d9d9b88b
prerequisite-patch-id: 1b04fe7abb2801551192579eaf449ec0575879a7
prerequisite-patch-id: 04c43ab1383ff99a18f125bd9494ce5e348d39c0
prerequisite-patch-id: 2ec07e430ae6410f1cbb515c7c94dfcbf48deb9d
prerequisite-patch-id: 19d90156bd1b798376c1b48e8d97cb2e10e052eb
prerequisite-patch-id: 83ad7de8b7d2987a67e2702d5b2a4e10dbfb8b88
prerequisite-patch-id: acb7e450a5c776f8aed85fee56ad4cd6eaa272ed
prerequisite-patch-id: 9efbb939415534e6ac18e0bb1a7e44fafa309e92
prerequisite-patch-id: c779017f15fc711a693fde48429b9410b6b0703b
prerequisite-patch-id: 6bae6f8cedbea090582ca108fa785f4ffa72194d
prerequisite-patch-id: 6d440be966ddb0c5ec25209e2add9eba9281e602
prerequisite-patch-id: 2f5fff666441ab39aa5a41ff04a2008a5910131d
prerequisite-patch-id: f3010317857ccda72dfd26c60517ecf2d7d68045
prerequisite-patch-id: 49c6204f732cb27ff947d27aedf919a76227396f
--
2.46.0
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#73299: [PATCH] build/go: Replace symlinks with a copy of the file.
2024-09-16 15:38 [bug#73299] [PATCH] build/go: Replace symlinks with a copy of the file Efraim Flashner
2024-09-16 20:09 ` Sharlatan Hellseher
@ 2024-09-19 13:26 ` Sharlatan Hellseher
2024-09-26 13:33 ` [bug#73299] " Sharlatan Hellseher
2024-09-26 19:09 ` Sharlatan Hellseher
3 siblings, 0 replies; 7+ messages in thread
From: Sharlatan Hellseher @ 2024-09-19 13:26 UTC (permalink / raw)
To: 73299-done
[-- Attachment #1: Type: text/plain, Size: 190 bytes --]
Hi,
Pushed as:
- 272cdbb16d * go-team gnu: build/go: Apply default 'fix-embed-files phase.
- 870204639e * build/go: Replace symlinks with a copy of the file.
to go-team branch.
--
Oleg
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* [bug#73299] [PATCH] build/go: Replace symlinks with a copy of the file.
2024-09-16 15:38 [bug#73299] [PATCH] build/go: Replace symlinks with a copy of the file Efraim Flashner
2024-09-16 20:09 ` Sharlatan Hellseher
2024-09-19 13:26 ` bug#73299: " Sharlatan Hellseher
@ 2024-09-26 13:33 ` Sharlatan Hellseher
2024-09-26 13:56 ` Maxim Cournoyer
2024-09-26 19:09 ` Sharlatan Hellseher
3 siblings, 1 reply; 7+ messages in thread
From: Sharlatan Hellseher @ 2024-09-26 13:33 UTC (permalink / raw)
To: 73299; +Cc: Maxim Cournoyer
[-- Attachment #1: Type: text/plain, Size: 278 bytes --]
Hi Maxim,
Thanks for a feedback!
I currently polishing go-team branch (rebasing, adjusting failed builds,
etc.)
Is it ok to apply your suggestions, modify the commit and rebase the
branch once again or it would be ok to apply adjustment commit on top
of it?
Thanks,
--
Oleg
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* [bug#73299] [PATCH] build/go: Replace symlinks with a copy of the file.
2024-09-26 13:33 ` [bug#73299] " Sharlatan Hellseher
@ 2024-09-26 13:56 ` Maxim Cournoyer
0 siblings, 0 replies; 7+ messages in thread
From: Maxim Cournoyer @ 2024-09-26 13:56 UTC (permalink / raw)
To: Sharlatan Hellseher; +Cc: 73299
Hi Sharlatan,
Sharlatan Hellseher <sharlatanus@gmail.com> writes:
> Hi Maxim,
>
> Thanks for a feedback!
>
> I currently polishing go-team branch (rebasing, adjusting failed builds,
> etc.)
> Is it ok to apply your suggestions, modify the commit and rebase the
> branch once again or it would be ok to apply adjustment commit on top
I think it'd be safer to have a fixup commit; unless you are sure nobody
cherry-picked some commits from the branch to master or elsewhere (which
would then appear duplicated once the go-team branch gets merged into
that same branch).
--
Thanks,
Maxim
^ permalink raw reply [flat|nested] 7+ messages in thread
* [bug#73299] [PATCH] build/go: Replace symlinks with a copy of the file.
2024-09-16 15:38 [bug#73299] [PATCH] build/go: Replace symlinks with a copy of the file Efraim Flashner
` (2 preceding siblings ...)
2024-09-26 13:33 ` [bug#73299] " Sharlatan Hellseher
@ 2024-09-26 19:09 ` Sharlatan Hellseher
2024-09-27 6:57 ` Maxim Cournoyer
3 siblings, 1 reply; 7+ messages in thread
From: Sharlatan Hellseher @ 2024-09-26 19:09 UTC (permalink / raw)
To: 73299; +Cc: Maxim Cournoyer
[-- Attachment #1: Type: text/plain, Size: 141 bytes --]
Hi,
Pushed to go-team as https://git.savannah.gnu.org/cgit/guix.git/commit/?h=go-team&id=ad39aa197af0833523b6c43ecc798790e0f9c060
--
Oleg
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* [bug#73299] [PATCH] build/go: Replace symlinks with a copy of the file.
2024-09-26 19:09 ` Sharlatan Hellseher
@ 2024-09-27 6:57 ` Maxim Cournoyer
0 siblings, 0 replies; 7+ messages in thread
From: Maxim Cournoyer @ 2024-09-27 6:57 UTC (permalink / raw)
To: Sharlatan Hellseher; +Cc: 73299
Hi,
Sharlatan Hellseher <sharlatanus@gmail.com> writes:
> Hi,
>
> Pushed to go-team as https://git.savannah.gnu.org/cgit/guix.git/commit/?h=go-team&id=ad39aa197af0833523b6c43ecc798790e0f9c060
Thank you for taking the effort to address my (small) comments!
--
Maxim
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2024-09-27 6:58 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-16 15:38 [bug#73299] [PATCH] build/go: Replace symlinks with a copy of the file Efraim Flashner
2024-09-16 20:09 ` Sharlatan Hellseher
2024-09-19 13:26 ` bug#73299: " Sharlatan Hellseher
2024-09-26 13:33 ` [bug#73299] " Sharlatan Hellseher
2024-09-26 13:56 ` Maxim Cournoyer
2024-09-26 19:09 ` Sharlatan Hellseher
2024-09-27 6:57 ` Maxim Cournoyer
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).