summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CONTRIBUTING.md21
-rw-r--r--Makefile2
-rw-r--r--OWNERS5
-rw-r--r--README.md4
-rw-r--r--RELEASE_NOTES.md48
-rw-r--r--changelog.txt130
-rw-r--r--cmd/podman/images.go6
-rw-r--r--cmd/podman/kill.go23
-rw-r--r--cmd/podman/pause.go17
-rw-r--r--cmd/podman/restart.go16
-rw-r--r--cmd/podman/rm.go26
-rw-r--r--cmd/podman/shared/parallel.go10
-rw-r--r--cmd/podman/stop.go23
-rw-r--r--cmd/podman/unpause.go18
-rw-r--r--cmd/podman/utils.go17
-rw-r--r--contrib/cirrus/lib.sh3
-rw-r--r--contrib/gate/Dockerfile69
-rw-r--r--contrib/gate/README.md4
-rwxr-xr-xcontrib/gate/entrypoint.sh15
-rw-r--r--contrib/spec/podman.spec.in12
-rw-r--r--docs/podman-container.1.md1
-rw-r--r--docs/podman-images.1.md44
-rw-r--r--docs/podman-rm.1.md19
-rw-r--r--docs/podman.1.md11
-rw-r--r--docs/tutorials/podman_tutorial.md99
-rw-r--r--install.md2
-rw-r--r--libpod/container_api.go7
-rw-r--r--libpod/container_internal_linux.go58
-rw-r--r--libpod/info.go2
-rw-r--r--libpod/networking_linux.go11
-rw-r--r--libpod/oci_linux.go3
-rw-r--r--libpod/runtime_ctr.go14
-rw-r--r--pkg/rootless/rootless_linux.go14
-rw-r--r--pkg/util/utils.go8
-rw-r--r--test/e2e/pause_test.go19
-rw-r--r--troubleshooting.md60
-rw-r--r--vendor.conf4
-rw-r--r--vendor/github.com/containers/storage/README.md2
-rw-r--r--vendor/github.com/containers/storage/drivers/aufs/aufs.go2
-rw-r--r--vendor/github.com/containers/storage/drivers/overlay/overlay.go19
-rw-r--r--vendor/github.com/containers/storage/drivers/zfs/zfs.go2
-rw-r--r--vendor/github.com/containers/storage/layers.go12
-rw-r--r--vendor/github.com/containers/storage/pkg/archive/example_changes.go97
-rw-r--r--vendor/github.com/containers/storage/pkg/idtools/parser.go56
-rw-r--r--vendor/github.com/containers/storage/store.go62
-rw-r--r--vendor/github.com/containers/storage/vendor.conf4
-rw-r--r--vendor/github.com/ostreedev/ostree-go/pkg/otadmin/admin.go0
-rw-r--r--vendor/github.com/ostreedev/ostree-go/pkg/otadmin/admin.go.h0
-rw-r--r--vendor/github.com/ostreedev/ostree-go/pkg/otadmin/admincleanup.go0
-rw-r--r--vendor/github.com/ostreedev/ostree-go/pkg/otadmin/admindeploy.go0
-rw-r--r--vendor/github.com/ostreedev/ostree-go/pkg/otadmin/admindiff.go0
-rw-r--r--vendor/github.com/ostreedev/ostree-go/pkg/otadmin/admininit.go0
-rw-r--r--vendor/github.com/ostreedev/ostree-go/pkg/otadmin/admininstutil.go0
-rw-r--r--vendor/github.com/ostreedev/ostree-go/pkg/otadmin/adminosinit.go0
-rw-r--r--vendor/github.com/ostreedev/ostree-go/pkg/otadmin/adminsetorigin.go0
-rw-r--r--vendor/github.com/ostreedev/ostree-go/pkg/otadmin/adminstatus.go0
-rw-r--r--vendor/github.com/ostreedev/ostree-go/pkg/otadmin/adminswitch.go0
-rw-r--r--vendor/github.com/ostreedev/ostree-go/pkg/otadmin/adminundeploy.go0
-rw-r--r--vendor/github.com/ostreedev/ostree-go/pkg/otadmin/adminunlock.go0
-rw-r--r--vendor/github.com/ostreedev/ostree-go/pkg/otadmin/adminupgrade.go0
-rw-r--r--vendor/github.com/ostreedev/ostree-go/pkg/otbuiltin/builtin.go94
-rw-r--r--vendor/github.com/ostreedev/ostree-go/pkg/otbuiltin/builtin.go.h12
-rw-r--r--vendor/github.com/ostreedev/ostree-go/pkg/otbuiltin/cat.go1
-rw-r--r--vendor/github.com/ostreedev/ostree-go/pkg/otbuiltin/checkout.go96
-rw-r--r--vendor/github.com/ostreedev/ostree-go/pkg/otbuiltin/checksum.go1
-rw-r--r--vendor/github.com/ostreedev/ostree-go/pkg/otbuiltin/commit.go15
-rw-r--r--vendor/github.com/ostreedev/ostree-go/pkg/otbuiltin/config.go1
-rw-r--r--vendor/github.com/ostreedev/ostree-go/pkg/otbuiltin/diff.go1
-rw-r--r--vendor/github.com/ostreedev/ostree-go/pkg/otbuiltin/export.go1
-rw-r--r--vendor/github.com/ostreedev/ostree-go/pkg/otbuiltin/fsck.go1
-rw-r--r--vendor/github.com/ostreedev/ostree-go/pkg/otbuiltin/gpgsign.go1
-rw-r--r--vendor/github.com/ostreedev/ostree-go/pkg/otbuiltin/init.go72
-rw-r--r--vendor/github.com/ostreedev/ostree-go/pkg/otbuiltin/log.go110
-rw-r--r--vendor/github.com/ostreedev/ostree-go/pkg/otbuiltin/ls.go1
-rw-r--r--vendor/github.com/ostreedev/ostree-go/pkg/otbuiltin/prune.go4
-rw-r--r--vendor/github.com/ostreedev/ostree-go/pkg/otbuiltin/pull.go1
-rw-r--r--vendor/github.com/ostreedev/ostree-go/pkg/otbuiltin/pulllocal.go1
-rw-r--r--vendor/github.com/ostreedev/ostree-go/pkg/otbuiltin/refs.go1
-rw-r--r--vendor/github.com/ostreedev/ostree-go/pkg/otbuiltin/remote.go1
-rw-r--r--vendor/github.com/ostreedev/ostree-go/pkg/otbuiltin/reset.go1
-rw-r--r--vendor/github.com/ostreedev/ostree-go/pkg/otbuiltin/revparse.go1
-rw-r--r--vendor/github.com/ostreedev/ostree-go/pkg/otbuiltin/show.go1
-rw-r--r--vendor/github.com/ostreedev/ostree-go/pkg/otbuiltin/staticdelta.go1
-rw-r--r--vendor/github.com/ostreedev/ostree-go/pkg/otbuiltin/summary.go1
-rw-r--r--vendor/github.com/ostreedev/ostree-go/pkg/otbuiltin/trivialhttpd.go1
-rw-r--r--vendor/github.com/ostreedev/ostree-go/pkg/otremote/remote.go.h0
-rw-r--r--vendor/github.com/ostreedev/ostree-go/pkg/otremote/remoteadd.go0
-rw-r--r--vendor/github.com/ostreedev/ostree-go/pkg/otremote/remotedelete.go0
-rw-r--r--vendor/github.com/ostreedev/ostree-go/pkg/otremote/remotegpgimport.go0
-rw-r--r--vendor/github.com/ostreedev/ostree-go/pkg/otremote/remotelist.go0
-rw-r--r--vendor/github.com/ostreedev/ostree-go/pkg/otremote/remoterefs.go0
-rw-r--r--vendor/github.com/ostreedev/ostree-go/pkg/otremote/remoteshowurl.go0
-rw-r--r--vendor/github.com/ostreedev/ostree-go/pkg/otremote/remotesummary.go0
-rw-r--r--version/version.go2
94 files changed, 926 insertions, 598 deletions
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index c4e208894..8e921dcf3 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -180,6 +180,27 @@ Use your real name (sorry, no pseudonyms or anonymous contributions.)
If you set your `user.name` and `user.email` git configs, you can sign your
commit automatically with `git commit -s`.
+### Go Format and lint
+
+All code changes must pass ``make validate`` and ``make lint``, as
+executed in a standard container. The container image for this
+purpose is provided at: ``quay.io/libpod/gate:latest``. However,
+for changes to the image itself, it may also be built locally
+from the repository root, with the command:
+
+```
+sudo podman build -t quay.io/libpod/gate:latest -f contrib/gate/Dockerfile .
+```
+
+The container executes 'make' by default, on a copy of the repository.
+This avoids changing or leaving build artifacts in your working directory.
+Execution does not require any special permissions from the host. However,
+the repository root must be bind-mounted into the container at
+'/usr/src/libpod'. For example, running `make lint` is done (from
+the repository root) with the command:
+
+``sudo podman run -it --rm -v $PWD:/usr/src/libpod:z quay.io/libpod/gate:latest lint``
+
### Integration Tests
Our primary means of performing integration testing for libpod is with the
diff --git a/Makefile b/Makefile
index ae1b263ad..d1fa65f23 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,6 @@
GO ?= go
DESTDIR ?= /
-EPOCH_TEST_COMMIT ?= 733cfe96819e1dc044e982b5321b3c902d1a47c6
+EPOCH_TEST_COMMIT ?= 1b52843cfd2ae254a6e52c74e564730f1c875c4c
HEAD ?= HEAD
CHANGELOG_BASE ?= HEAD~
CHANGELOG_TARGET ?= HEAD
diff --git a/OWNERS b/OWNERS
index 00f8bb1c3..a03622b2e 100644
--- a/OWNERS
+++ b/OWNERS
@@ -3,9 +3,14 @@ approvers:
- baude
- mrunalp
- rhatdan
+ - TomSweeneyRedHat
+ - umohnani8
+ - giuseppe
+ - vrothberg
reviewers:
- mheon
- baude
+ - mrunalp
- rhatdan
- TomSweeneyRedHat
- umohnani8
diff --git a/README.md b/README.md
index 157e94d7c..9cfb5b14c 100644
--- a/README.md
+++ b/README.md
@@ -1,9 +1,11 @@
![PODMAN logo](logo/podman-logo-source.svg)
# libpod - library for running OCI-based containers in Pods
-### Latest Version: 0.10.1.3
+### Latest Version: 0.11.1.1
### Status: Active Development
+### Continuous Integration: [![Build Status](https://api.cirrus-ci.com/github/containers/libpod.svg)](https://cirrus-ci.com/github/containers/libpod)
+
## What is the scope of this project?
libpod provides a library for applications looking to use the Container Pod concept popularized by Kubernetes.
diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md
index 6c7bf1a8f..05854c8d7 100644
--- a/RELEASE_NOTES.md
+++ b/RELEASE_NOTES.md
@@ -1,5 +1,53 @@
# Release Notes
+## 0.11.1.1
+### Bugfixes
+- Fixed a bug where Podman was not correctly adding firewall rules for containers, preventing them from accessing the network
+- Fixed a bug where full error messages were being lost when creating containers with user namespaces
+- Fixed a bug where container state was not properly updated if a failure occurred during network setup, which could cause mounts to be left behind when the container was removed
+- Fixed a bug where `podman exec` could time out on slower systems by increasing the relevant timeout
+
+### Misc
+- `podman rm -f` now removes paused containers. As such, `podman rm -af` completing successfully guarantees all Podman containers have been removed
+- Added a field to `podman info` to show if Podman is being run as rootless
+- Made a small output format change to `podman images` - image sizes now feature a space between number and unit (e.g. `123 MB` now instead of `123MB`)
+- Vendored an updated version of `containers/storage` to fix several bugs reported upstream
+
+## 0.11.1
+### Features
+- Added `--all` and `--latest` flags to `podman checkpoint` and `podman restore`
+- Added `--max-workers` flag to all Podman commands that support operating in parallel, allowing the maximum number of parallel workers used to be specified
+- Added `--all` flag to `podman restart`
+
+### Bugfixes
+- Fixed a bug where `podman port -l` would segfault if no containers were present
+- Fixed a bug where `podman stats -a` would error if containers were present but not running
+- Fixed a bug where container status checks would sometimes leave zombie OCI runtime processes
+- Fixed checkpoint and restore code to verify an appropriate version of `criu` is being used
+- Fixed a bug where environment variables with no specified value (e.g. `-e FOO`) caused errors (they are now added as empty)
+- Fixed a bug where rootless Podman would attempt to configure the system firewall, causing errors on some systems where iptables is not in the user's PATH
+- Fixed a bug where rootless Podman was unable to successfully write the container ID to a file when `--cid-file` was specified to `podman run`
+- Fixed a bug where `podman unmount` would refuse to unmount a container if it was running (the unmount will now be deferred until the container stops)
+- Fixed a bug where rootless `podman attach` would fail to attach due to a too-long path name
+- Fixed a bug where `podman info` was not properly reporting the Git commit Podman was built from
+- Fixed a bug where `podman run --interactive` was not holding STDIN open when `-a` flag was specified
+- Fixed a bug where Podman with the `cgroupfs` CGroup driver was sometimes not successfully removing pod CGroups
+- Fixed a bug where rootless Podman was unable to run systemd containers (note that this also requires an update to systemd)
+- Fixed a bug where `podman run` with the `--user` flag would fail if the container image did not contain `/etc/passwd` or `/etc/group`
+
+### Misc
+- `podman rm`, `podman restart`, `podman kill`, `podman pause`, and `podman unpause` now operate in parallel, greatly improving speed when multiple containers are specified
+- `podman create`, `podman run`, and `podman ps` have a number of improvements which should greatly increase their speed
+- Greatly improved performance and reduced memory utilization of container status checks, which should improve the speed of most Podman commands
+- Improve ability of `podman runlabel` to run commands that are not Podman
+- Podman containers with an IP address now add their hostnames to `/etc/hosts`
+- Changed default location of temporary libpod files in rootless Podman
+- Updated the default Podman seccomp profile
+
+### Compatability
+Several paths related to rootless Podman had their default values changed in this release.
+If paths were not hardcoded in libpod.conf, your system may lose track of running containers and believe they are newly-created.
+
## 0.10.1.3
### Bugfixes
- Fixed a bug where `podman build` would not work while any containers were running
diff --git a/changelog.txt b/changelog.txt
index ace41f1d9..7b0f0f3af 100644
--- a/changelog.txt
+++ b/changelog.txt
@@ -1,3 +1,133 @@
+- Changelog for v0.11.1.1 (2018-11-15)
+ * Vendor in containers/storage
+ * Add release notes for 0.11.1.1
+ * Increase pidWaitTimeout to 60s
+ * Cirrus: Add master branch testing status badge
+ * rootless: call IsRootless just once
+ * Bump golang to v1.10 in install.md
+ * Standardized container image for gofmt and lint
+ * Make list of approvers same as reviewers
+ * vendor: update ostree-go
+ * vendor.conf: fix typo
+ * Cleanup podman spec to not show git checkout is dirty
+ * Add space between num & unit in images output
+ * Update troubleshooting guide to deal with rootless path
+ * troubleshooting.md: add a recipe for rootless ping
+ * remove $-prefix from (most) shell examples
+ * docs: Fix duplicated entry for pod-container-unmount
+ * Better document rootless containers
+ * info: add rootless field
+ * Accurately update state if prepare() partially fails
+ * Do not hide errors when creating container with UserNSRoot
+ * rm -f now removes a paused container
+ * correct assignment of networkStatus
+ * podman_tutorial: cni build path has changed
+ * Bump gitvalidation epoch
+ * Bump to v0.11.2-dev
+ * Cirrus: Ignore any error from the IRC messenger
+ * rootless: default to fuse-overlayfs when available
+
+- Changelog for v0.11.1 (2018-11-08)
+ * Update release notes for 0.11.1
+ * update seccomp.json
+ * Touch up --log* options and daemons in man pages
+ * Fix run --hostname test that started failing post-merge
+ * move defer'd function declaration ahead of prepare error return
+ * Don't fail if /etc/passwd or /etc/group does not exists
+ * Print error status code if we fail to parse it
+ * Properly set Running state when starting containers
+ * Fix misspelling
+ * Retrieve container PID from conmon
+ * If a container ceases to exist in runc, set exit status
+ * EXPERIMENTAL: Do not call out to runc for sync
+ * Actually save changes from post-stop sync
+ * rootless: mount /sys/fs/cgroup/systemd from the host
+ * rootless: don't bind mount /sys/fs/cgroup/systemd in systemd mode
+ * Add hostname to /etc/hosts
+ * Temporarily fix the Python tests to fix some PRs
+ * Remove conmon cgroup before pod cgroup for cgroupfs
+ * Fix cleanup for "Pause a bunch of running containers"
+ * --interactive shall keep STDIN attached even when not explicitly called out
+ * Do never override podman with docker
+ * Make kill, pause, and unpause parallel.
+ * Fix long image name handling
+ * Make restart parallel and add --all
+ * Add ChangeAction to parse sub-options from --change
+ * replace quay.io/baude to quay.io/libpod
+ * Change humanize to use MB vs MiB.
+ * allow ppc64le to pass libpod integration tests
+ * Cirrus-CI: Add option to run system-tests
+ * Cirrus: Skip rebuilding images unless instructed
+ * Cirrus: Disable image build job abort on push
+ * Cirrus: Add a readme
+ * Ubuntu VM image build: try update twice
+ * Cirrus: Enable updating F28 image
+ * rootless: do not add an additional /run to runroot
+ * rootless: avoid hang on failed slirp4netns
+ * Fix setting of version information
+ * runtime: do not allow runroot longer than 50 characters
+ * attach: fix attach when cuid is too long
+ * truncate command output in ps by default
+ * Update the runc commit used for testing
+ * make various changes to ps output
+ * Sync default config with libpod.conf
+ * Use two spaces to pad PS fields
+ * unmount: fix error logic
+ * get user and group information using securejoin and runc's user library
+ * CONTRIBUTING.md: add section about describing changes
+ * Change to exported name in ParseDevice
+ * Vendor in latest containers/storage
+ * fix bug in rm -fa parallel deletes
+ * Ensure test container in running state
+ * Add tests for selinux labels
+ * Add --max-workers and heuristics for parallel operations
+ * Increase security and performance when looking up groups
+ * run prepare in parallel
+ * downgrade runc due a rootless bug
+ * runlabel: run any command
+ * Eat our own dogfood
+ * vendor: update containers/storage
+ * Add support for /usr/local installation
+ * create: fix writing cidfile when using rootless
+ * Explain the device format in man pages
+ * read conmon output and convert to json in two steps
+ * Cirrus: Use images w/ buildah fix
+ * Add --all and --latest to checkpoint/restore
+ * Use the newly added getAllOrLatestContainers() function
+ * Use the new checkAllAndLatest() function
+ * Also factor out getAllOrLatestContainers() function
+ * Add checkAllAndLatest() function
+ * Downgrade code to support python3.4
+ * Allow containers/storage to handle on SELinux labeling
+ * Use more reliable check for rootless for firewall init
+ * Vendor in latest containers/storage opencontainers/selinux
+ * Make podman ps fast
+ * Support auth file environment variable in podman build
+ * fix environment variable parsing
+ * tests: use existing CRIU version check
+ * Use the CRIU version check in checkpoint/restore
+ * Add helper function to read out CRIU version
+ * vendor in go-criu and dependencies
+ * oci: cleanup process status
+ * Handle http/https in registry given to login/out
+ * re-enable f29 testing
+ * correct stats err with non-running containers
+ * Use restoreArtifacts to save time in integration tests
+ * Make rm faster
+ * Fix man page to show info on storage
+ * Move rootless directory handling to the libpod/pkg/util directory
+ * Fix podman port -l
+ * Fix trivial missing markup in manpage
+ * Cirrus: Install CRIU in test images
+ * Cirrus: Use different CNI_COMMIT for Fedora
+ * Fix Cirrus/Packer VM image building
+ * Revert "Cirrus: Enable debugging delay on non-zero exit"
+ * Cirrus: IRC message when cirrus testing successful
+ * cirrus: Add simple IRC messenger
+ * fix NOTIFY_SOCKET in e2e testfix NOTIFY_SOCKET in e2e tests
+ * Bump gitvalidation epoch
+ * Bump to v0.10.2-dev
+
- Changelog for v0.10.1.3 (2018-10-17)
* Update release notes for 0.10.1.3
* Vendor in new new buildah/ci
diff --git a/cmd/podman/images.go b/cmd/podman/images.go
index a8955e49e..c52b26260 100644
--- a/cmd/podman/images.go
+++ b/cmd/podman/images.go
@@ -6,8 +6,7 @@ import (
"sort"
"strings"
"time"
-
- "github.com/sirupsen/logrus"
+ "unicode"
"github.com/containers/libpod/cmd/podman/formats"
"github.com/containers/libpod/cmd/podman/libpodruntime"
@@ -16,6 +15,7 @@ import (
"github.com/docker/go-units"
digest "github.com/opencontainers/go-digest"
"github.com/pkg/errors"
+ "github.com/sirupsen/logrus"
"github.com/urfave/cli"
)
@@ -289,6 +289,8 @@ func getImagesTemplateOutput(ctx context.Context, runtime *libpod.Runtime, image
sizeStr = err.Error()
} else {
sizeStr = units.HumanSizeWithPrecision(float64(*size), 3)
+ lastNumIdx := strings.LastIndexFunc(sizeStr, unicode.IsNumber)
+ sizeStr = sizeStr[:lastNumIdx+1] + " " + sizeStr[lastNumIdx+1:]
}
params := imagesTemplateParams{
Repository: repo,
diff --git a/cmd/podman/kill.go b/cmd/podman/kill.go
index 27882aeee..cfe4b4218 100644
--- a/cmd/podman/kill.go
+++ b/cmd/podman/kill.go
@@ -43,7 +43,6 @@ var (
// killCmd kills one or more containers with a signal
func killCmd(c *cli.Context) error {
var (
- lastError error
killFuncs []shared.ParallelWorkerInput
killSignal uint = uint(syscall.SIGTERM)
)
@@ -75,8 +74,12 @@ func killCmd(c *cli.Context) error {
containers, err := getAllOrLatestContainers(c, runtime, libpod.ContainerStateRunning, "running")
if err != nil {
- return err
+ if len(containers) == 0 {
+ return err
+ }
+ fmt.Println(err.Error())
}
+
for _, ctr := range containers {
con := ctr
f := func() error {
@@ -95,18 +98,6 @@ func killCmd(c *cli.Context) error {
}
logrus.Debugf("Setting maximum workers to %d", maxWorkers)
- killErrors := shared.ParallelExecuteWorkerPool(maxWorkers, killFuncs)
-
- for cid, result := range killErrors {
- if result != nil {
- if len(killErrors) > 1 {
- fmt.Println(result.Error())
- }
- lastError = result
- continue
- }
- fmt.Println(cid)
- }
-
- return lastError
+ killErrors, errCount := shared.ParallelExecuteWorkerPool(maxWorkers, killFuncs)
+ return printParallelOutput(killErrors, errCount)
}
diff --git a/cmd/podman/pause.go b/cmd/podman/pause.go
index 1e1585216..fcb2f3cb8 100644
--- a/cmd/podman/pause.go
+++ b/cmd/podman/pause.go
@@ -1,7 +1,6 @@
package main
import (
- "fmt"
"os"
"github.com/containers/libpod/cmd/podman/libpodruntime"
@@ -37,7 +36,6 @@ var (
func pauseCmd(c *cli.Context) error {
var (
- lastError error
pauseContainers []*libpod.Container
pauseFuncs []shared.ParallelWorkerInput
)
@@ -90,17 +88,6 @@ func pauseCmd(c *cli.Context) error {
}
logrus.Debugf("Setting maximum workers to %d", maxWorkers)
- pauseErrors := shared.ParallelExecuteWorkerPool(maxWorkers, pauseFuncs)
-
- for cid, result := range pauseErrors {
- if result != nil {
- if len(pauseErrors) > 1 {
- fmt.Println(result.Error())
- }
- lastError = result
- continue
- }
- fmt.Println(cid)
- }
- return lastError
+ pauseErrors, errCount := shared.ParallelExecuteWorkerPool(maxWorkers, pauseFuncs)
+ return printParallelOutput(pauseErrors, errCount)
}
diff --git a/cmd/podman/restart.go b/cmd/podman/restart.go
index 2e264db79..630493ef4 100644
--- a/cmd/podman/restart.go
+++ b/cmd/podman/restart.go
@@ -1,8 +1,6 @@
package main
import (
- "fmt"
-
"github.com/containers/libpod/cmd/podman/libpodruntime"
"github.com/containers/libpod/cmd/podman/shared"
"github.com/containers/libpod/libpod"
@@ -46,7 +44,6 @@ func restartCmd(c *cli.Context) error {
var (
restartFuncs []shared.ParallelWorkerInput
containers []*libpod.Container
- lastError error
restartContainers []*libpod.Container
)
@@ -124,15 +121,6 @@ func restartCmd(c *cli.Context) error {
logrus.Debugf("Setting maximum workers to %d", maxWorkers)
- restartErrors := shared.ParallelExecuteWorkerPool(maxWorkers, restartFuncs)
-
- for cid, result := range restartErrors {
- if result != nil {
- fmt.Println(result.Error())
- lastError = result
- continue
- }
- fmt.Println(cid)
- }
- return lastError
+ restartErrors, errCount := shared.ParallelExecuteWorkerPool(maxWorkers, restartFuncs)
+ return printParallelOutput(restartErrors, errCount)
}
diff --git a/cmd/podman/rm.go b/cmd/podman/rm.go
index 0fb5345ee..7c0569b78 100644
--- a/cmd/podman/rm.go
+++ b/cmd/podman/rm.go
@@ -4,7 +4,6 @@ import (
"fmt"
"github.com/containers/libpod/cmd/podman/libpodruntime"
"github.com/containers/libpod/cmd/podman/shared"
- "github.com/containers/libpod/libpod"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
"github.com/urfave/cli"
@@ -46,9 +45,7 @@ Running containers will not be removed without the -f option.
// saveCmd saves the image to either docker-archive or oci
func rmCmd(c *cli.Context) error {
var (
- delContainers []*libpod.Container
- lastError error
- deleteFuncs []shared.ParallelWorkerInput
+ deleteFuncs []shared.ParallelWorkerInput
)
ctx := getContext()
@@ -65,7 +62,13 @@ func rmCmd(c *cli.Context) error {
return err
}
- delContainers, lastError = getAllOrLatestContainers(c, runtime, -1, "all")
+ delContainers, err := getAllOrLatestContainers(c, runtime, -1, "all")
+ if err != nil {
+ if len(delContainers) == 0 {
+ return err
+ }
+ fmt.Println(err.Error())
+ }
for _, container := range delContainers {
con := container
@@ -84,14 +87,7 @@ func rmCmd(c *cli.Context) error {
}
logrus.Debugf("Setting maximum workers to %d", maxWorkers)
- deleteErrors := shared.ParallelExecuteWorkerPool(maxWorkers, deleteFuncs)
- for cid, result := range deleteErrors {
- if result != nil {
- fmt.Println(result.Error())
- lastError = result
- continue
- }
- fmt.Println(cid)
- }
- return lastError
+ // Run the parallel funcs
+ deleteErrors, errCount := shared.ParallelExecuteWorkerPool(maxWorkers, deleteFuncs)
+ return printParallelOutput(deleteErrors, errCount)
}
diff --git a/cmd/podman/shared/parallel.go b/cmd/podman/shared/parallel.go
index 633781a45..e6ce50f95 100644
--- a/cmd/podman/shared/parallel.go
+++ b/cmd/podman/shared/parallel.go
@@ -30,9 +30,10 @@ func ParallelWorker(wg *sync.WaitGroup, jobs <-chan ParallelWorkerInput, results
// ParallelExecuteWorkerPool takes container jobs and performs them in parallel. The worker
// int determines how many workers/threads should be premade.
-func ParallelExecuteWorkerPool(workers int, functions []ParallelWorkerInput) map[string]error {
+func ParallelExecuteWorkerPool(workers int, functions []ParallelWorkerInput) (map[string]error, int) {
var (
- wg sync.WaitGroup
+ wg sync.WaitGroup
+ errorCount int
)
resultChan := make(chan containerError, len(functions))
@@ -62,9 +63,12 @@ func ParallelExecuteWorkerPool(workers int, functions []ParallelWorkerInput) map
close(resultChan)
for ctrError := range resultChan {
results[ctrError.ContainerID] = ctrError.Err
+ if ctrError.Err != nil {
+ errorCount += 1
+ }
}
- return results
+ return results, errorCount
}
// Parallelize provides the maximum number of parallel workers (int) as calculated by a basic
diff --git a/cmd/podman/stop.go b/cmd/podman/stop.go
index cb36fd5cd..04022839a 100644
--- a/cmd/podman/stop.go
+++ b/cmd/podman/stop.go
@@ -59,7 +59,13 @@ func stopCmd(c *cli.Context) error {
}
defer runtime.Shutdown(false)
- containers, lastError := getAllOrLatestContainers(c, runtime, libpod.ContainerStateRunning, "running")
+ containers, err := getAllOrLatestContainers(c, runtime, libpod.ContainerStateRunning, "running")
+ if err != nil {
+ if len(containers) == 0 {
+ return err
+ }
+ fmt.Println(err.Error())
+ }
var stopFuncs []shared.ParallelWorkerInput
for _, ctr := range containers {
@@ -85,17 +91,6 @@ func stopCmd(c *cli.Context) error {
}
logrus.Debugf("Setting maximum workers to %d", maxWorkers)
- stopErrors := shared.ParallelExecuteWorkerPool(maxWorkers, stopFuncs)
-
- for cid, result := range stopErrors {
- if result != nil && result != libpod.ErrCtrStopped {
- if len(stopErrors) > 1 {
- fmt.Println(result.Error())
- }
- lastError = result
- continue
- }
- fmt.Println(cid)
- }
- return lastError
+ stopErrors, errCount := shared.ParallelExecuteWorkerPool(maxWorkers, stopFuncs)
+ return printParallelOutput(stopErrors, errCount)
}
diff --git a/cmd/podman/unpause.go b/cmd/podman/unpause.go
index 648fc9d3d..d77e056f8 100644
--- a/cmd/podman/unpause.go
+++ b/cmd/podman/unpause.go
@@ -1,7 +1,6 @@
package main
import (
- "fmt"
"os"
"github.com/containers/libpod/cmd/podman/libpodruntime"
@@ -37,7 +36,6 @@ var (
func unpauseCmd(c *cli.Context) error {
var (
- lastError error
unpauseContainers []*libpod.Container
unpauseFuncs []shared.ParallelWorkerInput
)
@@ -90,18 +88,6 @@ func unpauseCmd(c *cli.Context) error {
}
logrus.Debugf("Setting maximum workers to %d", maxWorkers)
- unpauseErrors := shared.ParallelExecuteWorkerPool(maxWorkers, unpauseFuncs)
-
- for cid, result := range unpauseErrors {
- if result != nil && result != libpod.ErrCtrStopped {
- if len(unpauseErrors) > 1 {
- fmt.Println(result.Error())
- }
- lastError = result
- continue
- }
- fmt.Println(cid)
- }
-
- return lastError
+ unpauseErrors, errCount := shared.ParallelExecuteWorkerPool(maxWorkers, unpauseFuncs)
+ return printParallelOutput(unpauseErrors, errCount)
}
diff --git a/cmd/podman/utils.go b/cmd/podman/utils.go
index afeccb668..5735156c2 100644
--- a/cmd/podman/utils.go
+++ b/cmd/podman/utils.go
@@ -207,3 +207,20 @@ func getPodsFromContext(c *cli.Context, r *libpod.Runtime) ([]*libpod.Pod, error
}
return pods, lastError
}
+
+//printParallelOutput takes the map of parallel worker results and outputs them
+// to stdout
+func printParallelOutput(m map[string]error, errCount int) error {
+ var lastError error
+ for cid, result := range m {
+ if result != nil {
+ if errCount > 1 {
+ fmt.Println(result.Error())
+ }
+ lastError = result
+ continue
+ }
+ fmt.Println(cid)
+ }
+ return lastError
+}
diff --git a/contrib/cirrus/lib.sh b/contrib/cirrus/lib.sh
index 2fa91258b..4a3efb8ff 100644
--- a/contrib/cirrus/lib.sh
+++ b/contrib/cirrus/lib.sh
@@ -106,7 +106,10 @@ ircmsg() {
SCRIPT="$GOSRC/$SCRIPT_BASE/podbot.py"
NICK="podbot_$CIRRUS_TASK_ID"
NICK="${NICK:0:15}" # Any longer will break things
+ set +e
$SCRIPT $NICK $1
+ echo "Ignoring exit($?)"
+ set -e
}
# Run sudo in directory with GOPATH set
diff --git a/contrib/gate/Dockerfile b/contrib/gate/Dockerfile
new file mode 100644
index 000000000..0c0e4aaf9
--- /dev/null
+++ b/contrib/gate/Dockerfile
@@ -0,0 +1,69 @@
+FROM fedora:28
+RUN dnf -y install \
+ atomic-registries \
+ btrfs-progs-devel \
+ buildah \
+ bzip2 \
+ conmon \
+ container-selinux \
+ containernetworking-cni \
+ containernetworking-cni-devel \
+ device-mapper-devel \
+ findutils \
+ git \
+ glib2-devel \
+ glibc-static \
+ gnupg \
+ golang \
+ gpgme-devel \
+ iptables \
+ libassuan-devel \
+ libseccomp-devel \
+ libselinux-devel \
+ lsof \
+ make \
+ nmap-ncat \
+ ostree-devel \
+ procps-ng \
+ python \
+ python3-dateutil \
+ python3-psutil \
+ python3-pytoml \
+ python3-varlink \
+ skopeo-containers \
+ slirp4netns \
+ rsync \
+ which \
+ xz \
+ && dnf clean all
+
+ENV GOPATH="/go" \
+ PATH="/go/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin" \
+ SRCPATH="/usr/src/libpod" \
+ GOSRC="/go/src/github.com/containers/libpod"
+
+# Only needed for installing build-time dependencies
+COPY / $GOSRC
+
+WORKDIR $GOSRC
+
+# Install dependencies
+RUN set -x && \
+ go get -u github.com/mailru/easyjson/... && \
+ install -D -m 755 "$GOPATH"/bin/easyjson /usr/bin/ && \
+ make install.tools && \
+ install -D -m 755 $GOSRC/contrib/gate/entrypoint.sh /usr/local/bin/ && \
+ rm -rf "$GOSRC"
+
+# Install cni config
+#RUN make install.cni
+RUN mkdir -p /etc/cni/net.d/
+COPY cni/87-podman-bridge.conflist /etc/cni/net.d/87-podman-bridge.conflist
+
+# Make sure we have some policy for pulling images
+RUN mkdir -p /etc/containers
+COPY test/policy.json /etc/containers/policy.json
+COPY test/redhat_sigstore.yaml /etc/containers/registries.d/registry.access.redhat.com.yaml
+
+VOLUME ["/usr/src/libpod"]
+ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
diff --git a/contrib/gate/README.md b/contrib/gate/README.md
new file mode 100644
index 000000000..709e6035f
--- /dev/null
+++ b/contrib/gate/README.md
@@ -0,0 +1,4 @@
+![PODMAN logo](../../logo/podman-logo-source.svg)
+
+A standard container image for `gofmt` and lint-checking the libpod
+repository. The [contributors guide contains the documentation for usage.](https://github.com/containers/libpod/blob/master/CONTRIBUTING.md#go-format-and-lint)
diff --git a/contrib/gate/entrypoint.sh b/contrib/gate/entrypoint.sh
new file mode 100755
index 000000000..e16094cc0
--- /dev/null
+++ b/contrib/gate/entrypoint.sh
@@ -0,0 +1,15 @@
+#!/bin/bash
+
+[[ -n "$SRCPATH" ]] || \
+ ( echo "ERROR: \$SRCPATH must be non-empty" && exit 1 )
+[[ -n "$GOSRC" ]] || \
+ ( echo "ERROR: \$GOSRC must be non-empty" && exit 2 )
+[[ -r "${SRCPATH}/contrib/gate/Dockerfile" ]] || \
+ ( echo "ERROR: Expecting libpod repository root at $SRCPATH" && exit 3 )
+
+# Working from a copy avoids needing to perturb the actual source files
+mkdir -p "$GOSRC"
+/usr/bin/rsync --recursive --links --quiet --safe-links \
+ --perms --times "${SRCPATH}/" "${GOSRC}/"
+cd "$GOSRC"
+make "$@"
diff --git a/contrib/spec/podman.spec.in b/contrib/spec/podman.spec.in
index c2d8fc59d..3192cbfed 100644
--- a/contrib/spec/podman.spec.in
+++ b/contrib/spec/podman.spec.in
@@ -39,7 +39,7 @@
%global shortcommit_conmon %(c=%{commit_conmon}; echo ${c:0:7})
Name: podman
-Version: 0.10.2
+Version: 0.11.2
Release: #COMMITDATE#.git%{shortcommit0}%{?dist}
Summary: Manage Pods, Containers and Container Images
License: ASL 2.0
@@ -378,10 +378,6 @@ providing packages with %{import_path} prefix.
%prep
%autosetup -Sgit -n %{repo}-%{shortcommit0}
-sed -i '/\/bin\/env/d' completions/bash/%{name}
-sed -i 's/0.0.0/%{version}/' contrib/python/%{name}/setup.py
-sed -i 's/0.0.0/%{version}/' contrib/python/py%{name}/setup.py
-mv pkg/hooks/README.md pkg/hooks/README-hooks.md
# untar cri-o
tar zxf %{SOURCE1}
@@ -416,15 +412,17 @@ popd
%install
install -dp %{buildroot}%{_unitdir}
-%{__make} PREFIX=%{buildroot}%{_prefix} ETCDIR=%{buildroot}%{_sysconfdir} \
+PODMAN_VERSION=%{version} %{__make} PREFIX=%{buildroot}%{_prefix} ETCDIR=%{buildroot}%{_sysconfdir} \
install.bin \
install.man \
install.cni \
install.systemd \
install.completions
+mv pkg/hooks/README.md pkg/hooks/README-hooks.md
+
%if %{with varlink}
-%{__make} DESTDIR=%{buildroot} install.python
+PODMAN_VERSION=%{version} %{__make} DESTDIR=%{buildroot} install.python
%endif # varlink
# install libpod.conf
diff --git a/docs/podman-container.1.md b/docs/podman-container.1.md
index eac3343d5..67d42bfef 100644
--- a/docs/podman-container.1.md
+++ b/docs/podman-container.1.md
@@ -38,7 +38,6 @@ The container command allows you to manage containers
| stop | [podman-stop(1)](podman-stop.1.md) | Stop one or more running containers. |
| top | [podman-top(1)](podman-top.1.md) | Display the running processes of a container. |
| umount | [podman-umount(1)](podman-umount.1.md) | Unmount a working container's root filesystem. |
-| unmount | [podman-umount(1)](podman-umount.1.md) | Unmount a working container's root filesystem. |
| unpause | [podman-unpause(1)](podman-unpause.1.md) | Unpause one or more containers. |
| wait | [podman-wait(1)](podman-wait.1.md) | Wait on one or more containers to stop and print their exit codes. |
diff --git a/docs/podman-images.1.md b/docs/podman-images.1.md
index 0bd829a8e..832df0e23 100644
--- a/docs/podman-images.1.md
+++ b/docs/podman-images.1.md
@@ -49,9 +49,9 @@ Sort by created, id, repository, size or tag (default: created)
```
# podman images
REPOSITORY TAG IMAGE ID CREATED SIZE
-docker.io/kubernetes/pause latest e3d42bcaf643 3 years ago 251kB
-<none> <none> ebb91b73692b 4 weeks ago 27.2MB
-docker.io/library/ubuntu latest 4526339ae51c 6 weeks ago 126MB
+docker.io/kubernetes/pause latest e3d42bcaf643 3 years ago 251 kB
+<none> <none> ebb91b73692b 4 weeks ago 27.2 MB
+docker.io/library/ubuntu latest 4526339ae51c 6 weeks ago 126 MB
```
```
@@ -63,17 +63,17 @@ ebb91b73692b
```
# podman images --noheading
-docker.io/kubernetes/pause latest e3d42bcaf643 3 years ago 251kB
-<none> <none> ebb91b73692b 4 weeks ago 27.2MB
-docker.io/library/ubuntu latest 4526339ae51c 6 weeks ago 126MB
+docker.io/kubernetes/pause latest e3d42bcaf643 3 years ago 251 kB
+<none> <none> ebb91b73692b 4 weeks ago 27.2 MB
+docker.io/library/ubuntu latest 4526339ae51c 6 weeks ago 126 MB
```
```
# podman images --no-trunc
REPOSITORY TAG IMAGE ID CREATED SIZE
-docker.io/kubernetes/pause latest sha256:e3d42bcaf643097dd1bb0385658ae8cbe100a80f773555c44690d22c25d16b27 3 years ago 251kB
-<none> <none> sha256:ebb91b73692bd27890685846412ae338d13552165eacf7fcd5f139bfa9c2d6d9 4 weeks ago 27.2MB
-docker.io/library/ubuntu latest sha256:4526339ae51c3cdc97956a7a961c193c39dfc6bd9733b0d762a36c6881b5583a 6 weeks ago 126MB
+docker.io/kubernetes/pause latest sha256:e3d42bcaf643097dd1bb0385658ae8cbe100a80f773555c44690d22c25d16b27 3 years ago 251 kB
+<none> <none> sha256:ebb91b73692bd27890685846412ae338d13552165eacf7fcd5f139bfa9c2d6d9 4 weeks ago 27.2 MB
+docker.io/library/ubuntu latest sha256:4526339ae51c3cdc97956a7a961c193c39dfc6bd9733b0d762a36c6881b5583a 6 weeks ago 126 MB
```
```
@@ -87,7 +87,7 @@ ebb91b73692b <none> <none>
```
# podman images --filter dangling=true
REPOSITORY TAG IMAGE ID CREATED SIZE
-<none> <none> ebb91b73692b 4 weeks ago 27.2MB
+<none> <none> ebb91b73692b 4 weeks ago 27.2 MB
```
```
@@ -126,25 +126,25 @@ REPOSITORY TAG IMAGE ID CREATED SIZE
```
# podman images --sort repository
REPOSITORY TAG IMAGE ID CREATED SIZE
-<none> <none> 2460217d76fc About a minute ago 4.41MB
-docker.io/library/alpine latest 3fd9065eaf02 5 months ago 4.41MB
-localhost/myapp latest b2e0ad03474a About a minute ago 4.41MB
-registry.access.redhat.com/rhel7 latest 7a840db7f020 2 weeks ago 211MB
-registry.fedoraproject.org/fedora 27 801894bc0e43 6 weeks ago 246MB
+<none> <none> 2460217d76fc About a minute ago 4.41 MB
+docker.io/library/alpine latest 3fd9065eaf02 5 months ago 4.41 MB
+localhost/myapp latest b2e0ad03474a About a minute ago 4.41 MB
+registry.access.redhat.com/rhel7 latest 7a840db7f020 2 weeks ago 211 MB
+registry.fedoraproject.org/fedora 27 801894bc0e43 6 weeks ago 246 MB
```
```
# podman images
REPOSITORY TAG IMAGE ID CREATED SIZE
-localhost/test latest 18f0c080cd72 4 seconds ago 4.42MB
-docker.io/library/alpine latest 3fd9065eaf02 5 months ago 4.41MB
+localhost/test latest 18f0c080cd72 4 seconds ago 4.42 MB
+docker.io/library/alpine latest 3fd9065eaf02 5 months ago 4.41 MB
# podman images -a
REPOSITORY TAG IMAGE ID CREATED SIZE
-localhost/test latest 18f0c080cd72 6 seconds ago 4.42MB
-<none> <none> 270e70dc54c0 7 seconds ago 4.42MB
-<none> <none> 4ed6fbe43414 8 seconds ago 4.41MB
-<none> <none> 6b0df8e71508 8 seconds ago 4.41MB
-docker.io/library/alpine latest 3fd9065eaf02 5 months ago 4.41MB
+localhost/test latest 18f0c080cd72 6 seconds ago 4.42 MB
+<none> <none> 270e70dc54c0 7 seconds ago 4.42 MB
+<none> <none> 4ed6fbe43414 8 seconds ago 4.41 MB
+<none> <none> 6b0df8e71508 8 seconds ago 4.41 MB
+docker.io/library/alpine latest 3fd9065eaf02 5 months ago 4.41 MB
```
## SEE ALSO
diff --git a/docs/podman-rm.1.md b/docs/podman-rm.1.md
index 7474a0d1f..56664a8c1 100644
--- a/docs/podman-rm.1.md
+++ b/docs/podman-rm.1.md
@@ -13,7 +13,7 @@ podman\-rm - Remove one or more containers
**--force, f**
-Force the removal of a running container
+Force the removal of a running and paused containers
**--all, a**
@@ -29,16 +29,29 @@ to run containers such as CRI-O, the last started container could be from either
Remove the volumes associated with the container. (Not yet implemented)
## EXAMPLE
-
+Remove a container by its name *mywebserver*
+```
podman rm mywebserver
-
+```
+Remove several containers by name and container id.
+```
podman rm mywebserver myflaskserver 860a4b23
+```
+Forcibly remove a container by container ID.
+```
podman rm -f 860a4b23
+```
+Remove all containers regardless of its run state.
+```
podman rm -f -a
+```
+Forcibly remove the latest container created.
+```
podman rm -f --latest
+```
## SEE ALSO
podman(1), podman-rmi(1)
diff --git a/docs/podman.1.md b/docs/podman.1.md
index 085af97ff..b7433d850 100644
--- a/docs/podman.1.md
+++ b/docs/podman.1.md
@@ -56,7 +56,7 @@ Path to the OCI compatible binary used to run containers
**--storage-driver, -s**=**value**
-Storage driver. The default storage driver for UID 0 is configured in /etc/containers/storage.conf (`$HOME/.config/containers/storage.conf` in rootless mode), and is *vfs* for other users. The `STORAGE_DRIVER` environment variable overrides the default. The --storage-driver specified driver overrides all.
+Storage driver. The default storage driver for UID 0 is configured in /etc/containers/storage.conf (`$HOME/.config/containers/storage.conf` in rootless mode), and is *vfs* for non-root users when *fuse-overlayfs* is not available. The `STORAGE_DRIVER` environment variable overrides the default. The --storage-driver specified driver overrides all.
Overriding this option will cause the *storage-opt* settings in /etc/containers/storage.conf to be ignored. The user must
specify additional options via the `--storage-opt` flag.
@@ -192,7 +192,7 @@ the exit codes follow the `chroot` standard, see below:
When Podman runs in rootless mode, the file `$HOME/.config/containers/storage.conf` is also loaded.
## Rootless mode
-Podman can also be used as non-root user. When podman runs in rootless mode, an user namespace is automatically created.
+Podman can also be used as non-root user. When podman runs in rootless mode, a user namespace is automatically created for the user, defined in /etc/subuid and /etc/subgid.
Containers created by a non-root user are not visible to other users and are not seen or managed by podman running as root.
@@ -209,13 +209,14 @@ Or just add the content manually.
$ echo USERNAME:10000:65536 >> /etc/subuid
$ echo USERNAME:10000:65536 >> /etc/subgid
+See the `subuid(5)` and `subgid(5)` man pages for more information.
+
Images are pulled under `XDG_DATA_HOME` when specified, otherwise in the home directory of the user under `.local/share/containers/storage`.
-Currently it is not possible to create a network device, so rootless containers need to run in the host network namespace. If a rootless container creates a network namespace,
-then only the loopback device will be available.
+Currently the slirp4netns package is required to be installed to create a network device, otherwise rootless containers need to run in the network namespace of the host.
## SEE ALSO
-`containers-mounts.conf(5)`, `containers-registries.conf(5)`, `containers-storage.conf(5)`, `crio(8)`, `libpod.conf(5)`, `oci-hooks(5)`, `policy.json(5)`
+`containers-mounts.conf(5)`, `containers-registries.conf(5)`, `containers-storage.conf(5)`, `crio(8)`, `libpod.conf(5)`, `oci-hooks(5)`, `policy.json(5)`, `subuid(5)`, `subgid(5)`, `slirp4netns(1)`
## HISTORY
Dec 2016, Originally compiled by Dan Walsh <dwalsh@redhat.com>
diff --git a/docs/tutorials/podman_tutorial.md b/docs/tutorials/podman_tutorial.md
index 152d65a59..5a8f997b8 100644
--- a/docs/tutorials/podman_tutorial.md
+++ b/docs/tutorials/podman_tutorial.md
@@ -5,10 +5,13 @@ Podman is a utility provided as part of the libpod library. It can be used to c
containers. The following tutorial will teach you how to set up Podman and perform some basic
commands with Podman.
+**NOTE**: the code samples are intended to be run as a non-root user, and use `sudo` where
+root escalation is required.
+
## Install Podman on Fedora from RPM Repositories
Fedora 27 and later provide Podman via the package manager.
```console
-$ sudo dnf install -y podman
+sudo dnf install -y podman
```
## Install Podman on Fedora from Source
@@ -18,10 +21,10 @@ acquire the source, and build it.
### Installing build and runtime dependencies
```console
-$ sudo dnf install -y git runc libassuan-devel golang golang-github-cpuguy83-go-md2man glibc-static \
- gpgme-devel glib2-devel device-mapper-devel libseccomp-devel \
- atomic-registries iptables skopeo-containers containernetworking-cni \
- conmon
+sudo dnf install -y git runc libassuan-devel golang golang-github-cpuguy83-go-md2man glibc-static \
+ gpgme-devel glib2-devel device-mapper-devel libseccomp-devel \
+ atomic-registries iptables skopeo-containers containernetworking-cni \
+ conmon
```
### Building and installing podman
@@ -29,12 +32,12 @@ First, configure a `GOPATH` (if you are using go1.8 or later, this defaults to `
and make libpod.
```console
-$ export GOPATH=~/go
-$ mkdir -p $GOPATH
-$ git clone https://github.com/containers/libpod/ $GOPATH/src/github.com/containers/libpod
-$ cd $GOPATH/src/github.com/containers/libpod
-$ make
-$ sudo make install PREFIX=/usr
+export GOPATH=~/go
+mkdir -p $GOPATH
+git clone https://github.com/containers/libpod/ $GOPATH/src/github.com/containers/libpod
+cd $GOPATH/src/github.com/containers/libpod
+make
+sudo make install PREFIX=/usr
```
You now have a working podman environment. Jump to [Familiarizing yourself with Podman](#familiarizing-yourself-with-podman)
@@ -50,8 +53,8 @@ tutorial. For this tutorial, the Ubuntu **artful-server-cloudimg** image was use
#### Installing base packages
```console
-$ sudo apt-get update
-$ sudo apt-get install libdevmapper-dev libglib2.0-dev libgpgme11-dev golang libseccomp-dev \
+sudo apt-get update
+sudo apt-get install libdevmapper-dev libglib2.0-dev libgpgme11-dev golang libseccomp-dev \
go-md2man libprotobuf-dev libprotobuf-c0-dev libseccomp-dev python3-setuptools
```
#### Building and installing conmon
@@ -59,42 +62,42 @@ First, configure a `GOPATH` (if you are using go1.8 or later, this defaults to `
and make libpod.
```console
-$ export GOPATH=~/go
-$ mkdir -p $GOPATH
-$ git clone https://github.com/kubernetes-sigs/cri-o $GOPATH/src/github.com/kubernetes-sigs/cri-o
-$ cd $GOPATH/src/github.com/kubernetes-sigs/cri-o
-$ mkdir bin
-$ make bin/conmon
-$ sudo install -D -m 755 bin/conmon /usr/libexec/podman/conmon
+export GOPATH=~/go
+mkdir -p $GOPATH
+git clone https://github.com/kubernetes-sigs/cri-o $GOPATH/src/github.com/kubernetes-sigs/cri-o
+cd $GOPATH/src/github.com/kubernetes-sigs/cri-o
+mkdir bin
+make bin/conmon
+sudo install -D -m 755 bin/conmon /usr/libexec/podman/conmon
```
#### Adding required configuration files
```console
-$ sudo mkdir -p /etc/containers
-$ sudo curl https://raw.githubusercontent.com/projectatomic/registries/master/registries.fedora -o /etc/containers/registries.conf
-$ sudo curl https://raw.githubusercontent.com/containers/skopeo/master/default-policy.json -o /etc/containers/policy.json
+sudo mkdir -p /etc/containers
+sudo curl https://raw.githubusercontent.com/projectatomic/registries/master/registries.fedora -o /etc/containers/registries.conf
+sudo curl https://raw.githubusercontent.com/containers/skopeo/master/default-policy.json -o /etc/containers/policy.json
```
#### Installing CNI plugins
```console
-$ git clone https://github.com/containernetworking/plugins.git $GOPATH/src/github.com/containernetworking/plugins
-$ cd $GOPATH/src/github.com/containernetworking/plugins
-$ ./build.sh
-$ sudo mkdir -p /usr/libexec/cni
-$ sudo cp bin/* /usr/libexec/cni
+git clone https://github.com/containernetworking/plugins.git $GOPATH/src/github.com/containernetworking/plugins
+cd $GOPATH/src/github.com/containernetworking/plugins
+./build_linux.sh
+sudo mkdir -p /usr/libexec/cni
+sudo cp bin/* /usr/libexec/cni
```
#### Installing runc
```console
-$ git clone https://github.com/opencontainers/runc.git $GOPATH/src/github.com/opencontainers/runc
-$ cd $GOPATH/src/github.com/opencontainers/runc
-$ make BUILDTAGS="seccomp"
-$ sudo cp runc /usr/bin/runc
+git clone https://github.com/opencontainers/runc.git $GOPATH/src/github.com/opencontainers/runc
+cd $GOPATH/src/github.com/opencontainers/runc
+make BUILDTAGS="seccomp"
+sudo cp runc /usr/bin/runc
```
### Building and installing Podman
```console
-$ git clone https://github.com/containers/libpod/ $GOPATH/src/github.com/containers/libpod
-$ cd $GOPATH/src/github.com/containers/libpod
-$ make
-$ sudo make install PREFIX=/usr
+git clone https://github.com/containers/libpod/ $GOPATH/src/github.com/containers/libpod
+cd $GOPATH/src/github.com/containers/libpod
+make
+sudo make install PREFIX=/usr
```
## Familiarizing yourself with Podman
@@ -103,10 +106,10 @@ $ sudo make install PREFIX=/usr
This sample container will run a very basic httpd server that serves only its index
page.
```console
-$ sudo podman run -dt -e HTTPD_VAR_RUN=/var/run/httpd -e HTTPD_MAIN_CONF_D_PATH=/etc/httpd/conf.d \
- -e HTTPD_MAIN_CONF_PATH=/etc/httpd/conf \
- -e HTTPD_CONTAINER_SCRIPTS_PATH=/usr/share/container-scripts/httpd/ \
- registry.fedoraproject.org/f27/httpd /usr/bin/run-httpd
+sudo podman run -dt -e HTTPD_VAR_RUN=/var/run/httpd -e HTTPD_MAIN_CONF_D_PATH=/etc/httpd/conf.d \
+ -e HTTPD_MAIN_CONF_PATH=/etc/httpd/conf \
+ -e HTTPD_CONTAINER_SCRIPTS_PATH=/usr/share/container-scripts/httpd/ \
+ registry.fedoraproject.org/f27/httpd /usr/bin/run-httpd
```
Because the container is being run in detached mode, represented by the *-d* in the podman run command, podman
will print the container ID after it has run.
@@ -114,7 +117,7 @@ will print the container ID after it has run.
### Listing running containers
The Podman *ps* command is used to list creating and running containers.
```console
-$ sudo podman ps
+sudo podman ps
```
Note: If you add *-a* to the *ps* command, Podman will show all containers.
@@ -134,7 +137,7 @@ Now that we have the IP address of the container, we can test the network commun
operating system and the container using curl. The following command should display the index page of our
containerized httpd server.
```console
-# curl http://<IP_address>:8080
+curl http://<IP_address>:8080
```
### Viewing the container's logs
@@ -163,7 +166,7 @@ With this a container can later be restored and continue running at exactly the
checkpoint. This capability requires CRIU 3.11 or later installed on the system.
To checkpoint the container use:
```console
-$ sudo podman container checkpoint <container_id>
+sudo podman container checkpoint <container_id>
```
### Restoring the container
@@ -171,29 +174,29 @@ Restoring a container is only possible for a previously checkpointed container.
continue to run at exactly the same point in time it was checkpointed.
To restore the container use:
```console
-$ sudo podman container restore <container_id>
+sudo podman container restore <container_id>
```
After being restored, the container will answer requests again as it did before checkpointing.
```console
-# curl http://<IP_address>:8080
+curl http://<IP_address>:8080
```
### Stopping the container
To stop the httpd container:
```console
-$ sudo podman stop --latest
+sudo podman stop --latest
```
You can also check the status of one or more containers using the *ps* subcommand. In this case, we should
use the *-a* argument to list all containers.
```console
-$ sudo podman ps -a
+sudo podman ps -a
```
### Removing the container
To remove the httpd container:
```console
-$ sudo podman rm --latest
+sudo podman rm --latest
```
You can verify the deletion of the container by running *podman ps -a*.
diff --git a/install.md b/install.md
index 33224c810..efb568b66 100644
--- a/install.md
+++ b/install.md
@@ -83,7 +83,7 @@ Debian, Ubuntu, and related distributions will also need to do the following set
If using an older release or a long-term support release, be careful to double-check that the version of `runc` is new enough (running `runc --version` should produce `spec: 1.0.0`), or else [build](https://github.com/containers/libpod/blob/master/docs/tutorials/podman_tutorial.md#installing-runc) your own.
-Be careful to double-check that the version of golang is new enough, version 1.8.x or higher is required. If needed, golang kits are available at https://golang.org/dl/
+Be careful to double-check that the version of golang is new enough, version 1.10.x or higher is required. If needed, golang kits are available at https://golang.org/dl/
**Optional**
diff --git a/libpod/container_api.go b/libpod/container_api.go
index d99aec5b4..390987394 100644
--- a/libpod/container_api.go
+++ b/libpod/container_api.go
@@ -330,9 +330,10 @@ func (c *Container) Exec(tty, privileged bool, env, cmd []string, user string) e
}
pidFile := c.execPidPath(sessionID)
- // 1 second seems a reasonable time to wait
- // See https://github.com/containers/libpod/issues/1495
- const pidWaitTimeout = 1000
+ // 60 second seems a reasonable time to wait
+ // https://github.com/containers/libpod/issues/1495
+ // https://github.com/containers/libpod/issues/1816
+ const pidWaitTimeout = 60000
// Wait until the runtime makes the pidfile
// TODO: If runtime errors before the PID file is created, we have to
diff --git a/libpod/container_internal_linux.go b/libpod/container_internal_linux.go
index 163cd75e7..66c7e8a04 100644
--- a/libpod/container_internal_linux.go
+++ b/libpod/container_internal_linux.go
@@ -57,7 +57,7 @@ func (c *Container) prepare() (err error) {
networkStatus []*cnitypes.Result
createNetNSErr, mountStorageErr error
mountPoint string
- saveNetworkStatus bool
+ tmpStateLock sync.Mutex
)
wg.Add(2)
@@ -66,17 +66,55 @@ func (c *Container) prepare() (err error) {
defer wg.Done()
// Set up network namespace if not already set up
if c.config.CreateNetNS && c.state.NetNS == nil && !c.config.PostConfigureNetNS {
- saveNetworkStatus = true
netNS, networkStatus, createNetNSErr = c.runtime.createNetNS(c)
+
+ tmpStateLock.Lock()
+ defer tmpStateLock.Unlock()
+
+ // Assign NetNS attributes to container
+ if createNetNSErr == nil {
+ c.state.NetNS = netNS
+ c.state.NetworkStatus = networkStatus
+ }
}
}()
// Mount storage if not mounted
go func() {
defer wg.Done()
mountPoint, mountStorageErr = c.mountStorage()
+
+ if mountStorageErr != nil {
+ return
+ }
+
+ tmpStateLock.Lock()
+ defer tmpStateLock.Unlock()
+
+ // Finish up mountStorage
+ c.state.Mounted = true
+ c.state.Mountpoint = mountPoint
+ if c.state.UserNSRoot == "" {
+ c.state.RealMountpoint = c.state.Mountpoint
+ } else {
+ c.state.RealMountpoint = filepath.Join(c.state.UserNSRoot, "mountpoint")
+ }
+
+ logrus.Debugf("Created root filesystem for container %s at %s", c.ID(), c.state.Mountpoint)
+ }()
+
+ defer func() {
+ if err != nil {
+ if err2 := c.cleanupNetwork(); err2 != nil {
+ logrus.Errorf("Error cleaning up container %s network: %v", c.ID(), err2)
+ }
+ if err2 := c.cleanupStorage(); err2 != nil {
+ logrus.Errorf("Error cleaning up container %s storage: %v", c.ID(), err2)
+ }
+ }
}()
wg.Wait()
+
if createNetNSErr != nil {
if mountStorageErr != nil {
logrus.Error(createNetNSErr)
@@ -88,22 +126,6 @@ func (c *Container) prepare() (err error) {
return mountStorageErr
}
- // Assign NetNS attributes to container
- if saveNetworkStatus {
- c.state.NetNS = netNS
- c.state.NetworkStatus = networkStatus
- }
-
- // Finish up mountStorage
- c.state.Mounted = true
- c.state.Mountpoint = mountPoint
- if c.state.UserNSRoot == "" {
- c.state.RealMountpoint = c.state.Mountpoint
- } else {
- c.state.RealMountpoint = filepath.Join(c.state.UserNSRoot, "mountpoint")
- }
-
- logrus.Debugf("Created root filesystem for container %s at %s", c.ID(), c.state.Mountpoint)
// Save the container
return c.save()
}
diff --git a/libpod/info.go b/libpod/info.go
index 4cbf3f734..5d8d160c8 100644
--- a/libpod/info.go
+++ b/libpod/info.go
@@ -12,6 +12,7 @@ import (
"strings"
"time"
+ "github.com/containers/libpod/pkg/rootless"
"github.com/containers/libpod/utils"
"github.com/containers/storage/pkg/system"
"github.com/pkg/errors"
@@ -30,6 +31,7 @@ func (r *Runtime) hostInfo() (map[string]interface{}, error) {
info["os"] = runtime.GOOS
info["arch"] = runtime.GOARCH
info["cpus"] = runtime.NumCPU()
+ info["rootless"] = rootless.IsRootless()
mi, err := system.ReadMemInfo()
if err != nil {
return nil, errors.Wrapf(err, "error reading memory info")
diff --git a/libpod/networking_linux.go b/libpod/networking_linux.go
index 863a764e2..43d0a61a4 100644
--- a/libpod/networking_linux.go
+++ b/libpod/networking_linux.go
@@ -64,20 +64,20 @@ func (r *Runtime) configureNetNS(ctr *Container, ctrNS ns.NetNS) ([]*cnitypes.Re
}
}()
- networkStatus := make([]*cnitypes.Result, 1)
+ networkStatus := make([]*cnitypes.Result, 0)
for idx, r := range results {
logrus.Debugf("[%d] CNI result: %v", idx, r.String())
resultCurrent, err := cnitypes.GetResult(r)
if err != nil {
return nil, errors.Wrapf(err, "error parsing CNI plugin result %q: %v", r.String(), err)
}
- networkStatus = append(ctr.state.NetworkStatus, resultCurrent)
+ networkStatus = append(networkStatus, resultCurrent)
}
// Add firewall rules to ensure the container has network access.
// Will not be necessary once CNI firewall plugin merges upstream.
// https://github.com/containernetworking/plugins/pull/75
- for _, netStatus := range ctr.state.NetworkStatus {
+ for _, netStatus := range networkStatus {
firewallConf := &firewall.FirewallNetConf{
PrevResult: netStatus,
}
@@ -90,13 +90,16 @@ func (r *Runtime) configureNetNS(ctr *Container, ctrNS ns.NetNS) ([]*cnitypes.Re
}
// Create and configure a new network namespace for a container
-func (r *Runtime) createNetNS(ctr *Container) (ns.NetNS, []*cnitypes.Result, error) {
+func (r *Runtime) createNetNS(ctr *Container) (n ns.NetNS, q []*cnitypes.Result, err error) {
ctrNS, err := netns.NewNS()
if err != nil {
return nil, nil, errors.Wrapf(err, "error creating network namespace for container %s", ctr.ID())
}
defer func() {
if err != nil {
+ if err2 := netns.UnmountNS(ctrNS); err2 != nil {
+ logrus.Errorf("Error unmounting partially created network namespace for container %s: %v", ctr.ID(), err2)
+ }
if err2 := ctrNS.Close(); err2 != nil {
logrus.Errorf("Error closing partially created network namespace for container %s: %v", ctr.ID(), err2)
}
diff --git a/libpod/oci_linux.go b/libpod/oci_linux.go
index 0447670b3..e6b7cbe4f 100644
--- a/libpod/oci_linux.go
+++ b/libpod/oci_linux.go
@@ -74,7 +74,8 @@ func (r *OCIRuntime) createContainer(ctr *Container, cgroupParent string, restor
defer wg.Done()
runtime.LockOSThread()
- fd, err := os.Open(fmt.Sprintf("/proc/%d/task/%d/ns/mnt", os.Getpid(), unix.Gettid()))
+ var fd *os.File
+ fd, err = os.Open(fmt.Sprintf("/proc/%d/task/%d/ns/mnt", os.Getpid(), unix.Gettid()))
if err != nil {
return
}
diff --git a/libpod/runtime_ctr.go b/libpod/runtime_ctr.go
index 09dc7c48b..09d0ec042 100644
--- a/libpod/runtime_ctr.go
+++ b/libpod/runtime_ctr.go
@@ -246,7 +246,19 @@ func (r *Runtime) removeContainer(ctx context.Context, c *Container, force bool)
}
if c.state.State == ContainerStatePaused {
- return errors.Wrapf(ErrCtrStateInvalid, "container %s is paused, cannot remove until unpaused", c.ID())
+ if !force {
+ return errors.Wrapf(ErrCtrStateInvalid, "container %s is paused, cannot remove until unpaused", c.ID())
+ }
+ if err := c.runtime.ociRuntime.killContainer(c, 9); err != nil {
+ return err
+ }
+ if err := c.unpause(); err != nil {
+ return err
+ }
+ // Need to update container state to make sure we know it's stopped
+ if err := c.waitForExitFileAndSync(); err != nil {
+ return err
+ }
}
// Check that the container's in a good state to be removed
diff --git a/pkg/rootless/rootless_linux.go b/pkg/rootless/rootless_linux.go
index 5c45f2694..85b0ef392 100644
--- a/pkg/rootless/rootless_linux.go
+++ b/pkg/rootless/rootless_linux.go
@@ -12,6 +12,7 @@ import (
"runtime"
"strconv"
"strings"
+ "sync"
"syscall"
"unsafe"
@@ -33,9 +34,17 @@ func runInUser() error {
return nil
}
+var (
+ isRootlessOnce sync.Once
+ isRootless bool
+)
+
// IsRootless tells us if we are running in rootless mode
func IsRootless() bool {
- return os.Geteuid() != 0 || os.Getenv("_LIBPOD_USERNS_CONFIGURED") != ""
+ isRootlessOnce.Do(func() {
+ isRootless = os.Geteuid() != 0 || os.Getenv("_LIBPOD_USERNS_CONFIGURED") != ""
+ })
+ return isRootless
}
var (
@@ -187,6 +196,9 @@ func BecomeRootInUserNS() (bool, int, error) {
if username == "" {
user, err := user.LookupId(fmt.Sprintf("%d", os.Getuid()))
if err != nil && os.Getenv("PODMAN_ALLOW_SINGLE_ID_MAPPING_IN_USERNS") == "" {
+ if os.IsNotExist(err) {
+ return false, 0, errors.Wrapf(err, "/etc/subuid or /etc/subgid does not exist, see subuid/subgid man pages for information on these files")
+ }
return false, 0, errors.Wrapf(err, "could not find user by UID nor USER env was set")
}
if err == nil {
diff --git a/pkg/util/utils.go b/pkg/util/utils.go
index 69f49e72a..3b43489b2 100644
--- a/pkg/util/utils.go
+++ b/pkg/util/utils.go
@@ -3,6 +3,7 @@ package util
import (
"fmt"
"os"
+ "os/exec"
"path/filepath"
"strconv"
"strings"
@@ -273,7 +274,12 @@ func GetRootlessStorageOpts() (storage.StoreOptions, error) {
dataDir = filepath.Join(resolvedHome, ".local", "share")
}
opts.GraphRoot = filepath.Join(dataDir, "containers", "storage")
- opts.GraphDriverName = "vfs"
+ if path, err := exec.LookPath("fuse-overlayfs"); err == nil {
+ opts.GraphDriverName = "overlay"
+ opts.GraphDriverOptions = []string{fmt.Sprintf("overlay.mount_program=%s", path)}
+ } else {
+ opts.GraphDriverName = "vfs"
+ }
return opts, nil
}
diff --git a/test/e2e/pause_test.go b/test/e2e/pause_test.go
index 1a2eb1a09..e80915670 100644
--- a/test/e2e/pause_test.go
+++ b/test/e2e/pause_test.go
@@ -91,7 +91,7 @@ var _ = Describe("Podman pause", func() {
})
- It("podman remove a paused container by id", func() {
+ It("podman remove a paused container by id without force", func() {
session := podmanTest.RunTopContainer("")
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
@@ -111,25 +111,26 @@ var _ = Describe("Podman pause", func() {
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
Expect(podmanTest.GetContainerStatus()).To(ContainSubstring(pausedState))
- result = podmanTest.Podman([]string{"rm", "--force", cid})
- result.WaitWithDefaultTimeout()
+ })
- Expect(result.ExitCode()).To(Equal(125))
- Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
- Expect(podmanTest.GetContainerStatus()).To(ContainSubstring(pausedState))
+ It("podman remove a paused container by id with force", func() {
+ session := podmanTest.RunTopContainer("")
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ cid := session.OutputToString()
- result = podmanTest.Podman([]string{"unpause", cid})
+ result := podmanTest.Podman([]string{"pause", cid})
result.WaitWithDefaultTimeout()
Expect(result.ExitCode()).To(Equal(0))
- Expect(podmanTest.NumberOfContainersRunning()).To(Equal(1))
+ Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
+ Expect(podmanTest.GetContainerStatus()).To(ContainSubstring(pausedState))
result = podmanTest.Podman([]string{"rm", "--force", cid})
result.WaitWithDefaultTimeout()
Expect(result.ExitCode()).To(Equal(0))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
-
})
It("podman stop a paused container by id", func() {
diff --git a/troubleshooting.md b/troubleshooting.md
index db36d1bb8..574196a69 100644
--- a/troubleshooting.md
+++ b/troubleshooting.md
@@ -10,7 +10,7 @@
A large number of issues reported against Podman are often found to already be fixed
in more current versions of the project. Before reporting an issue, please verify the
version you are running with `podman version` and compare it to the lastest release
-documented on the top of Podman's [README.md](README.md).
+documented on the top of Podman's [README.md](README.md).
If they differ, please update your version of PODMAN to the latest possible
and retry your command before reporting the issue.
@@ -68,4 +68,62 @@ communicate with a registry and not use tls verification.
* Turn off tls verification by passing false to the tls-verification option.
* I.e. `podman push --tls-verify=false alpine docker://localhost:5000/myalpine:latest`
+
+---
+### 4) Rootless: could not get runtime - database configuration mismatch
+
+In Podman release 0.11.1, a default path for rootless containers was changed,
+potentially causing rootless Podman to be unable to function. The new default
+path is not a problem for new installations, but existing installations will
+need to work around it with the following fix.
+
+#### Symptom
+
+```console
+$ podman info
+could not get runtime: database run root /run/user/1000/run does not match our run root /run/user/1000: database configuration mismatch
+```
+
+#### Solution
+
+To work around the new default path, we can manually set the path Podman is
+expecting in a configuration file.
+
+First, we need to make a new local configuration file for rootless Podman.
+* `mkdir -p ~/.config/containers`
+* `cp /usr/share/containers/libpod.conf ~/.config/containers`
+
+Next, edit the new local configuration file
+(`~/.config/containers/libpod.conf`) with your favorite editor. Comment out the
+line starting with `cgroup_manager` by adding a `#` character at the beginning
+of the line, and change the path in the line starting with `tmp_dir` to point to
+the first path in the error message Podman gave (in this case,
+`/run/user/1000/run`).
+
---
+### 4) rootless containers cannot ping hosts
+
+When using the ping command from a non-root container, the command may
+fail because of a lack of privileges.
+
+#### Symptom
+
+```console
+$ podman run --rm fedora ping -W10 -c1 redhat.com
+PING redhat.com (209.132.183.105): 56 data bytes
+
+--- redhat.com ping statistics ---
+1 packets transmitted, 0 packets received, 100% packet loss
+```
+
+#### Solution
+
+It is most likely necessary to enable unprivileged pings on the host.
+Be sure the UID of the user is part of the range in the
+`/proc/sys/net/ipv4/ping_group_range` file.
+
+To change its value you can use something like: `sysctl -w
+"net.ipv4.ping_group_range=0 2000000"`.
+
+To make the change persistent, you'll need to add a file in
+`/etc/sysctl.d` that contains `net.ipv4.ping_group_range=0 $MAX_UID`.
diff --git a/vendor.conf b/vendor.conf
index c3998b5f2..a16975bf9 100644
--- a/vendor.conf
+++ b/vendor.conf
@@ -12,7 +12,7 @@ github.com/containerd/continuity master
github.com/containernetworking/cni v0.7.0-alpha1
github.com/containernetworking/plugins 1562a1e60ed101aacc5e08ed9dbeba8e9f3d4ec1
github.com/containers/image bd10b1b53b2976f215b3f2f848fb8e7cad779aeb
-github.com/containers/storage 09abf3a26b8a3aa69e29fd7faeb260b98d675759
+github.com/containers/storage 3161726d1db0d0d4e86a9667dd476f09b997f497
github.com/containers/psgo 5dde6da0bc8831b35243a847625bcf18183bd1ee
github.com/coreos/go-systemd v14
github.com/cri-o/ocicni 2d2983e40c242322a56c22a903785e7f83eb378c
@@ -77,7 +77,7 @@ golang.org/x/sys master
golang.org/x/text f72d8390a633d5dfb0cc84043294db9f6c935756
golang.org/x/time f51c12702a4d776e4c1fa9b0fabab841babae631
golang.org/x/sync master
-google.golang.org/grpc v1.0.4 https://github.com/grpc/grpc-go<
+google.golang.org/grpc v1.0.4 https://github.com/grpc/grpc-go
gopkg.in/cheggaaa/pb.v1 v1.0.7
gopkg.in/inf.v0 v0.9.0
gopkg.in/mgo.v2 v2
diff --git a/vendor/github.com/containers/storage/README.md b/vendor/github.com/containers/storage/README.md
index f68cc55c3..fef46a689 100644
--- a/vendor/github.com/containers/storage/README.md
+++ b/vendor/github.com/containers/storage/README.md
@@ -2,7 +2,7 @@
layers, container images, and containers. A `containers-storage` CLI wrapper
is also included for manual and scripting use.
-To build the CLI wrapper, use 'make build-binary'.
+To build the CLI wrapper, use 'make binary'.
Operations which use VMs expect to launch them using 'vagrant', defaulting to
using its 'libvirt' provider. The boxes used are also available for the
diff --git a/vendor/github.com/containers/storage/drivers/aufs/aufs.go b/vendor/github.com/containers/storage/drivers/aufs/aufs.go
index f14ba24b9..474c7574d 100644
--- a/vendor/github.com/containers/storage/drivers/aufs/aufs.go
+++ b/vendor/github.com/containers/storage/drivers/aufs/aufs.go
@@ -405,7 +405,7 @@ func atomicRemove(source string) error {
case os.IsExist(err):
// Got error saying the target dir already exists, maybe the source doesn't exist due to a previous (failed) remove
if _, e := os.Stat(source); !os.IsNotExist(e) {
- return errors.Wrapf(err, "target rename dir '%s' exists but should not, this needs to be manually cleaned up")
+ return errors.Wrapf(err, "target rename dir '%s' exists but should not, this needs to be manually cleaned up", target)
}
default:
return errors.Wrapf(err, "error preparing atomic delete")
diff --git a/vendor/github.com/containers/storage/drivers/overlay/overlay.go b/vendor/github.com/containers/storage/drivers/overlay/overlay.go
index d2cc65bca..b7e15a7f6 100644
--- a/vendor/github.com/containers/storage/drivers/overlay/overlay.go
+++ b/vendor/github.com/containers/storage/drivers/overlay/overlay.go
@@ -340,6 +340,10 @@ func supportsOverlay(home string, homeMagic graphdriver.FsMagic, rootUID, rootGI
func (d *Driver) useNaiveDiff() bool {
useNaiveDiffLock.Do(func() {
+ if d.options.mountProgram != "" {
+ useNaiveDiffOnly = true
+ return
+ }
if err := doesSupportNativeDiff(d.home, d.options.mountOptions); err != nil {
logrus.Warnf("Not using native diff for overlay, this may cause degraded performance for building images: %v", err)
useNaiveDiffOnly = true
@@ -841,6 +845,17 @@ func (d *Driver) isParent(id, parent string) bool {
return ld == parentDir
}
+func (d *Driver) getWhiteoutFormat() archive.WhiteoutFormat {
+ whiteoutFormat := archive.OverlayWhiteoutFormat
+ if d.options.mountProgram != "" {
+ // If we are using a mount program, we are most likely running
+ // as an unprivileged user that cannot use mknod, so fallback to the
+ // AUFS whiteout format.
+ whiteoutFormat = archive.AUFSWhiteoutFormat
+ }
+ return whiteoutFormat
+}
+
// ApplyDiff applies the new layer into a root
func (d *Driver) ApplyDiff(id string, idMappings *idtools.IDMappings, parent string, mountLabel string, diff io.Reader) (size int64, err error) {
if !d.isParent(id, parent) {
@@ -858,7 +873,7 @@ func (d *Driver) ApplyDiff(id string, idMappings *idtools.IDMappings, parent str
if err := untar(diff, applyDir, &archive.TarOptions{
UIDMaps: idMappings.UIDs(),
GIDMaps: idMappings.GIDs(),
- WhiteoutFormat: archive.OverlayWhiteoutFormat,
+ WhiteoutFormat: d.getWhiteoutFormat(),
}); err != nil {
return 0, err
}
@@ -911,7 +926,7 @@ func (d *Driver) Diff(id string, idMappings *idtools.IDMappings, parent string,
Compression: archive.Uncompressed,
UIDMaps: idMappings.UIDs(),
GIDMaps: idMappings.GIDs(),
- WhiteoutFormat: archive.OverlayWhiteoutFormat,
+ WhiteoutFormat: d.getWhiteoutFormat(),
WhiteoutData: lowerDirs,
})
}
diff --git a/vendor/github.com/containers/storage/drivers/zfs/zfs.go b/vendor/github.com/containers/storage/drivers/zfs/zfs.go
index cb4424f2d..4e27a0a6f 100644
--- a/vendor/github.com/containers/storage/drivers/zfs/zfs.go
+++ b/vendor/github.com/containers/storage/drivers/zfs/zfs.go
@@ -52,7 +52,7 @@ func Init(base string, opt []string, uidMaps, gidMaps []idtools.IDMap) (graphdri
return nil, errors.Wrap(graphdriver.ErrPrerequisites, "the 'zfs' command is not available")
}
- file, err := os.OpenFile("/dev/zfs", os.O_RDWR, 600)
+ file, err := os.OpenFile("/dev/zfs", os.O_RDWR, 0600)
if err != nil {
logrus.Debugf("[zfs] cannot open /dev/zfs: %v", err)
return nil, errors.Wrapf(graphdriver.ErrPrerequisites, "could not open /dev/zfs: %v", err)
diff --git a/vendor/github.com/containers/storage/layers.go b/vendor/github.com/containers/storage/layers.go
index 1275ab47c..6c8f59b8b 100644
--- a/vendor/github.com/containers/storage/layers.go
+++ b/vendor/github.com/containers/storage/layers.go
@@ -542,8 +542,8 @@ func (r *layerStore) Put(id string, parentLayer *Layer, names []string, mountLab
_, idInUse = r.byid[id]
}
}
- if _, idInUse := r.byid[id]; idInUse {
- return nil, -1, ErrDuplicateID
+ if duplicateLayer, idInUse := r.byid[id]; idInUse {
+ return duplicateLayer, -1, ErrDuplicateID
}
names = dedupeNames(names)
for _, name := range names {
@@ -841,8 +841,12 @@ func (r *layerStore) Delete(id string) error {
return ErrLayerUnknown
}
id = layer.ID
- if _, err := r.Unmount(id, true); err != nil {
- return err
+ // This check is needed for idempotency of delete where the layer could have been
+ // already unmounted (since c/storage gives you that API directly)
+ for layer.MountCount > 0 {
+ if _, err := r.Unmount(id, false); err != nil {
+ return err
+ }
}
err := r.driver.Remove(id)
if err == nil {
diff --git a/vendor/github.com/containers/storage/pkg/archive/example_changes.go b/vendor/github.com/containers/storage/pkg/archive/example_changes.go
deleted file mode 100644
index 70f9c5564..000000000
--- a/vendor/github.com/containers/storage/pkg/archive/example_changes.go
+++ /dev/null
@@ -1,97 +0,0 @@
-// +build ignore
-
-// Simple tool to create an archive stream from an old and new directory
-//
-// By default it will stream the comparison of two temporary directories with junk files
-package main
-
-import (
- "flag"
- "fmt"
- "io"
- "io/ioutil"
- "os"
- "path"
-
- "github.com/containers/storage/pkg/archive"
- "github.com/sirupsen/logrus"
-)
-
-var (
- flDebug = flag.Bool("D", false, "debugging output")
- flNewDir = flag.String("newdir", "", "")
- flOldDir = flag.String("olddir", "", "")
- log = logrus.New()
-)
-
-func main() {
- flag.Usage = func() {
- fmt.Println("Produce a tar from comparing two directory paths. By default a demo tar is created of around 200 files (including hardlinks)")
- fmt.Printf("%s [OPTIONS]\n", os.Args[0])
- flag.PrintDefaults()
- }
- flag.Parse()
- log.Out = os.Stderr
- if (len(os.Getenv("DEBUG")) > 0) || *flDebug {
- logrus.SetLevel(logrus.DebugLevel)
- }
- var newDir, oldDir string
-
- if len(*flNewDir) == 0 {
- var err error
- newDir, err = ioutil.TempDir("", "storage-test-newDir")
- if err != nil {
- log.Fatal(err)
- }
- defer os.RemoveAll(newDir)
- if _, err := prepareUntarSourceDirectory(100, newDir, true); err != nil {
- log.Fatal(err)
- }
- } else {
- newDir = *flNewDir
- }
-
- if len(*flOldDir) == 0 {
- oldDir, err := ioutil.TempDir("", "storage-test-oldDir")
- if err != nil {
- log.Fatal(err)
- }
- defer os.RemoveAll(oldDir)
- } else {
- oldDir = *flOldDir
- }
-
- changes, err := archive.ChangesDirs(newDir, oldDir)
- if err != nil {
- log.Fatal(err)
- }
-
- a, err := archive.ExportChanges(newDir, changes)
- if err != nil {
- log.Fatal(err)
- }
- defer a.Close()
-
- i, err := io.Copy(os.Stdout, a)
- if err != nil && err != io.EOF {
- log.Fatal(err)
- }
- fmt.Fprintf(os.Stderr, "wrote archive of %d bytes", i)
-}
-
-func prepareUntarSourceDirectory(numberOfFiles int, targetPath string, makeLinks bool) (int, error) {
- fileData := []byte("fooo")
- for n := 0; n < numberOfFiles; n++ {
- fileName := fmt.Sprintf("file-%d", n)
- if err := ioutil.WriteFile(path.Join(targetPath, fileName), fileData, 0700); err != nil {
- return 0, err
- }
- if makeLinks {
- if err := os.Link(path.Join(targetPath, fileName), path.Join(targetPath, fileName+"-link")); err != nil {
- return 0, err
- }
- }
- }
- totalSize := numberOfFiles * len(fileData)
- return totalSize, nil
-}
diff --git a/vendor/github.com/containers/storage/pkg/idtools/parser.go b/vendor/github.com/containers/storage/pkg/idtools/parser.go
new file mode 100644
index 000000000..9b76395c2
--- /dev/null
+++ b/vendor/github.com/containers/storage/pkg/idtools/parser.go
@@ -0,0 +1,56 @@
+package idtools
+
+import (
+ "fmt"
+ "strconv"
+ "strings"
+)
+
+func nonDigitsToWhitespace(r rune) rune {
+ if !strings.ContainsRune("0123456789", r) {
+ return ' '
+ }
+ return r
+}
+
+func parseTriple(spec []string) (container, host, size uint32, err error) {
+ cid, err := strconv.ParseUint(spec[0], 10, 32)
+ if err != nil {
+ return 0, 0, 0, fmt.Errorf("error parsing id map value %q: %v", spec[0], err)
+ }
+ hid, err := strconv.ParseUint(spec[1], 10, 32)
+ if err != nil {
+ return 0, 0, 0, fmt.Errorf("error parsing id map value %q: %v", spec[1], err)
+ }
+ sz, err := strconv.ParseUint(spec[2], 10, 32)
+ if err != nil {
+ return 0, 0, 0, fmt.Errorf("error parsing id map value %q: %v", spec[2], err)
+ }
+ return uint32(cid), uint32(hid), uint32(sz), nil
+}
+
+// ParseIDMap parses idmap triples from string.
+func ParseIDMap(idMapSpec, mapSetting string) (idmap []IDMap, err error) {
+ if len(idMapSpec) > 0 {
+ idSpec := strings.Fields(strings.Map(nonDigitsToWhitespace, idMapSpec))
+ if len(idSpec)%3 != 0 {
+ return nil, fmt.Errorf("error initializing ID mappings: %s setting is malformed", mapSetting)
+ }
+ for i := range idSpec {
+ if i%3 != 0 {
+ continue
+ }
+ cid, hid, size, err := parseTriple(idSpec[i : i+3])
+ if err != nil {
+ return nil, fmt.Errorf("error initializing ID mappings: %s setting is malformed", mapSetting)
+ }
+ mapping := IDMap{
+ ContainerID: int(cid),
+ HostID: int(hid),
+ Size: int(size),
+ }
+ idmap = append(idmap, mapping)
+ }
+ }
+ return idmap, nil
+}
diff --git a/vendor/github.com/containers/storage/store.go b/vendor/github.com/containers/storage/store.go
index 7eaa82910..dfc30c43f 100644
--- a/vendor/github.com/containers/storage/store.go
+++ b/vendor/github.com/containers/storage/store.go
@@ -8,7 +8,6 @@ import (
"os"
"path/filepath"
"reflect"
- "strconv"
"strings"
"sync"
"time"
@@ -1069,7 +1068,7 @@ func (s *store) imageTopLayerForMapping(image *Image, ristore ROImageStore, read
}
mappedLayer, _, err := rlstore.Put("", parentLayer, nil, layer.MountLabel, nil, &layerOptions, false, nil, rc)
if err != nil {
- return nil, errors.Wrapf(err, "error creating ID-mapped copy of layer %q")
+ return nil, errors.Wrapf(err, "error creating ID-mapped copy of layer %q", parentLayer.ID)
}
if err = istore.addMappedTopLayer(image.ID, mappedLayer.ID); err != nil {
if err2 := rlstore.Delete(mappedLayer.ID); err2 != nil {
@@ -3203,56 +3202,19 @@ func ReloadConfigurationFile(configFile string, storeOptions *StoreOptions) {
storeOptions.UIDMap = mappings.UIDs()
storeOptions.GIDMap = mappings.GIDs()
}
- nonDigitsToWhitespace := func(r rune) rune {
- if strings.IndexRune("0123456789", r) == -1 {
- return ' '
- } else {
- return r
- }
- }
- parseTriple := func(spec []string) (container, host, size uint32, err error) {
- cid, err := strconv.ParseUint(spec[0], 10, 32)
- if err != nil {
- return 0, 0, 0, fmt.Errorf("error parsing id map value %q: %v", spec[0], err)
- }
- hid, err := strconv.ParseUint(spec[1], 10, 32)
- if err != nil {
- return 0, 0, 0, fmt.Errorf("error parsing id map value %q: %v", spec[1], err)
- }
- sz, err := strconv.ParseUint(spec[2], 10, 32)
- if err != nil {
- return 0, 0, 0, fmt.Errorf("error parsing id map value %q: %v", spec[2], err)
- }
- return uint32(cid), uint32(hid), uint32(sz), nil
+
+ uidmap, err := idtools.ParseIDMap(config.Storage.Options.RemapUIDs, "remap-uids")
+ if err != nil {
+ fmt.Print(err)
+ } else {
+ storeOptions.UIDMap = append(storeOptions.UIDMap, uidmap...)
}
- parseIDMap := func(idMapSpec, mapSetting string) (idmap []idtools.IDMap) {
- if len(idMapSpec) > 0 {
- idSpec := strings.Fields(strings.Map(nonDigitsToWhitespace, idMapSpec))
- if len(idSpec)%3 != 0 {
- fmt.Printf("Error initializing ID mappings: %s setting is malformed.\n", mapSetting)
- return nil
- }
- for i := range idSpec {
- if i%3 != 0 {
- continue
- }
- cid, hid, size, err := parseTriple(idSpec[i : i+3])
- if err != nil {
- fmt.Printf("Error initializing ID mappings: %s setting is malformed.\n", mapSetting)
- return nil
- }
- mapping := idtools.IDMap{
- ContainerID: int(cid),
- HostID: int(hid),
- Size: int(size),
- }
- idmap = append(idmap, mapping)
- }
- }
- return idmap
+ gidmap, err := idtools.ParseIDMap(config.Storage.Options.RemapGIDs, "remap-gids")
+ if err != nil {
+ fmt.Print(err)
+ } else {
+ storeOptions.GIDMap = append(storeOptions.GIDMap, gidmap...)
}
- storeOptions.UIDMap = append(storeOptions.UIDMap, parseIDMap(config.Storage.Options.RemapUIDs, "remap-uids")...)
- storeOptions.GIDMap = append(storeOptions.GIDMap, parseIDMap(config.Storage.Options.RemapGIDs, "remap-gids")...)
if os.Getenv("STORAGE_DRIVER") != "" {
storeOptions.GraphDriverName = os.Getenv("STORAGE_DRIVER")
}
diff --git a/vendor/github.com/containers/storage/vendor.conf b/vendor/github.com/containers/storage/vendor.conf
index 2276d5531..059ae94f0 100644
--- a/vendor/github.com/containers/storage/vendor.conf
+++ b/vendor/github.com/containers/storage/vendor.conf
@@ -2,13 +2,14 @@ github.com/BurntSushi/toml master
github.com/Microsoft/go-winio 307e919c663683a9000576fdc855acaf9534c165
github.com/Microsoft/hcsshim a8d9cc56cbce765a7eebdf4792e6ceceeff3edb8
github.com/davecgh/go-spew 346938d642f2ec3594ed81d874461961cd0faa76
-github.com/docker/engine-api 4290f40c056686fcaa5c9caf02eac1dde9315adf
+github.com/docker/docker 86f080cff0914e9694068ed78d503701667c4c00
github.com/docker/go-units 0dadbb0345b35ec7ef35e228dabb8de89a65bf52
github.com/mattn/go-shellwords 753a2322a99f87c0eff284980e77f53041555bc6
github.com/mistifyio/go-zfs c0224de804d438efd11ea6e52ada8014537d6062
github.com/opencontainers/go-digest master
github.com/opencontainers/runc 6c22e77604689db8725fa866f0f2ec0b3e8c3a07
github.com/opencontainers/selinux 36a9bc45a08c85f2c52bd9eb32e20267876773bd
+github.com/ostreedev/ostree-go aeb02c6b6aa2889db3ef62f7855650755befd460
github.com/pborman/uuid 1b00554d822231195d1babd97ff4a781231955c9
github.com/pkg/errors master
github.com/pmezard/go-difflib v1.0.0
@@ -20,4 +21,3 @@ github.com/tchap/go-patricia v2.2.6
github.com/vbatts/tar-split v0.10.2
golang.org/x/net 7dcfb8076726a3fdd9353b6b8a1f1b6be6811bd6
golang.org/x/sys 07c182904dbd53199946ba614a412c61d3c548f5
-github.com/ostreedev/ostree-go aeb02c6b6aa2889db3ef62f7855650755befd460
diff --git a/vendor/github.com/ostreedev/ostree-go/pkg/otadmin/admin.go b/vendor/github.com/ostreedev/ostree-go/pkg/otadmin/admin.go
deleted file mode 100644
index e69de29bb..000000000
--- a/vendor/github.com/ostreedev/ostree-go/pkg/otadmin/admin.go
+++ /dev/null
diff --git a/vendor/github.com/ostreedev/ostree-go/pkg/otadmin/admin.go.h b/vendor/github.com/ostreedev/ostree-go/pkg/otadmin/admin.go.h
deleted file mode 100644
index e69de29bb..000000000
--- a/vendor/github.com/ostreedev/ostree-go/pkg/otadmin/admin.go.h
+++ /dev/null
diff --git a/vendor/github.com/ostreedev/ostree-go/pkg/otadmin/admincleanup.go b/vendor/github.com/ostreedev/ostree-go/pkg/otadmin/admincleanup.go
deleted file mode 100644
index e69de29bb..000000000
--- a/vendor/github.com/ostreedev/ostree-go/pkg/otadmin/admincleanup.go
+++ /dev/null
diff --git a/vendor/github.com/ostreedev/ostree-go/pkg/otadmin/admindeploy.go b/vendor/github.com/ostreedev/ostree-go/pkg/otadmin/admindeploy.go
deleted file mode 100644
index e69de29bb..000000000
--- a/vendor/github.com/ostreedev/ostree-go/pkg/otadmin/admindeploy.go
+++ /dev/null
diff --git a/vendor/github.com/ostreedev/ostree-go/pkg/otadmin/admindiff.go b/vendor/github.com/ostreedev/ostree-go/pkg/otadmin/admindiff.go
deleted file mode 100644
index e69de29bb..000000000
--- a/vendor/github.com/ostreedev/ostree-go/pkg/otadmin/admindiff.go
+++ /dev/null
diff --git a/vendor/github.com/ostreedev/ostree-go/pkg/otadmin/admininit.go b/vendor/github.com/ostreedev/ostree-go/pkg/otadmin/admininit.go
deleted file mode 100644
index e69de29bb..000000000
--- a/vendor/github.com/ostreedev/ostree-go/pkg/otadmin/admininit.go
+++ /dev/null
diff --git a/vendor/github.com/ostreedev/ostree-go/pkg/otadmin/admininstutil.go b/vendor/github.com/ostreedev/ostree-go/pkg/otadmin/admininstutil.go
deleted file mode 100644
index e69de29bb..000000000
--- a/vendor/github.com/ostreedev/ostree-go/pkg/otadmin/admininstutil.go
+++ /dev/null
diff --git a/vendor/github.com/ostreedev/ostree-go/pkg/otadmin/adminosinit.go b/vendor/github.com/ostreedev/ostree-go/pkg/otadmin/adminosinit.go
deleted file mode 100644
index e69de29bb..000000000
--- a/vendor/github.com/ostreedev/ostree-go/pkg/otadmin/adminosinit.go
+++ /dev/null
diff --git a/vendor/github.com/ostreedev/ostree-go/pkg/otadmin/adminsetorigin.go b/vendor/github.com/ostreedev/ostree-go/pkg/otadmin/adminsetorigin.go
deleted file mode 100644
index e69de29bb..000000000
--- a/vendor/github.com/ostreedev/ostree-go/pkg/otadmin/adminsetorigin.go
+++ /dev/null
diff --git a/vendor/github.com/ostreedev/ostree-go/pkg/otadmin/adminstatus.go b/vendor/github.com/ostreedev/ostree-go/pkg/otadmin/adminstatus.go
deleted file mode 100644
index e69de29bb..000000000
--- a/vendor/github.com/ostreedev/ostree-go/pkg/otadmin/adminstatus.go
+++ /dev/null
diff --git a/vendor/github.com/ostreedev/ostree-go/pkg/otadmin/adminswitch.go b/vendor/github.com/ostreedev/ostree-go/pkg/otadmin/adminswitch.go
deleted file mode 100644
index e69de29bb..000000000
--- a/vendor/github.com/ostreedev/ostree-go/pkg/otadmin/adminswitch.go
+++ /dev/null
diff --git a/vendor/github.com/ostreedev/ostree-go/pkg/otadmin/adminundeploy.go b/vendor/github.com/ostreedev/ostree-go/pkg/otadmin/adminundeploy.go
deleted file mode 100644
index e69de29bb..000000000
--- a/vendor/github.com/ostreedev/ostree-go/pkg/otadmin/adminundeploy.go
+++ /dev/null
diff --git a/vendor/github.com/ostreedev/ostree-go/pkg/otadmin/adminunlock.go b/vendor/github.com/ostreedev/ostree-go/pkg/otadmin/adminunlock.go
deleted file mode 100644
index e69de29bb..000000000
--- a/vendor/github.com/ostreedev/ostree-go/pkg/otadmin/adminunlock.go
+++ /dev/null
diff --git a/vendor/github.com/ostreedev/ostree-go/pkg/otadmin/adminupgrade.go b/vendor/github.com/ostreedev/ostree-go/pkg/otadmin/adminupgrade.go
deleted file mode 100644
index e69de29bb..000000000
--- a/vendor/github.com/ostreedev/ostree-go/pkg/otadmin/adminupgrade.go
+++ /dev/null
diff --git a/vendor/github.com/ostreedev/ostree-go/pkg/otbuiltin/builtin.go b/vendor/github.com/ostreedev/ostree-go/pkg/otbuiltin/builtin.go
index d3a8ae5fd..24822b2b7 100644
--- a/vendor/github.com/ostreedev/ostree-go/pkg/otbuiltin/builtin.go
+++ b/vendor/github.com/ostreedev/ostree-go/pkg/otbuiltin/builtin.go
@@ -18,76 +18,102 @@ import (
// #include "builtin.go.h"
import "C"
+// Repo represents a local ostree repository
type Repo struct {
- //*glib.GObject
ptr unsafe.Pointer
}
-// Converts an ostree repo struct to its C equivalent
+// isInitialized checks if the repo has been initialized
+func (r *Repo) isInitialized() bool {
+ if r == nil || r.ptr == nil {
+ return false
+ }
+ return true
+}
+
+// native converts an ostree repo struct to its C equivalent
func (r *Repo) native() *C.OstreeRepo {
- //return (*C.OstreeRepo)(r.Ptr())
+ if !r.isInitialized() {
+ return nil
+ }
return (*C.OstreeRepo)(r.ptr)
}
-// Takes a C ostree repo and converts it to a Go struct
-func repoFromNative(p *C.OstreeRepo) *Repo {
- if p == nil {
+// repoFromNative takes a C ostree repo and converts it to a Go struct
+func repoFromNative(or *C.OstreeRepo) *Repo {
+ if or == nil {
return nil
}
- //o := (*glib.GObject)(unsafe.Pointer(p))
- //r := &Repo{o}
- r := &Repo{unsafe.Pointer(p)}
+ r := &Repo{unsafe.Pointer(or)}
return r
}
-// Checks if the repo has been initialized
-func (r *Repo) isInitialized() bool {
- if r.ptr != nil {
- return true
+// OpenRepo attempts to open the repo at the given path
+func OpenRepo(path string) (*Repo, error) {
+ if path == "" {
+ return nil, errors.New("empty path")
}
- return false
-}
-// Attempts to open the repo at the given path
-func OpenRepo(path string) (*Repo, error) {
- var cerr *C.GError = nil
cpath := C.CString(path)
- pathc := C.g_file_new_for_path(cpath)
- defer C.g_object_unref(C.gpointer(pathc))
- crepo := C.ostree_repo_new(pathc)
+ defer C.free(unsafe.Pointer(cpath))
+ repoPath := C.g_file_new_for_path(cpath)
+ defer C.g_object_unref(C.gpointer(repoPath))
+ crepo := C.ostree_repo_new(repoPath)
repo := repoFromNative(crepo)
+
+ var cerr *C.GError
r := glib.GoBool(glib.GBoolean(C.ostree_repo_open(crepo, nil, &cerr)))
if !r {
return nil, generateError(cerr)
}
+
return repo, nil
}
-// Enable support for tombstone commits, which allow the repo to distinguish between
-// commits that were intentionally deleted and commits that were removed accidentally
-func enableTombstoneCommits(repo *Repo) error {
- var tombstoneCommits bool
- var config *C.GKeyFile = C.ostree_repo_get_config(repo.native())
- var cerr *C.GError
+// enableTombstoneCommits enables support for tombstone commits.
+//
+// This allows to distinguish between intentional deletions and accidental removals
+// of commits.
+func (r *Repo) enableTombstoneCommits() error {
+ if !r.isInitialized() {
+ return errors.New("repo not initialized")
+ }
- tombstoneCommits = glib.GoBool(glib.GBoolean(C.g_key_file_get_boolean(config, (*C.gchar)(C.CString("core")), (*C.gchar)(C.CString("tombstone-commits")), nil)))
+ config := C.ostree_repo_get_config(r.native())
+ groupC := C.CString("core")
+ defer C.free(unsafe.Pointer(groupC))
+ keyC := C.CString("tombstone-commits")
+ defer C.free(unsafe.Pointer(keyC))
+ valueC := C.g_key_file_get_boolean(config, (*C.gchar)(groupC), (*C.gchar)(keyC), nil)
+ tombstoneCommits := glib.GoBool(glib.GBoolean(valueC))
- //tombstoneCommits is false only if it really is false or if it is set to FALSE in the config file
+ // tombstoneCommits is false only if it really is false or if it is set to FALSE in the config file
if !tombstoneCommits {
- C.g_key_file_set_boolean(config, (*C.gchar)(C.CString("core")), (*C.gchar)(C.CString("tombstone-commits")), C.TRUE)
- if !glib.GoBool(glib.GBoolean(C.ostree_repo_write_config(repo.native(), config, &cerr))) {
+ var cerr *C.GError
+ C.g_key_file_set_boolean(config, (*C.gchar)(groupC), (*C.gchar)(keyC), C.TRUE)
+ if !glib.GoBool(glib.GBoolean(C.ostree_repo_write_config(r.native(), config, &cerr))) {
return generateError(cerr)
}
}
return nil
}
+// generateError wraps a GLib error into a Go one.
func generateError(err *C.GError) error {
+ if err == nil {
+ return errors.New("nil GError")
+ }
+
goErr := glib.ConvertGError(glib.ToGError(unsafe.Pointer(err)))
_, file, line, ok := runtime.Caller(1)
if ok {
- return errors.New(fmt.Sprintf("%s:%d - %s", file, line, goErr))
- } else {
- return goErr
+ return fmt.Errorf("%s:%d - %s", file, line, goErr)
}
+ return goErr
+}
+
+// isOk wraps a return value (gboolean/gint) into a bool.
+// 0 is false/error, everything else is true/ok.
+func isOk(v C.int) bool {
+ return glib.GoBool(glib.GBoolean(v))
}
diff --git a/vendor/github.com/ostreedev/ostree-go/pkg/otbuiltin/builtin.go.h b/vendor/github.com/ostreedev/ostree-go/pkg/otbuiltin/builtin.go.h
index 734de9821..76171554d 100644
--- a/vendor/github.com/ostreedev/ostree-go/pkg/otbuiltin/builtin.go.h
+++ b/vendor/github.com/ostreedev/ostree-go/pkg/otbuiltin/builtin.go.h
@@ -33,24 +33,12 @@ _ostree_repo_file(GFile *file)
return OSTREE_REPO_FILE (file);
}
-static guint
-_gpointer_to_uint (gpointer ptr)
-{
- return GPOINTER_TO_UINT (ptr);
-}
-
static gpointer
_guint_to_pointer (guint u)
{
return GUINT_TO_POINTER (u);
}
-static void
-_g_clear_object (volatile GObject **object_ptr)
-{
- g_clear_object(object_ptr);
-}
-
static const GVariantType*
_g_variant_type (char *type)
{
diff --git a/vendor/github.com/ostreedev/ostree-go/pkg/otbuiltin/cat.go b/vendor/github.com/ostreedev/ostree-go/pkg/otbuiltin/cat.go
deleted file mode 100644
index d43ea07c7..000000000
--- a/vendor/github.com/ostreedev/ostree-go/pkg/otbuiltin/cat.go
+++ /dev/null
@@ -1 +0,0 @@
-package otbuiltin
diff --git a/vendor/github.com/ostreedev/ostree-go/pkg/otbuiltin/checkout.go b/vendor/github.com/ostreedev/ostree-go/pkg/otbuiltin/checkout.go
index 55b51bfbd..04ada1792 100644
--- a/vendor/github.com/ostreedev/ostree-go/pkg/otbuiltin/checkout.go
+++ b/vendor/github.com/ostreedev/ostree-go/pkg/otbuiltin/checkout.go
@@ -1,7 +1,7 @@
package otbuiltin
import (
- "strings"
+ "errors"
"unsafe"
glib "github.com/ostreedev/ostree-go/pkg/glibobject"
@@ -14,34 +14,42 @@ import (
// #include "builtin.go.h"
import "C"
-// Global variable for options
-var checkoutOpts checkoutOptions
-
-// Contains all of the options for checking commits out of
-// an ostree repo
+// checkoutOptions defines all of the options for checking commits
+// out of an ostree repo
+//
+// Note: while this is private, fields are public and part of the API.
type checkoutOptions struct {
- UserMode bool // Do not change file ownership or initialize extended attributes
- Union bool // Keep existing directories and unchanged files, overwriting existing filesystem
- AllowNoent bool // Do nothing if the specified filepath does not exist
- DisableCache bool // Do not update or use the internal repository uncompressed object caceh
- Whiteouts bool // Process 'whiteout' (docker style) entries
- RequireHardlinks bool // Do not fall back to full copies if hard linking fails
- Subpath string // Checkout sub-directory path
- FromFile string // Process many checkouts from the given file
+ // UserMode defines whether to checkout a repo in `bare-user` mode
+ UserMode bool
+ // Union specifies whether to overwrite existing filesystem entries
+ Union bool
+ // AllowNoEnt defines whether to skip filepaths that do not exist
+ AllowNoent bool
+ // DisableCache defines whether to disable internal repository uncompressed object cache
+ DisableCache bool
+ // Whiteouts defines whether to Process 'whiteout' (docker style) entries
+ Whiteouts bool
+ // RequireHardlinks defines whether to fall back to full copies if hard linking fails
+ RequireHardlinks bool
+ // SubPath specifies a sub-directory to use for checkout
+ Subpath string
+ // FromFile specifies an optional file containing many checkouts to process
+ FromFile string
}
-// Instantiates and returns a checkoutOptions struct with default values set
+// NewCheckoutOptions instantiates and returns a checkoutOptions struct with default values set
func NewCheckoutOptions() checkoutOptions {
return checkoutOptions{}
}
-// Checks out a commit with the given ref from a repository at the location of repo path to to the destination. Returns an error if the checkout could not be processed
-func Checkout(repoPath, destination, commit string, opts checkoutOptions) error {
- checkoutOpts = opts
-
+// Checkout checks out commit `commitRef` from a repository at `repoPath`,
+// writing it to `destination`. Returns an error if the checkout could not be processed.
+func Checkout(repoPath, destination, commitRef string, opts checkoutOptions) error {
var cancellable *glib.GCancellable
- ccommit := C.CString(commit)
+
+ ccommit := C.CString(commitRef)
defer C.free(unsafe.Pointer(ccommit))
+
var gerr = glib.NewGError()
cerr := (*C.GError)(gerr.Ptr())
defer C.free(unsafe.Pointer(cerr))
@@ -53,50 +61,48 @@ func Checkout(repoPath, destination, commit string, opts checkoutOptions) error
return generateError(cerr)
}
- if strings.Compare(checkoutOpts.FromFile, "") != 0 {
- err := processManyCheckouts(crepo, destination, cancellable)
- if err != nil {
- return err
- }
- } else {
- var resolvedCommit *C.char
- defer C.free(unsafe.Pointer(resolvedCommit))
- if !glib.GoBool(glib.GBoolean(C.ostree_repo_resolve_rev(crepo, ccommit, C.FALSE, &resolvedCommit, &cerr))) {
- return generateError(cerr)
- }
- err := processOneCheckout(crepo, resolvedCommit, checkoutOpts.Subpath, destination, cancellable)
- if err != nil {
- return err
- }
+ // Multiple checkouts to process
+ if opts.FromFile != "" {
+ return processManyCheckouts(crepo, destination, cancellable)
}
- return nil
+
+ // Simple single checkout
+ var resolvedCommit *C.char
+ defer C.free(unsafe.Pointer(resolvedCommit))
+ if !glib.GoBool(glib.GBoolean(C.ostree_repo_resolve_rev(crepo, ccommit, C.FALSE, &resolvedCommit, &cerr))) {
+ return generateError(cerr)
+ }
+
+ return processOneCheckout(crepo, resolvedCommit, destination, opts, cancellable)
}
-// Processes one checkout from the repo
-func processOneCheckout(crepo *C.OstreeRepo, resolvedCommit *C.char, subpath, destination string, cancellable *glib.GCancellable) error {
+// processOneCheckout processes one checkout from the repo
+func processOneCheckout(crepo *C.OstreeRepo, resolvedCommit *C.char, destination string, opts checkoutOptions, cancellable *glib.GCancellable) error {
cdest := C.CString(destination)
defer C.free(unsafe.Pointer(cdest))
+
var gerr = glib.NewGError()
cerr := (*C.GError)(gerr.Ptr())
defer C.free(unsafe.Pointer(cerr))
- var repoCheckoutAtOptions C.OstreeRepoCheckoutAtOptions
- if checkoutOpts.UserMode {
+ // Process options into bitflags
+ var repoCheckoutAtOptions C.OstreeRepoCheckoutAtOptions
+ if opts.UserMode {
repoCheckoutAtOptions.mode = C.OSTREE_REPO_CHECKOUT_MODE_USER
}
- if checkoutOpts.Union {
+ if opts.Union {
repoCheckoutAtOptions.overwrite_mode = C.OSTREE_REPO_CHECKOUT_OVERWRITE_UNION_FILES
}
- checkedOut := glib.GoBool(glib.GBoolean(C.ostree_repo_checkout_at(crepo, &repoCheckoutAtOptions, C._at_fdcwd(), cdest, resolvedCommit, nil, &cerr)))
- if !checkedOut {
+ // Checkout commit to destination
+ if !glib.GoBool(glib.GBoolean(C.ostree_repo_checkout_at(crepo, &repoCheckoutAtOptions, C._at_fdcwd(), cdest, resolvedCommit, nil, &cerr))) {
return generateError(cerr)
}
return nil
}
-// process many checkouts
+// processManyCheckouts processes many checkouts in a single batch
func processManyCheckouts(crepo *C.OstreeRepo, target string, cancellable *glib.GCancellable) error {
- return nil
+ return errors.New("batch checkouts processing: not implemented")
}
diff --git a/vendor/github.com/ostreedev/ostree-go/pkg/otbuiltin/checksum.go b/vendor/github.com/ostreedev/ostree-go/pkg/otbuiltin/checksum.go
deleted file mode 100644
index d43ea07c7..000000000
--- a/vendor/github.com/ostreedev/ostree-go/pkg/otbuiltin/checksum.go
+++ /dev/null
@@ -1 +0,0 @@
-package otbuiltin
diff --git a/vendor/github.com/ostreedev/ostree-go/pkg/otbuiltin/commit.go b/vendor/github.com/ostreedev/ostree-go/pkg/otbuiltin/commit.go
index 9550f802c..ccaff7a10 100644
--- a/vendor/github.com/ostreedev/ostree-go/pkg/otbuiltin/commit.go
+++ b/vendor/github.com/ostreedev/ostree-go/pkg/otbuiltin/commit.go
@@ -59,11 +59,11 @@ func NewCommitOptions() commitOptions {
}
type OstreeRepoTransactionStats struct {
- metadata_objects_total int32
+ metadata_objects_total int32
metadata_objects_written int32
- content_objects_total int32
- content_objects_written int32
- content_bytes_written uint64
+ content_objects_total int32
+ content_objects_written int32
+ content_bytes_written uint64
}
func (repo *Repo) PrepareTransaction() (bool, error) {
@@ -125,6 +125,7 @@ func (repo *Repo) RegenerateSummary() error {
// Commits a directory, specified by commitPath, to an ostree repo as a given branch
func (repo *Repo) Commit(commitPath, branch string, opts commitOptions) (string, error) {
+ // TODO(lucab): `options` is global un-synchronized mutable state, get rid of it.
options = opts
var err error
@@ -140,7 +141,7 @@ func (repo *Repo) Commit(commitPath, branch string, opts commitOptions) (string,
var cerr *C.GError
defer C.free(unsafe.Pointer(cerr))
var metadata *C.GVariant = nil
- defer func(){
+ defer func() {
if metadata != nil {
defer C.g_variant_unref(metadata)
}
@@ -196,7 +197,7 @@ func (repo *Repo) Commit(commitPath, branch string, opts commitOptions) (string,
}
if options.AddDetachedMetadataString != nil {
- _, err := parseKeyValueStrings(options.AddDetachedMetadataString)
+ _, err = parseKeyValueStrings(options.AddDetachedMetadataString)
if err != nil {
goto out
}
@@ -476,7 +477,7 @@ func handleStatOverrideLine(line string, table *glib.GHashTable) error {
// Handle an individual line from a Skiplist file
func handleSkipListline(line string, table *glib.GHashTable) error {
- C.g_hash_table_add((*C.GHashTable)(table.Ptr()), C.gpointer( C.g_strdup((*C.gchar)(C.CString(line)))))
+ C.g_hash_table_add((*C.GHashTable)(table.Ptr()), C.gpointer(C.g_strdup((*C.gchar)(C.CString(line)))))
return nil
}
diff --git a/vendor/github.com/ostreedev/ostree-go/pkg/otbuiltin/config.go b/vendor/github.com/ostreedev/ostree-go/pkg/otbuiltin/config.go
deleted file mode 100644
index d43ea07c7..000000000
--- a/vendor/github.com/ostreedev/ostree-go/pkg/otbuiltin/config.go
+++ /dev/null
@@ -1 +0,0 @@
-package otbuiltin
diff --git a/vendor/github.com/ostreedev/ostree-go/pkg/otbuiltin/diff.go b/vendor/github.com/ostreedev/ostree-go/pkg/otbuiltin/diff.go
deleted file mode 100644
index d43ea07c7..000000000
--- a/vendor/github.com/ostreedev/ostree-go/pkg/otbuiltin/diff.go
+++ /dev/null
@@ -1 +0,0 @@
-package otbuiltin
diff --git a/vendor/github.com/ostreedev/ostree-go/pkg/otbuiltin/export.go b/vendor/github.com/ostreedev/ostree-go/pkg/otbuiltin/export.go
deleted file mode 100644
index d43ea07c7..000000000
--- a/vendor/github.com/ostreedev/ostree-go/pkg/otbuiltin/export.go
+++ /dev/null
@@ -1 +0,0 @@
-package otbuiltin
diff --git a/vendor/github.com/ostreedev/ostree-go/pkg/otbuiltin/fsck.go b/vendor/github.com/ostreedev/ostree-go/pkg/otbuiltin/fsck.go
deleted file mode 100644
index d43ea07c7..000000000
--- a/vendor/github.com/ostreedev/ostree-go/pkg/otbuiltin/fsck.go
+++ /dev/null
@@ -1 +0,0 @@
-package otbuiltin
diff --git a/vendor/github.com/ostreedev/ostree-go/pkg/otbuiltin/gpgsign.go b/vendor/github.com/ostreedev/ostree-go/pkg/otbuiltin/gpgsign.go
deleted file mode 100644
index d43ea07c7..000000000
--- a/vendor/github.com/ostreedev/ostree-go/pkg/otbuiltin/gpgsign.go
+++ /dev/null
@@ -1 +0,0 @@
-package otbuiltin
diff --git a/vendor/github.com/ostreedev/ostree-go/pkg/otbuiltin/init.go b/vendor/github.com/ostreedev/ostree-go/pkg/otbuiltin/init.go
index c1ca2dc7e..6ee6671b4 100644
--- a/vendor/github.com/ostreedev/ostree-go/pkg/otbuiltin/init.go
+++ b/vendor/github.com/ostreedev/ostree-go/pkg/otbuiltin/init.go
@@ -1,11 +1,8 @@
package otbuiltin
import (
- "errors"
"strings"
"unsafe"
-
- glib "github.com/ostreedev/ostree-go/pkg/glibobject"
)
// #cgo pkg-config: ostree-1
@@ -15,43 +12,37 @@ import (
// #include "builtin.go.h"
import "C"
-// Declare variables for options
-var initOpts initOptions
-
-// Contains all of the options for initializing an ostree repo
+// initOptions contains all of the options for initializing an ostree repo
+//
+// Note: while this is private, exported fields are public and part of the API.
type initOptions struct {
- Mode string // either bare, archive-z2, or bare-user
-
- repoMode C.OstreeRepoMode
+ // Mode defines repository mode: either bare, archive-z2, or bare-user
+ Mode string
}
-// Instantiates and returns an initOptions struct with default values set
+// NewInitOptions instantiates and returns an initOptions struct with default values set
func NewInitOptions() initOptions {
- io := initOptions{}
- io.Mode = "bare"
- io.repoMode = C.OSTREE_REPO_MODE_BARE
- return io
+ return initOptions{
+ Mode: "bare",
+ }
}
-// Initializes a new ostree repository at the given path. Returns true
+// Init initializes a new ostree repository at the given path. Returns true
// if the repo exists at the location, regardless of whether it was initialized
// by the function or if it already existed. Returns an error if the repo could
// not be initialized
func Init(path string, options initOptions) (bool, error) {
- initOpts = options
- err := parseMode()
+ repoMode, err := parseRepoMode(options.Mode)
if err != nil {
return false, err
}
// Create a repo struct from the path
- var cerr *C.GError
- defer C.free(unsafe.Pointer(cerr))
cpath := C.CString(path)
defer C.free(unsafe.Pointer(cpath))
pathc := C.g_file_new_for_path(cpath)
defer C.g_object_unref(C.gpointer(pathc))
- crepo := C.ostree_repo_new(pathc)
+ repo := C.ostree_repo_new(pathc)
// If the repo exists in the filesystem, return an error but set exists to true
/* var exists C.gboolean = 0
@@ -63,28 +54,31 @@ func Init(path string, options initOptions) (bool, error) {
return false, generateError(cerr)
}*/
- cerr = nil
- created := glib.GoBool(glib.GBoolean(C.ostree_repo_create(crepo, initOpts.repoMode, nil, &cerr)))
- if !created {
- errString := generateError(cerr).Error()
- if strings.Contains(errString, "File exists") {
- return true, generateError(cerr)
+ var cErr *C.GError
+ defer C.free(unsafe.Pointer(cErr))
+ if r := C.ostree_repo_create(repo, repoMode, nil, &cErr); !isOk(r) {
+ err := generateError(cErr)
+ if strings.Contains(err.Error(), "File exists") {
+ return true, err
}
- return false, generateError(cerr)
+ return false, err
}
return true, nil
}
-// Converts the mode string to a C.OSTREE_REPO_MODE enum value
-func parseMode() error {
- if strings.EqualFold(initOpts.Mode, "bare") {
- initOpts.repoMode = C.OSTREE_REPO_MODE_BARE
- } else if strings.EqualFold(initOpts.Mode, "bare-user") {
- initOpts.repoMode = C.OSTREE_REPO_MODE_BARE_USER
- } else if strings.EqualFold(initOpts.Mode, "archive-z2") {
- initOpts.repoMode = C.OSTREE_REPO_MODE_ARCHIVE_Z2
- } else {
- return errors.New("Invalid option for mode")
+// parseRepoMode converts a mode string to a C.OSTREE_REPO_MODE enum value
+func parseRepoMode(modeLabel string) (C.OstreeRepoMode, error) {
+ var cErr *C.GError
+ defer C.free(unsafe.Pointer(cErr))
+
+ cModeLabel := C.CString(modeLabel)
+ defer C.free(unsafe.Pointer(cModeLabel))
+
+ var retMode C.OstreeRepoMode
+ if r := C.ostree_repo_mode_from_string(cModeLabel, &retMode, &cErr); !isOk(r) {
+ // NOTE(lucab): zero-value for this C enum has no special/invalid meaning.
+ return C.OSTREE_REPO_MODE_BARE, generateError(cErr)
}
- return nil
+
+ return retMode, nil
}
diff --git a/vendor/github.com/ostreedev/ostree-go/pkg/otbuiltin/log.go b/vendor/github.com/ostreedev/ostree-go/pkg/otbuiltin/log.go
index 2ceea0925..d57498215 100644
--- a/vendor/github.com/ostreedev/ostree-go/pkg/otbuiltin/log.go
+++ b/vendor/github.com/ostreedev/ostree-go/pkg/otbuiltin/log.go
@@ -2,7 +2,6 @@ package otbuiltin
import (
"fmt"
- "strings"
"time"
"unsafe"
@@ -16,13 +15,7 @@ import (
// #include "builtin.go.h"
import "C"
-// Declare variables for options
-var logOpts logOptions
-
-// Set the format of the strings in the log
-const formatString = "2006-01-02 03:04;05 -0700"
-
-// Struct for the various pieces of data in a log entry
+// LogEntry is a struct for the various pieces of data in a log entry
type LogEntry struct {
Checksum []byte
Variant []byte
@@ -39,24 +32,25 @@ func (l LogEntry) String() string {
return fmt.Sprintf("%s\n%s\n\n", l.Checksum, l.Variant)
}
-type OstreeDumpFlags uint
+type ostreeDumpFlags uint
const (
- OSTREE_DUMP_NONE OstreeDumpFlags = 0
- OSTREE_DUMP_RAW OstreeDumpFlags = 1 << iota
+ ostreeDumpNone ostreeDumpFlags = 0
+ ostreeDumpRaw ostreeDumpFlags = 1 << iota
)
-// Contains all of the options for initializing an ostree repo
+// logOptions contains all of the options for initializing an ostree repo
type logOptions struct {
- Raw bool // Show raw variant data
+ // Raw determines whether to show raw variant data
+ Raw bool
}
-//Instantiates and returns a logOptions struct with default values set
+// NewLogOptions instantiates and returns a logOptions struct with default values set
func NewLogOptions() logOptions {
return logOptions{}
}
-// Show the logs of a branch starting with a given commit or ref. Returns a
+// Log shows the logs of a branch starting with a given commit or ref. Returns a
// slice of log entries on success and an error otherwise
func Log(repoPath, branch string, options logOptions) ([]LogEntry, error) {
// attempt to open the repository
@@ -69,12 +63,12 @@ func Log(repoPath, branch string, options logOptions) ([]LogEntry, error) {
defer C.free(unsafe.Pointer(cbranch))
var checksum *C.char
defer C.free(unsafe.Pointer(checksum))
- var flags OstreeDumpFlags = OSTREE_DUMP_NONE
var cerr *C.GError
defer C.free(unsafe.Pointer(cerr))
- if logOpts.Raw {
- flags |= OSTREE_DUMP_RAW
+ flags := ostreeDumpNone
+ if options.Raw {
+ flags |= ostreeDumpRaw
}
if !glib.GoBool(glib.GBoolean(C.ostree_repo_resolve_rev(repo.native(), cbranch, C.FALSE, &checksum, &cerr))) {
@@ -84,84 +78,86 @@ func Log(repoPath, branch string, options logOptions) ([]LogEntry, error) {
return logCommit(repo, checksum, false, flags)
}
-func logCommit(repo *Repo, checksum *C.char, isRecursive bool, flags OstreeDumpFlags) ([]LogEntry, error) {
+func logCommit(repo *Repo, checksum *C.char, isRecursive bool, flags ostreeDumpFlags) ([]LogEntry, error) {
var variant *C.GVariant
- var parent *C.char
- defer C.free(unsafe.Pointer(parent))
var gerr = glib.NewGError()
var cerr = (*C.GError)(gerr.Ptr())
defer C.free(unsafe.Pointer(cerr))
- entries := make([]LogEntry, 0, 1)
- var err error
if !glib.GoBool(glib.GBoolean(C.ostree_repo_load_variant(repo.native(), C.OSTREE_OBJECT_TYPE_COMMIT, checksum, &variant, &cerr))) {
if isRecursive && glib.GoBool(glib.GBoolean(C.g_error_matches(cerr, C.g_io_error_quark(), C.G_IO_ERROR_NOT_FOUND))) {
return nil, nil
}
- return entries, generateError(cerr)
+ return nil, generateError(cerr)
}
- nextLogEntry := dumpLogObject(C.OSTREE_OBJECT_TYPE_COMMIT, checksum, variant, flags)
-
- // get the parent of this commit
- parent = (*C.char)(C.ostree_commit_get_parent(variant))
+ // Get the parent of this commit
+ parent := (*C.char)(C.ostree_commit_get_parent(variant))
defer C.free(unsafe.Pointer(parent))
+
+ entries := make([]LogEntry, 0, 1)
if parent != nil {
+ var err error
entries, err = logCommit(repo, parent, true, flags)
if err != nil {
return nil, err
}
}
- entries = append(entries, *nextLogEntry)
+
+ nextLogEntry := dumpLogObject(C.OSTREE_OBJECT_TYPE_COMMIT, checksum, variant, flags)
+ entries = append(entries, nextLogEntry)
+
return entries, nil
}
-func dumpLogObject(objectType C.OstreeObjectType, checksum *C.char, variant *C.GVariant, flags OstreeDumpFlags) *LogEntry {
- objLog := new(LogEntry)
- objLog.Checksum = []byte(C.GoString(checksum))
+func dumpLogObject(objectType C.OstreeObjectType, checksum *C.char, variant *C.GVariant, flags ostreeDumpFlags) LogEntry {
+ csum := []byte(C.GoString(checksum))
- if (flags & OSTREE_DUMP_RAW) != 0 {
- dumpVariant(objLog, variant)
- return objLog
+ if (flags & ostreeDumpRaw) != 0 {
+ return dumpVariant(variant, csum)
}
switch objectType {
case C.OSTREE_OBJECT_TYPE_COMMIT:
- dumpCommit(objLog, variant, flags)
- return objLog
+ return dumpCommit(variant, flags, csum)
default:
- return objLog
+ return LogEntry{
+ Checksum: csum,
+ }
}
}
-func dumpVariant(log *LogEntry, variant *C.GVariant) {
- var byteswappedVariant *C.GVariant
-
+func dumpVariant(variant *C.GVariant, csum []byte) LogEntry {
+ var logVariant []byte
if C.G_BYTE_ORDER != C.G_BIG_ENDIAN {
- byteswappedVariant = C.g_variant_byteswap(variant)
- log.Variant = []byte(C.GoString((*C.char)(C.g_variant_print(byteswappedVariant, C.TRUE))))
+ byteswappedVariant := C.g_variant_byteswap(variant)
+ logVariant = []byte(C.GoString((*C.char)(C.g_variant_print(byteswappedVariant, C.TRUE))))
} else {
- log.Variant = []byte(C.GoString((*C.char)(C.g_variant_print(byteswappedVariant, C.TRUE))))
+ logVariant = []byte(C.GoString((*C.char)(C.g_variant_print(variant, C.TRUE))))
+ }
+
+ return LogEntry{
+ Checksum: csum,
+ Variant: logVariant,
}
}
-func dumpCommit(log *LogEntry, variant *C.GVariant, flags OstreeDumpFlags) {
- var subject, body *C.char
+func dumpCommit(variant *C.GVariant, flags ostreeDumpFlags, csum []byte) LogEntry {
+ var subject *C.char
defer C.free(unsafe.Pointer(subject))
+ var body *C.char
defer C.free(unsafe.Pointer(body))
- var timestamp C.guint64
+ var timeBigE C.guint64
- C._g_variant_get_commit_dump(variant, C.CString("(a{sv}aya(say)&s&stayay)"), &subject, &body, &timestamp)
+ C._g_variant_get_commit_dump(variant, C.CString("(a{sv}aya(say)&s&stayay)"), &subject, &body, &timeBigE)
- // Timestamp is now a Unix formatted timestamp as a guint64
- timestamp = C._guint64_from_be(timestamp)
- log.Timestamp = time.Unix((int64)(timestamp), 0)
-
- if strings.Compare(C.GoString(subject), "") != 0 {
- log.Subject = C.GoString(subject)
- }
+ // Translate to a host-endian epoch and convert to Go timestamp
+ timeHostE := C._guint64_from_be(timeBigE)
+ timestamp := time.Unix((int64)(timeHostE), 0)
- if strings.Compare(C.GoString(body), "") != 0 {
- log.Body = C.GoString(body)
+ return LogEntry{
+ Timestamp: timestamp,
+ Subject: C.GoString(subject),
+ Body: C.GoString(body),
}
}
diff --git a/vendor/github.com/ostreedev/ostree-go/pkg/otbuiltin/ls.go b/vendor/github.com/ostreedev/ostree-go/pkg/otbuiltin/ls.go
deleted file mode 100644
index d43ea07c7..000000000
--- a/vendor/github.com/ostreedev/ostree-go/pkg/otbuiltin/ls.go
+++ /dev/null
@@ -1 +0,0 @@
-package otbuiltin
diff --git a/vendor/github.com/ostreedev/ostree-go/pkg/otbuiltin/prune.go b/vendor/github.com/ostreedev/ostree-go/pkg/otbuiltin/prune.go
index 8dfa40a55..532522fc5 100644
--- a/vendor/github.com/ostreedev/ostree-go/pkg/otbuiltin/prune.go
+++ b/vendor/github.com/ostreedev/ostree-go/pkg/otbuiltin/prune.go
@@ -145,7 +145,7 @@ func deleteCommit(repo *Repo, commitToDelete string, cancellable *glib.GCancella
}
}
- if err := enableTombstoneCommits(repo); err != nil {
+ if err := repo.enableTombstoneCommits(); err != nil {
return err
}
@@ -169,7 +169,7 @@ func pruneCommitsKeepYoungerThanDate(repo *Repo, date time.Time, cancellable *gl
var cerr = (*C.GError)(gerr.Ptr())
defer C.free(unsafe.Pointer(cerr))
- if err := enableTombstoneCommits(repo); err != nil {
+ if err := repo.enableTombstoneCommits(); err != nil {
return err
}
diff --git a/vendor/github.com/ostreedev/ostree-go/pkg/otbuiltin/pull.go b/vendor/github.com/ostreedev/ostree-go/pkg/otbuiltin/pull.go
deleted file mode 100644
index d43ea07c7..000000000
--- a/vendor/github.com/ostreedev/ostree-go/pkg/otbuiltin/pull.go
+++ /dev/null
@@ -1 +0,0 @@
-package otbuiltin
diff --git a/vendor/github.com/ostreedev/ostree-go/pkg/otbuiltin/pulllocal.go b/vendor/github.com/ostreedev/ostree-go/pkg/otbuiltin/pulllocal.go
deleted file mode 100644
index d43ea07c7..000000000
--- a/vendor/github.com/ostreedev/ostree-go/pkg/otbuiltin/pulllocal.go
+++ /dev/null
@@ -1 +0,0 @@
-package otbuiltin
diff --git a/vendor/github.com/ostreedev/ostree-go/pkg/otbuiltin/refs.go b/vendor/github.com/ostreedev/ostree-go/pkg/otbuiltin/refs.go
deleted file mode 100644
index d43ea07c7..000000000
--- a/vendor/github.com/ostreedev/ostree-go/pkg/otbuiltin/refs.go
+++ /dev/null
@@ -1 +0,0 @@
-package otbuiltin
diff --git a/vendor/github.com/ostreedev/ostree-go/pkg/otbuiltin/remote.go b/vendor/github.com/ostreedev/ostree-go/pkg/otbuiltin/remote.go
deleted file mode 100644
index d43ea07c7..000000000
--- a/vendor/github.com/ostreedev/ostree-go/pkg/otbuiltin/remote.go
+++ /dev/null
@@ -1 +0,0 @@
-package otbuiltin
diff --git a/vendor/github.com/ostreedev/ostree-go/pkg/otbuiltin/reset.go b/vendor/github.com/ostreedev/ostree-go/pkg/otbuiltin/reset.go
deleted file mode 100644
index d43ea07c7..000000000
--- a/vendor/github.com/ostreedev/ostree-go/pkg/otbuiltin/reset.go
+++ /dev/null
@@ -1 +0,0 @@
-package otbuiltin
diff --git a/vendor/github.com/ostreedev/ostree-go/pkg/otbuiltin/revparse.go b/vendor/github.com/ostreedev/ostree-go/pkg/otbuiltin/revparse.go
deleted file mode 100644
index d43ea07c7..000000000
--- a/vendor/github.com/ostreedev/ostree-go/pkg/otbuiltin/revparse.go
+++ /dev/null
@@ -1 +0,0 @@
-package otbuiltin
diff --git a/vendor/github.com/ostreedev/ostree-go/pkg/otbuiltin/show.go b/vendor/github.com/ostreedev/ostree-go/pkg/otbuiltin/show.go
deleted file mode 100644
index d43ea07c7..000000000
--- a/vendor/github.com/ostreedev/ostree-go/pkg/otbuiltin/show.go
+++ /dev/null
@@ -1 +0,0 @@
-package otbuiltin
diff --git a/vendor/github.com/ostreedev/ostree-go/pkg/otbuiltin/staticdelta.go b/vendor/github.com/ostreedev/ostree-go/pkg/otbuiltin/staticdelta.go
deleted file mode 100644
index d43ea07c7..000000000
--- a/vendor/github.com/ostreedev/ostree-go/pkg/otbuiltin/staticdelta.go
+++ /dev/null
@@ -1 +0,0 @@
-package otbuiltin
diff --git a/vendor/github.com/ostreedev/ostree-go/pkg/otbuiltin/summary.go b/vendor/github.com/ostreedev/ostree-go/pkg/otbuiltin/summary.go
deleted file mode 100644
index d43ea07c7..000000000
--- a/vendor/github.com/ostreedev/ostree-go/pkg/otbuiltin/summary.go
+++ /dev/null
@@ -1 +0,0 @@
-package otbuiltin
diff --git a/vendor/github.com/ostreedev/ostree-go/pkg/otbuiltin/trivialhttpd.go b/vendor/github.com/ostreedev/ostree-go/pkg/otbuiltin/trivialhttpd.go
deleted file mode 100644
index d43ea07c7..000000000
--- a/vendor/github.com/ostreedev/ostree-go/pkg/otbuiltin/trivialhttpd.go
+++ /dev/null
@@ -1 +0,0 @@
-package otbuiltin
diff --git a/vendor/github.com/ostreedev/ostree-go/pkg/otremote/remote.go.h b/vendor/github.com/ostreedev/ostree-go/pkg/otremote/remote.go.h
deleted file mode 100644
index e69de29bb..000000000
--- a/vendor/github.com/ostreedev/ostree-go/pkg/otremote/remote.go.h
+++ /dev/null
diff --git a/vendor/github.com/ostreedev/ostree-go/pkg/otremote/remoteadd.go b/vendor/github.com/ostreedev/ostree-go/pkg/otremote/remoteadd.go
deleted file mode 100644
index e69de29bb..000000000
--- a/vendor/github.com/ostreedev/ostree-go/pkg/otremote/remoteadd.go
+++ /dev/null
diff --git a/vendor/github.com/ostreedev/ostree-go/pkg/otremote/remotedelete.go b/vendor/github.com/ostreedev/ostree-go/pkg/otremote/remotedelete.go
deleted file mode 100644
index e69de29bb..000000000
--- a/vendor/github.com/ostreedev/ostree-go/pkg/otremote/remotedelete.go
+++ /dev/null
diff --git a/vendor/github.com/ostreedev/ostree-go/pkg/otremote/remotegpgimport.go b/vendor/github.com/ostreedev/ostree-go/pkg/otremote/remotegpgimport.go
deleted file mode 100644
index e69de29bb..000000000
--- a/vendor/github.com/ostreedev/ostree-go/pkg/otremote/remotegpgimport.go
+++ /dev/null
diff --git a/vendor/github.com/ostreedev/ostree-go/pkg/otremote/remotelist.go b/vendor/github.com/ostreedev/ostree-go/pkg/otremote/remotelist.go
deleted file mode 100644
index e69de29bb..000000000
--- a/vendor/github.com/ostreedev/ostree-go/pkg/otremote/remotelist.go
+++ /dev/null
diff --git a/vendor/github.com/ostreedev/ostree-go/pkg/otremote/remoterefs.go b/vendor/github.com/ostreedev/ostree-go/pkg/otremote/remoterefs.go
deleted file mode 100644
index e69de29bb..000000000
--- a/vendor/github.com/ostreedev/ostree-go/pkg/otremote/remoterefs.go
+++ /dev/null
diff --git a/vendor/github.com/ostreedev/ostree-go/pkg/otremote/remoteshowurl.go b/vendor/github.com/ostreedev/ostree-go/pkg/otremote/remoteshowurl.go
deleted file mode 100644
index e69de29bb..000000000
--- a/vendor/github.com/ostreedev/ostree-go/pkg/otremote/remoteshowurl.go
+++ /dev/null
diff --git a/vendor/github.com/ostreedev/ostree-go/pkg/otremote/remotesummary.go b/vendor/github.com/ostreedev/ostree-go/pkg/otremote/remotesummary.go
deleted file mode 100644
index e69de29bb..000000000
--- a/vendor/github.com/ostreedev/ostree-go/pkg/otremote/remotesummary.go
+++ /dev/null
diff --git a/version/version.go b/version/version.go
index 0fd4e5aeb..01b9b7a8d 100644
--- a/version/version.go
+++ b/version/version.go
@@ -4,4 +4,4 @@ package version
// NOTE: remember to bump the version at the top
// of the top-level README.md file when this is
// bumped.
-const Version = "0.10.2-dev"
+const Version = "0.11.2-dev"