docker-distribution: fix build for 386

The build error could be reproduced by using qemux86 as the MACHINE
or using qemux86-64 as the MACHINE and then running 'bitbake
lib32-docker-distribution'.

The root cause is the wrong file (s3_64bit.go) is imported. Fix the
tag matching to ensure s3_32bit.go is imported in case of 386.

Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
This commit is contained in:
Chen Qi 2025-05-29 11:51:10 +08:00 committed by Bruce Ashfield
parent 51e50ba710
commit 962471bc70
2 changed files with 46 additions and 0 deletions

View File

@ -7,6 +7,7 @@ SRCREV_distribution = "da404778edd3faa665e48ca3bb791b6144f3355e"
SRC_URI = "git://github.com/docker/distribution.git;branch=main;name=distribution;destsuffix=git/src/github.com/distribution/distribution/v3;protocol=https \
file://docker-registry.service \
file://0001-build-use-to-use-cross-go-compiler.patch \
file://0001-s3-aws-fix-build-for-386.patch \
"
PACKAGES =+ "docker-registry"

View File

@ -0,0 +1,45 @@
From 6970080b10a53d858dd444a643a2bd911de12940 Mon Sep 17 00:00:00 2001
From: Chen Qi <Qi.Chen@windriver.com>
Date: Thu, 29 May 2025 11:28:38 +0800
Subject: [PATCH] s3-aws: fix build for 386
When building for 386, we got the following build error:
registry/storage/driver/s3-aws/s3.go:312:99: cannot use
maxChunkSize (untyped int constant 5368709120) as int value
in argument to getParameterAsInteger (overflows)
This is because the s3_64bit.go is used. Adjust the build tag matching
in s3_32bit.go and s3_64bit.go to fix this issue.
Upstream-Status: Submitted [https://github.com/distribution/distribution/pull/4642]
Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
---
registry/storage/driver/s3-aws/s3_32bit.go | 2 +-
registry/storage/driver/s3-aws/s3_64bit.go | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/registry/storage/driver/s3-aws/s3_32bit.go b/registry/storage/driver/s3-aws/s3_32bit.go
index 218e3eab..84161fcb 100644
--- a/registry/storage/driver/s3-aws/s3_32bit.go
+++ b/registry/storage/driver/s3-aws/s3_32bit.go
@@ -1,4 +1,4 @@
-//go:build arm
+//go:build arm || 386
package s3
diff --git a/registry/storage/driver/s3-aws/s3_64bit.go b/registry/storage/driver/s3-aws/s3_64bit.go
index 55254e49..2ed1f92f 100644
--- a/registry/storage/driver/s3-aws/s3_64bit.go
+++ b/registry/storage/driver/s3-aws/s3_64bit.go
@@ -1,4 +1,4 @@
-//go:build !arm
+//go:build !arm && !386
package s3
--
2.34.1