mirror of
https://github.com/containers/podman.git
synced 2025-09-29 01:35:06 +08:00
pkg/specgen: do not depend on libimage for remote
This is the last place were the remote client pulls in libimage, with this the podman-remote binary size decreases from 44788 KB to 39424 KB (not stripped). This change simply fixes that by gating it behind the remote build tag. Of course it would be a bit cleaner to never leak libimage into pkg/specgen and only have it in pkg/specgen/generate. But this would be much more involved with big chnages so I went with the easy and quick way instead. [NO NEW TESTS NEEDED] Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This commit is contained in:
@ -6,7 +6,6 @@ import (
|
||||
"strings"
|
||||
"syscall"
|
||||
|
||||
"github.com/containers/common/libimage"
|
||||
nettypes "github.com/containers/common/libnetwork/types"
|
||||
"github.com/containers/image/v5/manifest"
|
||||
"github.com/containers/podman/v4/libpod/define"
|
||||
@ -570,20 +569,7 @@ type SpecGenerator struct {
|
||||
ContainerResourceConfig
|
||||
ContainerHealthCheckConfig
|
||||
|
||||
image *libimage.Image `json:"-"`
|
||||
resolvedImageName string `json:"-"`
|
||||
}
|
||||
|
||||
// SetImage sets the associated for the generator.
|
||||
func (s *SpecGenerator) SetImage(image *libimage.Image, resolvedImageName string) {
|
||||
s.image = image
|
||||
s.resolvedImageName = resolvedImageName
|
||||
}
|
||||
|
||||
// Image returns the associated image for the generator.
|
||||
// May be nil if no image has been set yet.
|
||||
func (s *SpecGenerator) GetImage() (*libimage.Image, string) {
|
||||
return s.image, s.resolvedImageName
|
||||
cacheLibImage
|
||||
}
|
||||
|
||||
func (s *SpecGenerator) IsInitContainer() bool {
|
||||
|
23
pkg/specgen/specgen_local.go
Normal file
23
pkg/specgen/specgen_local.go
Normal file
@ -0,0 +1,23 @@
|
||||
//go:build !remote
|
||||
// +build !remote
|
||||
|
||||
package specgen
|
||||
|
||||
import "github.com/containers/common/libimage"
|
||||
|
||||
type cacheLibImage struct {
|
||||
image *libimage.Image `json:"-"`
|
||||
resolvedImageName string `json:"-"`
|
||||
}
|
||||
|
||||
// SetImage sets the associated for the generator.
|
||||
func (s *SpecGenerator) SetImage(image *libimage.Image, resolvedImageName string) {
|
||||
s.image = image
|
||||
s.resolvedImageName = resolvedImageName
|
||||
}
|
||||
|
||||
// Image returns the associated image for the generator.
|
||||
// May be nil if no image has been set yet.
|
||||
func (s *SpecGenerator) GetImage() (*libimage.Image, string) {
|
||||
return s.image, s.resolvedImageName
|
||||
}
|
8
pkg/specgen/specgen_remote.go
Normal file
8
pkg/specgen/specgen_remote.go
Normal file
@ -0,0 +1,8 @@
|
||||
//go:build remote
|
||||
// +build remote
|
||||
|
||||
package specgen
|
||||
|
||||
// Empty stub we do not use any libimage on the remote client,
|
||||
// this drastically decreases binary size for the remote client.
|
||||
type cacheLibImage struct{}
|
Reference in New Issue
Block a user