1
0
mirror of https://github.com/containers/buildah.git synced 2026-02-05 09:45:38 +01:00

Fix a build break on FreeBSD

The build breaks trying to build libcontainer/userns which no longer
builds on FreeBSD. Fortunately we only need this for
userns.RunningInUserNS so this change moves that call to a linux-only
file and adds a stub for FreeBSD.

[NO NEW TESTS NEEDED]

Signed-off-by: Doug Rabson <dfr@rabson.org>
This commit is contained in:
Doug Rabson
2024-01-25 16:30:15 +00:00
parent a65305a289
commit 32b8ceeb6f
3 changed files with 19 additions and 3 deletions

5
add.go
View File

@@ -23,7 +23,6 @@ import (
"github.com/containers/storage/pkg/idtools"
"github.com/hashicorp/go-multierror"
digest "github.com/opencontainers/go-digest"
"github.com/opencontainers/runc/libcontainer/userns"
"github.com/opencontainers/runtime-spec/specs-go"
"github.com/sirupsen/logrus"
)
@@ -438,7 +437,7 @@ func (b *Builder) Add(destination string, extract bool, options AddAndCopyOption
ChmodDirs: nil,
ChownFiles: nil,
ChmodFiles: nil,
IgnoreDevices: userns.RunningInUserNS(),
IgnoreDevices: runningInUserNS(),
}
putErr = copier.Put(extractDirectory, extractDirectory, putOptions, io.TeeReader(pipeReader, hasher))
}
@@ -579,7 +578,7 @@ func (b *Builder) Add(destination string, extract bool, options AddAndCopyOption
ChmodDirs: nil,
ChownFiles: nil,
ChmodFiles: nil,
IgnoreDevices: userns.RunningInUserNS(),
IgnoreDevices: runningInUserNS(),
}
putErr = copier.Put(extractDirectory, extractDirectory, putOptions, io.TeeReader(pipeReader, hasher))
}

8
add_common.go Normal file
View File

@@ -0,0 +1,8 @@
//go:build !linux
// +build !linux
package buildah
func runningInUserNS() bool {
return false
}

9
add_linux.go Normal file
View File

@@ -0,0 +1,9 @@
package buildah
import (
"github.com/opencontainers/runc/libcontainer/userns"
)
func runningInUserNS() bool {
return userns.RunningInUserNS()
}