summaryrefslogtreecommitdiff
path: root/pkg
diff options
context:
space:
mode:
Diffstat (limited to 'pkg')
-rw-r--r--pkg/api/handlers/compat/events.go6
-rw-r--r--pkg/api/handlers/compat/images_build.go10
-rw-r--r--pkg/bindings/images/build.go7
-rw-r--r--pkg/domain/infra/abi/terminal/sigproxy_commn.go (renamed from pkg/domain/infra/abi/terminal/sigproxy_linux.go)3
-rw-r--r--pkg/domain/infra/abi/terminal/terminal_common.go (renamed from pkg/domain/infra/abi/terminal/terminal_linux.go)3
-rw-r--r--pkg/domain/infra/abi/terminal/terminal_unsupported.go4
-rw-r--r--pkg/machine/config.go2
-rw-r--r--pkg/specgenutil/specgen.go8
-rw-r--r--pkg/systemd/notifyproxy/notifyproxy_test.go2
9 files changed, 37 insertions, 8 deletions
diff --git a/pkg/api/handlers/compat/events.go b/pkg/api/handlers/compat/events.go
index 18fb35966..105404a0d 100644
--- a/pkg/api/handlers/compat/events.go
+++ b/pkg/api/handlers/compat/events.go
@@ -89,6 +89,12 @@ func GetEvents(w http.ResponseWriter, r *http.Request) {
}
e := entities.ConvertToEntitiesEvent(*evt)
+ // Some events differ between Libpod and Docker endpoints.
+ // Handle these differences for Docker-compat.
+ if !utils.IsLibpodRequest(r) && e.Type == "image" && e.Status == "remove" {
+ e.Status = "delete"
+ e.Action = "delete"
+ }
if !utils.IsLibpodRequest(r) && e.Status == "died" {
e.Status = "die"
e.Action = "die"
diff --git a/pkg/api/handlers/compat/images_build.go b/pkg/api/handlers/compat/images_build.go
index 020991cc7..7ba1029a7 100644
--- a/pkg/api/handlers/compat/images_build.go
+++ b/pkg/api/handlers/compat/images_build.go
@@ -101,6 +101,7 @@ func BuildImage(w http.ResponseWriter, r *http.Request) {
ForceRm bool `schema:"forcerm"`
From string `schema:"from"`
HTTPProxy bool `schema:"httpproxy"`
+ IDMappingOptions string `schema:"idmappingoptions"`
IdentityLabel bool `schema:"identitylabel"`
Ignore bool `schema:"ignore"`
Isolation string `schema:"isolation"`
@@ -389,6 +390,14 @@ func BuildImage(w http.ResponseWriter, r *http.Request) {
}
}
+ var idMappingOptions buildahDefine.IDMappingOptions
+ if _, found := r.URL.Query()["idmappingoptions"]; found {
+ if err := json.Unmarshal([]byte(query.IDMappingOptions), &idMappingOptions); err != nil {
+ utils.BadRequest(w, "idmappingoptions", query.IDMappingOptions, err)
+ return
+ }
+ }
+
var cacheFrom reference.Named
if _, found := r.URL.Query()["cachefrom"]; found {
cacheFrom, err = parse.RepoNameToNamedReference(query.CacheFrom)
@@ -644,6 +653,7 @@ func BuildImage(w http.ResponseWriter, r *http.Request) {
Excludes: excludes,
ForceRmIntermediateCtrs: query.ForceRm,
From: fromImage,
+ IDMappingOptions: &idMappingOptions,
IgnoreUnrecognizedInstructions: query.Ignore,
Isolation: isolation,
Jobs: &jobs,
diff --git a/pkg/bindings/images/build.go b/pkg/bindings/images/build.go
index 2615bc516..8348ac54b 100644
--- a/pkg/bindings/images/build.go
+++ b/pkg/bindings/images/build.go
@@ -88,6 +88,13 @@ func Build(ctx context.Context, containerFiles []string, options entities.BuildO
}
params.Set("additionalbuildcontexts", string(additionalBuildContextMap))
}
+ if options.IDMappingOptions != nil {
+ idmappingsOptions, err := jsoniter.Marshal(options.IDMappingOptions)
+ if err != nil {
+ return nil, err
+ }
+ params.Set("idmappingoptions", string(idmappingsOptions))
+ }
if buildArgs := options.Args; len(buildArgs) > 0 {
bArgs, err := jsoniter.MarshalToString(buildArgs)
if err != nil {
diff --git a/pkg/domain/infra/abi/terminal/sigproxy_linux.go b/pkg/domain/infra/abi/terminal/sigproxy_commn.go
index 16d345f06..3a0132ef3 100644
--- a/pkg/domain/infra/abi/terminal/sigproxy_linux.go
+++ b/pkg/domain/infra/abi/terminal/sigproxy_commn.go
@@ -1,3 +1,6 @@
+//go:build linux || freebsd
+// +build linux freebsd
+
package terminal
import (
diff --git a/pkg/domain/infra/abi/terminal/terminal_linux.go b/pkg/domain/infra/abi/terminal/terminal_common.go
index 222590871..afae2c085 100644
--- a/pkg/domain/infra/abi/terminal/terminal_linux.go
+++ b/pkg/domain/infra/abi/terminal/terminal_common.go
@@ -1,3 +1,6 @@
+//go:build linux || freebsd
+// +build linux freebsd
+
package terminal
import (
diff --git a/pkg/domain/infra/abi/terminal/terminal_unsupported.go b/pkg/domain/infra/abi/terminal/terminal_unsupported.go
index 8fe325736..21ed6c8d4 100644
--- a/pkg/domain/infra/abi/terminal/terminal_unsupported.go
+++ b/pkg/domain/infra/abi/terminal/terminal_unsupported.go
@@ -1,5 +1,5 @@
-//go:build !linux
-// +build !linux
+//go:build !linux && !freebsd
+// +build !linux,!freebsd
package terminal
diff --git a/pkg/machine/config.go b/pkg/machine/config.go
index 5162006db..54aa9e1b7 100644
--- a/pkg/machine/config.go
+++ b/pkg/machine/config.go
@@ -175,7 +175,7 @@ func (rc RemoteConnectionType) MakeSSHURL(host, path, port, userName string) url
return uri
}
-// GetCacheDir returns the dir where VM images are downladed into when pulled
+// GetCacheDir returns the dir where VM images are downloaded into when pulled
func GetCacheDir(vmType string) (string, error) {
dataDir, err := GetDataDir(vmType)
if err != nil {
diff --git a/pkg/specgenutil/specgen.go b/pkg/specgenutil/specgen.go
index 8c2c59fed..d0e09fe72 100644
--- a/pkg/specgenutil/specgen.go
+++ b/pkg/specgenutil/specgen.go
@@ -20,7 +20,6 @@ import (
"github.com/containers/podman/v4/pkg/specgen"
systemdDefine "github.com/containers/podman/v4/pkg/systemd/define"
"github.com/containers/podman/v4/pkg/util"
- "github.com/docker/docker/opts"
"github.com/docker/go-units"
"github.com/opencontainers/runtime-spec/specs-go"
)
@@ -461,11 +460,12 @@ func FillOutSpecGen(s *specgen.SpecGenerator, c *entities.ContainerCreateOptions
// SHM Size
if c.ShmSize != "" {
- var m opts.MemBytes
- if err := m.Set(c.ShmSize); err != nil {
+ val, err := units.RAMInBytes(c.ShmSize)
+
+ if err != nil {
return fmt.Errorf("unable to translate --shm-size: %w", err)
}
- val := m.Value()
+
s.ShmSize = &val
}
diff --git a/pkg/systemd/notifyproxy/notifyproxy_test.go b/pkg/systemd/notifyproxy/notifyproxy_test.go
index edad95659..ce63fc9cd 100644
--- a/pkg/systemd/notifyproxy/notifyproxy_test.go
+++ b/pkg/systemd/notifyproxy/notifyproxy_test.go
@@ -37,7 +37,7 @@ func TestWaitAndClose(t *testing.T) {
time.Sleep(250 * time.Millisecond)
select {
case err := <-ch:
- t.Fatalf("Should stil be waiting but received %v", err)
+ t.Fatalf("Should still be waiting but received %v", err)
default:
}