meta-virtualization/recipes-containers/docker/files/0003-builder.go-avoid-using-strings.Cut-from-go-1.18.patch
Martin Jansa 36b5b74c89 docker: update to v20.10.25 + 58 commits to fix compatibility with go currently in kirkstone
* since this backport:
  https://lists.openembedded.org/g/openembedded-core/message/185082
  landed in kirkstone:
  https://git.openembedded.org/openembedded-core/commit/?h=kirkstone&id=5dc74138649ab7a2c0158a43225dc7a8fd732355

  docker cannot access network and fails with:
  "http: invalid Host header"

  update to latest commit in 20.10 branch, because latest tag v20.10.25
  have the fix yet:
  https://github.com/moby/moby/compare/v20.10.21...v20.10.25

  so we need couple more commits from upstream:
  https://github.com/moby/moby/compare/v20.10.25...791d8ab87747169b4cbfcdf2fd57c81952bae6d5

  Adjust the go version revert which was here since the upgrade to v20.10.21:
  https://git.yoctoproject.org/meta-virtualization/commit/?h=kirkstone&id=927537108bcf2b98859512ce3eae59a73439994d

  and add another revert for the go upgrades from upstream for this older
  patch to apply.

* update cli to latest in 20.10 branch as well:
  baeda1f82a..911449ca24

Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
2023-08-15 18:45:49 +00:00

33 lines
1.2 KiB
Diff

From 6867fc1f6bd01596c2d3dc7bc07e26fa98965185 Mon Sep 17 00:00:00 2001
From: Martin Jansa <Martin.Jansa@gmail.com>
Date: Mon, 14 Aug 2023 16:41:42 +0200
Subject: [PATCH] builder.go: avoid using strings.Cut from go-1.18
* we're still using go-1.17
Upstream-Status: Inapropriate
---
builder/builder-next/builder.go | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/builder/builder-next/builder.go b/builder/builder-next/builder.go
index ee6b9f0fb1..a9bda8c370 100644
--- a/builder/builder-next/builder.go
+++ b/builder/builder-next/builder.go
@@ -555,10 +555,13 @@ func toBuildkitExtraHosts(inp []string, hostGatewayIP net.IP) (string, error) {
}
hosts := make([]string, 0, len(inp))
for _, h := range inp {
- host, ip, ok := strings.Cut(h, ":")
- if !ok || host == "" || ip == "" {
+ parts := strings.Split(h, ":")
+
+ if len(parts) != 2 || parts[0] == "" || parts[1] == "" {
return "", errors.Errorf("invalid host %s", h)
}
+ host := parts[0]
+ ip := parts[1]
// If the IP Address is a "host-gateway", replace this value with the
// IP address stored in the daemon level HostGatewayIP config variable.
if ip == opts.HostGatewayName {