Skip to contentSkip to conversation

package/pkg-golang.mk: make GOPROXY configurable

PATCH Superseded James Hilliard 2 participants 4 messages Oct 28, 2024

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/2 package/pkg-golang.mk: make GOPROXY configurable

Some packages like the upcoming netbird package don't work correctly with GOPROXY=direct which is not the default setting for the go toolchain.

Lets make the GOPROXY setting configurable and use the default toolchain setting which is most likely to be what packages end up typically being tested against.

---
 Config.in             | 11 +++++++++++
 package/pkg-golang.mk |  2 +-
 2 files changed, 12 insertions(+), 1 deletion(-)
Config.in +11 -0
index df43db7eff..ad6ac38656 100644
@@ -258,6 +258,17 @@ config BR2_PRIMARY_SITE_ONLY
 	  the project can be built even if the upstream tarball
 	  locations disappear.
 
+config BR2_GOPROXY_LIST
+	string "GOPROXY list"
+	default "https://proxy.golang.org,direct"
+	depends on BR2_PACKAGE_HOST_GO_TARGET_ARCH_SUPPORTS
+	help
+	  List of module proxy URLs. The go command will attempt to
+	  download modules from each server in sequence. The keyword
+	  direct instructs the go command to download modules from
+	  version control repositories where they’re developed instead
+	  of using a proxy.
+
 if !BR2_PRIMARY_SITE_ONLY
 
 config BR2_BACKUP_SITE
package/pkg-golang.mk +1 -1
index 8e27602d41..f586f75dfa 100644
@@ -88,7 +88,7 @@ $(2)_POST_PATCH_HOOKS += $(2)_GEN_GOMOD
 $(2)_DOWNLOAD_POST_PROCESS = go
 $(2)_DL_ENV += \
 	$$(HOST_GO_COMMON_ENV) \
-	GOPROXY=direct \
+	GOPROXY=$$(call qstrip,$$(BR2_GOPROXY_LIST)) \
 	$$($(2)_GO_ENV)
 
 # Because we append vendored info, we can't rely on the values being empty
Signature · 6 lines
2.34.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw

PATCH v2 2/2 package/netbird: new package

---
Changes v1 -> v2:
- remove package specific GOPROXY
- update to 0.30.3

---
 DEVELOPERS                   |  1 +
 package/Config.in            |  1 +
 package/netbird/Config.in    | 10 ++++++++++
 package/netbird/netbird.hash |  3 +++
 package/netbird/netbird.mk   | 25 +++++++++++++++++++++++++
 5 files changed, 40 insertions(+)
 create mode 100644 package/netbird/Config.in
 create mode 100644 package/netbird/netbird.hash
 create mode 100644 package/netbird/netbird.mk
DEVELOPERS +1 -0
index 9743ae30d4..be40f986b7 100644
@@ -1509,6 +1509,7 @@ F:	package/libucontext/
 F:	package/lilv/
 F:	package/lv2/
 F:	package/neon-2-sse/
+F:	package/netbird/
 F:	package/pipewire/
 F:	package/python*
 F:	package/rtl8192eu/
package/Config.in +1 -0
index 57a95a6ea8..dcc1cc8268 100644
@@ -2550,6 +2550,7 @@ endif
 	source "package/ndisc6/Config.in"
 	source "package/net-tools/Config.in"
 	source "package/netatalk/Config.in"
+	source "package/netbird/Config.in"
 	source "package/netcalc/Config.in"
 	source "package/netcat/Config.in"
 	source "package/netcat-openbsd/Config.in"
package/netbird/Config.in new file +10 -0
new file mode 100644
index 0000000000..b2e1eb6fd5
@@ -0,0 +1,10 @@
+config BR2_PACKAGE_NETBIRD
+	bool "netbird"
+	depends on BR2_PACKAGE_HOST_GO_TARGET_ARCH_SUPPORTS
+	select BR2_PACKAGE_HOST_GO
+	help
+	  Connect your devices into a secure WireGuard-based
+	  overlay network with SSO, MFA and granular access
+	  controls.
+
+	  https://github.com/netbirdio/netbird
package/netbird/netbird.hash new file +3 -0
new file mode 100644
index 0000000000..08ba5913a0
@@ -0,0 +1,3 @@
+# Locally computed
+sha256  c736d7d3796eb7a5446ff0ccc562e4f79d8fa6f33e11047e4af9cb3202a4c7e3  netbird-0.30.3-go2.tar.gz
+sha256  c9f34c452ac8f054df592e3eeca0e271b91e8010c0fc6cf8c76aabf547a9388d  LICENSE
package/netbird/netbird.mk new file +25 -0
new file mode 100644
index 0000000000..c7be6ef213
@@ -0,0 +1,25 @@
+################################################################################
+#
+# netbird
+#
+################################################################################
+
+NETBIRD_VERSION = 0.30.3
+NETBIRD_SITE = $(call github,netbirdio,netbird,v$(NETBIRD_VERSION))
+NETBIRD_LICENSE = BSD-3-Clause
+NETBIRD_LICENSE_FILES = LICENSE
+NETBIRD_GOMOD = github.com/netbirdio/netbird
+NETBIRD_BUILD_TARGETS = client
+NETBIRD_LDFLAGS = \
+	-X github.com/netbirdio/netbird/version.version=$(NETBIRD_VERSION)
+
+define NETBIRD_INSTALL_TARGET_CMDS
+	$(INSTALL) -D -m 0755 $(@D)/bin/client $(TARGET_DIR)/usr/bin/netbird
+endef
+
+define NETBIRD_LINUX_CONFIG_FIXUPS
+	$(call KCONFIG_ENABLE_OPT,CONFIG_TUN)
+	$(call KCONFIG_ENABLE_OPT,CONFIG_WIREGUARD)
+endef
+
+$(eval $(golang-package))
Signature · 6 lines
2.34.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#2 lore raw
In reply to James Hilliard

Hi James,

Quoted 4 lines · James Hilliard

Some packages like the upcoming netbird package don't work correctly with GOPROXY=direct which is not the default setting for the go toolchain.

https://github.com/netbirdio/netbird/pull/2789

While it is a good idea to add this option, I don't think mentioning netbird is necessary since the intent of this option is not to make packages that won't work with GOPROXY direct work. It's just for the performance improvement.

When merging packages I'd still expect us to test it with GOPROXY direct as well.

Lets make the GOPROXY setting configurable and use the default

Quoted 18 lines

toolchain setting which is most likely to be what packages end up typically being tested against.

---
 Config.in             | 11 +++++++++++
 package/pkg-golang.mk |  2 +-
 2 files changed, 12 insertions(+), 1 deletion(-)
Config.in +1 -0
index df43db7eff..ad6ac38656 100644
@@ -258,6 +258,17 @@ config BR2_PRIMARY_SITE_ONLY
          the project can be built even if the upstream tarball
          locations disappear.
 
+config BR2_GOPROXY_LIST

Config.in config BR2_PRIMARY_SITE_ONLY · line 271

Quoted 10 lines
Config.in +9 -0
+       string "GOPROXY list"
+       default "https://proxy.golang.org,direct"
+       depends on BR2_PACKAGE_HOST_GO_TARGET_ARCH_SUPPORTS
+       help
+         List of module proxy URLs. The go command will attempt to
+         download modules from each server in sequence. The keyword
+         direct instructs the go command to download modules from
+         version control repositories where they’re developed instead
+         of using a proxy.
 

Why do we put this here as opposed to

BR2_PACKAGE_GO_GOPROXY

I'm not against it, but it's a question that comes to mind.

Also, why GOPROXY_LIST instead of just GOPROXY?

Otherwise looks good.

Best regards,
Christian Stewart

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#3 lore raw
Quoted 5 lines · Christian Stewart

Hi James,

Quoted 1 line · James Hilliard
Quoted 8 lines
Quoted 3 lines

Some packages like the upcoming netbird package don't work correctly with GOPROXY=direct which is not the default setting for the go toolchain.

https://github.com/netbirdio/netbird/pull/2789

While it is a good idea to add this option, I don't think mentioning netbird is necessary since the intent of this option is not to make packages that won't work with GOPROXY direct work. It's just for the performance improvement.

IMO making the build work when direct doesn't is one of the use cases, mostly due to the potential for direct downloads breaking randomly.

As GOPROXY="https://proxy.golang.org,direct" is the golang default it's what one should expect upstream projects to be testing with and the most important configuration to have functional. Building with only direct is IMO a non-standard configuration that while nice to have working shouldn't block updating packages by itself.

Quoted 2 lines

When merging packages I'd still expect us to test it with GOPROXY direct as well.

Possibly, however as GOPROXY=direct is a non-default configuration I think it's less important for buildroot itself.

Quoted 33 lines
Quoted 19 lines

Lets make the GOPROXY setting configurable and use the default toolchain setting which is most likely to be what packages end up typically being tested against.

---
 Config.in             | 11 +++++++++++
 package/pkg-golang.mk |  2 +-
 2 files changed, 12 insertions(+), 1 deletion(-)
Config.in +0 -0
index df43db7eff..ad6ac38656 100644
@@ -258,6 +258,17 @@ config BR2_PRIMARY_SITE_ONLY
          the project can be built even if the upstream tarball
          locations disappear.
 

Config.in config BR2_PRIMARY_SITE_ONLY · line 270

Quoted 10 lines
Config.in +10 -0
+config BR2_GOPROXY_LIST
+       string "GOPROXY list"
+       default "https://proxy.golang.org,direct"
+       depends on BR2_PACKAGE_HOST_GO_TARGET_ARCH_SUPPORTS
+       help
+         List of module proxy URLs. The go command will attempt to
+         download modules from each server in sequence. The keyword
+         direct instructs the go command to download modules from
+         version control repositories where they’re developed instead
+         of using a proxy.

Why do we put this here as opposed to

Quoted 5 lines

BR2_PACKAGE_GO_GOPROXY

I'm not against it, but it's a question that comes to mind.

Also, why GOPROXY_LIST instead of just GOPROXY?

I figured it was a bit more descriptive since the variable is a list of goproxies essentially, doesn't matter much to me.

Quoted 5 lines

Otherwise looks good.

Best regards,
Christian Stewart

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot