enable podman-remote on windows

build a podman-remote binary for windows that allows users to use the
remote client on windows and interact with podman on linux system.

Signed-off-by: baude <bbaude@redhat.com>
This commit is contained in:
baude
2019-04-22 16:01:31 -05:00
parent b5af10ce5a
commit 0b6bb6a3d3
38 changed files with 3020 additions and 2820 deletions

View File

@@ -26,7 +26,7 @@ const (
Package = "buildah"
// Version for the Package. Bump version in contrib/rpm/buildah.spec
// too.
Version = "1.8.0"
Version = "1.9.0-dev"
// The value we use to identify what type of information, currently a
// serialized Builder structure, we are using as per-container state.
// This should only be changed when we make incompatible changes to

View File

@@ -24,6 +24,22 @@ func init() {
reexec.Register(symlinkModifiedTime, resolveSymlinkTimeModified)
}
// resolveSymlink uses a child subprocess to resolve any symlinks in filename
// in the context of rootdir.
func resolveSymlink(rootdir, filename string) (string, error) {
// The child process expects a chroot and one path that
// will be consulted relative to the chroot directory and evaluated
// for any symbolic links present.
cmd := reexec.Command(symlinkChrootedCommand, rootdir, filename)
output, err := cmd.CombinedOutput()
if err != nil {
return "", errors.Wrapf(err, string(output))
}
// Hand back the resolved symlink, will be filename if a symlink is not found
return string(output), nil
}
// main() for resolveSymlink()'s subprocess.
func resolveChrootedSymlinks() {
status := 0
@@ -55,22 +71,6 @@ func resolveChrootedSymlinks() {
os.Exit(status)
}
// resolveSymlink uses a child subprocess to resolve any symlinks in filename
// in the context of rootdir.
func resolveSymlink(rootdir, filename string) (string, error) {
// The child process expects a chroot and one path that
// will be consulted relative to the chroot directory and evaluated
// for any symbolic links present.
cmd := reexec.Command(symlinkChrootedCommand, rootdir, filename)
output, err := cmd.CombinedOutput()
if err != nil {
return "", errors.Wrapf(err, string(output))
}
// Hand back the resolved symlink, will be filename if a symlink is not found
return string(output), nil
}
// main() for grandparent subprocess. Its main job is to shuttle stdio back
// and forth, managing a pseudo-terminal if we want one, for our child, the
// parent subprocess.

View File

@@ -0,0 +1,13 @@
// +build !linux
package imagebuildah
import "github.com/pkg/errors"
func resolveSymlink(rootdir, filename string) (string, error) {
return "", errors.New("function not supported on non-linux systems")
}
func resolveModifiedTime(rootdir, filename, historyTime string) (bool, error) {
return false, errors.New("function not supported on non-linux systems")
}

View File

@@ -22,7 +22,6 @@ import (
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
"golang.org/x/crypto/ssh/terminal"
"golang.org/x/sys/unix"
)
const (
@@ -39,14 +38,9 @@ func CommonBuildOptions(c *cobra.Command) (*buildah.CommonBuildOptions, error) {
memorySwap int64
err error
)
rlim := unix.Rlimit{Cur: 1048576, Max: 1048576}
defaultLimits := []string{}
if err := unix.Setrlimit(unix.RLIMIT_NOFILE, &rlim); err == nil {
defaultLimits = append(defaultLimits, fmt.Sprintf("nofile=%d:%d", rlim.Cur, rlim.Max))
}
if err := unix.Setrlimit(unix.RLIMIT_NPROC, &rlim); err == nil {
defaultLimits = append(defaultLimits, fmt.Sprintf("nproc=%d:%d", rlim.Cur, rlim.Max))
}
defaultLimits := getDefaultProcessLimits()
memVal, _ := c.Flags().GetString("memory")
if memVal != "" {
memoryLimit, err = units.RAMInBytes(memVal)

View File

@@ -0,0 +1,20 @@
// +build linux darwin
package parse
import (
"fmt"
"golang.org/x/sys/unix"
)
func getDefaultProcessLimits() []string {
rlim := unix.Rlimit{Cur: 1048576, Max: 1048576}
defaultLimits := []string{}
if err := unix.Setrlimit(unix.RLIMIT_NOFILE, &rlim); err == nil {
defaultLimits = append(defaultLimits, fmt.Sprintf("nofile=%d:%d", rlim.Cur, rlim.Max))
}
if err := unix.Setrlimit(unix.RLIMIT_NPROC, &rlim); err == nil {
defaultLimits = append(defaultLimits, fmt.Sprintf("nproc=%d:%d", rlim.Cur, rlim.Max))
}
return defaultLimits
}

View File

@@ -0,0 +1,7 @@
// +build !linux,!darwin
package parse
func getDefaultProcessLimits() []string {
return []string{}
}

View File

File diff suppressed because it is too large Load Diff

View File

File diff suppressed because it is too large Load Diff

View File

@@ -1,11 +0,0 @@
// +build !linux
package buildah
import (
"github.com/pkg/errors"
)
func setChildProcess() error {
return errors.New("function not supported on non-linux systems")
}

View File

@@ -0,0 +1,20 @@
// +build !linux
package buildah
import (
"github.com/pkg/errors"
)
func setChildProcess() error {
return errors.New("function not supported on non-linux systems")
}
func runUsingRuntimeMain() {}
func (b *Builder) Run(command []string, options RunOptions) error {
return errors.New("function not supported on non-linux systems")
}
func DefaultNamespaceOptions() (NamespaceOptions, error) {
return NamespaceOptions{}, errors.New("function not supported on non-linux systems")
}