summaryrefslogtreecommitdiff
path: root/cmd/podman/common
diff options
context:
space:
mode:
authorPaul Holzinger <paul.holzinger@web.de>2021-03-15 12:55:06 +0100
committerPaul Holzinger <paul.holzinger@web.de>2021-03-15 14:02:04 +0100
commit57e8c66322849ff60e6126616c0c9883a80fb139 (patch)
treedc91b324d82675d66c6b1f37d6ca97c82597ae30 /cmd/podman/common
parent762148deb6be6925d17bd12f219f7385e1402439 (diff)
downloadpodman-57e8c66322849ff60e6126616c0c9883a80fb139.tar.gz
podman-57e8c66322849ff60e6126616c0c9883a80fb139.tar.bz2
podman-57e8c66322849ff60e6126616c0c9883a80fb139.zip
Do not leak libpod package into the remote client
Some packages used by the remote client imported the libpod package. This is not wanted because it adds unnecessary bloat to the client and also causes problems with platform specific code(linux only), see #9710. The solution is to move the used functions/variables into extra packages which do not import libpod. This change shrinks the remote client size more than 6MB compared to the current master. [NO TESTS NEEDED] I have no idea how to test this properly but with #9710 the cross compile should fail. Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
Diffstat (limited to 'cmd/podman/common')
-rw-r--r--cmd/podman/common/completion.go9
-rw-r--r--cmd/podman/common/specgen.go6
2 files changed, 7 insertions, 8 deletions
diff --git a/cmd/podman/common/completion.go b/cmd/podman/common/completion.go
index 7629a8145..bc106263c 100644
--- a/cmd/podman/common/completion.go
+++ b/cmd/podman/common/completion.go
@@ -8,12 +8,11 @@ import (
"github.com/containers/common/pkg/config"
"github.com/containers/podman/v3/cmd/podman/registry"
- "github.com/containers/podman/v3/libpod"
"github.com/containers/podman/v3/libpod/define"
"github.com/containers/podman/v3/pkg/domain/entities"
"github.com/containers/podman/v3/pkg/registries"
"github.com/containers/podman/v3/pkg/rootless"
- systemdGen "github.com/containers/podman/v3/pkg/systemd/generate"
+ systemdDefine "github.com/containers/podman/v3/pkg/systemd/define"
"github.com/containers/podman/v3/pkg/util"
"github.com/spf13/cobra"
)
@@ -732,8 +731,8 @@ func AutocompletePullOption(cmd *cobra.Command, args []string, toComplete string
// AutocompleteRestartOption - Autocomplete restart options for create and run command.
// -> "always", "no", "on-failure", "unless-stopped"
func AutocompleteRestartOption(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
- restartOptions := []string{libpod.RestartPolicyAlways, libpod.RestartPolicyNo,
- libpod.RestartPolicyOnFailure, libpod.RestartPolicyUnlessStopped}
+ restartOptions := []string{define.RestartPolicyAlways, define.RestartPolicyNo,
+ define.RestartPolicyOnFailure, define.RestartPolicyUnlessStopped}
return restartOptions, cobra.ShellCompDirectiveNoFileComp
}
@@ -908,7 +907,7 @@ func AutocompleteEventFilter(cmd *cobra.Command, args []string, toComplete strin
// AutocompleteSystemdRestartOptions - Autocomplete systemd restart options.
// -> "no", "on-success", "on-failure", "on-abnormal", "on-watchdog", "on-abort", "always"
func AutocompleteSystemdRestartOptions(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
- return systemdGen.RestartPolicies, cobra.ShellCompDirectiveNoFileComp
+ return systemdDefine.RestartPolicies, cobra.ShellCompDirectiveNoFileComp
}
// AutocompleteTrustType - Autocomplete trust type options.
diff --git a/cmd/podman/common/specgen.go b/cmd/podman/common/specgen.go
index 2fafbfac1..d1b67d963 100644
--- a/cmd/podman/common/specgen.go
+++ b/cmd/podman/common/specgen.go
@@ -14,7 +14,7 @@ import (
envLib "github.com/containers/podman/v3/pkg/env"
ns "github.com/containers/podman/v3/pkg/namespaces"
"github.com/containers/podman/v3/pkg/specgen"
- systemdGen "github.com/containers/podman/v3/pkg/systemd/generate"
+ systemdDefine "github.com/containers/podman/v3/pkg/systemd/define"
"github.com/containers/podman/v3/pkg/util"
"github.com/docker/go-units"
"github.com/opencontainers/runtime-spec/specs-go"
@@ -342,8 +342,8 @@ func FillOutSpecGen(s *specgen.SpecGenerator, c *ContainerCLIOpts, args []string
return errors.Wrapf(err, "unable to process labels")
}
- if systemdUnit, exists := osEnv[systemdGen.EnvVariable]; exists {
- labels[systemdGen.EnvVariable] = systemdUnit
+ if systemdUnit, exists := osEnv[systemdDefine.EnvVariable]; exists {
+ labels[systemdDefine.EnvVariable] = systemdUnit
}
s.Labels = labels