summaryrefslogtreecommitdiff
path: root/vendor
diff options
context:
space:
mode:
Diffstat (limited to 'vendor')
-rw-r--r--vendor/github.com/containers/buildah/buildah.go2
-rw-r--r--vendor/github.com/containers/buildah/go.mod7
-rw-r--r--vendor/github.com/containers/buildah/go.sum20
-rw-r--r--vendor/github.com/containers/buildah/image.go5
-rw-r--r--vendor/github.com/containers/buildah/imagebuildah/build.go2
-rw-r--r--vendor/github.com/containers/buildah/imagebuildah/executor.go9
-rw-r--r--vendor/github.com/containers/buildah/imagebuildah/stage_executor.go7
-rw-r--r--vendor/github.com/containers/buildah/install.md63
-rw-r--r--vendor/github.com/containers/buildah/pkg/cli/common.go3
-rw-r--r--vendor/github.com/containers/buildah/pkg/umask/umask_unsupported.go7
-rw-r--r--vendor/github.com/containers/buildah/run_linux.go28
-rw-r--r--vendor/github.com/containers/common/pkg/subscriptions/mounts.conf1
-rw-r--r--vendor/github.com/containers/common/pkg/subscriptions/subscriptions.go (renamed from vendor/github.com/containers/buildah/pkg/secrets/secrets.go)111
-rw-r--r--vendor/github.com/containers/common/pkg/umask/umask_unix.go (renamed from vendor/github.com/containers/buildah/pkg/umask/umask_unix.go)6
-rw-r--r--vendor/github.com/containers/common/pkg/umask/umask_unsupported.go7
-rw-r--r--vendor/github.com/varlink/go/LICENSE201
-rw-r--r--vendor/github.com/varlink/go/cmd/varlink-go-interface-generator/main.go445
-rw-r--r--vendor/github.com/varlink/go/varlink/bridge.go65
-rw-r--r--vendor/github.com/varlink/go/varlink/bridge_windows.go63
-rw-r--r--vendor/github.com/varlink/go/varlink/call.go104
-rw-r--r--vendor/github.com/varlink/go/varlink/connection.go291
-rw-r--r--vendor/github.com/varlink/go/varlink/doc.go63
-rw-r--r--vendor/github.com/varlink/go/varlink/idl/idl.go497
-rw-r--r--vendor/github.com/varlink/go/varlink/orgvarlinkservice.go162
-rw-r--r--vendor/github.com/varlink/go/varlink/resolver.go92
-rw-r--r--vendor/github.com/varlink/go/varlink/service.go375
-rw-r--r--vendor/github.com/varlink/go/varlink/socketactivation.go63
-rw-r--r--vendor/github.com/varlink/go/varlink/socketactivation_windows.go7
-rw-r--r--vendor/modules.txt10
29 files changed, 154 insertions, 2562 deletions
diff --git a/vendor/github.com/containers/buildah/buildah.go b/vendor/github.com/containers/buildah/buildah.go
index 9ab47e60c..10e3f17ed 100644
--- a/vendor/github.com/containers/buildah/buildah.go
+++ b/vendor/github.com/containers/buildah/buildah.go
@@ -28,7 +28,7 @@ const (
Package = "buildah"
// Version for the Package. Bump version in contrib/rpm/buildah.spec
// too.
- Version = "1.18.0"
+ Version = "1.19.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
diff --git a/vendor/github.com/containers/buildah/go.mod b/vendor/github.com/containers/buildah/go.mod
index b1f3ad67a..0d795f6b6 100644
--- a/vendor/github.com/containers/buildah/go.mod
+++ b/vendor/github.com/containers/buildah/go.mod
@@ -5,12 +5,11 @@ go 1.12
require (
github.com/containerd/containerd v1.4.1 // indirect
github.com/containernetworking/cni v0.7.2-0.20190904153231-83439463f784
- github.com/containers/common v0.26.3
- github.com/containers/image/v5 v5.8.0
+ github.com/containers/common v0.29.0
+ github.com/containers/image/v5 v5.8.1
github.com/containers/ocicrypt v1.0.3
- github.com/containers/storage v1.24.0
+ github.com/containers/storage v1.24.1
github.com/docker/distribution v2.7.1+incompatible
- github.com/docker/docker v17.12.0-ce-rc1.0.20201020191947-73dc6a680cdd+incompatible // indirect
github.com/docker/go-units v0.4.0
github.com/docker/libnetwork v0.8.0-dev.2.0.20190625141545-5a177b73e316
github.com/fsouza/go-dockerclient v1.6.6
diff --git a/vendor/github.com/containers/buildah/go.sum b/vendor/github.com/containers/buildah/go.sum
index 069328c38..e3413bc68 100644
--- a/vendor/github.com/containers/buildah/go.sum
+++ b/vendor/github.com/containers/buildah/go.sum
@@ -73,20 +73,17 @@ github.com/containerd/ttrpc v0.0.0-20190828154514-0e0f228740de/go.mod h1:PvCDdDG
github.com/containerd/typeurl v0.0.0-20180627222232-a93fcdb778cd/go.mod h1:Cm3kwCdlkCfMSHURc+r6fwoGH6/F1hH3S4sg0rLFWPc=
github.com/containernetworking/cni v0.7.2-0.20190904153231-83439463f784 h1:rqUVLD8I859xRgUx/WMC3v7QAFqbLKZbs+0kqYboRJc=
github.com/containernetworking/cni v0.7.2-0.20190904153231-83439463f784/go.mod h1:LGwApLUm2FpoOfxTDEeq8T9ipbpZ61X79hmU3w8FmsY=
-github.com/containers/common v0.26.3 h1:5Kb5fMmJ7/xMiJ+iEbPA+5pQpl/FGxCgJex4nml4Slo=
-github.com/containers/common v0.26.3/go.mod h1:hJWZIlrl5MsE2ELNRa+MPp6I1kPbXHauuj0Ym4BsLG4=
-github.com/containers/image/v5 v5.7.0 h1:fiTC8/Xbr+zEP6njGTZtPW/3UD7MC93nC9DbUoWdxkA=
-github.com/containers/image/v5 v5.7.0/go.mod h1:8aOy+YaItukxghRORkvhq5ibWttHErzDLy6egrKfKos=
-github.com/containers/image/v5 v5.8.0 h1:B3FGHi0bdGXgg698kBIGOlHCXN5n+scJr6/5354GOPU=
-github.com/containers/image/v5 v5.8.0/go.mod h1:jKxdRtyIDumVa56hdsZvV+gwx4zB50hRou6pIuCWLkg=
+github.com/containers/common v0.29.0 h1:hTMC+urdkk5bKfhL/OgCixIX5xjJgQ2l2jPG745ECFQ=
+github.com/containers/common v0.29.0/go.mod h1:yT4GTUHsKRmpaDb+mecXRnIMre7W3ZgwXqaYMywXlaA=
+github.com/containers/image/v5 v5.8.1 h1:aHW8a/Kd0dTJ7PTL/fc6y12sJqHxWgqilu+XyHfjD8Q=
+github.com/containers/image/v5 v5.8.1/go.mod h1:blOEFd/iFdeyh891ByhCVUc+xAcaI3gBegXECwz9UbQ=
github.com/containers/libtrust v0.0.0-20190913040956-14b96171aa3b h1:Q8ePgVfHDplZ7U33NwHZkrVELsZP5fYj9pM5WBZB2GE=
github.com/containers/libtrust v0.0.0-20190913040956-14b96171aa3b/go.mod h1:9rfv8iPl1ZP7aqh9YA68wnZv2NUDbXdcdPHVz0pFbPY=
github.com/containers/ocicrypt v1.0.3 h1:vYgl+RZ9Q3DPMuTfxmN+qp0X2Bj52uuY2vnt6GzVe1c=
github.com/containers/ocicrypt v1.0.3/go.mod h1:CUBa+8MRNL/VkpxYIpaMtgn1WgXGyvPQj8jcy0EVG6g=
-github.com/containers/storage v1.23.6/go.mod h1:haFs0HRowKwyzvWEx9EgI3WsL8XCSnBDb5f8P5CAxJY=
github.com/containers/storage v1.23.7/go.mod h1:cUT2zHjtx+WlVri30obWmM2gpqpi8jfPsmIzP1TVpEI=
-github.com/containers/storage v1.24.0 h1:Fo2LkF7tkMLmo38sTZ/G8wHjcn8JfUFPfyTxM4WwMfk=
-github.com/containers/storage v1.24.0/go.mod h1:A4d3BzuZK9b3oLVEsiSRhZLPIx3z7utgiPyXLK/YMhY=
+github.com/containers/storage v1.24.1 h1:1+f8fy6ly35c8SLet5jzZ8t0WJJs5+xSpfMAYw0R3kc=
+github.com/containers/storage v1.24.1/go.mod h1:0xJL06Dmd+ZYXIUdnBUPN0JnhHGgwMkLvnnAonJfWJU=
github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk=
github.com/coreos/etcd v3.3.13+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE=
github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=
@@ -232,8 +229,8 @@ github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvW
github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00=
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
github.com/klauspost/compress v1.11.1/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs=
-github.com/klauspost/compress v1.11.2 h1:MiK62aErc3gIiVEtyzKfeOHgW7atJb5g/KNX5m3c2nQ=
-github.com/klauspost/compress v1.11.2/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs=
+github.com/klauspost/compress v1.11.3 h1:dB4Bn0tN3wdCzQxnS8r06kV74qN/TAfaIS0bVE8h3jc=
+github.com/klauspost/compress v1.11.3/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs=
github.com/klauspost/pgzip v1.2.5 h1:qnWYvvKqedOF2ulHpMG72XQol4ILEJ8k2wwRl/Km8oE=
github.com/klauspost/pgzip v1.2.5/go.mod h1:Ch1tH69qFZu15pkjo5kYi6mth2Zzwzt50oCQKQE9RUs=
github.com/konsorten/go-windows-terminal-sequences v1.0.1 h1:mweAR1A6xJ3oS2pRaGiHgQ4OO8tzTaLawm8vnODuwDk=
@@ -278,7 +275,6 @@ github.com/moby/sys/mount v0.1.1 h1:mdhBytJ1SMmMat0gtzWWjFX/87K5j6E/7Q5z7rR0cZY=
github.com/moby/sys/mount v0.1.1/go.mod h1:FVQFLDRWwyBjDTBNQXDlWnSFREqOo3OKX9aqhmeoo74=
github.com/moby/sys/mountinfo v0.1.0/go.mod h1:w2t2Avltqx8vE7gX5l+QiBKxODu2TX0+Syr3h52Tw4o=
github.com/moby/sys/mountinfo v0.1.3/go.mod h1:w2t2Avltqx8vE7gX5l+QiBKxODu2TX0+Syr3h52Tw4o=
-github.com/moby/sys/mountinfo v0.3.1/go.mod h1:rEr8tzG/lsIZHBtN/JjGG+LMYx9eXgW2JI+6q0qou+A=
github.com/moby/sys/mountinfo v0.4.0 h1:1KInV3Huv18akCu58V7lzNlt+jFmqlu1EaErnEHE/VM=
github.com/moby/sys/mountinfo v0.4.0/go.mod h1:rEr8tzG/lsIZHBtN/JjGG+LMYx9eXgW2JI+6q0qou+A=
github.com/moby/term v0.0.0-20200429084858-129dac9f73f6/go.mod h1:or9wGItza1sRcM4Wd3dIv8DsFHYQuFsMHEdxUIlUxms=
diff --git a/vendor/github.com/containers/buildah/image.go b/vendor/github.com/containers/buildah/image.go
index 154bc503f..7c55020ab 100644
--- a/vendor/github.com/containers/buildah/image.go
+++ b/vendor/github.com/containers/buildah/image.go
@@ -321,10 +321,7 @@ func (i *containerImageRef) NewImageSource(ctx context.Context, sc *types.System
}
// If we're not re-exporting the data, and we're reusing layers individually, reuse
// the blobsum and diff IDs.
- if !i.exporting && !i.squash && layerID != i.layerID {
- if layer.UncompressedDigest == "" {
- return nil, errors.Errorf("unable to look up size of layer %q", layerID)
- }
+ if !i.exporting && !i.squash && layerID != i.layerID && layer.UncompressedDigest != "" {
layerBlobSum := layer.UncompressedDigest
layerBlobSize := layer.UncompressedSize
diffID := layer.UncompressedDigest
diff --git a/vendor/github.com/containers/buildah/imagebuildah/build.go b/vendor/github.com/containers/buildah/imagebuildah/build.go
index a97a403b3..1ec21e786 100644
--- a/vendor/github.com/containers/buildah/imagebuildah/build.go
+++ b/vendor/github.com/containers/buildah/imagebuildah/build.go
@@ -185,6 +185,8 @@ type BuildOptions struct {
Jobs *int
// LogRusage logs resource usage for each step.
LogRusage bool
+ // Excludes is a list of excludes to be used instead of the .dockerignore file.
+ Excludes []string
}
// BuildDockerfiles parses a set of one or more Dockerfiles (which may be
diff --git a/vendor/github.com/containers/buildah/imagebuildah/executor.go b/vendor/github.com/containers/buildah/imagebuildah/executor.go
index 8c96b4e67..3c41ec1d2 100644
--- a/vendor/github.com/containers/buildah/imagebuildah/executor.go
+++ b/vendor/github.com/containers/buildah/imagebuildah/executor.go
@@ -130,9 +130,12 @@ func NewExecutor(store storage.Store, options BuildOptions, mainNode *parser.Nod
return nil, errors.Wrapf(err, "failed to get container config")
}
- excludes, err := imagebuilder.ParseDockerignore(options.ContextDirectory)
- if err != nil {
- return nil, err
+ excludes := options.Excludes
+ if len(excludes) == 0 {
+ excludes, err = imagebuilder.ParseDockerignore(options.ContextDirectory)
+ if err != nil {
+ return nil, err
+ }
}
capabilities, err := defaultContainerConfig.Capabilities("", options.AddCapabilities, options.DropCapabilities)
if err != nil {
diff --git a/vendor/github.com/containers/buildah/imagebuildah/stage_executor.go b/vendor/github.com/containers/buildah/imagebuildah/stage_executor.go
index 6c058e226..191645b89 100644
--- a/vendor/github.com/containers/buildah/imagebuildah/stage_executor.go
+++ b/vendor/github.com/containers/buildah/imagebuildah/stage_executor.go
@@ -368,6 +368,7 @@ func (s *StageExecutor) Run(run imagebuilder.Run, config docker.Config) error {
Stderr: s.executor.err,
Quiet: s.executor.quiet,
NamespaceOptions: s.executor.namespaceOptions,
+ Terminal: buildah.WithoutTerminal,
}
if config.NetworkDisabled {
options.ConfigureNetwork = buildah.NetworkDisabled
@@ -1144,7 +1145,11 @@ func (s *StageExecutor) intermediateImageExists(ctx context.Context, currNode *p
// lines in the Dockerfile up till the point we are at in the build.
manifestType, history, diffIDs, err := s.executor.getImageTypeAndHistoryAndDiffIDs(ctx, image.ID)
if err != nil {
- return "", errors.Wrapf(err, "error getting history of %q", image.ID)
+ // It's possible that this image is for another architecture, which results
+ // in a custom-crafted error message that we'd have to use substring matching
+ // to recognize. Instead, ignore the image.
+ logrus.Debugf("error getting history of %q (%v), ignoring it", image.ID, err)
+ continue
}
// If this candidate isn't of the type that we're building, then it may have lost
// some format-specific information that a building-without-cache run wouldn't lose.
diff --git a/vendor/github.com/containers/buildah/install.md b/vendor/github.com/containers/buildah/install.md
index 00381e16a..119315d1f 100644
--- a/vendor/github.com/containers/buildah/install.md
+++ b/vendor/github.com/containers/buildah/install.md
@@ -59,35 +59,31 @@ sudo dnf -y install buildah
#### [Debian](https://debian.org)
-The buildah package is [being worked on](https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=928083)
-for inclusion in the default Debian repos.
-
-Alternatively, the [Kubic project](https://build.opensuse.org/project/show/devel:kubic:libcontainers:stable)
-provides packages for Debian 10, testing and unstable.
+The buildah package is available in
+the [Bullseye (testing) branch](https://packages.debian.org/bullseye/buildah), which
+will be the next stable release (Debian 11) as well as Debian Unstable/Sid.
```bash
-# Debian Unstable/Sid
-echo 'deb http://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/Debian_Unstable/ /' > /etc/apt/sources.list.d/devel:kubic:libcontainers:stable.list
-wget -nv https://download.opensuse.org/repositories/devel:kubic:libcontainers:stable/Debian_Unstable/Release.key -O Release.key
+# Debian Testing/Bullseye or Unstable/Sid
+sudo apt-get update
+sudo apt-get -y install buildah
+```
-# Debian Testing
-echo 'deb http://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/Debian_Testing/ /' > /etc/apt/sources.list.d/devel:kubic:libcontainers:stable.list
-wget -nv https://download.opensuse.org/repositories/devel:kubic:libcontainers:stable/Debian_Testing/Release.key -O Release.key
+The [Kubic project](https://build.opensuse.org/project/show/devel:kubic:libcontainers:stable)
+provides packages for Debian 10. The Kubic packages for Debian Testing/Bullseye and Debian Unstable/Sid
+have been discontinued to avoid
+[conflicts](https://github.com/containers/buildah/issues/2797) with the official packages.
-# Debian 10
-echo 'deb http://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/Debian_10/ /' > /etc/apt/sources.list.d/devel:kubic:libcontainers:stable.list
-wget -nv https://download.opensuse.org/repositories/devel:kubic:libcontainers:stable/Debian_10/Release.key -O Release.key
+Caution: If you upgrade from Debian 10 to Testing/Bullseye or
+Unstable/Sid you would likely end up downgrading Buildah because the version in
+OBS is more frequently updated than the one in Debian's official repositories,
+due to how Debian works.
-sudo apt-key add - < Release.key
-sudo apt-get update -qq
-sudo apt-get -qq -y install buildah
-```
-
-### [Fedora](https://www.fedoraproject.org), [CentOS](https://www.centos.org)
+### [Fedora](https://www.fedoraproject.org)
```bash
-sudo yum -y install buildah
+sudo dnf -y install buildah
```
### [Fedora SilverBlue](https://silverblue.fedoraproject.org)
@@ -127,19 +123,25 @@ sudo subscription-manager repos --enable=rhel-7-server-extras-rpms
sudo yum -y install buildah
```
-#### [Raspbian](https://raspbian.org)
+#### [Raspberry Pi OS armhf (ex Raspbian)](https://www.raspberrypi.org/downloads/raspberry-pi-os/)
The Kubic project provides packages for Raspbian 10.
```bash
# Raspbian 10
-echo 'deb http://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/Raspbian_10/ /' > /etc/apt/sources.list.d/devel:kubic:libcontainers:stable.list
-wget -nv https://download.opensuse.org/repositories/devel:kubic:libcontainers:stable/Raspbian_10/Release.key -O Release.key
-sudo apt-key add - < Release.key
+echo 'deb https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/Raspbian_10/ /' | sudo tee /etc/apt/sources.list.d/devel:kubic:libcontainers:stable.list
+curl -L https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/Raspbian_10/Release.key | sudo apt-key add -
sudo apt-get update -qq
sudo apt-get -qq -y install buildah
```
+#### [Raspberry Pi OS arm64 (beta)](https://downloads.raspberrypi.org/raspios_arm64/images/)
+
+Raspberry Pi OS use the standard Debian's repositories,
+so it is fully compatible with Debian's arm64 repository.
+You can simply follow the [steps for Debian](#debian) to install podman.
+
+
### [RHEL8 Beta](https://www.redhat.com/en/blog/powering-its-future-while-preserving-present-introducing-red-hat-enterprise-linux-8-beta?intcmp=701f2000001Cz6OAAS)
```bash
@@ -149,7 +151,16 @@ sudo yum module install -y buildah
### [Ubuntu](https://www.ubuntu.com)
-The Kubic project provides packages for Ubuntu 18.04, 19.04 and 19.10 (it should also work with direct derivatives like Pop!\_OS).
+The buildah package is available in the official repositories for Ubuntu 20.10
+and newer.
+
+```bash
+# Ubuntu 20.10 and newer
+sudo apt-get -y update
+sudo apt-get -y install buildah
+```
+
+The [Kubic project](https://build.opensuse.org/package/show/devel:kubic:libcontainers:stable/buildah) provides packages for some older but supported Ubuntu versions (it should also work with direct derivatives like Pop!\_OS).
```bash
. /etc/os-release
diff --git a/vendor/github.com/containers/buildah/pkg/cli/common.go b/vendor/github.com/containers/buildah/pkg/cli/common.go
index 62a328de0..123548d97 100644
--- a/vendor/github.com/containers/buildah/pkg/cli/common.go
+++ b/vendor/github.com/containers/buildah/pkg/cli/common.go
@@ -59,6 +59,7 @@ type BudResults struct {
Creds string
DisableCompression bool
DisableContentTrust bool
+ IgnoreFile string
File []string
Format string
Iidfile string
@@ -185,6 +186,7 @@ func GetBudFlags(flags *BudResults) pflag.FlagSet {
fs.StringVar(&flags.Creds, "creds", "", "use `[username[:password]]` for accessing the registry")
fs.BoolVarP(&flags.DisableCompression, "disable-compression", "D", true, "don't compress layers by default")
fs.BoolVar(&flags.DisableContentTrust, "disable-content-trust", false, "This is a Docker specific option and is a NOOP")
+ fs.StringVar(&flags.IgnoreFile, "ignorefile", "", "path to an alternate .dockerignore file")
fs.StringSliceVarP(&flags.File, "file", "f", []string{}, "`pathname or URL` of a Dockerfile")
fs.StringVar(&flags.Format, "format", DefaultFormat(), "`format` of the built image's manifest and metadata. Use BUILDAH_FORMAT environment variable to override.")
fs.StringVar(&flags.Iidfile, "iidfile", "", "`file` to write the image ID to")
@@ -231,6 +233,7 @@ func GetBudFlagsCompletions() commonComp.FlagCompletions {
flagCompletion["creds"] = commonComp.AutocompleteNone
flagCompletion["file"] = commonComp.AutocompleteDefault
flagCompletion["format"] = commonComp.AutocompleteNone
+ flagCompletion["ignorefile"] = commonComp.AutocompleteDefault
flagCompletion["iidfile"] = commonComp.AutocompleteDefault
flagCompletion["jobs"] = commonComp.AutocompleteNone
flagCompletion["label"] = commonComp.AutocompleteNone
diff --git a/vendor/github.com/containers/buildah/pkg/umask/umask_unsupported.go b/vendor/github.com/containers/buildah/pkg/umask/umask_unsupported.go
deleted file mode 100644
index 20913a718..000000000
--- a/vendor/github.com/containers/buildah/pkg/umask/umask_unsupported.go
+++ /dev/null
@@ -1,7 +0,0 @@
-// +build !linux,!darwin
-
-package umask
-
-func CheckUmask() {}
-
-func SetUmask(int) int { return 0 }
diff --git a/vendor/github.com/containers/buildah/run_linux.go b/vendor/github.com/containers/buildah/run_linux.go
index d907941ed..d20d39423 100644
--- a/vendor/github.com/containers/buildah/run_linux.go
+++ b/vendor/github.com/containers/buildah/run_linux.go
@@ -25,10 +25,10 @@ import (
"github.com/containers/buildah/chroot"
"github.com/containers/buildah/copier"
"github.com/containers/buildah/pkg/overlay"
- "github.com/containers/buildah/pkg/secrets"
"github.com/containers/buildah/util"
"github.com/containers/common/pkg/capabilities"
"github.com/containers/common/pkg/config"
+ "github.com/containers/common/pkg/subscriptions"
"github.com/containers/storage/pkg/idtools"
"github.com/containers/storage/pkg/ioutils"
"github.com/containers/storage/pkg/reexec"
@@ -216,16 +216,28 @@ func (b *Builder) Run(command []string, options RunOptions) error {
}
// Empty file, so no need to recreate if it exists
if _, ok := bindFiles["/run/.containerenv"]; !ok {
- // Empty string for now, but we may consider populating this later
containerenvPath := filepath.Join(path, "/run/.containerenv")
if err = os.MkdirAll(filepath.Dir(containerenvPath), 0755); err != nil {
return err
}
- emptyFile, err := os.Create(containerenvPath)
- if err != nil {
+
+ rootless := 0
+ if unshare.IsRootless() {
+ rootless = 1
+ }
+ // Populate the .containerenv with container information
+ containerenv := fmt.Sprintf(`\
+engine="buildah-%s"
+name=%q
+id=%q
+image=%q
+imageid=%q
+rootless=%d
+`, Version, b.Container, b.ContainerID, b.FromImage, b.FromImageID, rootless)
+
+ if err = ioutils.AtomicWriteFile(containerenvPath, []byte(containerenv), 0755); err != nil {
return err
}
- emptyFile.Close()
if err := label.Relabel(containerenvPath, b.MountLabel, false); err != nil {
return err
}
@@ -477,15 +489,15 @@ func (b *Builder) setupMounts(mountPoint string, spec *specs.Spec, bundlePath st
return errors.Wrapf(err, "error determining work directory for container %q", b.ContainerID)
}
- // Figure out which UID and GID to tell the secrets package to use
+ // Figure out which UID and GID to tell the subscritions package to use
// for files that it creates.
rootUID, rootGID, err := util.GetHostRootIDs(spec)
if err != nil {
return err
}
- // Get the list of secrets mounts.
- secretMounts := secrets.SecretMountsWithUIDGID(b.MountLabel, cdir, b.DefaultMountsFilePath, mountPoint, int(rootUID), int(rootGID), unshare.IsRootless(), false)
+ // Get the list of subscriptionss mounts.
+ secretMounts := subscriptions.MountsWithUIDGID(b.MountLabel, cdir, b.DefaultMountsFilePath, mountPoint, int(rootUID), int(rootGID), unshare.IsRootless(), false)
// Add temporary copies of the contents of volume locations at the
// volume locations, unless we already have something there.
diff --git a/vendor/github.com/containers/common/pkg/subscriptions/mounts.conf b/vendor/github.com/containers/common/pkg/subscriptions/mounts.conf
new file mode 100644
index 000000000..b7cde9d8a
--- /dev/null
+++ b/vendor/github.com/containers/common/pkg/subscriptions/mounts.conf
@@ -0,0 +1 @@
+/usr/share/rhel/secrets:/run/secrets
diff --git a/vendor/github.com/containers/buildah/pkg/secrets/secrets.go b/vendor/github.com/containers/common/pkg/subscriptions/subscriptions.go
index 32f888fa8..6aa66b0c8 100644
--- a/vendor/github.com/containers/buildah/pkg/secrets/secrets.go
+++ b/vendor/github.com/containers/common/pkg/subscriptions/subscriptions.go
@@ -1,4 +1,4 @@
-package secrets
+package subscriptions
import (
"bufio"
@@ -7,7 +7,7 @@ import (
"path/filepath"
"strings"
- "github.com/containers/buildah/pkg/umask"
+ "github.com/containers/common/pkg/umask"
"github.com/containers/storage/pkg/idtools"
rspec "github.com/opencontainers/runtime-spec/specs-go"
"github.com/opencontainers/selinux/go-selinux/label"
@@ -27,16 +27,16 @@ var (
UserOverrideMountsFile = filepath.Join(os.Getenv("HOME"), ".config/containers/mounts.conf")
)
-// secretData stores the name of the file and the content read from it
-type secretData struct {
+// subscriptionData stores the name of the file and the content read from it
+type subscriptionData struct {
name string
data []byte
mode os.FileMode
dirMode os.FileMode
}
-// saveTo saves secret data to given directory
-func (s secretData) saveTo(dir string) error {
+// saveTo saves subscription data to given directory
+func (s subscriptionData) saveTo(dir string) error {
path := filepath.Join(dir, s.name)
if err := os.MkdirAll(filepath.Dir(path), s.dirMode); err != nil {
return err
@@ -44,10 +44,10 @@ func (s secretData) saveTo(dir string) error {
return ioutil.WriteFile(path, s.data, s.mode)
}
-func readAll(root, prefix string, parentMode os.FileMode) ([]secretData, error) {
+func readAll(root, prefix string, parentMode os.FileMode) ([]subscriptionData, error) {
path := filepath.Join(root, prefix)
- data := []secretData{}
+ data := []subscriptionData{}
files, err := ioutil.ReadDir(path)
if err != nil {
@@ -74,7 +74,7 @@ func readAll(root, prefix string, parentMode os.FileMode) ([]secretData, error)
return data, nil
}
-func readFileOrDir(root, name string, parentMode os.FileMode) ([]secretData, error) {
+func readFileOrDir(root, name string, parentMode os.FileMode) ([]subscriptionData, error) {
path := filepath.Join(root, name)
s, err := os.Stat(path)
@@ -93,7 +93,7 @@ func readFileOrDir(root, name string, parentMode os.FileMode) ([]secretData, err
if err != nil {
return nil, err
}
- return []secretData{{
+ return []subscriptionData{{
name: name,
data: bytes,
mode: s.Mode(),
@@ -101,13 +101,13 @@ func readFileOrDir(root, name string, parentMode os.FileMode) ([]secretData, err
}}, nil
}
-func getHostSecretData(hostDir string, mode os.FileMode) ([]secretData, error) {
- var allSecrets []secretData
- hostSecrets, err := readAll(hostDir, "", mode)
+func getHostSubscriptionData(hostDir string, mode os.FileMode) ([]subscriptionData, error) {
+ var allSubscriptions []subscriptionData
+ hostSubscriptions, err := readAll(hostDir, "", mode)
if err != nil {
- return nil, errors.Wrapf(err, "failed to read secrets from %q", hostDir)
+ return nil, errors.Wrapf(err, "failed to read subscriptions from %q", hostDir)
}
- return append(allSecrets, hostSecrets...), nil
+ return append(allSubscriptions, hostSubscriptions...), nil
}
func getMounts(filePath string) []string {
@@ -136,7 +136,7 @@ func getMounts(filePath string) []string {
}
// getHostAndCtrDir separates the host:container paths
-func getMountsMap(path string) (string, string, error) {
+func getMountsMap(path string) (string, string, error) { //nolint
arr := strings.SplitN(path, ":", 2)
switch len(arr) {
case 1:
@@ -147,27 +147,21 @@ func getMountsMap(path string) (string, string, error) {
return "", "", errors.Errorf("unable to get host and container dir from path: %s", path)
}
-// SecretMounts copies, adds, and mounts the secrets to the container root filesystem
-// Deprecated, Please use SecretMountWithUIDGID
-func SecretMounts(mountLabel, containerWorkingDir, mountFile string, rootless, disableFips bool) []rspec.Mount {
- return SecretMountsWithUIDGID(mountLabel, containerWorkingDir, mountFile, containerWorkingDir, 0, 0, rootless, disableFips)
-}
-
-// SecretMountsWithUIDGID copies, adds, and mounts the secrets to the container root filesystem
+// MountsWithUIDGID copies, adds, and mounts the subscriptions to the container root filesystem
// mountLabel: MAC/SELinux label for container content
-// containerWorkingDir: Private data for storing secrets on the host mounted in container.
+// containerWorkingDir: Private data for storing subscriptions on the host mounted in container.
// mountFile: Additional mount points required for the container.
// mountPoint: Container image mountpoint
-// uid: to assign to content created for secrets
-// gid: to assign to content created for secrets
+// uid: to assign to content created for subscriptions
+// gid: to assign to content created for subscriptions
// rootless: indicates whether container is running in rootless mode
// disableFips: indicates whether system should ignore fips mode
-func SecretMountsWithUIDGID(mountLabel, containerWorkingDir, mountFile, mountPoint string, uid, gid int, rootless, disableFips bool) []rspec.Mount {
+func MountsWithUIDGID(mountLabel, containerWorkingDir, mountFile, mountPoint string, uid, gid int, rootless, disableFips bool) []rspec.Mount {
var (
- secretMounts []rspec.Mount
- mountFiles []string
+ subscriptionMounts []rspec.Mount
+ mountFiles []string
)
- // Add secrets from paths given in the mounts.conf files
+ // Add subscriptions from paths given in the mounts.conf files
// mountFile will have a value if the hidden --default-mounts-file flag is set
// Note for testing purposes only
if mountFile == "" {
@@ -180,31 +174,32 @@ func SecretMountsWithUIDGID(mountLabel, containerWorkingDir, mountFile, mountPoi
}
for _, file := range mountFiles {
if _, err := os.Stat(file); err == nil {
- mounts, err := addSecretsFromMountsFile(file, mountLabel, containerWorkingDir, uid, gid)
+ mounts, err := addSubscriptionsFromMountsFile(file, mountLabel, containerWorkingDir, uid, gid)
if err != nil {
- logrus.Warnf("error mounting secrets, skipping entry in %s: %v", file, err)
+ logrus.Warnf("error mounting subscriptions, skipping entry in %s: %v", file, err)
}
- secretMounts = mounts
+ subscriptionMounts = mounts
break
}
}
- // Only add FIPS secret mount if disableFips=false
+ // Only add FIPS subscription mount if disableFips=false
if disableFips {
- return secretMounts
+ return subscriptionMounts
}
- // Add FIPS mode secret if /etc/system-fips exists on the host
+ // Add FIPS mode subscription if /etc/system-fips exists on the host
_, err := os.Stat("/etc/system-fips")
- if err == nil {
- if err := addFIPSModeSecret(&secretMounts, containerWorkingDir, mountPoint, mountLabel, uid, gid); err != nil {
- logrus.Errorf("error adding FIPS mode secret to container: %v", err)
+ switch {
+ case err == nil:
+ if err := addFIPSModeSubscription(&subscriptionMounts, containerWorkingDir, mountPoint, mountLabel, uid, gid); err != nil {
+ logrus.Errorf("error adding FIPS mode subscription to container: %v", err)
}
- } else if os.IsNotExist(err) {
- logrus.Debug("/etc/system-fips does not exist on host, not mounting FIPS mode secret")
- } else {
- logrus.Errorf("stat /etc/system-fips failed for FIPS mode secret: %v", err)
+ case os.IsNotExist(err):
+ logrus.Debug("/etc/system-fips does not exist on host, not mounting FIPS mode subscription")
+ default:
+ logrus.Errorf("stat /etc/system-fips failed for FIPS mode subscription: %v", err)
}
- return secretMounts
+ return subscriptionMounts
}
func rchown(chowndir string, uid, gid int) error {
@@ -213,9 +208,9 @@ func rchown(chowndir string, uid, gid int) error {
})
}
-// addSecretsFromMountsFile copies the contents of host directory to container directory
+// addSubscriptionsFromMountsFile copies the contents of host directory to container directory
// and returns a list of mounts
-func addSecretsFromMountsFile(filePath, mountLabel, containerWorkingDir string, uid, gid int) ([]rspec.Mount, error) {
+func addSubscriptionsFromMountsFile(filePath, mountLabel, containerWorkingDir string, uid, gid int) ([]rspec.Mount, error) {
var mounts []rspec.Mount
defaultMountsPaths := getMounts(filePath)
for _, path := range defaultMountsPaths {
@@ -235,7 +230,7 @@ func addSecretsFromMountsFile(filePath, mountLabel, containerWorkingDir string,
ctrDirOrFileOnHost := filepath.Join(containerWorkingDir, ctrDirOrFile)
- // In the event of a restart, don't want to copy secrets over again as they already would exist in ctrDirOrFileOnHost
+ // In the event of a restart, don't want to copy subscriptions over again as they already would exist in ctrDirOrFileOnHost
_, err = os.Stat(ctrDirOrFileOnHost)
if os.IsNotExist(err) {
@@ -245,17 +240,17 @@ func addSecretsFromMountsFile(filePath, mountLabel, containerWorkingDir string,
}
// Don't let the umask have any influence on the file and directory creation
- oldUmask := umask.SetUmask(0)
- defer umask.SetUmask(oldUmask)
+ oldUmask := umask.Set(0)
+ defer umask.Set(oldUmask)
switch mode := fileInfo.Mode(); {
case mode.IsDir():
if err = os.MkdirAll(ctrDirOrFileOnHost, mode.Perm()); err != nil {
return nil, errors.Wrapf(err, "making container directory %q failed", ctrDirOrFileOnHost)
}
- data, err := getHostSecretData(hostDirOrFile, mode.Perm())
+ data, err := getHostSubscriptionData(hostDirOrFile, mode.Perm())
if err != nil {
- return nil, errors.Wrapf(err, "getting host secret data failed")
+ return nil, errors.Wrapf(err, "getting host subscription data failed")
}
for _, s := range data {
if err := s.saveTo(ctrDirOrFileOnHost); err != nil {
@@ -305,15 +300,15 @@ func addSecretsFromMountsFile(filePath, mountLabel, containerWorkingDir string,
return mounts, nil
}
-// addFIPSModeSecret creates /run/secrets/system-fips in the container
+// addFIPSModeSubscription creates /run/secrets/system-fips in the container
// root filesystem if /etc/system-fips exists on hosts.
// This enables the container to be FIPS compliant and run openssl in
// FIPS mode as the host is also in FIPS mode.
-func addFIPSModeSecret(mounts *[]rspec.Mount, containerWorkingDir, mountPoint, mountLabel string, uid, gid int) error {
- secretsDir := "/run/secrets"
- ctrDirOnHost := filepath.Join(containerWorkingDir, secretsDir)
+func addFIPSModeSubscription(mounts *[]rspec.Mount, containerWorkingDir, mountPoint, mountLabel string, uid, gid int) error {
+ subscriptionsDir := "/run/secrets"
+ ctrDirOnHost := filepath.Join(containerWorkingDir, subscriptionsDir)
if _, err := os.Stat(ctrDirOnHost); os.IsNotExist(err) {
- if err = idtools.MkdirAllAs(ctrDirOnHost, 0755, uid, gid); err != nil {
+ if err = idtools.MkdirAllAs(ctrDirOnHost, 0755, uid, gid); err != nil { //nolint
return errors.Wrapf(err, "making container directory %q on host failed", ctrDirOnHost)
}
if err = label.Relabel(ctrDirOnHost, mountLabel, false); err != nil {
@@ -330,10 +325,10 @@ func addFIPSModeSecret(mounts *[]rspec.Mount, containerWorkingDir, mountPoint, m
defer file.Close()
}
- if !mountExists(*mounts, secretsDir) {
+ if !mountExists(*mounts, subscriptionsDir) {
m := rspec.Mount{
Source: ctrDirOnHost,
- Destination: secretsDir,
+ Destination: subscriptionsDir,
Type: "bind",
Options: []string{"bind", "rprivate"},
}
diff --git a/vendor/github.com/containers/buildah/pkg/umask/umask_unix.go b/vendor/github.com/containers/common/pkg/umask/umask_unix.go
index 02e10945b..bb589f7ac 100644
--- a/vendor/github.com/containers/buildah/pkg/umask/umask_unix.go
+++ b/vendor/github.com/containers/common/pkg/umask/umask_unix.go
@@ -8,13 +8,13 @@ import (
"github.com/sirupsen/logrus"
)
-func CheckUmask() {
- oldUmask := syscall.Umask(0022)
+func Check() {
+ oldUmask := syscall.Umask(0022) //nolint
if (oldUmask & ^0022) != 0 {
logrus.Debugf("umask value too restrictive. Forcing it to 022")
}
}
-func SetUmask(value int) int {
+func Set(value int) int {
return syscall.Umask(value)
}
diff --git a/vendor/github.com/containers/common/pkg/umask/umask_unsupported.go b/vendor/github.com/containers/common/pkg/umask/umask_unsupported.go
new file mode 100644
index 000000000..9041d5f20
--- /dev/null
+++ b/vendor/github.com/containers/common/pkg/umask/umask_unsupported.go
@@ -0,0 +1,7 @@
+// +build !linux,!darwin
+
+package umask
+
+func Check() {}
+
+func Set(int) int { return 0 }
diff --git a/vendor/github.com/varlink/go/LICENSE b/vendor/github.com/varlink/go/LICENSE
deleted file mode 100644
index 261eeb9e9..000000000
--- a/vendor/github.com/varlink/go/LICENSE
+++ /dev/null
@@ -1,201 +0,0 @@
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
diff --git a/vendor/github.com/varlink/go/cmd/varlink-go-interface-generator/main.go b/vendor/github.com/varlink/go/cmd/varlink-go-interface-generator/main.go
deleted file mode 100644
index 98a983c5e..000000000
--- a/vendor/github.com/varlink/go/cmd/varlink-go-interface-generator/main.go
+++ /dev/null
@@ -1,445 +0,0 @@
-package main
-
-import (
- "bytes"
- "fmt"
- "go/format"
- "io/ioutil"
- "os"
- "path"
- "strings"
-
- "github.com/varlink/go/varlink/idl"
-)
-
-func writeType(b *bytes.Buffer, t *idl.Type, json bool, ident int) {
- switch t.Kind {
- case idl.TypeBool:
- b.WriteString("bool")
-
- case idl.TypeInt:
- b.WriteString("int64")
-
- case idl.TypeFloat:
- b.WriteString("float64")
-
- case idl.TypeString, idl.TypeEnum:
- b.WriteString("string")
-
- case idl.TypeObject:
- b.WriteString("json.RawMessage")
-
- case idl.TypeArray:
- b.WriteString("[]")
- writeType(b, t.ElementType, json, ident)
-
- case idl.TypeMap:
- b.WriteString("map[string]")
- writeType(b, t.ElementType, json, ident)
-
- case idl.TypeMaybe:
- b.WriteString("*")
- writeType(b, t.ElementType, json, ident)
-
- case idl.TypeAlias:
- b.WriteString(t.Alias)
-
- case idl.TypeStruct:
- if len(t.Fields) == 0 {
- b.WriteString("struct{}")
- } else {
- b.WriteString("struct {\n")
- for _, field := range t.Fields {
- for i := 0; i < ident+1; i++ {
- b.WriteString("\t")
- }
-
- b.WriteString(strings.Title(field.Name) + " ")
- writeType(b, field.Type, json, ident+1)
- if json {
- b.WriteString(" `json:\"" + field.Name)
- if field.Type.Kind == idl.TypeMaybe {
- b.WriteString(",omitempty")
- }
- b.WriteString("\"`")
- }
- b.WriteString("\n")
- }
- for i := 0; i < ident; i++ {
- b.WriteString("\t")
- }
- b.WriteString("}")
- }
- }
-}
-
-func writeDocString(b *bytes.Buffer, s string) {
- if s == "" {
- return
- }
-
- // Quote multi-line docstrings
- b.WriteString("// " + strings.Replace(s, "\n", "\n// ", -1))
- b.WriteString("\n")
-}
-
-func generateTemplate(description string) (string, []byte, error) {
- description = strings.TrimRight(description, "\n")
-
- midl, err := idl.New(description)
- if err != nil {
- return "", nil, err
- }
-
- pkgname := strings.Replace(midl.Name, ".", "", -1)
-
- var b bytes.Buffer
- b.WriteString("// Generated with github.com/varlink/go/cmd/varlink-go-interface-generator\n\n")
-
- writeDocString(&b, midl.Doc)
- b.WriteString("package " + pkgname + "\n\n")
- b.WriteString("@IMPORTS@\n\n")
-
- b.WriteString("// Generated type declarations\n\n")
-
- for _, a := range midl.Aliases {
- writeDocString(&b, a.Doc)
- b.WriteString("type " + a.Name + " ")
- writeType(&b, a.Type, true, 0)
- b.WriteString("\n\n")
- }
-
- for _, a := range midl.Errors {
- writeDocString(&b, a.Doc)
- b.WriteString("type " + a.Name + " ")
- writeType(&b, a.Type, true, 0)
- b.WriteString("\nfunc (e " + a.Name + ") Error() string {\n")
- b.WriteString("\treturn \"" + midl.Name + "." + a.Name + "\"\n")
- b.WriteString("}\n\n")
- }
-
- b.WriteString("func Dispatch_Error(err error) error {\n")
- b.WriteString("\tif e, ok := err.(*varlink.Error); ok {\n")
- b.WriteString("\t\tswitch e.Name {\n")
- for _, a := range midl.Errors {
- b.WriteString("\t\tcase \"" + midl.Name + "." + a.Name + "\":\n")
- b.WriteString("\t\t\terrorRawParameters := e.Parameters.(*json.RawMessage)\n")
- b.WriteString("\t\t\tif errorRawParameters == nil {\n")
- b.WriteString("\t\t\t\treturn e\n")
- b.WriteString("\t\t\t}\n")
- b.WriteString("\t\t\tvar param " + a.Name + "\n")
- b.WriteString("\t\t\terr := json.Unmarshal(*errorRawParameters, &param)\n")
- b.WriteString("\t\t\tif err != nil {\n")
- b.WriteString("\t\t\t\treturn e\n")
- b.WriteString("\t\t\t}\n")
- b.WriteString("\t\t\treturn &param\n")
- }
- b.WriteString("\t\t}\n")
- b.WriteString("\t}\n")
- b.WriteString("\treturn err\n")
- b.WriteString("}\n\n")
-
- b.WriteString("// Generated client method calls\n\n")
-
- for _, m := range midl.Methods {
- writeDocString(&b, m.Doc)
- b.WriteString("type " + m.Name + "_methods struct{}\n")
- b.WriteString("func " + m.Name + "() " + m.Name + "_methods { return " + m.Name + "_methods{} }\n\n")
-
- b.WriteString("func (m " + m.Name + "_methods) Call(c *varlink.Connection")
- for _, field := range m.In.Fields {
- b.WriteString(", " + field.Name + "_in_ ")
- writeType(&b, field.Type, false, 1)
- }
- b.WriteString(") (")
- for _, field := range m.Out.Fields {
- b.WriteString(field.Name + "_out_ ")
- writeType(&b, field.Type, false, 1)
- b.WriteString(", ")
- }
- b.WriteString("err_ error) {\n")
- b.WriteString("receive, err_ := m.Send(c, 0")
- for _, field := range m.In.Fields {
- b.WriteString(", " + field.Name + "_in_ ")
- }
- b.WriteString(")\n")
- b.WriteString("if err_ != nil {\n" +
- "\treturn\n" +
- "}\n")
- b.WriteString("\t")
- for _, field := range m.Out.Fields {
- b.WriteString(field.Name + "_out_ ")
- b.WriteString(", ")
- }
- b.WriteString("_, err_ = receive()\n")
- b.WriteString("\treturn\n" +
- "}\n\n")
-
- b.WriteString("func (m " + m.Name + "_methods) Send(c *varlink.Connection, flags uint64")
- for _, field := range m.In.Fields {
- b.WriteString(", " + field.Name + "_in_ ")
- writeType(&b, field.Type, false, 1)
- }
- b.WriteString(") (func() (")
- for _, field := range m.Out.Fields {
- writeType(&b, field.Type, false, 1)
- b.WriteString(", ")
- }
- b.WriteString("uint64, error), error) {\n")
- if len(m.In.Fields) > 0 {
- b.WriteString("\tvar in ")
- writeType(&b, m.In, true, 1)
- b.WriteString("\n")
- for _, field := range m.In.Fields {
- switch field.Type.Kind {
- case idl.TypeStruct, idl.TypeArray, idl.TypeMap:
- b.WriteString("\tin." + strings.Title(field.Name) + " = ")
- writeType(&b, field.Type, true, 1)
- b.WriteString("(" + field.Name + "_in_)\n")
-
- default:
- b.WriteString("\tin." + strings.Title(field.Name) + " = " + field.Name + "_in_\n")
- }
- }
- b.WriteString("\treceive, err := c.Send(\"" + midl.Name + "." + m.Name + "\", in, flags)\n")
- } else {
- b.WriteString("\treceive, err := c.Send(\"" + midl.Name + "." + m.Name + "\", nil, flags)\n")
- }
- b.WriteString("\tif err != nil {\n" +
- "\t\treturn nil, err\n" +
- "\t}\n")
- b.WriteString("\treturn func() (")
- for _, field := range m.Out.Fields {
- b.WriteString(field.Name + "_out_ ")
- writeType(&b, field.Type, false, 3)
- b.WriteString(", ")
- }
- b.WriteString("flags uint64, err error) {\n")
- if len(m.Out.Fields) > 0 {
- b.WriteString("\t\tvar out ")
- writeType(&b, m.Out, true, 2)
- b.WriteString("\n")
- b.WriteString("\t\tflags, err = receive(&out)\n")
- } else {
- b.WriteString("\t\tflags, err = receive(nil)\n")
- }
- b.WriteString("\t\tif err != nil {\n" +
- "\t\t\terr = Dispatch_Error(err)\n" +
- "\t\t\treturn\n" +
- "\t\t}\n")
- for _, field := range m.Out.Fields {
- b.WriteString("\t\t" + field.Name + "_out_ = ")
- switch field.Type.Kind {
- case idl.TypeStruct, idl.TypeArray, idl.TypeMap:
- writeType(&b, field.Type, false, 2)
- b.WriteString("(out." + strings.Title(field.Name) + ")\n")
-
- default:
- b.WriteString("out." + strings.Title(field.Name) + "\n")
- }
- }
- b.WriteString("\t\treturn\n" +
- "\t}, nil\n")
- b.WriteString("}\n\n")
- }
-
- b.WriteString("// Generated service interface with all methods\n\n")
-
- b.WriteString("type " + pkgname + "Interface interface {\n")
- for _, m := range midl.Methods {
- b.WriteString("\t" + m.Name + "(c VarlinkCall")
- for _, field := range m.In.Fields {
- b.WriteString(", " + field.Name + "_ ")
- writeType(&b, field.Type, false, 1)
- }
- b.WriteString(") error\n")
- }
- b.WriteString("}\n\n")
-
- b.WriteString("// Generated service object with all methods\n\n")
-
- b.WriteString("type VarlinkCall struct{ varlink.Call }\n\n")
-
- b.WriteString("// Generated reply methods for all varlink errors\n\n")
-
- for _, e := range midl.Errors {
- writeDocString(&b, e.Doc)
- b.WriteString("func (c *VarlinkCall) Reply" + e.Name + "(")
- for i, field := range e.Type.Fields {
- if i > 0 {
- b.WriteString(", ")
- }
- b.WriteString(field.Name + "_ ")
- writeType(&b, field.Type, false, 1)
- }
- b.WriteString(") error {\n")
- b.WriteString("\tvar out " + e.Name + "\n")
- if len(e.Type.Fields) > 0 {
- for _, field := range e.Type.Fields {
- switch field.Type.Kind {
- case idl.TypeStruct, idl.TypeArray, idl.TypeMap:
- b.WriteString("\tout." + strings.Title(field.Name) + " = ")
- writeType(&b, field.Type, true, 1)
- b.WriteString("(" + field.Name + "_)\n")
-
- default:
- b.WriteString("\tout." + strings.Title(field.Name) + " = " + field.Name + "_\n")
- }
- }
- }
- b.WriteString("\treturn c.ReplyError(\"" + midl.Name + "." + e.Name + "\", &out)\n")
- b.WriteString("}\n\n")
- }
-
- b.WriteString("// Generated reply methods for all varlink methods\n\n")
-
- for _, m := range midl.Methods {
- b.WriteString("func (c *VarlinkCall) Reply" + m.Name + "(")
- for i, field := range m.Out.Fields {
- if i > 0 {
- b.WriteString(", ")
- }
- b.WriteString(field.Name + "_ ")
- writeType(&b, field.Type, false, 1)
- }
- b.WriteString(") error {\n")
- if len(m.Out.Fields) > 0 {
- b.WriteString("\tvar out ")
- writeType(&b, m.Out, true, 1)
- b.WriteString("\n")
- for _, field := range m.Out.Fields {
- switch field.Type.Kind {
- case idl.TypeStruct, idl.TypeArray, idl.TypeMap:
- b.WriteString("\tout." + strings.Title(field.Name) + " = ")
- writeType(&b, field.Type, true, 1)
- b.WriteString("(" + field.Name + "_)\n")
-
- default:
- b.WriteString("\tout." + strings.Title(field.Name) + " = " + field.Name + "_\n")
- }
- }
- b.WriteString("\treturn c.Reply(&out)\n")
- } else {
- b.WriteString("\treturn c.Reply(nil)\n")
- }
- b.WriteString("}\n\n")
- }
-
- b.WriteString("// Generated dummy implementations for all varlink methods\n\n")
-
- for _, m := range midl.Methods {
- writeDocString(&b, m.Doc)
- b.WriteString("func (s *VarlinkInterface) " + m.Name + "(c VarlinkCall")
- for _, field := range m.In.Fields {
- b.WriteString(", " + field.Name + "_ ")
- writeType(&b, field.Type, false, 1)
- }
- b.WriteString(") error {\n" +
- "\treturn c.ReplyMethodNotImplemented(\"" + midl.Name + "." + m.Name + "\")\n" +
- "}\n\n")
- }
-
- b.WriteString("// Generated method call dispatcher\n\n")
-
- b.WriteString("func (s *VarlinkInterface) VarlinkDispatch(call varlink.Call, methodname string) error {\n" +
- "\tswitch methodname {\n")
- for _, m := range midl.Methods {
- b.WriteString("\tcase \"" + m.Name + "\":\n")
- if len(m.In.Fields) > 0 {
- b.WriteString("\t\tvar in ")
- writeType(&b, m.In, true, 2)
- b.WriteString("\n")
- b.WriteString("\t\terr := call.GetParameters(&in)\n" +
- "\t\tif err != nil {\n" +
- "\t\t\treturn call.ReplyInvalidParameter(\"parameters\")\n" +
- "\t\t}\n")
- b.WriteString("\t\treturn s." + pkgname + "Interface." + m.Name + "(VarlinkCall{call}")
- if len(m.In.Fields) > 0 {
- for _, field := range m.In.Fields {
- switch field.Type.Kind {
- case idl.TypeStruct, idl.TypeArray, idl.TypeMap:
- b.WriteString(", ")
- writeType(&b, field.Type, false, 2)
- b.WriteString("(in." + strings.Title(field.Name) + ")")
-
- default:
- b.WriteString(", in." + strings.Title(field.Name))
- }
- }
- }
- b.WriteString(")\n")
- } else {
- b.WriteString("\t\treturn s." + pkgname + "Interface." + m.Name + "(VarlinkCall{call})\n")
- }
- b.WriteString("\n")
- }
- b.WriteString("\tdefault:\n" +
- "\t\treturn call.ReplyMethodNotFound(methodname)\n" +
- "\t}\n" +
- "}\n\n")
-
- b.WriteString("// Generated varlink interface name\n\n")
-
- b.WriteString("func (s *VarlinkInterface) VarlinkGetName() string {\n" +
- "\treturn `" + midl.Name + "`\n" + "}\n\n")
-
- b.WriteString("// Generated varlink interface description\n\n")
-
- // Special-quote backtick, it cannot be part of a backtick-quoted string
- b.WriteString("func (s *VarlinkInterface) VarlinkGetDescription() string {\n" +
- "\treturn `" + strings.Replace(midl.Description, "`", "` + \"`\" + `", -1) + "\n`\n}\n\n")
-
- b.WriteString("// Generated service interface\n\n")
-
- b.WriteString("type VarlinkInterface struct {\n" +
- "\t" + pkgname + "Interface\n" +
- "}\n\n")
-
- b.WriteString("func VarlinkNew(m " + pkgname + "Interface) *VarlinkInterface {\n" +
- "\treturn &VarlinkInterface{m}\n" +
- "}\n")
-
- ret_string := b.String()
-
- if strings.Contains(ret_string, "json.RawMessage") {
- ret_string = strings.Replace(ret_string, "@IMPORTS@", "import (\n\t\"github.com/varlink/go/varlink\"\n\t\"encoding/json\"\n)", 1)
- } else {
- ret_string = strings.Replace(ret_string, "@IMPORTS@", `import "github.com/varlink/go/varlink"`, 1)
- }
-
- pretty, err := format.Source([]byte(ret_string))
- if err != nil {
- return "", nil, err
- }
-
- return pkgname, pretty, nil
-}
-
-func generateFile(varlinkFile string) {
- file, err := ioutil.ReadFile(varlinkFile)
- if err != nil {
- fmt.Fprintf(os.Stderr, "Error reading file '%s': %s\n", varlinkFile, err)
- os.Exit(1)
- }
-
- pkgname, b, err := generateTemplate(string(file))
- if err != nil {
- fmt.Fprintf(os.Stderr, "Error parsing file '%s': %s\n", varlinkFile, err)
- os.Exit(1)
- }
-
- filename := path.Dir(varlinkFile) + "/" + pkgname + ".go"
- err = ioutil.WriteFile(filename, b, 0660)
- if err != nil {
- fmt.Fprintf(os.Stderr, "Error writing file '%s': %s\n", filename, err)
- os.Exit(1)
- }
-}
-
-func main() {
- if len(os.Args) != 2 {
- fmt.Printf("Usage: %s <file>\n", os.Args[0])
- os.Exit(1)
- }
- generateFile(os.Args[1])
-}
diff --git a/vendor/github.com/varlink/go/varlink/bridge.go b/vendor/github.com/varlink/go/varlink/bridge.go
deleted file mode 100644
index c478dcd88..000000000
--- a/vendor/github.com/varlink/go/varlink/bridge.go
+++ /dev/null
@@ -1,65 +0,0 @@
-// +build !windows
-
-package varlink
-
-import (
- "bufio"
- "io"
- "net"
- "os"
- "os/exec"
-)
-
-type PipeCon struct {
- net.Conn
- cmd *exec.Cmd
- reader *io.ReadCloser
- writer *io.WriteCloser
-}
-
-func (p PipeCon) Close() error {
- err1 := (*p.reader).Close()
- err2 := (*p.writer).Close()
- if err1 != nil {
- return err1
- }
- if err2 != nil {
- return err2
- }
- p.cmd.Wait()
-
- return nil
-}
-
-// NewBridgeWithStderr returns a new connection with the given bridge.
-func NewBridgeWithStderr(bridge string, stderr io.Writer) (*Connection, error) {
- //var err error
-
- c := Connection{}
- cmd := exec.Command("sh", "-c", bridge)
- cmd.Stderr = stderr
- r, err := cmd.StdoutPipe()
- if err != nil {
- return nil, err
- }
- w, err := cmd.StdinPipe()
- if err != nil {
- return nil, err
- }
- c.conn = PipeCon{nil, cmd, &r, &w}
- c.address = ""
- c.Reader = bufio.NewReader(r)
- c.Writer = bufio.NewWriter(w)
-
- err = cmd.Start()
- if err != nil {
- return nil, err
- }
-
- return &c, nil
-}
-
-// NewBridge returns a new connection with the given bridge.
-func NewBridge(bridge string) (*Connection, error) {
- return NewBridgeWithStderr(bridge, os.Stderr)
-}
diff --git a/vendor/github.com/varlink/go/varlink/bridge_windows.go b/vendor/github.com/varlink/go/varlink/bridge_windows.go
deleted file mode 100644
index 42953b871..000000000
--- a/vendor/github.com/varlink/go/varlink/bridge_windows.go
+++ /dev/null
@@ -1,63 +0,0 @@
-package varlink
-
-import (
- "bufio"
- "io"
- "net"
- "os"
- "os/exec"
-)
-
-type PipeCon struct {
- net.Conn
- cmd *exec.Cmd
- reader *io.ReadCloser
- writer *io.WriteCloser
-}
-
-func (p PipeCon) Close() error {
- err1 := (*p.reader).Close()
- err2 := (*p.writer).Close()
- if err1 != nil {
- return err1
- }
- if err2 != nil {
- return err2
- }
- p.cmd.Wait()
-
- return nil
-}
-
-// NewBridgeWithStderr returns a new connection with the given bridge.
-func NewBridgeWithStderr(bridge string, stderr io.Writer) (*Connection, error) {
- //var err error
-
- c := Connection{}
- cmd := exec.Command("cmd", "/C", bridge)
- cmd.Stderr = stderr
- r, err := cmd.StdoutPipe()
- if err != nil {
- return nil, err
- }
- w, err := cmd.StdinPipe()
- if err != nil {
- return nil, err
- }
- c.conn = PipeCon{nil, cmd, &r, &w}
- c.address = ""
- c.Reader = bufio.NewReader(r)
- c.Writer = bufio.NewWriter(w)
-
- err = cmd.Start()
- if err != nil {
- return nil, err
- }
-
- return &c, nil
-}
-
-// NewBridge returns a new connection with the given bridge.
-func NewBridge(bridge string) (*Connection, error) {
- return NewBridgeWithStderr(bridge, os.Stderr)
-} \ No newline at end of file
diff --git a/vendor/github.com/varlink/go/varlink/call.go b/vendor/github.com/varlink/go/varlink/call.go
deleted file mode 100644
index 0eaf24aca..000000000
--- a/vendor/github.com/varlink/go/varlink/call.go
+++ /dev/null
@@ -1,104 +0,0 @@
-package varlink
-
-import (
- "bufio"
- "encoding/json"
- "fmt"
- "io"
- "net"
- "strings"
-)
-
-// Call is a method call retrieved by a Service. The connection from the
-// client can be terminated by returning an error from the call instead
-// of sending a reply or error reply.
-type Call struct {
- *bufio.Reader
- *bufio.Writer
- Conn *net.Conn
- Request *[]byte
- In *serviceCall
- Continues bool
- Upgrade bool
-}
-
-// WantsMore indicates if the calling client accepts more than one reply to this method call.
-func (c *Call) WantsMore() bool {
- return c.In.More
-}
-
-// WantsUpgrade indicates that the calling client wants the connection to be upgraded.
-func (c *Call) WantsUpgrade() bool {
- return c.In.Upgrade
-}
-
-// IsOneway indicate that the calling client does not expect a reply.
-func (c *Call) IsOneway() bool {
- return c.In.Oneway
-}
-
-// GetParameters retrieves the method call parameters.
-func (c *Call) GetParameters(p interface{}) error {
- if c.In.Parameters == nil {
- return fmt.Errorf("empty parameters")
- }
- return json.Unmarshal(*c.In.Parameters, p)
-}
-
-func (c *Call) sendMessage(r *serviceReply) error {
- if c.In.Oneway {
- return nil
- }
-
- b, e := json.Marshal(r)
- if e != nil {
- return e
- }
-
- b = append(b, 0)
- _, e = c.Writer.Write(b)
- if e != nil {
- if e == io.EOF {
- return io.ErrUnexpectedEOF
- }
- return e
- }
- e = c.Writer.Flush()
- if e == io.EOF {
- return io.ErrUnexpectedEOF
- }
- return e
-}
-
-// Reply sends a reply to this method call.
-func (c *Call) Reply(parameters interface{}) error {
- if !c.Continues {
- return c.sendMessage(&serviceReply{
- Parameters: parameters,
- })
- }
-
- if !c.In.More {
- return fmt.Errorf("call did not set more, it does not expect continues")
- }
-
- return c.sendMessage(&serviceReply{
- Continues: true,
- Parameters: parameters,
- })
-}
-
-// ReplyError sends an error reply to this method call.
-func (c *Call) ReplyError(name string, parameters interface{}) error {
- r := strings.LastIndex(name, ".")
- if r <= 0 {
- return fmt.Errorf("invalid error name")
- }
- if name[:r] == "org.varlink.service" {
- return fmt.Errorf("refused to send org.varlink.service errors")
- }
- return c.sendMessage(&serviceReply{
- Error: name,
- Parameters: parameters,
- })
-}
diff --git a/vendor/github.com/varlink/go/varlink/connection.go b/vendor/github.com/varlink/go/varlink/connection.go
deleted file mode 100644
index 596caa825..000000000
--- a/vendor/github.com/varlink/go/varlink/connection.go
+++ /dev/null
@@ -1,291 +0,0 @@
-package varlink
-
-import (
- "bufio"
- "encoding/json"
- "fmt"
- "io"
- "net"
- "strings"
-)
-
-// Message flags for Send(). More indicates that the client accepts more than one method
-// reply to this call. Oneway requests, that the service must not send a method reply to
-// this call. Continues indicates that the service will send more than one reply.
-const (
- More = 1 << iota
- Oneway = 1 << iota
- Continues = 1 << iota
- Upgrade = 1 << iota
-)
-
-// Error is a varlink error returned from a method call.
-type Error struct {
- Name string
- Parameters interface{}
-}
-
-func (e *Error) DispatchError() error {
- errorRawParameters := e.Parameters.(*json.RawMessage)
-
- switch e.Name {
- case "org.varlink.service.InterfaceNotFound":
- var param InterfaceNotFound
- if errorRawParameters != nil {
- err := json.Unmarshal(*errorRawParameters, &param)
- if err != nil {
- return e
- }
- }
- return &param
- case "org.varlink.service.MethodNotFound":
- var param MethodNotFound
- if errorRawParameters != nil {
- err := json.Unmarshal(*errorRawParameters, &param)
- if err != nil {
- return e
- }
- }
- return &param
- case "org.varlink.service.MethodNotImplemented":
- var param MethodNotImplemented
- if errorRawParameters != nil {
- err := json.Unmarshal(*errorRawParameters, &param)
- if err != nil {
- return e
- }
- }
- return &param
- case "org.varlink.service.InvalidParameter":
- var param InvalidParameter
- if errorRawParameters != nil {
- err := json.Unmarshal(*errorRawParameters, &param)
- if err != nil {
- return e
- }
- }
- return &param
- }
- return e
-}
-
-// Error returns the fully-qualified varlink error name.
-func (e *Error) Error() string {
- return e.Name
-}
-
-// Connection is a connection from a client to a service.
-type Connection struct {
- io.Closer
- address string
- conn net.Conn
- Reader *bufio.Reader
- Writer *bufio.Writer
-}
-
-// Send sends a method call. It returns a receive() function which is called to retrieve the method reply.
-// If Send() is called with the `More`flag and the receive() function carries the `Continues` flag, receive()
-// can be called multiple times to retrieve multiple replies.
-func (c *Connection) Send(method string, parameters interface{}, flags uint64) (func(interface{}) (uint64, error), error) {
- type call struct {
- Method string `json:"method"`
- Parameters interface{} `json:"parameters,omitempty"`
- More bool `json:"more,omitempty"`
- Oneway bool `json:"oneway,omitempty"`
- Upgrade bool `json:"upgrade,omitempty"`
- }
-
- if (flags&More != 0) && (flags&Oneway != 0) {
- return nil, &Error{
- Name: "org.varlink.InvalidParameter",
- Parameters: "oneway",
- }
- }
-
- if (flags&More != 0) && (flags&Upgrade != 0) {
- return nil, &Error{
- Name: "org.varlink.InvalidParameter",
- Parameters: "more",
- }
- }
-
- m := call{
- Method: method,
- Parameters: parameters,
- More: flags&More != 0,
- Oneway: flags&Oneway != 0,
- Upgrade: flags&Upgrade != 0,
- }
- b, err := json.Marshal(m)
- if err != nil {
- return nil, err
- }
-
- b = append(b, 0)
- _, err = c.Writer.Write(b)
- if err != nil {
- if err == io.EOF {
- return nil, io.ErrUnexpectedEOF
- }
- return nil, err
- }
-
- err = c.Writer.Flush()
- if err != nil {
- if err == io.EOF {
- return nil, io.ErrUnexpectedEOF
- }
- return nil, err
- }
-
- receive := func(out_parameters interface{}) (uint64, error) {
- type reply struct {
- Parameters *json.RawMessage `json:"parameters"`
- Continues bool `json:"continues"`
- Error string `json:"error"`
- }
-
- out, err := c.Reader.ReadBytes('\x00')
- if err != nil {
- if err == io.EOF {
- return 0, io.ErrUnexpectedEOF
- }
- return 0, err
- }
-
- var m reply
- err = json.Unmarshal(out[:len(out)-1], &m)
- if err != nil {
- return 0, err
- }
-
- if m.Error != "" {
- e := &Error{
- Name: m.Error,
- Parameters: m.Parameters,
- }
- return 0, e.DispatchError()
- }
-
- if m.Parameters != nil {
- json.Unmarshal(*m.Parameters, out_parameters)
- }
-
- if m.Continues {
- return Continues, nil
- }
-
- return 0, nil
- }
-
- return receive, nil
-}
-
-// Call sends a method call and returns the method reply.
-func (c *Connection) Call(method string, parameters interface{}, out_parameters interface{}) error {
- receive, err := c.Send(method, &parameters, 0)
- if err != nil {
- return err
- }
-
- _, err = receive(out_parameters)
- return err
-}
-
-// GetInterfaceDescription requests the interface description string from the service.
-func (c *Connection) GetInterfaceDescription(name string) (string, error) {
- type request struct {
- Interface string `json:"interface"`
- }
- type reply struct {
- Description string `json:"description"`
- }
-
- var r reply
- err := c.Call("org.varlink.service.GetInterfaceDescription", request{Interface: name}, &r)
- if err != nil {
- return "", err
- }
-
- return r.Description, nil
-}
-
-// GetInfo requests information about the service.
-func (c *Connection) GetInfo(vendor *string, product *string, version *string, url *string, interfaces *[]string) error {
- type reply struct {
- Vendor string `json:"vendor"`
- Product string `json:"product"`
- Version string `json:"version"`
- URL string `json:"url"`
- Interfaces []string `json:"interfaces"`
- }
-
- var r reply
- err := c.Call("org.varlink.service.GetInfo", nil, &r)
- if err != nil {
- return err
- }
-
- if vendor != nil {
- *vendor = r.Vendor
- }
- if product != nil {
- *product = r.Product
- }
- if version != nil {
- *version = r.Version
- }
- if url != nil {
- *url = r.URL
- }
- if interfaces != nil {
- *interfaces = r.Interfaces
- }
-
- return nil
-}
-
-// Close terminates the connection.
-func (c *Connection) Close() error {
- return c.conn.Close()
-}
-
-// NewConnection returns a new connection to the given address.
-func NewConnection(address string) (*Connection, error) {
- var err error
-
- words := strings.SplitN(address, ":", 2)
-
- if len(words) != 2 {
- return nil, fmt.Errorf("Protocol missing")
- }
-
- protocol := words[0]
- addr := words[1]
-
- // Ignore parameters after ';'
- words = strings.SplitN(addr, ";", 2)
- if words != nil {
- addr = words[0]
- }
-
- switch protocol {
- case "unix":
- break
-
- case "tcp":
- break
- }
-
- c := Connection{}
- c.conn, err = net.Dial(protocol, addr)
- if err != nil {
- return nil, err
- }
-
- c.address = address
- c.Reader = bufio.NewReader(c.conn)
- c.Writer = bufio.NewWriter(c.conn)
-
- return &c, nil
-}
diff --git a/vendor/github.com/varlink/go/varlink/doc.go b/vendor/github.com/varlink/go/varlink/doc.go
deleted file mode 100644
index de1ed2380..000000000
--- a/vendor/github.com/varlink/go/varlink/doc.go
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
-Package varlink provides varlink client and server implementations. See http://varlink.org
-for more information about varlink.
-
-Example varlink interface definition in a org.example.this.varlink file:
- interface org.example.this
-
- method Ping(in: string) -> (out: string)
-
-Generated Go module in a orgexamplethis/orgexamplethis.go file. The generated module
-provides reply methods for all methods specified in the varlink interface description.
-The stub implementations return a MethodNotImplemented error; the service implementation
-using this module will override the methods with its own implementation.
- // Generated with github.com/varlink/go/cmd/varlink-go-interface-generator
- package orgexamplethis
-
- import "github.com/varlink/go/varlink"
-
- type orgexamplethisInterface interface {
- Ping(c VarlinkCall, in string) error
- }
-
- type VarlinkCall struct{ varlink.Call }
-
- func (c *VarlinkCall) ReplyPing(out string) error {
- var out struct {
- Out string `json:"out,omitempty"`
- }
- out.Out = out
- return c.Reply(&out)
- }
-
- func (s *VarlinkInterface) Ping(c VarlinkCall, in string) error {
- return c.ReplyMethodNotImplemented("Ping")
- }
-
- [...]
-
-Service implementing the interface and its method:
- import ("orgexamplethis")
-
- type Data struct {
- orgexamplethis.VarlinkInterface
- data string
- }
-
- data := Data{data: "test"}
-
- func (d *Data) Ping(call orgexamplethis.VarlinkCall, ping string) error {
- return call.ReplyPing(ping)
- }
-
- service, _ = varlink.NewService(
- "Example",
- "This",
- "1",
- "https://example.org/this",
- )
-
- service.RegisterInterface(orgexamplethis.VarlinkNew(&data))
- err := service.Listen("unix:/run/org.example.this", 0)
-*/
-package varlink
diff --git a/vendor/github.com/varlink/go/varlink/idl/idl.go b/vendor/github.com/varlink/go/varlink/idl/idl.go
deleted file mode 100644
index b09b4798b..000000000
--- a/vendor/github.com/varlink/go/varlink/idl/idl.go
+++ /dev/null
@@ -1,497 +0,0 @@
-// Package idl provides a varlink interface description parser.
-package idl
-
-import (
- "bytes"
- "fmt"
- "regexp"
-)
-
-// Valid TypeKind values.
-const (
- TypeBool = iota
- TypeInt
- TypeFloat
- TypeString
- TypeObject
- TypeArray
- TypeMaybe
- TypeMap
- TypeStruct
- TypeEnum
- TypeAlias
-)
-
-// TypeKind specifies the type of an Type.
-type TypeKind uint
-
-// Type represents a varlink type. Types are method input and output parameters,
-// error output parameters, or custom defined types in the interface description.
-type Type struct {
- Kind TypeKind
- ElementType *Type
- Alias string
- Fields []TypeField
-}
-
-// TypeField is a named member of a TypeStruct.
-type TypeField struct {
- Name string
- Type *Type
-}
-
-// Alias represents a named Type in the interface description.
-type Alias struct {
- Name string
- Doc string
- Type *Type
-}
-
-// Method represents a method defined in the interface description.
-type Method struct {
- Name string
- Doc string
- In *Type
- Out *Type
-}
-
-// Error represents an error defined in the interface description.
-type Error struct {
- Name string
- Doc string
- Type *Type
-}
-
-// IDL represents a parsed varlink interface description with types, methods, errors and
-// documentation.
-type IDL struct {
- Name string
- Doc string
- Description string
- Members []interface{}
- Aliases []*Alias
- Methods []*Method
- Errors []*Error
-}
-
-type parser struct {
- input string
- position int
- lineStart int
- lastComment bytes.Buffer
-}
-
-func (p *parser) next() int {
- r := -1
-
- if p.position < len(p.input) {
- r = int(p.input[p.position])
- }
-
- p.position++
- return r
-}
-
-func (p *parser) backup() {
- p.position--
-}
-
-func (p *parser) advance() bool {
- for {
- char := p.next()
-
- if char == '\n' {
- p.lineStart = p.position
- p.lastComment.Reset()
-
- } else if char == ' ' || char == '\t' {
- // ignore
-
- } else if char == '#' {
- p.next()
- start := p.position
- for {
- c := p.next()
- if c < 0 || c == '\n' {
- p.backup()
- break
- }
- }
- if p.lastComment.Len() > 0 {
- p.lastComment.WriteByte('\n')
- }
- p.lastComment.WriteString(p.input[start:p.position])
- p.next()
-
- } else {
- p.backup()
- break
- }
- }
-
- return p.position < len(p.input)
-}
-
-func (p *parser) advanceOnLine() {
- for {
- char := p.next()
- if char != ' ' {
- p.backup()
- return
- }
- }
-}
-
-func (p *parser) readKeyword() string {
- start := p.position
-
- for {
- char := p.next()
- if char < 'a' || char > 'z' {
- p.backup()
- break
- }
- }
-
- return p.input[start:p.position]
-}
-
-func (p *parser) readInterfaceName() string {
- start := p.position
- dnrx := regexp.MustCompile(`^[a-z]+(\.[a-z0-9]+([-][a-z0-9]+)*)+`)
- name := dnrx.FindString(p.input[start:])
- if name != "" {
- if len(name) > 255 {
- return ""
- }
- p.position += len(name)
- return name
- }
- xdnrx := regexp.MustCompile(`^xn--[a-z0-9]+(\.[a-z0-9]+([-][a-z0-9]+)*)+`)
- name = xdnrx.FindString(p.input[start:])
- if name != "" {
- if len(name) > 255 {
- return ""
- }
- p.position += len(name)
- return name
- }
- return ""
-}
-
-func (p *parser) readFieldName() string {
- start := p.position
-
- char := p.next()
- if char < 'a' || char > 'z' {
- p.backup()
- return ""
- }
-
- for {
- char := p.next()
- if (char < 'A' || char > 'Z') && (char < 'a' || char > 'z') && (char < '0' || char > '9') && char != '_' {
- p.backup()
- break
- }
- }
-
- return p.input[start:p.position]
-}
-
-func (p *parser) readTypeName() string {
- start := p.position
-
- for {
- char := p.next()
- if (char < 'A' || char > 'Z') && (char < 'a' || char > 'z') && (char < '0' || char > '9') {
- p.backup()
- break
- }
- }
-
- return p.input[start:p.position]
-}
-
-func (p *parser) readStructType() *Type {
- if p.next() != '(' {
- p.backup()
- return nil
- }
-
- t := &Type{Kind: TypeStruct}
- t.Fields = make([]TypeField, 0)
-
- char := p.next()
- if char != ')' {
- p.backup()
-
- for {
- field := TypeField{}
-
- p.advance()
- field.Name = p.readFieldName()
- if field.Name == "" {
- return nil
- }
-
- p.advance()
-
- // Enums have no types, they are just a list of names
- if p.next() == ':' {
- if t.Kind == TypeEnum {
- return nil
- }
-
- p.advance()
- field.Type = p.readType()
- if field.Type == nil {
- return nil
- }
-
- } else {
- t.Kind = TypeEnum
- p.backup()
- }
-
- t.Fields = append(t.Fields, field)
-
- p.advance()
- char = p.next()
- if char != ',' {
- break
- }
- }
-
- if char != ')' {
- return nil
- }
- }
-
- return t
-}
-
-func (p *parser) readType() *Type {
- var t *Type
-
- switch p.next() {
- case '?':
- e := p.readType()
- if e == nil {
- return nil
- }
- if e.Kind == TypeMaybe {
- return nil
- }
- t = &Type{Kind: TypeMaybe, ElementType: e}
-
- case '[':
- var kind TypeKind
-
- switch p.readKeyword() {
- case "string":
- kind = TypeMap
-
- case "":
- kind = TypeArray
-
- default:
- return nil
- }
-
- if p.next() != ']' {
- return nil
- }
- e := p.readType()
- if e == nil {
- return nil
- }
- t = &Type{Kind: kind, ElementType: e}
-
- default:
- p.backup()
- if keyword := p.readKeyword(); keyword != "" {
- switch keyword {
- case "bool":
- t = &Type{Kind: TypeBool}
-
- case "int":
- t = &Type{Kind: TypeInt}
-
- case "float":
- t = &Type{Kind: TypeFloat}
-
- case "string":
- t = &Type{Kind: TypeString}
-
- case "object":
- t = &Type{Kind: TypeObject}
- }
-
- } else if name := p.readTypeName(); name != "" {
- t = &Type{Kind: TypeAlias, Alias: name}
-
- } else if t = p.readStructType(); t == nil {
- return nil
- }
- }
-
- return t
-}
-
-func (p *parser) readAlias(idl *IDL) (*Alias, error) {
- a := &Alias{}
-
- p.advance()
- a.Doc = p.lastComment.String()
- a.Name = p.readTypeName()
- if a.Name == "" {
- return nil, fmt.Errorf("missing type name")
- }
-
- p.advance()
- a.Type = p.readType()
- if a.Type == nil {
- return nil, fmt.Errorf("missing type declaration")
- }
-
- return a, nil
-}
-
-func (p *parser) readMethod(idl *IDL) (*Method, error) {
- m := &Method{}
-
- p.advance()
- m.Doc = p.lastComment.String()
- m.Name = p.readTypeName()
- if m.Name == "" {
- return nil, fmt.Errorf("missing method type")
- }
-
- p.advance()
- m.In = p.readType()
- if m.In == nil {
- return nil, fmt.Errorf("missing method input")
- }
-
- p.advance()
- one := p.next()
- two := p.next()
- if (one != '-') || two != '>' {
- return nil, fmt.Errorf("missing method '->' operator")
- }
-
- p.advance()
- m.Out = p.readType()
- if m.Out == nil {
- return nil, fmt.Errorf("missing method output")
- }
-
- return m, nil
-}
-
-func (p *parser) readError(idl *IDL) (*Error, error) {
- e := &Error{}
-
- p.advance()
- e.Doc = p.lastComment.String()
- e.Name = p.readTypeName()
- if e.Name == "" {
- return nil, fmt.Errorf("missing error name")
- }
-
- p.advanceOnLine()
- e.Type = p.readType()
-
- return e, nil
-}
-
-func (p *parser) readIDL() (*IDL, error) {
- if keyword := p.readKeyword(); keyword != "interface" {
- return nil, fmt.Errorf("missing interface keyword")
- }
-
- idl := &IDL{
- Members: make([]interface{}, 0),
- Aliases: make([]*Alias, 0),
- Methods: make([]*Method, 0),
- Errors: make([]*Error, 0),
- }
-
- p.advance()
- idl.Doc = p.lastComment.String()
- idl.Name = p.readInterfaceName()
- if idl.Name == "" {
- return nil, fmt.Errorf("interface name")
- }
-
- // Check for duplicates
- members := make(map[string]struct{}, 0)
-
- for {
- if !p.advance() {
- break
- }
-
- switch keyword := p.readKeyword(); keyword {
- case "type":
- a, err := p.readAlias(idl)
- if err != nil {
- return nil, err
- }
- if _, ok := members[a.Name]; ok {
- return nil, fmt.Errorf("type `%s` already defined", a.Name)
- }
- members[a.Name] = struct{}{}
- idl.Aliases = append(idl.Aliases, a)
- idl.Members = append(idl.Members, a)
-
- case "method":
- m, err := p.readMethod(idl)
- if err != nil {
- return nil, err
- }
- if _, ok := members[m.Name]; ok {
- return nil, fmt.Errorf("method `%s` already defined", m.Name)
- }
- members[m.Name] = struct{}{}
- idl.Methods = append(idl.Methods, m)
- idl.Members = append(idl.Members, m)
-
- case "error":
- e, err := p.readError(idl)
- if err != nil {
- return nil, err
- }
- if _, ok := members[e.Name]; ok {
- return nil, fmt.Errorf("error `%s` already defined", e.Name)
- }
- members[e.Name] = struct{}{}
- idl.Errors = append(idl.Errors, e)
- idl.Members = append(idl.Members, e)
-
- default:
- return nil, fmt.Errorf("unknown keyword '%s'", keyword)
- }
- }
-
- return idl, nil
-}
-
-// New parses a varlink interface description.
-func New(description string) (*IDL, error) {
- p := &parser{input: description}
-
- p.advance()
- idl, err := p.readIDL()
- if err != nil {
- return nil, err
- }
-
- if len(idl.Methods) == 0 {
- return nil, fmt.Errorf("no methods defined")
- }
-
- idl.Description = description
- return idl, nil
-}
diff --git a/vendor/github.com/varlink/go/varlink/orgvarlinkservice.go b/vendor/github.com/varlink/go/varlink/orgvarlinkservice.go
deleted file mode 100644
index 600c99d34..000000000
--- a/vendor/github.com/varlink/go/varlink/orgvarlinkservice.go
+++ /dev/null
@@ -1,162 +0,0 @@
-package varlink
-
-// The requested interface was not found.
-type InterfaceNotFound struct {
- Interface string `json:"interface"`
-}
-
-func (e InterfaceNotFound) Error() string {
- return "org.varlink.service.InterfaceNotFound"
-}
-
-// The requested method was not found
-type MethodNotFound struct {
- Method string `json:"method"`
-}
-
-func (e MethodNotFound) Error() string {
- return "org.varlink.service.MethodNotFound"
-}
-
-// The interface defines the requested method, but the service does not
-// implement it.
-type MethodNotImplemented struct {
- Method string `json:"method"`
-}
-
-func (e MethodNotImplemented) Error() string {
- return "org.varlink.service.MethodNotImplemented"
-}
-
-// One of the passed parameters is invalid.
-type InvalidParameter struct {
- Parameter string `json:"parameter"`
-}
-
-func (e InvalidParameter) Error() string {
- return "org.varlink.service.InvalidParameter"
-}
-
-func doReplyError(c *Call, name string, parameters interface{}) error {
- return c.sendMessage(&serviceReply{
- Error: name,
- Parameters: parameters,
- })
-}
-
-// ReplyInterfaceNotFound sends a org.varlink.service errror reply to this method call
-func (c *Call) ReplyInterfaceNotFound(interfaceA string) error {
- var out InterfaceNotFound
- out.Interface = interfaceA
- return doReplyError(c, "org.varlink.service.InterfaceNotFound", &out)
-}
-
-// ReplyMethodNotFound sends a org.varlink.service errror reply to this method call
-func (c *Call) ReplyMethodNotFound(method string) error {
- var out MethodNotFound
- out.Method = method
- return doReplyError(c, "org.varlink.service.MethodNotFound", &out)
-}
-
-// ReplyMethodNotImplemented sends a org.varlink.service errror reply to this method call
-func (c *Call) ReplyMethodNotImplemented(method string) error {
- var out MethodNotImplemented
- out.Method = method
- return doReplyError(c, "org.varlink.service.MethodNotImplemented", &out)
-}
-
-// ReplyInvalidParameter sends a org.varlink.service errror reply to this method call
-func (c *Call) ReplyInvalidParameter(parameter string) error {
- var out InvalidParameter
- out.Parameter = parameter
- return doReplyError(c, "org.varlink.service.InvalidParameter", &out)
-}
-
-func (c *Call) replyGetInfo(vendor string, product string, version string, url string, interfaces []string) error {
- var out struct {
- Vendor string `json:"vendor,omitempty"`
- Product string `json:"product,omitempty"`
- Version string `json:"version,omitempty"`
- URL string `json:"url,omitempty"`
- Interfaces []string `json:"interfaces,omitempty"`
- }
- out.Vendor = vendor
- out.Product = product
- out.Version = version
- out.URL = url
- out.Interfaces = interfaces
- return c.Reply(&out)
-}
-
-func (c *Call) replyGetInterfaceDescription(description string) error {
- var out struct {
- Description string `json:"description,omitempty"`
- }
- out.Description = description
- return c.Reply(&out)
-}
-
-func (s *Service) orgvarlinkserviceDispatch(c Call, methodname string) error {
- switch methodname {
- case "GetInfo":
- return s.getInfo(c)
- case "GetInterfaceDescription":
- var in struct {
- Interface string `json:"interface"`
- }
- err := c.GetParameters(&in)
- if err != nil {
- return c.ReplyInvalidParameter("parameters")
- }
- return s.getInterfaceDescription(c, in.Interface)
-
- default:
- return c.ReplyMethodNotFound(methodname)
- }
-}
-
-func (s *orgvarlinkserviceInterface) VarlinkDispatch(call Call, methodname string) error {
- return nil
-}
-
-func (s *orgvarlinkserviceInterface) VarlinkGetName() string {
- return `org.varlink.service`
-}
-
-func (s *orgvarlinkserviceInterface) VarlinkGetDescription() string {
- return `# The Varlink Service Interface is provided by every varlink service. It
-# describes the service and the interfaces it implements.
-interface org.varlink.service
-
-# Get a list of all the interfaces a service provides and information
-# about the implementation.
-method GetInfo() -> (
- vendor: string,
- product: string,
- version: string,
- url: string,
- interfaces: []string
-)
-
-# Get the description of an interface that is implemented by this service.
-method GetInterfaceDescription(interface: string) -> (description: string)
-
-# The requested interface was not found.
-error InterfaceNotFound (interface: string)
-
-# The requested method was not found
-error MethodNotFound (method: string)
-
-# The interface defines the requested method, but the service does not
-# implement it.
-error MethodNotImplemented (method: string)
-
-# One of the passed parameters is invalid.
-error InvalidParameter (parameter: string)`
-}
-
-type orgvarlinkserviceInterface struct{}
-
-func orgvarlinkserviceNew() *orgvarlinkserviceInterface {
- return &orgvarlinkserviceInterface{}
-}
diff --git a/vendor/github.com/varlink/go/varlink/resolver.go b/vendor/github.com/varlink/go/varlink/resolver.go
deleted file mode 100644
index f0f4487d2..000000000
--- a/vendor/github.com/varlink/go/varlink/resolver.go
+++ /dev/null
@@ -1,92 +0,0 @@
-package varlink
-
-// ResolverAddress is the well-known address of the varlink interface resolver,
-// it translates varlink interface names to varlink service addresses.
-const ResolverAddress = "unix:/run/org.varlink.resolver"
-
-// Resolver resolves varlink interface names to varlink addresses
-type Resolver struct {
- address string
- conn *Connection
-}
-
-// Resolve resolves a varlink interface name to a varlink address.
-func (r *Resolver) Resolve(iface string) (string, error) {
- type request struct {
- Interface string `json:"interface"`
- }
- type reply struct {
- Address string `json:"address"`
- }
-
- /* don't ask the resolver for itself */
- if iface == "org.varlink.resolver" {
- return r.address, nil
- }
-
- var rep reply
- err := r.conn.Call("org.varlink.resolver.Resolve", &request{Interface: iface}, &rep)
- if err != nil {
- return "", err
- }
-
- return rep.Address, nil
-}
-
-// GetInfo requests information about the resolver.
-func (r *Resolver) GetInfo(vendor *string, product *string, version *string, url *string, interfaces *[]string) error {
- type reply struct {
- Vendor string
- Product string
- Version string
- URL string
- Interfaces []string
- }
-
- var rep reply
- err := r.conn.Call("org.varlink.resolver.GetInfo", nil, &rep)
- if err != nil {
- return err
- }
-
- if vendor != nil {
- *vendor = rep.Vendor
- }
- if product != nil {
- *product = rep.Product
- }
- if version != nil {
- *version = rep.Version
- }
- if url != nil {
- *url = rep.URL
- }
- if interfaces != nil {
- *interfaces = rep.Interfaces
- }
-
- return nil
-}
-
-// Close terminates the resolver.
-func (r *Resolver) Close() error {
- return r.conn.Close()
-}
-
-// NewResolver returns a new resolver connected to the given address.
-func NewResolver(address string) (*Resolver, error) {
- if address == "" {
- address = ResolverAddress
- }
-
- c, err := NewConnection(address)
- if err != nil {
- return nil, err
- }
- r := Resolver{
- address: address,
- conn: c,
- }
-
- return &r, nil
-}
diff --git a/vendor/github.com/varlink/go/varlink/service.go b/vendor/github.com/varlink/go/varlink/service.go
deleted file mode 100644
index bf13aa1de..000000000
--- a/vendor/github.com/varlink/go/varlink/service.go
+++ /dev/null
@@ -1,375 +0,0 @@
-package varlink
-
-import (
- "bufio"
- "encoding/json"
- "fmt"
- "net"
- "os"
- "strings"
- "sync"
- "time"
-)
-
-type dispatcher interface {
- VarlinkDispatch(c Call, methodname string) error
- VarlinkGetName() string
- VarlinkGetDescription() string
-}
-
-type serviceCall struct {
- Method string `json:"method"`
- Parameters *json.RawMessage `json:"parameters,omitempty"`
- More bool `json:"more,omitempty"`
- Oneway bool `json:"oneway,omitempty"`
- Upgrade bool `json:"upgrade,omitempty"`
-}
-
-type serviceReply struct {
- Parameters interface{} `json:"parameters,omitempty"`
- Continues bool `json:"continues,omitempty"`
- Error string `json:"error,omitempty"`
-}
-
-// Service represents an active varlink service. In addition to the registered custom varlink Interfaces, every service
-// implements the org.varlink.service interface which allows clients to retrieve information about the
-// running service.
-type Service struct {
- vendor string
- product string
- version string
- url string
- interfaces map[string]dispatcher
- names []string
- descriptions map[string]string
- running bool
- listener net.Listener
- conncounter int64
- mutex sync.Mutex
- protocol string
- address string
-}
-
-// ServiceTimoutError helps API users to special-case timeouts.
-type ServiceTimeoutError struct{}
-
-func (ServiceTimeoutError) Error() string {
- return "service timeout"
-}
-
-func (s *Service) getInfo(c Call) error {
- return c.replyGetInfo(s.vendor, s.product, s.version, s.url, s.names)
-}
-
-func (s *Service) getInterfaceDescription(c Call, name string) error {
- if name == "" {
- return c.ReplyInvalidParameter("interface")
- }
-
- description, ok := s.descriptions[name]
- if !ok {
- return c.ReplyInvalidParameter("interface")
- }
-
- return c.replyGetInterfaceDescription(description)
-}
-
-func (s *Service) HandleMessage(conn *net.Conn, reader *bufio.Reader, writer *bufio.Writer, request []byte) error {
- var in serviceCall
-
- err := json.Unmarshal(request, &in)
-
- if err != nil {
- return err
- }
-
- c := Call{
- Conn: conn,
- Reader: reader,
- Writer: writer,
- In: &in,
- Request: &request,
- }
-
- r := strings.LastIndex(in.Method, ".")
- if r <= 0 {
- return c.ReplyInvalidParameter("method")
- }
-
- interfacename := in.Method[:r]
- methodname := in.Method[r+1:]
-
- if interfacename == "org.varlink.service" {
- return s.orgvarlinkserviceDispatch(c, methodname)
- }
-
- // Find the interface and method in our service
- iface, ok := s.interfaces[interfacename]
- if !ok {
- return c.ReplyInterfaceNotFound(interfacename)
- }
-
- return iface.VarlinkDispatch(c, methodname)
-}
-
-// Shutdown shuts down the listener of a running service.
-func (s *Service) Shutdown() {
- s.running = false
- s.mutex.Lock()
- if s.listener != nil {
- s.listener.Close()
- }
- s.mutex.Unlock()
-}
-
-func (s *Service) handleConnection(conn net.Conn, wg *sync.WaitGroup) {
- defer func() { s.mutex.Lock(); s.conncounter--; s.mutex.Unlock(); wg.Done() }()
- reader := bufio.NewReader(conn)
- writer := bufio.NewWriter(conn)
-
- for {
- request, err := reader.ReadBytes('\x00')
- if err != nil {
- break
- }
-
- err = s.HandleMessage(&conn, reader, writer, request[:len(request)-1])
- if err != nil {
- // FIXME: report error
- //fmt.Fprintf(os.Stderr, "handleMessage: %v", err)
- break
- }
- }
-
- conn.Close()
-}
-
-func (s *Service) teardown() {
- s.mutex.Lock()
- s.listener = nil
- s.running = false
- s.protocol = ""
- s.address = ""
- s.mutex.Unlock()
-}
-
-func (s *Service) parseAddress(address string) error {
- words := strings.SplitN(address, ":", 2)
- if len(words) != 2 {
- return fmt.Errorf("Unknown protocol")
- }
-
- s.protocol = words[0]
- s.address = words[1]
-
- // Ignore parameters after ';'
- words = strings.SplitN(s.address, ";", 2)
- if words != nil {
- s.address = words[0]
- }
-
- switch s.protocol {
- case "unix":
- break
- case "tcp":
- break
-
- default:
- return fmt.Errorf("Unknown protocol")
- }
-
- return nil
-}
-
-func (s *Service) GetListener() (*net.Listener, error) {
- s.mutex.Lock()
- l := s.listener
- s.mutex.Unlock()
- return &l, nil
-}
-
-func (s *Service) setListener() error {
- l := activationListener()
- if l == nil {
- if s.protocol == "unix" && s.address[0] != '@' {
- os.Remove(s.address)
- }
-
- var err error
- l, err = net.Listen(s.protocol, s.address)
- if err != nil {
- return err
- }
-
- if s.protocol == "unix" && s.address[0] != '@' {
- l.(*net.UnixListener).SetUnlinkOnClose(true)
- }
- }
-
- s.mutex.Lock()
- s.listener = l
- s.mutex.Unlock()
-
- return nil
-}
-
-func (s *Service) refreshTimeout(timeout time.Duration) error {
- switch l := s.listener.(type) {
- case *net.UnixListener:
- if err := l.SetDeadline(time.Now().Add(timeout)); err != nil {
- return err
- }
- case *net.TCPListener:
- if err := l.SetDeadline(time.Now().Add(timeout)); err != nil {
- return err
- }
-
- }
- return nil
-}
-
-// Listen starts a Service.
-func (s *Service) Bind(address string) error {
- s.mutex.Lock()
- if s.running {
- s.mutex.Unlock()
- return fmt.Errorf("Init(): already running")
- }
- s.mutex.Unlock()
-
- s.parseAddress(address)
-
- err := s.setListener()
- if err != nil {
- return err
- }
- return nil
-}
-
-// Listen starts a Service.
-func (s *Service) Listen(address string, timeout time.Duration) error {
- var wg sync.WaitGroup
- defer func() { s.teardown(); wg.Wait() }()
-
- err := s.Bind(address)
- if err != nil {
- return err
- }
-
- s.mutex.Lock()
- s.running = true
- l := s.listener
- s.mutex.Unlock()
-
- for s.running {
- if timeout != 0 {
- if err := s.refreshTimeout(timeout); err != nil {
- return err
- }
- }
- conn, err := l.Accept()
- if err != nil {
- if err.(net.Error).Timeout() {
- s.mutex.Lock()
- if s.conncounter == 0 {
- s.mutex.Unlock()
- return ServiceTimeoutError{}
- }
- s.mutex.Unlock()
- continue
- }
- if !s.running {
- return nil
- }
- return err
- }
- s.mutex.Lock()
- s.conncounter++
- s.mutex.Unlock()
- wg.Add(1)
- go s.handleConnection(conn, &wg)
- }
-
- return nil
-}
-
-// Listen starts a Service.
-func (s *Service) DoListen(timeout time.Duration) error {
- var wg sync.WaitGroup
- defer func() { s.teardown(); wg.Wait() }()
-
- s.mutex.Lock()
- l := s.listener
- s.mutex.Unlock()
-
- if l == nil {
- return fmt.Errorf("No listener set")
- }
-
- s.mutex.Lock()
- s.running = true
- s.mutex.Unlock()
-
- for s.running {
- if timeout != 0 {
- if err := s.refreshTimeout(timeout); err != nil {
- return err
- }
- }
- conn, err := l.Accept()
- if err != nil {
- if err.(net.Error).Timeout() {
- s.mutex.Lock()
- if s.conncounter == 0 {
- s.mutex.Unlock()
- return ServiceTimeoutError{}
- }
- s.mutex.Unlock()
- continue
- }
- if !s.running {
- return nil
- }
- return err
- }
- s.mutex.Lock()
- s.conncounter++
- s.mutex.Unlock()
- wg.Add(1)
- go s.handleConnection(conn, &wg)
- }
-
- return nil
-}
-
-// RegisterInterface registers a varlink.Interface containing struct to the Service
-func (s *Service) RegisterInterface(iface dispatcher) error {
- name := iface.VarlinkGetName()
- if _, ok := s.interfaces[name]; ok {
- return fmt.Errorf("interface '%s' already registered", name)
- }
-
- if s.running {
- return fmt.Errorf("service is already running")
- }
- s.interfaces[name] = iface
- s.descriptions[name] = iface.VarlinkGetDescription()
- s.names = append(s.names, name)
-
- return nil
-}
-
-// NewService creates a new Service which implements the list of given varlink interfaces.
-func NewService(vendor string, product string, version string, url string) (*Service, error) {
- s := Service{
- vendor: vendor,
- product: product,
- version: version,
- url: url,
- interfaces: make(map[string]dispatcher),
- descriptions: make(map[string]string),
- }
- err := s.RegisterInterface(orgvarlinkserviceNew())
-
- return &s, err
-}
diff --git a/vendor/github.com/varlink/go/varlink/socketactivation.go b/vendor/github.com/varlink/go/varlink/socketactivation.go
deleted file mode 100644
index a64c0dc8e..000000000
--- a/vendor/github.com/varlink/go/varlink/socketactivation.go
+++ /dev/null
@@ -1,63 +0,0 @@
-// +build !windows
-
-package varlink
-
-import (
- "net"
- "os"
- "strconv"
- "strings"
- "syscall"
-)
-
-func activationListener() net.Listener {
- pid, err := strconv.Atoi(os.Getenv("LISTEN_PID"))
- if err != nil || pid != os.Getpid() {
- return nil
- }
-
- nfds, err := strconv.Atoi(os.Getenv("LISTEN_FDS"))
- if err != nil || nfds < 1 {
- return nil
- }
-
- fd := -1
-
- // If more than one file descriptor is passed, find the
- // "varlink" tag. The first file descriptor is always 3.
- if nfds > 1 {
- fdnames, set := os.LookupEnv("LISTEN_FDNAMES")
- if !set {
- return nil
- }
-
- names := strings.Split(fdnames, ":")
- if len(names) != nfds {
- return nil
- }
-
- for i, name := range names {
- if name == "varlink" {
- fd = 3 + i
- break
- }
- }
-
- if fd < 0 {
- return nil
- }
-
- } else {
- fd = 3
- }
-
- syscall.CloseOnExec(fd)
-
- file := os.NewFile(uintptr(fd), "varlink")
- listener, err := net.FileListener(file)
- if err != nil {
- return nil
- }
-
- return listener
-}
diff --git a/vendor/github.com/varlink/go/varlink/socketactivation_windows.go b/vendor/github.com/varlink/go/varlink/socketactivation_windows.go
deleted file mode 100644
index fb0894531..000000000
--- a/vendor/github.com/varlink/go/varlink/socketactivation_windows.go
+++ /dev/null
@@ -1,7 +0,0 @@
-package varlink
-
-import "net"
-
-func activationListener() net.Listener {
- return nil
-}
diff --git a/vendor/modules.txt b/vendor/modules.txt
index 557fe263f..0c6b4de57 100644
--- a/vendor/modules.txt
+++ b/vendor/modules.txt
@@ -67,7 +67,7 @@ github.com/containernetworking/plugins/pkg/utils/hwaddr
github.com/containernetworking/plugins/pkg/utils/sysctl
github.com/containernetworking/plugins/plugins/ipam/host-local/backend
github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator
-# github.com/containers/buildah v1.18.0
+# github.com/containers/buildah v1.18.1-0.20201125084616-dd26b137459c
github.com/containers/buildah
github.com/containers/buildah/bind
github.com/containers/buildah/chroot
@@ -84,9 +84,7 @@ github.com/containers/buildah/pkg/manifests
github.com/containers/buildah/pkg/overlay
github.com/containers/buildah/pkg/parse
github.com/containers/buildah/pkg/rusage
-github.com/containers/buildah/pkg/secrets
github.com/containers/buildah/pkg/supplemented
-github.com/containers/buildah/pkg/umask
github.com/containers/buildah/util
# github.com/containers/common v0.29.0
github.com/containers/common/pkg/apparmor
@@ -100,7 +98,9 @@ github.com/containers/common/pkg/report
github.com/containers/common/pkg/report/camelcase
github.com/containers/common/pkg/retry
github.com/containers/common/pkg/seccomp
+github.com/containers/common/pkg/subscriptions
github.com/containers/common/pkg/sysinfo
+github.com/containers/common/pkg/umask
github.com/containers/common/version
# github.com/containers/conmon v2.0.20+incompatible
github.com/containers/conmon/runner/config
@@ -549,10 +549,6 @@ github.com/ulikunitz/xz
github.com/ulikunitz/xz/internal/hash
github.com/ulikunitz/xz/internal/xlog
github.com/ulikunitz/xz/lzma
-# github.com/varlink/go v0.0.0-20190502142041-0f1d566d194b
-github.com/varlink/go/cmd/varlink-go-interface-generator
-github.com/varlink/go/varlink
-github.com/varlink/go/varlink/idl
# github.com/vbatts/tar-split v0.11.1
github.com/vbatts/tar-split/archive/tar
github.com/vbatts/tar-split/tar/asm