Windows: Updates Windows Vendoring
Updates windows dependent libraries for vendoing.
This commit is contained in:
36
vendor/github.com/Microsoft/hcsshim/cmd/wclayer/create.go
generated
vendored
Normal file
36
vendor/github.com/Microsoft/hcsshim/cmd/wclayer/create.go
generated
vendored
Normal file
@ -0,0 +1,36 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"path/filepath"
|
||||
|
||||
"github.com/Microsoft/hcsshim"
|
||||
"github.com/Microsoft/hcsshim/internal/appargs"
|
||||
"github.com/urfave/cli"
|
||||
)
|
||||
|
||||
var createCommand = cli.Command{
|
||||
Name: "create",
|
||||
Usage: "creates a new writable container layer",
|
||||
Flags: []cli.Flag{
|
||||
cli.StringSliceFlag{
|
||||
Name: "layer, l",
|
||||
Usage: "paths to the read-only parent layers",
|
||||
},
|
||||
},
|
||||
ArgsUsage: "<layer path>",
|
||||
Before: appargs.Validate(appargs.NonEmptyString),
|
||||
Action: func(context *cli.Context) error {
|
||||
path, err := filepath.Abs(context.Args().First())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
layers, err := normalizeLayers(context.StringSlice("layer"), true)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
di := driverInfo
|
||||
return hcsshim.CreateScratchLayer(di, path, layers[len(layers)-1], layers)
|
||||
},
|
||||
}
|
66
vendor/github.com/Microsoft/hcsshim/cmd/wclayer/export.go
generated
vendored
Normal file
66
vendor/github.com/Microsoft/hcsshim/cmd/wclayer/export.go
generated
vendored
Normal file
@ -0,0 +1,66 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"compress/gzip"
|
||||
"io"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
winio "github.com/Microsoft/go-winio"
|
||||
"github.com/Microsoft/hcsshim/internal/appargs"
|
||||
"github.com/Microsoft/hcsshim/internal/ociwclayer"
|
||||
"github.com/urfave/cli"
|
||||
)
|
||||
|
||||
var exportCommand = cli.Command{
|
||||
Name: "export",
|
||||
Usage: "exports a layer to a tar file",
|
||||
Flags: []cli.Flag{
|
||||
cli.StringSliceFlag{
|
||||
Name: "layer, l",
|
||||
Usage: "paths to the read-only parent layers",
|
||||
},
|
||||
cli.StringFlag{
|
||||
Name: "output, o",
|
||||
Usage: "output layer tar (defaults to stdout)",
|
||||
},
|
||||
cli.BoolFlag{
|
||||
Name: "gzip, z",
|
||||
Usage: "compress output with gzip compression",
|
||||
},
|
||||
},
|
||||
ArgsUsage: "<layer path>",
|
||||
Before: appargs.Validate(appargs.NonEmptyString),
|
||||
Action: func(context *cli.Context) (err error) {
|
||||
path, err := filepath.Abs(context.Args().First())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
layers, err := normalizeLayers(context.StringSlice("layer"), true)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = winio.EnableProcessPrivileges([]string{winio.SeBackupPrivilege})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
fp := context.String("output")
|
||||
f := os.Stdout
|
||||
if fp != "" {
|
||||
f, err = os.Create(fp)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer f.Close()
|
||||
}
|
||||
w := io.Writer(f)
|
||||
if context.Bool("gzip") {
|
||||
w = gzip.NewWriter(w)
|
||||
}
|
||||
|
||||
return ociwclayer.ExportLayer(w, path, layers)
|
||||
},
|
||||
}
|
74
vendor/github.com/Microsoft/hcsshim/cmd/wclayer/import.go
generated
vendored
Normal file
74
vendor/github.com/Microsoft/hcsshim/cmd/wclayer/import.go
generated
vendored
Normal file
@ -0,0 +1,74 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"compress/gzip"
|
||||
"io"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/Microsoft/go-winio"
|
||||
"github.com/Microsoft/hcsshim/internal/appargs"
|
||||
"github.com/Microsoft/hcsshim/internal/ociwclayer"
|
||||
"github.com/urfave/cli"
|
||||
)
|
||||
|
||||
var importCommand = cli.Command{
|
||||
Name: "import",
|
||||
Usage: "imports a layer from a tar file",
|
||||
Flags: []cli.Flag{
|
||||
cli.StringSliceFlag{
|
||||
Name: "layer, l",
|
||||
Usage: "paths to the read-only parent layers",
|
||||
},
|
||||
cli.StringFlag{
|
||||
Name: "input, i",
|
||||
Usage: "input layer tar (defaults to stdin)",
|
||||
},
|
||||
},
|
||||
ArgsUsage: "<layer path>",
|
||||
Before: appargs.Validate(appargs.NonEmptyString),
|
||||
Action: func(context *cli.Context) (err error) {
|
||||
path, err := filepath.Abs(context.Args().First())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
layers, err := normalizeLayers(context.StringSlice("layer"), false)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
fp := context.String("input")
|
||||
f := os.Stdin
|
||||
if fp != "" {
|
||||
f, err = os.Open(fp)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer f.Close()
|
||||
}
|
||||
r, err := addDecompressor(f)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = winio.EnableProcessPrivileges([]string{winio.SeBackupPrivilege, winio.SeRestorePrivilege})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
_, err = ociwclayer.ImportLayer(r, path, layers)
|
||||
return err
|
||||
},
|
||||
}
|
||||
|
||||
func addDecompressor(r io.Reader) (io.Reader, error) {
|
||||
b := bufio.NewReader(r)
|
||||
hdr, err := b.Peek(3)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if hdr[0] == 0x1f && hdr[1] == 0x8b && hdr[2] == 8 {
|
||||
return gzip.NewReader(b)
|
||||
}
|
||||
return b, nil
|
||||
}
|
88
vendor/github.com/Microsoft/hcsshim/cmd/wclayer/mount.go
generated
vendored
Normal file
88
vendor/github.com/Microsoft/hcsshim/cmd/wclayer/mount.go
generated
vendored
Normal file
@ -0,0 +1,88 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/Microsoft/hcsshim"
|
||||
"github.com/Microsoft/hcsshim/internal/appargs"
|
||||
"github.com/urfave/cli"
|
||||
)
|
||||
|
||||
var mountCommand = cli.Command{
|
||||
Name: "mount",
|
||||
Usage: "mounts a scratch",
|
||||
ArgsUsage: "<scratch path>",
|
||||
Flags: []cli.Flag{
|
||||
cli.StringSliceFlag{
|
||||
Name: "layer, l",
|
||||
Usage: "paths to the parent layers for this layer",
|
||||
},
|
||||
},
|
||||
Action: func(context *cli.Context) (err error) {
|
||||
if context.NArg() != 1 {
|
||||
return errors.New("invalid usage")
|
||||
}
|
||||
path, err := filepath.Abs(context.Args().First())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
layers, err := normalizeLayers(context.StringSlice("layer"), true)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = hcsshim.ActivateLayer(driverInfo, path)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer func() {
|
||||
if err != nil {
|
||||
hcsshim.DeactivateLayer(driverInfo, path)
|
||||
}
|
||||
}()
|
||||
|
||||
err = hcsshim.PrepareLayer(driverInfo, path, layers)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer func() {
|
||||
if err != nil {
|
||||
hcsshim.UnprepareLayer(driverInfo, path)
|
||||
}
|
||||
}()
|
||||
|
||||
mountPath, err := hcsshim.GetLayerMountPath(driverInfo, path)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
_, err = fmt.Println(mountPath)
|
||||
return err
|
||||
},
|
||||
}
|
||||
|
||||
var unmountCommand = cli.Command{
|
||||
Name: "unmount",
|
||||
Usage: "unmounts a scratch",
|
||||
ArgsUsage: "<layer path>",
|
||||
Before: appargs.Validate(appargs.NonEmptyString),
|
||||
Action: func(context *cli.Context) (err error) {
|
||||
path, err := filepath.Abs(context.Args().First())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = hcsshim.UnprepareLayer(driverInfo, path)
|
||||
if err != nil {
|
||||
fmt.Fprintln(os.Stderr, err)
|
||||
}
|
||||
err = hcsshim.DeactivateLayer(driverInfo, path)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
},
|
||||
}
|
31
vendor/github.com/Microsoft/hcsshim/cmd/wclayer/remove.go
generated
vendored
Normal file
31
vendor/github.com/Microsoft/hcsshim/cmd/wclayer/remove.go
generated
vendored
Normal file
@ -0,0 +1,31 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"path/filepath"
|
||||
|
||||
winio "github.com/Microsoft/go-winio"
|
||||
"github.com/Microsoft/hcsshim"
|
||||
"github.com/Microsoft/hcsshim/internal/appargs"
|
||||
|
||||
"github.com/urfave/cli"
|
||||
)
|
||||
|
||||
var removeCommand = cli.Command{
|
||||
Name: "remove",
|
||||
Usage: "permanently removes a layer directory in its entirety",
|
||||
ArgsUsage: "<layer path>",
|
||||
Before: appargs.Validate(appargs.NonEmptyString),
|
||||
Action: func(context *cli.Context) (err error) {
|
||||
path, err := filepath.Abs(context.Args().First())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = winio.EnableProcessPrivileges([]string{winio.SeBackupPrivilege, winio.SeRestorePrivilege})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return hcsshim.DestroyLayer(driverInfo, path)
|
||||
},
|
||||
}
|
BIN
vendor/github.com/Microsoft/hcsshim/cmd/wclayer/resource_windows_386.syso
generated
vendored
Normal file
BIN
vendor/github.com/Microsoft/hcsshim/cmd/wclayer/resource_windows_386.syso
generated
vendored
Normal file
Binary file not shown.
BIN
vendor/github.com/Microsoft/hcsshim/cmd/wclayer/resource_windows_amd64.syso
generated
vendored
Normal file
BIN
vendor/github.com/Microsoft/hcsshim/cmd/wclayer/resource_windows_amd64.syso
generated
vendored
Normal file
Binary file not shown.
43
vendor/github.com/Microsoft/hcsshim/cmd/wclayer/versioninfo.json
generated
vendored
Normal file
43
vendor/github.com/Microsoft/hcsshim/cmd/wclayer/versioninfo.json
generated
vendored
Normal file
@ -0,0 +1,43 @@
|
||||
{
|
||||
"FixedFileInfo": {
|
||||
"FileVersion": {
|
||||
"Major": 1,
|
||||
"Minor": 0,
|
||||
"Patch": 0,
|
||||
"Build": 0
|
||||
},
|
||||
"ProductVersion": {
|
||||
"Major": 1,
|
||||
"Minor": 0,
|
||||
"Patch": 0,
|
||||
"Build": 0
|
||||
},
|
||||
"FileFlagsMask": "3f",
|
||||
"FileFlags ": "00",
|
||||
"FileOS": "040004",
|
||||
"FileType": "01",
|
||||
"FileSubType": "00"
|
||||
},
|
||||
"StringFileInfo": {
|
||||
"Comments": "",
|
||||
"CompanyName": "",
|
||||
"FileDescription": "",
|
||||
"FileVersion": "",
|
||||
"InternalName": "",
|
||||
"LegalCopyright": "",
|
||||
"LegalTrademarks": "",
|
||||
"OriginalFilename": "",
|
||||
"PrivateBuild": "",
|
||||
"ProductName": "",
|
||||
"ProductVersion": "v1.0.0.0",
|
||||
"SpecialBuild": ""
|
||||
},
|
||||
"VarFileInfo": {
|
||||
"Translation": {
|
||||
"LangID": "0409",
|
||||
"CharsetID": "04B0"
|
||||
}
|
||||
},
|
||||
"IconPath": "",
|
||||
"ManifestPath": "wclayer.exe.manifest"
|
||||
}
|
10
vendor/github.com/Microsoft/hcsshim/cmd/wclayer/wclayer.exe.manifest
generated
vendored
Normal file
10
vendor/github.com/Microsoft/hcsshim/cmd/wclayer/wclayer.exe.manifest
generated
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
|
||||
<description>wclayer</description>
|
||||
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
|
||||
<application>
|
||||
<!-- Windows 10 -->
|
||||
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
|
||||
</application>
|
||||
</compatibility>
|
||||
</assembly>
|
60
vendor/github.com/Microsoft/hcsshim/cmd/wclayer/wclayer.go
generated
vendored
Normal file
60
vendor/github.com/Microsoft/hcsshim/cmd/wclayer/wclayer.go
generated
vendored
Normal file
@ -0,0 +1,60 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/Microsoft/hcsshim"
|
||||
"github.com/urfave/cli"
|
||||
)
|
||||
|
||||
// Add a manifest to get proper Windows version detection.
|
||||
//
|
||||
// goversioninfo can be installed with "go get github.com/josephspurrier/goversioninfo/cmd/goversioninfo"
|
||||
|
||||
//go:generate goversioninfo -platform-specific
|
||||
|
||||
var usage = `Windows Container layer utility
|
||||
|
||||
wclayer is a command line tool for manipulating Windows Container
|
||||
storage layers. It can import and export layers from and to OCI format
|
||||
layer tar files, create new writable layers, and mount and unmount
|
||||
container images.`
|
||||
|
||||
var driverInfo = hcsshim.DriverInfo{}
|
||||
|
||||
func main() {
|
||||
app := cli.NewApp()
|
||||
app.Name = "wclayer"
|
||||
app.Commands = []cli.Command{
|
||||
createCommand,
|
||||
exportCommand,
|
||||
importCommand,
|
||||
mountCommand,
|
||||
removeCommand,
|
||||
unmountCommand,
|
||||
}
|
||||
app.Usage = usage
|
||||
|
||||
if err := app.Run(os.Args); err != nil {
|
||||
fmt.Fprintln(os.Stderr, err)
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
|
||||
func normalizeLayers(il []string, needOne bool) ([]string, error) {
|
||||
if needOne && len(il) == 0 {
|
||||
return nil, errors.New("at least one read-only layer must be specified")
|
||||
}
|
||||
ol := make([]string, len(il))
|
||||
for i := range il {
|
||||
var err error
|
||||
ol[i], err = filepath.Abs(il[i])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
return ol, nil
|
||||
}
|
Reference in New Issue
Block a user