Debian

Available patches from Ubuntu

To see Ubuntu differences wrt. to Debian, write down a grep-dctrl query identifying the packages you're interested in:
grep-dctrl -n -sPackage Sources.Debian
(e.g. -FPackage linux-ntfs or linux-ntfs)

Modified packages are listed below:

Debian ( Changelog | PTS | Bugs ) Ubuntu ( Changelog | txt | LP | Bugs ) | Diff from Ubuntu

Source: desktop-base

desktop-base (9.0.6ubuntu1) cosmic; urgency=medium * Sync with Debian. Remaining change: - debian/postinst, debian/prerm: Don't apply Debian branding for GRUB -- Jeremy Bicha <jbicha@ubuntu.com> Fri, 18 May 2018 10:54:55 -0400

Modifications :
  1. Download patch debian/prerm

    --- 9.0.6/debian/prerm 2018-02-16 23:43:27.000000000 +0000 +++ 9.0.6ubuntu1/debian/prerm 2018-05-18 14:54:55.000000000 +0000 @@ -116,38 +116,38 @@ EOF /usr/share/desktop-base/active-theme/login/background.svg # Remove GRUB background alternatives - while read theme ratio; do - update-alternatives --remove \ - desktop-grub \ - /usr/share/desktop-base/$theme-theme/grub/grub-$ratio.png - done << EOF -softwaves 4x3 -softwaves 16x9 -lines 4x3 -lines 16x9 -joy 4x3 -joy 16x9 -spacefun 4x3 -spacefun 16x9 -EOF - ## *Lastly* remove *highest priority* alternative - num_grub_efi_installed=$(dpkg-query --list "grub-efi*" 2> /dev/null | grep "^i" | wc -l) - if [ $num_grub_efi_installed -gt 0 ] ; then - remove_first_ratio=4x3 - remove_last_ratio=16x9 - else - remove_first_ratio=16x9 - remove_last_ratio=4x3 - fi - update-alternatives --remove \ - desktop-grub.sh \ - /usr/share/desktop-base/active-theme/grub/grub_background.sh - update-alternatives --remove \ - desktop-grub \ - /usr/share/desktop-base/active-theme/grub/grub-$remove_first_ratio.png - update-alternatives --remove \ - desktop-grub \ - /usr/share/desktop-base/active-theme/grub/grub-$remove_last_ratio.png +# while read theme ratio; do +# update-alternatives --remove \ +# desktop-grub \ +# /usr/share/desktop-base/$theme-theme/grub/grub-$ratio.png +# done << EOF +#softwaves 4x3 +#softwaves 16x9 +#lines 4x3 +#lines 16x9 +#joy 4x3 +#joy 16x9 +#spacefun 4x3 +#spacefun 16x9 +#EOF +# ## *Lastly* remove *highest priority* alternative +# num_grub_efi_installed=$(dpkg-query --list "grub-efi*" 2> /dev/null | grep "^i" | wc -l) +# if [ $num_grub_efi_installed -gt 0 ] ; then +# remove_first_ratio=4x3 +# remove_last_ratio=16x9 +# else +# remove_first_ratio=16x9 +# remove_last_ratio=4x3 +# fi +# update-alternatives --remove \ +# desktop-grub.sh \ +# /usr/share/desktop-base/active-theme/grub/grub_background.sh +# update-alternatives --remove \ +# desktop-grub \ +# /usr/share/desktop-base/active-theme/grub/grub-$remove_first_ratio.png +# update-alternatives --remove \ +# desktop-grub \ +# /usr/share/desktop-base/active-theme/grub/grub-$remove_last_ratio.png # Remove theme package alternatives
  2. Download patch debian/control

    --- 9.0.6/debian/control 2018-03-05 09:20:26.000000000 +0000 +++ 9.0.6ubuntu1/debian/control 2018-05-18 14:54:55.000000000 +0000 @@ -1,7 +1,8 @@ Source: desktop-base Section: x11 Priority: optional -Maintainer: Debian Desktop Team <debian-desktop@lists.debian.org> +Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com> +XSBC-Original-Maintainer: Debian Desktop Team <debian-desktop@lists.debian.org> Uploaders: Yves-Alexis Perez <corsac@debian.org>, Josselin Mouette <joss@debian.org>, Paul Tagliamonte <paultag@debian.org>,
  3. Download patch debian/postinst

    --- 9.0.6/debian/postinst 2018-03-04 21:25:43.000000000 +0000 +++ 9.0.6ubuntu1/debian/postinst 2018-05-18 14:54:55.000000000 +0000 @@ -167,70 +167,70 @@ EOF # Favor widescreen / hi-res background for efi installations detected # by the presence of grub-efi* packages (not the grub-efi*-bin which don’t # necessary account for grub being the active bootloader). - if dpkg-query --list grub-efi* | grep -v "^... grub-efi[^[:space:]]*-bin" | grep -q "^[ih][HUFWti] " ; then - echo "grub-efi* packages found, using 16/9 as default grub background ratio" - grub_first_ratio="16x9" - grub_second_ratio="4x3" - else - echo "No grub-efi* package found, using 4/3 as default grub background ratio" - grub_first_ratio="4x3" - grub_second_ratio="16x9" - fi - active_grub_background=/usr/share/desktop-base/active-theme/grub/grub_background.sh - active_grub_first_ratio=/usr/share/desktop-base/active-theme/grub/grub-${grub_first_ratio}.png - if [ -e ${active_grub_first_ratio} ] && [ -e ${active_grub_background} ]; then - update-alternatives --install \ - /usr/share/images/desktop-base/desktop-grub.png \ - desktop-grub ${active_grub_first_ratio} 50 \ - --slave /usr/share/desktop-base/grub_background.sh \ - desktop-grub.sh ${active_grub_background} - fi - active_grub_second_ratio=/usr/share/desktop-base/active-theme/grub/grub-${grub_second_ratio}.png - if [ -e ${active_grub_second_ratio} ] && [ -e ${active_grub_background} ]; then - update-alternatives --install \ - /usr/share/images/desktop-base/desktop-grub.png \ - desktop-grub ${active_grub_second_ratio} 45 \ - --slave /usr/share/desktop-base/grub_background.sh \ - desktop-grub.sh ${active_grub_background} - fi - # Alternatives for theme packages - while read theme ratio priority; do - update-alternatives --install /usr/share/images/desktop-base/desktop-grub.png \ - desktop-grub \ - /usr/share/desktop-base/$theme-theme/grub/grub-$ratio.png $priority \ - --slave /usr/share/desktop-base/grub_background.sh \ - desktop-grub.sh \ - /usr/share/desktop-base/$theme-theme/grub/grub_background.sh - done << EOF -softwaves 4x3 40 -softwaves 16x9 40 -lines 4x3 30 -lines 16x9 30 -joy 4x3 30 -joy 16x9 30 -spacefun 4x3 30 -spacefun 16x9 30 -EOF +# if dpkg-query --list grub-efi* | grep -v "^... grub-efi[^[:space:]]*-bin" | grep -q "^[ih][HUFWti] " ; then +# echo "grub-efi* packages found, using 16/9 as default grub background ratio" +# grub_first_ratio="16x9" +# grub_second_ratio="4x3" +# else +# echo "No grub-efi* package found, using 4/3 as default grub background ratio" +# grub_first_ratio="4x3" +# grub_second_ratio="16x9" +# fi +# active_grub_background=/usr/share/desktop-base/active-theme/grub/grub_background.sh +# active_grub_first_ratio=/usr/share/desktop-base/active-theme/grub/grub-${grub_first_ratio}.png +# if [ -e ${active_grub_first_ratio} ] && [ -e ${active_grub_background} ]; then +# update-alternatives --install \ +# /usr/share/images/desktop-base/desktop-grub.png \ +# desktop-grub ${active_grub_first_ratio} 50 \ +# --slave /usr/share/desktop-base/grub_background.sh \ +# desktop-grub.sh ${active_grub_background} +# fi +# active_grub_second_ratio=/usr/share/desktop-base/active-theme/grub/grub-${grub_second_ratio}.png +# if [ -e ${active_grub_second_ratio} ] && [ -e ${active_grub_background} ]; then +# update-alternatives --install \ +# /usr/share/images/desktop-base/desktop-grub.png \ +# desktop-grub ${active_grub_second_ratio} 45 \ +# --slave /usr/share/desktop-base/grub_background.sh \ +# desktop-grub.sh ${active_grub_background} +# fi +# # Alternatives for theme packages +# while read theme ratio priority; do +# update-alternatives --install /usr/share/images/desktop-base/desktop-grub.png \ +# desktop-grub \ +# /usr/share/desktop-base/$theme-theme/grub/grub-$ratio.png $priority \ +# --slave /usr/share/desktop-base/grub_background.sh \ +# desktop-grub.sh \ +# /usr/share/desktop-base/$theme-theme/grub/grub_background.sh +# done << EOF +#softwaves 4x3 40 +#softwaves 16x9 40 +#lines 4x3 30 +#lines 16x9 30 +#joy 4x3 30 +#joy 16x9 30 +#spacefun 4x3 30 +#spacefun 16x9 30 +#EOF # Apply GRUB background update into /boot # Try detecting active grub packages (so not -doc, -common, -bin) as a hint # that GRUB is being used as bootloader before calling update-grub. # Some people use the *-bin packages without using GRUB as bootloader # (see #851893 for more context). - if dpkg-query --list "grub-*" | grep -v "^... grub\(-common\|-emu\|[^[:space:]]*\(-bin\|-doc\)\)" | grep -q "^[ih][HUFWti] " \ - && which update-grub > /dev/null ; then +# if dpkg-query --list "grub-*" | grep -v "^... grub\(-common\|-emu\|[^[:space:]]*\(-bin\|-doc\)\)" | grep -q "^[ih][HUFWti] " \ +# && which update-grub > /dev/null ; then # Ensure the background image file has actually been written to disc # before updating. - sync +# sync # Report success whatever grub return status. This is needed at least # in live systems fon installation to succeed (see #850601). # Until we find a better solution like detecting we’re in a live image # and not calling update-grub at all. - update-grub || echo "Updating grub failed, report success anyway!" - fi +# update-grub || echo "Updating grub failed, report success anyway!" +# fi - if which update-initramfs > /dev/null; then - update-initramfs -u - fi +# if which update-initramfs > /dev/null; then +# update-initramfs -u +# fi fi

Debian ( Changelog | PTS | Bugs ) Ubuntu ( Changelog | txt | LP | Bugs ) | Diff from Ubuntu

Source: docker.io

docker.io (18.06.1-0ubuntu2) disco; urgency=medium * Fix containerd/runc embedded commit values * Add "libsystemd-dev" to "Build-Depends" (LP: #1802979) -- Tianon Gravi <tianon@debian.org> Fri, 19 Oct 2018 13:06:35 -0700 docker.io (18.06.1-0ubuntu1) cosmic; urgency=medium * Update to 18.06.1 upstream release (LP: #1794396) - drop "fix-btrfs-constants.patch" (applied upstream) * Update debconf to prompt more aggressively (LP: #1784602) 1. does not prompt on initial install (but does start the daemon) 2. does prompt on every reinstall / upgrade (if the daemon is running) 3. does prompt during "dpkg-reconfigure docker.io" (but does _not_ [re]start the daemon) 4. works properly with DEBIAN_FRONTEND=noninteractive -- user's previous/stored answer to the question automatically applies with no prompt * Check if "docker" group exists before creating it (LP: #1769911) -- Tianon Gravi <tianon@debian.org> Mon, 24 Sep 2018 15:42:19 -0700 docker.io (17.12.1-0ubuntu6) cosmic; urgency=medium * d/tests/docker-in-lxd: Avoid startup race and drop lxd-client depends -- Stéphane Graber <stgraber@ubuntu.com> Sat, 15 Sep 2018 03:07:49 +0200 docker.io (17.12.1-0ubuntu5) cosmic; urgency=medium * Fix ftbfs by cherry-picking https://github.com/containerd/btrfs/pull/16. -- Michael Hudson-Doyle <michael.hudson@ubuntu.com> Wed, 01 Aug 2018 11:40:05 +1200 docker.io (17.12.1-0ubuntu4) cosmic; urgency=medium * d/tests/docker-in-lxd: only setup network bridge if missing -- Stéphane Graber <stgraber@ubuntu.com> Tue, 05 Jun 2018 22:58:51 -0400 docker.io (17.12.1-0ubuntu3) cosmic; urgency=medium * d/tests/docker-in-lxd: switch to ubuntu-daily lxd remote and wait for cloud-init to finish before running commands in the container. -- Michael Hudson-Doyle <michael.hudson@ubuntu.com> Tue, 22 May 2018 10:54:00 +1200 docker.io (17.12.1-0ubuntu2) cosmic; urgency=medium * Update btrfs dependencies to use the new libbtrfs-dev & btrfs-progs. -- Dimitri John Ledkov <xnox@ubuntu.com> Thu, 17 May 2018 09:27:15 +0100 docker.io (17.12.1-0ubuntu1) bionic; urgency=medium [ Tianon Gravi ] * Update to 17.12.1-ce upstream release - swap from github.com/docker/docker to .../docker/docker-ce - build separate components in a way that can be parallelized - remove older (unsupported) contrib/ bits from being shipped - drop a lot of unnecessary packaging bits from debian/ * Adjust debconf prompt: - ask during _every_ upgrade - default to not restarting [ Michael Hudson-Doyle ] * Switch to building with default version of Go. * Adjust debconf template to match change in behavior. -- Tianon Gravi <tianon@debian.org> Wed, 28 Feb 2018 09:46:05 -0800 docker.io (17.03.2-0ubuntu5) bionic; urgency=medium * d/control, d/rules: Fix FTBFS when built with golang 1.10 by build depending on golang-1.9-go. See https://github.com/moby/moby/pull/35739 for upstream discussion on golang 1.10 compatibility. -- Tyler Hicks <tyhicks@canonical.com> Tue, 20 Mar 2018 13:57:16 +0000 docker.io (17.03.2-0ubuntu4) bionic; urgency=medium * d/tests/docker-in-lxd: Fix failing test due to /etc/resolv.conf being a symlink in Bionic. The 'lxc file pull <path> -' command prints the symlink contents (the target path) to stdout, rather than the contents of the target file, so use 'lxc exec' to grep /etc/resolv.conf. Grep will follow the symlink in situations where /etc/resolv.conf is a symlink. -- Tyler Hicks <tyhicks@canonical.com> Mon, 19 Mar 2018 19:35:52 +0000 docker.io (17.03.2-0ubuntu3) bionic; urgency=medium * d/tests/docker-in-lxd: set DEBIAN_FRONTEND=noninteractive when installing docker in the lxd container -- Michael Hudson-Doyle <michael.hudson@ubuntu.com> Wed, 21 Feb 2018 10:49:58 +1300 docker.io (17.03.2-0ubuntu2) bionic; urgency=medium * Replace "--no-restart-on-upgrade" with "--no-start" and a debconf prompt - not restarting Docker causes many issues (LP: #1658691) - suggested methods for keeping containers up are to use a restart policy ("--restart=..." on "docker run"), Swarm Mode services, or rolling replacement of k8s workers * Backport 30519 for bashism (LP: #1744599) - https://github.com/docker/docker/pull/30519 -- Tianon Gravi <tianon@debian.org> Thu, 07 Dec 2017 09:42:53 -0800 docker.io (17.03.2-0ubuntu1) bionic; urgency=medium * Update to 17.03.2 upstream release -- Tianon Gravi <tianon@debian.org> Wed, 01 Nov 2017 12:30:17 -0700 docker.io (1.13.1-0ubuntu6) artful; urgency=medium * Add missing "runc" patches for LXD-enablement -- Tianon Gravi <tianon@debian.org> Wed, 11 Oct 2017 19:38:03 -0700 docker.io (1.13.1-0ubuntu5) artful; urgency=medium * Replace "runc" dependency with a multiorig copy of Docker's exact supported commit contents (installed as "/usr/bin/docker-runc" mirroring upstream's package) * Replace "containerd" in the same way (with the exact upstream-supported commit, binaries installed as "/usr/bin/docker-containerd*") -- Tianon Gravi <tianon@debian.org> Fri, 29 Sep 2017 13:22:39 -0700 docker.io (1.13.1-0ubuntu4) artful; urgency=medium * d/tests/docker-in-lxd: Better handle DNS with systemd-resolved. -- Stéphane Graber <stgraber@ubuntu.com> Thu, 21 Sep 2017 01:12:33 -0400 docker.io (1.13.1-0ubuntu3) artful; urgency=medium * d/tests/docker-in-lxd: check for network-up has a race condition when systemd-resolved is used. Add an additional check for a real DNS server in systemd-resolve --status. -- Steve Langasek <steve.langasek@ubuntu.com> Fri, 15 Sep 2017 23:32:16 -0700 docker.io (1.13.1-0ubuntu2) artful; urgency=medium * d/tests/docker-in-lxd: copy more apt config into container * d/golang-github-docker-docker-dev.install: install missing packages. (LP: #1714564) * d/control: Add Build-Depend on tzdata. -- Michael Hudson-Doyle <michael.hudson@ubuntu.com> Mon, 04 Sep 2017 13:31:34 +1200 docker.io (1.13.1-0ubuntu1) artful; urgency=medium * Update to 1.13.1 upstream release - refresh patches (removing many that are applied upstream in 1.13+) - use dh_clean (via debian/clean) instead of explicit "rm" in rules - pull in explicit libnetwork sources for "docker-proxy" - drop unnecessary dh_golang usage (only used for Built-Using calculation) - update "upstream-version-gitcommits" with a more recent list of commits - add "tini" for building "docker-init" (used by "docker run --init") - prefer Go 1.7 explicitly if it's available -- Tianon Gravi <tianon@debian.org> Tue, 22 Aug 2017 09:30:24 -0700 docker.io (1.12.6-0ubuntu7) artful; urgency=medium * Make sure to set security.nesting for the LXD autopkgtest. -- Stéphane Graber <stgraber@ubuntu.com> Tue, 06 Jun 2017 14:55:34 -0600 docker.io (1.12.6-0ubuntu6) artful; urgency=medium * Fix FTBFS on Go 1.8. -- Stéphane Graber <stgraber@ubuntu.com> Mon, 05 Jun 2017 16:21:16 -0600 docker.io (1.12.6-0ubuntu5) artful; urgency=medium * Update LXD autopkgtest now that the "docker" profile is deprecated. -- Stéphane Graber <stgraber@ubuntu.com> Mon, 05 Jun 2017 15:59:18 -0600 docker.io (1.12.6-0ubuntu4) zesty; urgency=medium * Revert 1.12.6-0ubuntu2 as it does not achieve the stated goal on both s390x and armhf. And lxc/lxd adt runners are too restrictive to e.g. import an ubuntu-base container for a minimal functional test. -- Dimitri John Ledkov <xnox@ubuntu.com> Tue, 14 Mar 2017 09:41:30 +0000 docker.io (1.12.6-0ubuntu3) zesty; urgency=medium * debian/tests/docker-in-lxd: Fix a latent version comparison bug that was causing migration failures due to the script thinking it was dealing with an old LXD (< 2.2) when it was really dealing with a recent LXD (>= 2.10). The fix is to use `lxc info` to check if the network extension is supported, rather than trying to compare version strings. -- Tyler Hicks <tyhicks@canonical.com> Fri, 10 Mar 2017 17:40:22 +0000 docker.io (1.12.6-0ubuntu2) zesty; urgency=medium * Remove isolation-machine restriction from adt smoke-test testcase. Should pass on s390x lxd runners; will fails on armhf runners but that is not a regressions since previously all tests were simply skipped on armhf. LP: #1658150 -- Dimitri John Ledkov <xnox@ubuntu.com> Wed, 01 Feb 2017 10:08:00 +0000 docker.io (1.12.6-0ubuntu1) zesty; urgency=medium * Update to 1.12.6 upstream release (LP: #1655906) - add a few new privileged tests to "skip-privileged-unit-tests.patch" * Adjust runc Depends to ensure fix for CVE-2016-9962 is included -- Tianon Gravi <tianon@debian.org> Fri, 13 Jan 2017 11:57:24 +1300 docker.io (1.12.3-0ubuntu4) zesty; urgency=medium * Explicity depend on the version of runc that was built with seccomp support. -- Michael Hudson-Doyle <michael.hudson@ubuntu.com> Mon, 12 Dec 2016 11:15:01 +1300 docker.io (1.12.3-0ubuntu3) zesty; urgency=medium [ Michael Hudson-Doyle ] * d/test/docker-in-lxd: make test for "is network up" more robust. [ Stefan Bader ] * Backport upstream 1.13 change to keep existing bridges untouched (LP: #1647376) - upstream-1.13-Vendor-libnetwork-51d88e9ae63f.patch -- Michael Hudson-Doyle <michael.hudson@ubuntu.com> Thu, 08 Dec 2016 11:53:36 +1300 docker.io (1.12.3-0ubuntu2) zesty; urgency=medium [ Tianon Gravi ] * Enable seccomp support (LP: #1639407) -- Steve Langasek <steve.langasek@ubuntu.com> Wed, 30 Nov 2016 12:34:22 -0800 docker.io (1.12.3-0ubuntu1) zesty; urgency=medium * Update to 1.12.3 upstream release - https://github.com/docker/docker/releases/tag/v1.12.2 - https://github.com/docker/docker/releases/tag/v1.12.3 -- Tianon Gravi <tianon@debian.org> Tue, 15 Nov 2016 15:50:32 -0800 docker.io (1.12.1-0ubuntu15) yakkety; urgency=medium * d/test/docker-in-lxd: use images:ubuntu/${suite}/${arch} instead of ubuntu-daily:${suite} because the former does not have cloud-init in it to rewrite /etc/apt/sources.list at unexpected times. -- Michael Hudson-Doyle <michael.hudson@ubuntu.com> Mon, 10 Oct 2016 21:38:17 +1300 docker.io (1.12.1-0ubuntu14) yakkety; urgency=medium * d/test/docker-in-lxd: cope with changes in lxd 2.3. -- Michael Hudson-Doyle <michael.hudson@ubuntu.com> Mon, 10 Oct 2016 15:30:42 +1300 docker.io (1.12.1-0ubuntu13) yakkety; urgency=medium * d/tests/docker-in-lxd: copy apt config from host to container rather than just enabling all of the -proposed pocket. -- Michael Hudson-Doyle <michael.hudson@ubuntu.com> Tue, 27 Sep 2016 12:23:56 +1300 docker.io (1.12.1-0ubuntu12) yakkety; urgency=medium * Final(?) docker-in-lxd fix: of course, alpine:latest is only the name of the image on amd64. -- Michael Hudson-Doyle <michael.hudson@ubuntu.com> Mon, 19 Sep 2016 20:34:59 +1200 docker.io (1.12.1-0ubuntu11) yakkety; urgency=medium * Even more docker-in-lxd fixes. -- Michael Hudson-Doyle <michael.hudson@ubuntu.com> Mon, 19 Sep 2016 14:14:33 +1200 docker.io (1.12.1-0ubuntu10) yakkety; urgency=medium * Yet another docker-in-lxd fix. -- Michael Hudson-Doyle <michael.hudson@ubuntu.com> Fri, 16 Sep 2016 19:02:41 +1200 docker.io (1.12.1-0ubuntu9) yakkety; urgency=medium * Proxy related fix for docker-in-lxd. -- Michael Hudson-Doyle <michael.hudson@ubuntu.com> Fri, 16 Sep 2016 18:59:54 +1200 docker.io (1.12.1-0ubuntu8) yakkety; urgency=medium * Re-enable docker-in-lxd again after many fixes. -- Michael Hudson-Doyle <michael.hudson@ubuntu.com> Fri, 16 Sep 2016 12:26:04 +1200 docker.io (1.12.1-0ubuntu7) yakkety; urgency=medium * d/tests/control: disable docker-in-lxd again, does not work in production infrastructure. -- Michael Hudson-Doyle <michael.hudson@ubuntu.com> Thu, 08 Sep 2016 09:41:13 +1200 docker.io (1.12.1-0ubuntu6) yakkety; urgency=medium * d/tests/control: docker-in-lxd needs to depend on lxd-client as well. -- Michael Hudson-Doyle <michael.hudson@ubuntu.com> Wed, 07 Sep 2016 21:18:18 +1200 docker.io (1.12.1-0ubuntu5) yakkety; urgency=medium * Ignore failure to set oom_score_adj, as happens in an unprivileged container. * Use $DOCKER_OPTS in service file again. * Add an autopkgtest to test docker-in-lxd. -- Michael Hudson-Doyle <michael.hudson@ubuntu.com> Wed, 07 Sep 2016 15:36:50 +1200 docker.io (1.12.1-0ubuntu4) yakkety; urgency=medium * Fix service file. -- Michael Hudson-Doyle <michael.hudson@ubuntu.com> Wed, 07 Sep 2016 14:13:12 +1200 docker.io (1.12.1-0ubuntu3) yakkety; urgency=medium * Skip "TestOverlay50LayerRead" on "overlay" driver too (in "skip-privileged-unit-tests.patch") -- Tianon Gravi <tianon@debian.org> Mon, 29 Aug 2016 16:00:00 -0700 docker.io (1.12.1-0ubuntu2) yakkety; urgency=medium * Add new "overlay2" driver's tests to "skip-privileged-unit-tests.patch" (FTBFS fix) -- Tianon Gravi <tianon@debian.org> Fri, 26 Aug 2016 10:20:24 -0700 docker.io (1.12.1-0ubuntu1) yakkety; urgency=medium * Update to 1.12.1 upstream release (LP: #1602243) - refresh "cgroupfs-mount-convenience-copy.patch" - remove "fatal-error-old-kernels.patch"; applied upstream, https://github.com/docker/docker/commit/51b23d88422918c24291f5876df35f91b23a446a - refresh "change-system-unit-env-file.patch" - refresh "21491--systemd-tasksmax.patch" - remove "22000--ignore-invalid-host-header.patch"; applied upstream, https://github.com/docker/docker/pull/22000 https://github.com/docker/docker/pull/22888 https://github.com/docker/docker/pull/23046 - refresh "remove-docker-prefix.patch" - refresh "skip-privileged-unit-tests.patch"; add new privileged tests, + TestMakeRemoteContext + TestMakeSumTarContext + TestDispatch + TestEmptyDockerfile + TestDockerfileOutsideTheBuildContext + TestRealodNoOpts - replace "lxd--20902--docker-in-userns.patch" with the upstream-applied "lxd--25672--docker-in-userns.patch" - remove "lxd--runc-617.patch"; no longer necessary (due to kernel fixes), https://github.com/opencontainers/runc/pull/617#issuecomment-223654149 - remove "21714--no-aufs-in-userns.patch"; applied upstream, https://github.com/docker/docker/pull/21714 - add "man" to "DH_GOLANG_EXCLUDES" (has new "generate.go" which imports the non-vendored "github.com/spf13/cobra/doc", causing dh_golang to choke) - add "docker-proxy-vendor.patch" to account for "vendor/..." vs "vendor/src/..." - install new explicit "dockerd" and "docker-proxy" binaries - update containerd dependency (>= 0.2.3) - update runc dependency (>= 1.0.0-rc1) * Update "debian/watch" to use "uscan.tianon.xyz" so older versions are still easily fetchable without excess work outside uscan -- Tianon Gravi <tianon@debian.org> Wed, 24 Aug 2016 11:48:34 -0700 docker.io (1.11.2-0ubuntu6) yakkety; urgency=medium * Merge from Debian Unstable: - more README.Debian notes (including a fixed href) - new "docker-doc" package which contains the documentation - use "dh-golang" for building (generates appropriate Built-Using) - run upstream unit tests during dh_auto_test - convert upstream-discouraged "/etc/default/docker" to comments-only - utilize dh_install (w/dh-exec) more fully to simplify debian/rules - fix "/etc/docker" permissions for co-existence with docker-registry - remove "/var/lib/docker" on purge * Remaining Ubuntu delta: - non-pruned vendor/ (included in golang-github-docker-docker-dev) - Docker-in-userns patches * Changes from pending Debian upload: - build from within GOPATH so Go packages are resolved properly - split "dh_auto_build-arch" from "dh_auto_build-indep" - include vendor/ in golang-github-docker-docker-dev (since we don't necessarily have the appropriate packages for Depends on that package) -- Tianon Gravi <tianon@debian.org> Fri, 19 Aug 2016 10:15:14 -0700

Modifications :
  1. Download patch cli/cli/command/container/list_test.go

    --- 18.06.0+dfsg1-1/cli/cli/command/container/list_test.go 2018-07-18 18:54:54.000000000 +0000 +++ 18.06.1-0ubuntu2/cli/cli/command/container/list_test.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,164 +0,0 @@ -package container - -import ( - "fmt" - "io/ioutil" - "testing" - - "github.com/docker/cli/cli/config/configfile" - "github.com/docker/cli/internal/test" - "github.com/docker/docker/api/types" - // Import builders to get the builder function as package function - . "github.com/docker/cli/internal/test/builders" - "gotest.tools/assert" - "gotest.tools/golden" -) - -func TestContainerListErrors(t *testing.T) { - testCases := []struct { - args []string - flags map[string]string - containerListFunc func(types.ContainerListOptions) ([]types.Container, error) - expectedError string - }{ - { - flags: map[string]string{ - "format": "{{invalid}}", - }, - expectedError: `function "invalid" not defined`, - }, - { - flags: map[string]string{ - "format": "{{join}}", - }, - expectedError: `wrong number of args for join`, - }, - { - containerListFunc: func(_ types.ContainerListOptions) ([]types.Container, error) { - return nil, fmt.Errorf("error listing containers") - }, - expectedError: "error listing containers", - }, - } - for _, tc := range testCases { - cmd := newListCommand( - test.NewFakeCli(&fakeClient{ - containerListFunc: tc.containerListFunc, - }), - ) - cmd.SetArgs(tc.args) - for key, value := range tc.flags { - cmd.Flags().Set(key, value) - } - cmd.SetOutput(ioutil.Discard) - assert.ErrorContains(t, cmd.Execute(), tc.expectedError) - } -} - -func TestContainerListWithoutFormat(t *testing.T) { - cli := test.NewFakeCli(&fakeClient{ - containerListFunc: func(_ types.ContainerListOptions) ([]types.Container, error) { - return []types.Container{ - *Container("c1"), - *Container("c2", WithName("foo")), - *Container("c3", WithPort(80, 80, TCP), WithPort(81, 81, TCP), WithPort(82, 82, TCP)), - *Container("c4", WithPort(81, 81, UDP)), - *Container("c5", WithPort(82, 82, IP("8.8.8.8"), TCP)), - }, nil - }, - }) - cmd := newListCommand(cli) - assert.NilError(t, cmd.Execute()) - golden.Assert(t, cli.OutBuffer().String(), "container-list-without-format.golden") -} - -func TestContainerListNoTrunc(t *testing.T) { - cli := test.NewFakeCli(&fakeClient{ - containerListFunc: func(_ types.ContainerListOptions) ([]types.Container, error) { - return []types.Container{ - *Container("c1"), - *Container("c2", WithName("foo/bar")), - }, nil - }, - }) - cmd := newListCommand(cli) - cmd.Flags().Set("no-trunc", "true") - assert.NilError(t, cmd.Execute()) - golden.Assert(t, cli.OutBuffer().String(), "container-list-without-format-no-trunc.golden") -} - -// Test for GitHub issue docker/docker#21772 -func TestContainerListNamesMultipleTime(t *testing.T) { - cli := test.NewFakeCli(&fakeClient{ - containerListFunc: func(_ types.ContainerListOptions) ([]types.Container, error) { - return []types.Container{ - *Container("c1"), - *Container("c2", WithName("foo/bar")), - }, nil - }, - }) - cmd := newListCommand(cli) - cmd.Flags().Set("format", "{{.Names}} {{.Names}}") - assert.NilError(t, cmd.Execute()) - golden.Assert(t, cli.OutBuffer().String(), "container-list-format-name-name.golden") -} - -// Test for GitHub issue docker/docker#30291 -func TestContainerListFormatTemplateWithArg(t *testing.T) { - cli := test.NewFakeCli(&fakeClient{ - containerListFunc: func(_ types.ContainerListOptions) ([]types.Container, error) { - return []types.Container{ - *Container("c1", WithLabel("some.label", "value")), - *Container("c2", WithName("foo/bar"), WithLabel("foo", "bar")), - }, nil - }, - }) - cmd := newListCommand(cli) - cmd.Flags().Set("format", `{{.Names}} {{.Label "some.label"}}`) - assert.NilError(t, cmd.Execute()) - golden.Assert(t, cli.OutBuffer().String(), "container-list-format-with-arg.golden") -} - -func TestContainerListFormatSizeSetsOption(t *testing.T) { - cli := test.NewFakeCli(&fakeClient{ - containerListFunc: func(options types.ContainerListOptions) ([]types.Container, error) { - assert.Check(t, options.Size) - return []types.Container{}, nil - }, - }) - cmd := newListCommand(cli) - cmd.Flags().Set("format", `{{.Size}}`) - assert.NilError(t, cmd.Execute()) -} - -func TestContainerListWithConfigFormat(t *testing.T) { - cli := test.NewFakeCli(&fakeClient{ - containerListFunc: func(_ types.ContainerListOptions) ([]types.Container, error) { - return []types.Container{ - *Container("c1", WithLabel("some.label", "value")), - *Container("c2", WithName("foo/bar"), WithLabel("foo", "bar")), - }, nil - }, - }) - cli.SetConfigFile(&configfile.ConfigFile{ - PsFormat: "{{ .Names }} {{ .Image }} {{ .Labels }}", - }) - cmd := newListCommand(cli) - assert.NilError(t, cmd.Execute()) - golden.Assert(t, cli.OutBuffer().String(), "container-list-with-config-format.golden") -} - -func TestContainerListWithFormat(t *testing.T) { - cli := test.NewFakeCli(&fakeClient{ - containerListFunc: func(_ types.ContainerListOptions) ([]types.Container, error) { - return []types.Container{ - *Container("c1", WithLabel("some.label", "value")), - *Container("c2", WithName("foo/bar"), WithLabel("foo", "bar")), - }, nil - }, - }) - cmd := newListCommand(cli) - cmd.Flags().Set("format", "{{ .Names }} {{ .Image }} {{ .Labels }}") - assert.NilError(t, cmd.Execute()) - golden.Assert(t, cli.OutBuffer().String(), "container-list-with-format.golden") -}
  2. Download patch cli/cli/command/config/create.go

    --- 18.06.0+dfsg1-1/cli/cli/command/config/create.go 2018-07-18 18:54:54.000000000 +0000 +++ 18.06.1-0ubuntu2/cli/cli/command/config/create.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,86 +0,0 @@ -package config - -import ( - "context" - "fmt" - "io" - "io/ioutil" - - "github.com/docker/cli/cli" - "github.com/docker/cli/cli/command" - "github.com/docker/cli/opts" - "github.com/docker/docker/api/types/swarm" - "github.com/docker/docker/pkg/system" - "github.com/pkg/errors" - "github.com/spf13/cobra" -) - -type createOptions struct { - name string - templateDriver string - file string - labels opts.ListOpts -} - -func newConfigCreateCommand(dockerCli command.Cli) *cobra.Command { - createOpts := createOptions{ - labels: opts.NewListOpts(opts.ValidateEnv), - } - - cmd := &cobra.Command{ - Use: "create [OPTIONS] CONFIG file|-", - Short: "Create a config from a file or STDIN", - Args: cli.ExactArgs(2), - RunE: func(cmd *cobra.Command, args []string) error { - createOpts.name = args[0] - createOpts.file = args[1] - return runConfigCreate(dockerCli, createOpts) - }, - } - flags := cmd.Flags() - flags.VarP(&createOpts.labels, "label", "l", "Config labels") - flags.StringVar(&createOpts.templateDriver, "template-driver", "", "Template driver") - flags.SetAnnotation("driver", "version", []string{"1.37"}) - - return cmd -} - -func runConfigCreate(dockerCli command.Cli, options createOptions) error { - client := dockerCli.Client() - ctx := context.Background() - - var in io.Reader = dockerCli.In() - if options.file != "-" { - file, err := system.OpenSequential(options.file) - if err != nil { - return err - } - in = file - defer file.Close() - } - - configData, err := ioutil.ReadAll(in) - if err != nil { - return errors.Errorf("Error reading content from %q: %v", options.file, err) - } - - spec := swarm.ConfigSpec{ - Annotations: swarm.Annotations{ - Name: options.name, - Labels: opts.ConvertKVStringsToMap(options.labels.GetAll()), - }, - Data: configData, - } - if options.templateDriver != "" { - spec.Templating = &swarm.Driver{ - Name: options.templateDriver, - } - } - r, err := client.ConfigCreate(ctx, spec) - if err != nil { - return err - } - - fmt.Fprintln(dockerCli.Out(), r.ID) - return nil -}
  3. Download patch cli/cli/command/checkpoint/remove_test.go

    --- 18.06.0+dfsg1-1/cli/cli/command/checkpoint/remove_test.go 2018-07-18 18:54:54.000000000 +0000 +++ 18.06.1-0ubuntu2/cli/cli/command/checkpoint/remove_test.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,65 +0,0 @@ -package checkpoint - -import ( - "io/ioutil" - "testing" - - "github.com/docker/cli/internal/test" - "github.com/docker/docker/api/types" - "github.com/pkg/errors" - "gotest.tools/assert" - is "gotest.tools/assert/cmp" -) - -func TestCheckpointRemoveErrors(t *testing.T) { - testCases := []struct { - args []string - checkpointDeleteFunc func(container string, options types.CheckpointDeleteOptions) error - expectedError string - }{ - { - args: []string{"too-few-arguments"}, - expectedError: "requires exactly 2 arguments", - }, - { - args: []string{"too", "many", "arguments"}, - expectedError: "requires exactly 2 arguments", - }, - { - args: []string{"foo", "bar"}, - checkpointDeleteFunc: func(container string, options types.CheckpointDeleteOptions) error { - return errors.Errorf("error deleting checkpoint") - }, - expectedError: "error deleting checkpoint", - }, - } - - for _, tc := range testCases { - cli := test.NewFakeCli(&fakeClient{ - checkpointDeleteFunc: tc.checkpointDeleteFunc, - }) - cmd := newRemoveCommand(cli) - cmd.SetArgs(tc.args) - cmd.SetOutput(ioutil.Discard) - assert.ErrorContains(t, cmd.Execute(), tc.expectedError) - } -} - -func TestCheckpointRemoveWithOptions(t *testing.T) { - var containerID, checkpointID, checkpointDir string - cli := test.NewFakeCli(&fakeClient{ - checkpointDeleteFunc: func(container string, options types.CheckpointDeleteOptions) error { - containerID = container - checkpointID = options.CheckpointID - checkpointDir = options.CheckpointDir - return nil - }, - }) - cmd := newRemoveCommand(cli) - cmd.SetArgs([]string{"container-foo", "checkpoint-bar"}) - cmd.Flags().Set("checkpoint-dir", "/dir/foo") - assert.NilError(t, cmd.Execute()) - assert.Check(t, is.Equal("container-foo", containerID)) - assert.Check(t, is.Equal("checkpoint-bar", checkpointID)) - assert.Check(t, is.Equal("/dir/foo", checkpointDir)) -}
  4. Download patch cli/cli/command/container/stats_unit_test.go

    --- 18.06.0+dfsg1-1/cli/cli/command/container/stats_unit_test.go 2018-07-18 18:54:54.000000000 +0000 +++ 18.06.1-0ubuntu2/cli/cli/command/container/stats_unit_test.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,25 +0,0 @@ -package container - -import ( - "testing" - - "github.com/docker/docker/api/types" -) - -func TestCalculateBlockIO(t *testing.T) { - blkio := types.BlkioStats{ - IoServiceBytesRecursive: []types.BlkioStatEntry{ - {Major: 8, Minor: 0, Op: "read", Value: 1234}, - {Major: 8, Minor: 1, Op: "read", Value: 4567}, - {Major: 8, Minor: 0, Op: "write", Value: 123}, - {Major: 8, Minor: 1, Op: "write", Value: 456}, - }, - } - blkRead, blkWrite := calculateBlockIO(blkio) - if blkRead != 5801 { - t.Fatalf("blkRead = %d, want 5801", blkRead) - } - if blkWrite != 579 { - t.Fatalf("blkWrite = %d, want 579", blkWrite) - } -}
  5. Download patch cli/cli/command/container/stats_helpers_test.go

    --- 18.06.0+dfsg1-1/cli/cli/command/container/stats_helpers_test.go 2018-07-18 18:54:54.000000000 +0000 +++ 18.06.1-0ubuntu2/cli/cli/command/container/stats_helpers_test.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,47 +0,0 @@ -package container - -import ( - "fmt" - "testing" - - "github.com/docker/docker/api/types" - "gotest.tools/assert" -) - -func TestCalculateMemUsageUnixNoCache(t *testing.T) { - // Given - stats := types.MemoryStats{Usage: 500, Stats: map[string]uint64{"cache": 400}} - - // When - result := calculateMemUsageUnixNoCache(stats) - - // Then - assert.Assert(t, inDelta(100.0, result, 1e-6)) -} - -func TestCalculateMemPercentUnixNoCache(t *testing.T) { - // Given - someLimit := float64(100.0) - noLimit := float64(0.0) - used := float64(70.0) - - // When and Then - t.Run("Limit is set", func(t *testing.T) { - result := calculateMemPercentUnixNoCache(someLimit, used) - assert.Assert(t, inDelta(70.0, result, 1e-6)) - }) - t.Run("No limit, no cgroup data", func(t *testing.T) { - result := calculateMemPercentUnixNoCache(noLimit, used) - assert.Assert(t, inDelta(0.0, result, 1e-6)) - }) -} - -func inDelta(x, y, delta float64) func() (bool, string) { - return func() (bool, string) { - diff := x - y - if diff < -delta || diff > delta { - return false, fmt.Sprintf("%f != %f within %f", x, y, delta) - } - return true, "" - } -}
  6. Download patch cli/cli/command/formatter/container.go
  7. Download patch cli/cli/command/container/opts_test.go
  8. Download patch cli/cli/command/container/exec_test.go
  9. Download patch cli/cli/command/config/testdata/config-inspect-without-format.single-config.golden

    --- 18.06.0+dfsg1-1/cli/cli/command/config/testdata/config-inspect-without-format.single-config.golden 2018-07-18 18:54:54.000000000 +0000 +++ 18.06.1-0ubuntu2/cli/cli/command/config/testdata/config-inspect-without-format.single-config.golden 1970-01-01 00:00:00.000000000 +0000 @@ -1,12 +0,0 @@ -[ - { - "ID": "ID-foo", - "Version": {}, - "CreatedAt": "0001-01-01T00:00:00Z", - "UpdatedAt": "0001-01-01T00:00:00Z", - "Spec": { - "Name": "foo", - "Labels": null - } - } -]
  10. Download patch cli/cli/command/config/testdata/config-inspect-with-format.json-template.golden

    --- 18.06.0+dfsg1-1/cli/cli/command/config/testdata/config-inspect-with-format.json-template.golden 2018-07-18 18:54:54.000000000 +0000 +++ 18.06.1-0ubuntu2/cli/cli/command/config/testdata/config-inspect-with-format.json-template.golden 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -{"label1":"label-foo"}
  11. Download patch cli/cli/command/checkpoint/list_test.go

    --- 18.06.0+dfsg1-1/cli/cli/command/checkpoint/list_test.go 2018-07-18 18:54:54.000000000 +0000 +++ 18.06.1-0ubuntu2/cli/cli/command/checkpoint/list_test.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,67 +0,0 @@ -package checkpoint - -import ( - "io/ioutil" - "testing" - - "github.com/docker/cli/internal/test" - "github.com/docker/docker/api/types" - "github.com/pkg/errors" - "gotest.tools/assert" - is "gotest.tools/assert/cmp" - "gotest.tools/golden" -) - -func TestCheckpointListErrors(t *testing.T) { - testCases := []struct { - args []string - checkpointListFunc func(container string, options types.CheckpointListOptions) ([]types.Checkpoint, error) - expectedError string - }{ - { - args: []string{}, - expectedError: "requires exactly 1 argument", - }, - { - args: []string{"too", "many", "arguments"}, - expectedError: "requires exactly 1 argument", - }, - { - args: []string{"foo"}, - checkpointListFunc: func(container string, options types.CheckpointListOptions) ([]types.Checkpoint, error) { - return []types.Checkpoint{}, errors.Errorf("error getting checkpoints for container foo") - }, - expectedError: "error getting checkpoints for container foo", - }, - } - - for _, tc := range testCases { - cli := test.NewFakeCli(&fakeClient{ - checkpointListFunc: tc.checkpointListFunc, - }) - cmd := newListCommand(cli) - cmd.SetArgs(tc.args) - cmd.SetOutput(ioutil.Discard) - assert.ErrorContains(t, cmd.Execute(), tc.expectedError) - } -} - -func TestCheckpointListWithOptions(t *testing.T) { - var containerID, checkpointDir string - cli := test.NewFakeCli(&fakeClient{ - checkpointListFunc: func(container string, options types.CheckpointListOptions) ([]types.Checkpoint, error) { - containerID = container - checkpointDir = options.CheckpointDir - return []types.Checkpoint{ - {Name: "checkpoint-foo"}, - }, nil - }, - }) - cmd := newListCommand(cli) - cmd.SetArgs([]string{"container-foo"}) - cmd.Flags().Set("checkpoint-dir", "/dir/foo") - assert.NilError(t, cmd.Execute()) - assert.Check(t, is.Equal("container-foo", containerID)) - assert.Check(t, is.Equal("/dir/foo", checkpointDir)) - golden.Assert(t, cli.OutBuffer().String(), "checkpoint-list-with-options.golden") -}
  12. Download patch cli/cli/command/container/exec.go
  13. Download patch cli/cli/command/container/run_test.go

    --- 18.06.0+dfsg1-1/cli/cli/command/container/run_test.go 2018-07-18 18:54:54.000000000 +0000 +++ 18.06.1-0ubuntu2/cli/cli/command/container/run_test.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,75 +0,0 @@ -package container - -import ( - "fmt" - "io/ioutil" - "testing" - - "github.com/docker/cli/internal/test" - "github.com/docker/cli/internal/test/notary" - "github.com/docker/docker/api/types/container" - "github.com/docker/docker/api/types/network" - "gotest.tools/assert" - is "gotest.tools/assert/cmp" -) - -func TestRunLabel(t *testing.T) { - cli := test.NewFakeCli(&fakeClient{ - createContainerFunc: func(_ *container.Config, _ *container.HostConfig, _ *network.NetworkingConfig, _ string) (container.ContainerCreateCreatedBody, error) { - return container.ContainerCreateCreatedBody{ - ID: "id", - }, nil - }, - Version: "1.36", - }) - cmd := NewRunCommand(cli) - cmd.Flags().Set("detach", "true") - cmd.SetArgs([]string{"--label", "foo", "busybox"}) - assert.NilError(t, cmd.Execute()) -} - -func TestRunCommandWithContentTrustErrors(t *testing.T) { - testCases := []struct { - name string - args []string - expectedError string - notaryFunc test.NotaryClientFuncType - }{ - { - name: "offline-notary-server", - notaryFunc: notary.GetOfflineNotaryRepository, - expectedError: "client is offline", - args: []string{"image:tag"}, - }, - { - name: "uninitialized-notary-server", - notaryFunc: notary.GetUninitializedNotaryRepository, - expectedError: "remote trust data does not exist", - args: []string{"image:tag"}, - }, - { - name: "empty-notary-server", - notaryFunc: notary.GetEmptyTargetsNotaryRepository, - expectedError: "No valid trust data for tag", - args: []string{"image:tag"}, - }, - } - for _, tc := range testCases { - cli := test.NewFakeCli(&fakeClient{ - createContainerFunc: func(config *container.Config, - hostConfig *container.HostConfig, - networkingConfig *network.NetworkingConfig, - containerName string, - ) (container.ContainerCreateCreatedBody, error) { - return container.ContainerCreateCreatedBody{}, fmt.Errorf("shouldn't try to pull image") - }, - }, test.EnableContentTrust) - cli.SetNotaryClient(tc.notaryFunc) - cmd := NewRunCommand(cli) - cmd.SetArgs(tc.args) - cmd.SetOutput(ioutil.Discard) - err := cmd.Execute() - assert.Assert(t, err != nil) - assert.Assert(t, is.Contains(cli.ErrBuffer().String(), tc.expectedError)) - } -}
  14. Download patch cli/cli/command/checkpoint/remove.go

    --- 18.06.0+dfsg1-1/cli/cli/command/checkpoint/remove.go 2018-07-18 18:54:54.000000000 +0000 +++ 18.06.1-0ubuntu2/cli/cli/command/checkpoint/remove.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,44 +0,0 @@ -package checkpoint - -import ( - "context" - - "github.com/docker/cli/cli" - "github.com/docker/cli/cli/command" - "github.com/docker/docker/api/types" - "github.com/spf13/cobra" -) - -type removeOptions struct { - checkpointDir string -} - -func newRemoveCommand(dockerCli command.Cli) *cobra.Command { - var opts removeOptions - - cmd := &cobra.Command{ - Use: "rm [OPTIONS] CONTAINER CHECKPOINT", - Aliases: []string{"remove"}, - Short: "Remove a checkpoint", - Args: cli.ExactArgs(2), - RunE: func(cmd *cobra.Command, args []string) error { - return runRemove(dockerCli, args[0], args[1], opts) - }, - } - - flags := cmd.Flags() - flags.StringVarP(&opts.checkpointDir, "checkpoint-dir", "", "", "Use a custom checkpoint storage directory") - - return cmd -} - -func runRemove(dockerCli command.Cli, container string, checkpoint string, opts removeOptions) error { - client := dockerCli.Client() - - removeOpts := types.CheckpointDeleteOptions{ - CheckpointID: checkpoint, - CheckpointDir: opts.checkpointDir, - } - - return client.CheckpointDelete(context.Background(), container, removeOpts) -}
  15. Download patch cli/cli/command/container/prune.go

    --- 18.06.0+dfsg1-1/cli/cli/command/container/prune.go 2018-07-18 18:54:54.000000000 +0000 +++ 18.06.1-0ubuntu2/cli/cli/command/container/prune.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,78 +0,0 @@ -package container - -import ( - "context" - "fmt" - - "github.com/docker/cli/cli" - "github.com/docker/cli/cli/command" - "github.com/docker/cli/opts" - units "github.com/docker/go-units" - "github.com/spf13/cobra" -) - -type pruneOptions struct { - force bool - filter opts.FilterOpt -} - -// NewPruneCommand returns a new cobra prune command for containers -func NewPruneCommand(dockerCli command.Cli) *cobra.Command { - options := pruneOptions{filter: opts.NewFilterOpt()} - - cmd := &cobra.Command{ - Use: "prune [OPTIONS]", - Short: "Remove all stopped containers", - Args: cli.NoArgs, - RunE: func(cmd *cobra.Command, args []string) error { - spaceReclaimed, output, err := runPrune(dockerCli, options) - if err != nil { - return err - } - if output != "" { - fmt.Fprintln(dockerCli.Out(), output) - } - fmt.Fprintln(dockerCli.Out(), "Total reclaimed space:", units.HumanSize(float64(spaceReclaimed))) - return nil - }, - Annotations: map[string]string{"version": "1.25"}, - } - - flags := cmd.Flags() - flags.BoolVarP(&options.force, "force", "f", false, "Do not prompt for confirmation") - flags.Var(&options.filter, "filter", "Provide filter values (e.g. 'until=<timestamp>')") - - return cmd -} - -const warning = `WARNING! This will remove all stopped containers. -Are you sure you want to continue?` - -func runPrune(dockerCli command.Cli, options pruneOptions) (spaceReclaimed uint64, output string, err error) { - pruneFilters := command.PruneFilters(dockerCli, options.filter.Value()) - - if !options.force && !command.PromptForConfirmation(dockerCli.In(), dockerCli.Out(), warning) { - return 0, "", nil - } - - report, err := dockerCli.Client().ContainersPrune(context.Background(), pruneFilters) - if err != nil { - return 0, "", err - } - - if len(report.ContainersDeleted) > 0 { - output = "Deleted Containers:\n" - for _, id := range report.ContainersDeleted { - output += id + "\n" - } - spaceReclaimed = report.SpaceReclaimed - } - - return spaceReclaimed, output, nil -} - -// RunPrune calls the Container Prune API -// This returns the amount of space reclaimed and a detailed output string -func RunPrune(dockerCli command.Cli, filter opts.FilterOpt) (uint64, string, error) { - return runPrune(dockerCli, pruneOptions{force: true, filter: filter}) -}
  16. Download patch cli/cli/command/config/testdata/config-inspect-pretty.simple.golden

    --- 18.06.0+dfsg1-1/cli/cli/command/config/testdata/config-inspect-pretty.simple.golden 2018-07-18 18:54:54.000000000 +0000 +++ 18.06.1-0ubuntu2/cli/cli/command/config/testdata/config-inspect-pretty.simple.golden 1970-01-01 00:00:00.000000000 +0000 @@ -1,8 +0,0 @@ -ID: configID -Name: configName -Labels: - - lbl1=value1 -Created at: 0001-01-01 00:00:00 +0000 utc -Updated at: 0001-01-01 00:00:00 +0000 utc -Data: -payload here
  17. Download patch cli/cli/command/container/client_test.go

    --- 18.06.0+dfsg1-1/cli/cli/command/container/client_test.go 2018-07-18 18:54:54.000000000 +0000 +++ 18.06.1-0ubuntu2/cli/cli/command/container/client_test.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,126 +0,0 @@ -package container - -import ( - "context" - "io" - - "github.com/docker/docker/api/types" - "github.com/docker/docker/api/types/container" - "github.com/docker/docker/api/types/network" - "github.com/docker/docker/client" -) - -type fakeClient struct { - client.Client - inspectFunc func(string) (types.ContainerJSON, error) - execInspectFunc func(execID string) (types.ContainerExecInspect, error) - execCreateFunc func(container string, config types.ExecConfig) (types.IDResponse, error) - createContainerFunc func(config *container.Config, hostConfig *container.HostConfig, networkingConfig *network.NetworkingConfig, containerName string) (container.ContainerCreateCreatedBody, error) - containerStartFunc func(container string, options types.ContainerStartOptions) error - imageCreateFunc func(parentReference string, options types.ImageCreateOptions) (io.ReadCloser, error) - infoFunc func() (types.Info, error) - containerStatPathFunc func(container, path string) (types.ContainerPathStat, error) - containerCopyFromFunc func(container, srcPath string) (io.ReadCloser, types.ContainerPathStat, error) - logFunc func(string, types.ContainerLogsOptions) (io.ReadCloser, error) - waitFunc func(string) (<-chan container.ContainerWaitOKBody, <-chan error) - containerListFunc func(types.ContainerListOptions) ([]types.Container, error) - Version string -} - -func (f *fakeClient) ContainerList(_ context.Context, options types.ContainerListOptions) ([]types.Container, error) { - if f.containerListFunc != nil { - return f.containerListFunc(options) - } - return []types.Container{}, nil -} - -func (f *fakeClient) ContainerInspect(_ context.Context, containerID string) (types.ContainerJSON, error) { - if f.inspectFunc != nil { - return f.inspectFunc(containerID) - } - return types.ContainerJSON{}, nil -} - -func (f *fakeClient) ContainerExecCreate(_ context.Context, container string, config types.ExecConfig) (types.IDResponse, error) { - if f.execCreateFunc != nil { - return f.execCreateFunc(container, config) - } - return types.IDResponse{}, nil -} - -func (f *fakeClient) ContainerExecInspect(_ context.Context, execID string) (types.ContainerExecInspect, error) { - if f.execInspectFunc != nil { - return f.execInspectFunc(execID) - } - return types.ContainerExecInspect{}, nil -} - -func (f *fakeClient) ContainerExecStart(ctx context.Context, execID string, config types.ExecStartCheck) error { - return nil -} - -func (f *fakeClient) ContainerCreate( - _ context.Context, - config *container.Config, - hostConfig *container.HostConfig, - networkingConfig *network.NetworkingConfig, - containerName string, -) (container.ContainerCreateCreatedBody, error) { - if f.createContainerFunc != nil { - return f.createContainerFunc(config, hostConfig, networkingConfig, containerName) - } - return container.ContainerCreateCreatedBody{}, nil -} - -func (f *fakeClient) ImageCreate(ctx context.Context, parentReference string, options types.ImageCreateOptions) (io.ReadCloser, error) { - if f.imageCreateFunc != nil { - return f.imageCreateFunc(parentReference, options) - } - return nil, nil -} - -func (f *fakeClient) Info(_ context.Context) (types.Info, error) { - if f.infoFunc != nil { - return f.infoFunc() - } - return types.Info{}, nil -} - -func (f *fakeClient) ContainerStatPath(_ context.Context, container, path string) (types.ContainerPathStat, error) { - if f.containerStatPathFunc != nil { - return f.containerStatPathFunc(container, path) - } - return types.ContainerPathStat{}, nil -} - -func (f *fakeClient) CopyFromContainer(_ context.Context, container, srcPath string) (io.ReadCloser, types.ContainerPathStat, error) { - if f.containerCopyFromFunc != nil { - return f.containerCopyFromFunc(container, srcPath) - } - return nil, types.ContainerPathStat{}, nil -} - -func (f *fakeClient) ContainerLogs(_ context.Context, container string, options types.ContainerLogsOptions) (io.ReadCloser, error) { - if f.logFunc != nil { - return f.logFunc(container, options) - } - return nil, nil -} - -func (f *fakeClient) ClientVersion() string { - return f.Version -} - -func (f *fakeClient) ContainerWait(_ context.Context, container string, _ container.WaitCondition) (<-chan container.ContainerWaitOKBody, <-chan error) { - if f.waitFunc != nil { - return f.waitFunc(container) - } - return nil, nil -} - -func (f *fakeClient) ContainerStart(_ context.Context, container string, options types.ContainerStartOptions) error { - if f.containerStartFunc != nil { - return f.containerStartFunc(container, options) - } - return nil -}
  18. Download patch cli/cli/command/formatter/config_test.go

    --- 18.06.0+dfsg1-1/cli/cli/command/formatter/config_test.go 2018-07-18 18:54:54.000000000 +0000 +++ 18.06.1-0ubuntu2/cli/cli/command/formatter/config_test.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,64 +0,0 @@ -package formatter - -import ( - "bytes" - "testing" - "time" - - "github.com/docker/docker/api/types/swarm" - "gotest.tools/assert" - is "gotest.tools/assert/cmp" -) - -func TestConfigContextFormatWrite(t *testing.T) { - // Check default output format (verbose and non-verbose mode) for table headers - cases := []struct { - context Context - expected string - }{ - // Errors - { - Context{Format: "{{InvalidFunction}}"}, - `Template parsing error: template: :1: function "InvalidFunction" not defined -`, - }, - { - Context{Format: "{{nil}}"}, - `Template parsing error: template: :1:2: executing "" at <nil>: nil is not a command -`, - }, - // Table format - {Context{Format: NewConfigFormat("table", false)}, - `ID NAME CREATED UPDATED -1 passwords Less than a second ago Less than a second ago -2 id_rsa Less than a second ago Less than a second ago -`}, - {Context{Format: NewConfigFormat("table {{.Name}}", true)}, - `NAME -passwords -id_rsa -`}, - {Context{Format: NewConfigFormat("{{.ID}}-{{.Name}}", false)}, - `1-passwords -2-id_rsa -`}, - } - - configs := []swarm.Config{ - {ID: "1", - Meta: swarm.Meta{CreatedAt: time.Now(), UpdatedAt: time.Now()}, - Spec: swarm.ConfigSpec{Annotations: swarm.Annotations{Name: "passwords"}}}, - {ID: "2", - Meta: swarm.Meta{CreatedAt: time.Now(), UpdatedAt: time.Now()}, - Spec: swarm.ConfigSpec{Annotations: swarm.Annotations{Name: "id_rsa"}}}, - } - for _, testcase := range cases { - out := bytes.NewBufferString("") - testcase.context.Output = out - if err := ConfigWrite(testcase.context, configs); err != nil { - assert.ErrorContains(t, err, testcase.expected) - } else { - assert.Check(t, is.Equal(out.String(), testcase.expected)) - } - } -}
  19. Download patch cli/cli/command/container/unpause.go

    --- 18.06.0+dfsg1-1/cli/cli/command/container/unpause.go 2018-07-18 18:54:54.000000000 +0000 +++ 18.06.1-0ubuntu2/cli/cli/command/container/unpause.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,50 +0,0 @@ -package container - -import ( - "context" - "fmt" - "strings" - - "github.com/docker/cli/cli" - "github.com/docker/cli/cli/command" - "github.com/pkg/errors" - "github.com/spf13/cobra" -) - -type unpauseOptions struct { - containers []string -} - -// NewUnpauseCommand creates a new cobra.Command for `docker unpause` -func NewUnpauseCommand(dockerCli command.Cli) *cobra.Command { - var opts unpauseOptions - - cmd := &cobra.Command{ - Use: "unpause CONTAINER [CONTAINER...]", - Short: "Unpause all processes within one or more containers", - Args: cli.RequiresMinArgs(1), - RunE: func(cmd *cobra.Command, args []string) error { - opts.containers = args - return runUnpause(dockerCli, &opts) - }, - } - return cmd -} - -func runUnpause(dockerCli command.Cli, opts *unpauseOptions) error { - ctx := context.Background() - - var errs []string - errChan := parallelOperation(ctx, opts.containers, dockerCli.Client().ContainerUnpause) - for _, container := range opts.containers { - if err := <-errChan; err != nil { - errs = append(errs, err.Error()) - continue - } - fmt.Fprintln(dockerCli.Out(), container) - } - if len(errs) > 0 { - return errors.New(strings.Join(errs, "\n")) - } - return nil -}
  20. Download patch cli/cli/command/container/inspect.go

    --- 18.06.0+dfsg1-1/cli/cli/command/container/inspect.go 2018-07-18 18:54:54.000000000 +0000 +++ 18.06.1-0ubuntu2/cli/cli/command/container/inspect.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,47 +0,0 @@ -package container - -import ( - "context" - - "github.com/docker/cli/cli" - "github.com/docker/cli/cli/command" - "github.com/docker/cli/cli/command/inspect" - "github.com/spf13/cobra" -) - -type inspectOptions struct { - format string - size bool - refs []string -} - -// newInspectCommand creates a new cobra.Command for `docker container inspect` -func newInspectCommand(dockerCli command.Cli) *cobra.Command { - var opts inspectOptions - - cmd := &cobra.Command{ - Use: "inspect [OPTIONS] CONTAINER [CONTAINER...]", - Short: "Display detailed information on one or more containers", - Args: cli.RequiresMinArgs(1), - RunE: func(cmd *cobra.Command, args []string) error { - opts.refs = args - return runInspect(dockerCli, opts) - }, - } - - flags := cmd.Flags() - flags.StringVarP(&opts.format, "format", "f", "", "Format the output using the given Go template") - flags.BoolVarP(&opts.size, "size", "s", false, "Display total file sizes") - - return cmd -} - -func runInspect(dockerCli command.Cli, opts inspectOptions) error { - client := dockerCli.Client() - ctx := context.Background() - - getRefFunc := func(ref string) (interface{}, []byte, error) { - return client.ContainerInspectWithRaw(ctx, ref, opts.size) - } - return inspect.Inspect(dockerCli.Out(), opts.refs, opts.format, getRefFunc) -}
  21. Download patch cli/cli/command/config/testdata/config-inspect-with-format.simple-template.golden

    --- 18.06.0+dfsg1-1/cli/cli/command/config/testdata/config-inspect-with-format.simple-template.golden 2018-07-18 18:54:54.000000000 +0000 +++ 18.06.1-0ubuntu2/cli/cli/command/config/testdata/config-inspect-with-format.simple-template.golden 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -foo
  22. Download patch cli/cli/command/cli_test.go
  23. Download patch cli/cli/command/checkpoint/create.go

    --- 18.06.0+dfsg1-1/cli/cli/command/checkpoint/create.go 2018-07-18 18:54:54.000000000 +0000 +++ 18.06.1-0ubuntu2/cli/cli/command/checkpoint/create.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,57 +0,0 @@ -package checkpoint - -import ( - "context" - "fmt" - - "github.com/docker/cli/cli" - "github.com/docker/cli/cli/command" - "github.com/docker/docker/api/types" - "github.com/spf13/cobra" -) - -type createOptions struct { - container string - checkpoint string - checkpointDir string - leaveRunning bool -} - -func newCreateCommand(dockerCli command.Cli) *cobra.Command { - var opts createOptions - - cmd := &cobra.Command{ - Use: "create [OPTIONS] CONTAINER CHECKPOINT", - Short: "Create a checkpoint from a running container", - Args: cli.ExactArgs(2), - RunE: func(cmd *cobra.Command, args []string) error { - opts.container = args[0] - opts.checkpoint = args[1] - return runCreate(dockerCli, opts) - }, - } - - flags := cmd.Flags() - flags.BoolVar(&opts.leaveRunning, "leave-running", false, "Leave the container running after checkpoint") - flags.StringVarP(&opts.checkpointDir, "checkpoint-dir", "", "", "Use a custom checkpoint storage directory") - - return cmd -} - -func runCreate(dockerCli command.Cli, opts createOptions) error { - client := dockerCli.Client() - - checkpointOpts := types.CheckpointCreateOptions{ - CheckpointID: opts.checkpoint, - CheckpointDir: opts.checkpointDir, - Exit: !opts.leaveRunning, - } - - err := client.CheckpointCreate(context.Background(), opts.container, checkpointOpts) - if err != nil { - return err - } - - fmt.Fprintf(dockerCli.Out(), "%s\n", opts.checkpoint) - return nil -}
  24. Download patch cli/cli/command/container/testdata/container-list-without-format.golden

    --- 18.06.0+dfsg1-1/cli/cli/command/container/testdata/container-list-without-format.golden 2018-07-18 18:54:54.000000000 +0000 +++ 18.06.1-0ubuntu2/cli/cli/command/container/testdata/container-list-without-format.golden 1970-01-01 00:00:00.000000000 +0000 @@ -1,6 +0,0 @@ -CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES -container_id busybox:latest "top" Less than a second ago Up 1 second c1 -container_id busybox:latest "top" Less than a second ago Up 1 second c2 -container_id busybox:latest "top" Less than a second ago Up 1 second 80-82/tcp c3 -container_id busybox:latest "top" Less than a second ago Up 1 second 81/udp c4 -container_id busybox:latest "top" Less than a second ago Up 1 second 8.8.8.8:82->82/tcp c5
  25. Download patch cli/cli/command/checkpoint/cmd.go

    --- 18.06.0+dfsg1-1/cli/cli/command/checkpoint/cmd.go 2018-07-18 18:54:54.000000000 +0000 +++ 18.06.1-0ubuntu2/cli/cli/command/checkpoint/cmd.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,28 +0,0 @@ -package checkpoint - -import ( - "github.com/docker/cli/cli" - "github.com/docker/cli/cli/command" - "github.com/spf13/cobra" -) - -// NewCheckpointCommand returns the `checkpoint` subcommand (only in experimental) -func NewCheckpointCommand(dockerCli command.Cli) *cobra.Command { - cmd := &cobra.Command{ - Use: "checkpoint", - Short: "Manage checkpoints", - Args: cli.NoArgs, - RunE: command.ShowHelp(dockerCli.Err()), - Annotations: map[string]string{ - "experimental": "", - "ostype": "linux", - "version": "1.25", - }, - } - cmd.AddCommand( - newCreateCommand(dockerCli), - newListCommand(dockerCli), - newRemoveCommand(dockerCli), - ) - return cmd -}
  26. Download patch cli/cli/command/config/testdata/config-list-with-config-format.golden

    --- 18.06.0+dfsg1-1/cli/cli/command/config/testdata/config-list-with-config-format.golden 2018-07-18 18:54:54.000000000 +0000 +++ 18.06.1-0ubuntu2/cli/cli/command/config/testdata/config-list-with-config-format.golden 1970-01-01 00:00:00.000000000 +0000 @@ -1,2 +0,0 @@ -bar label=label-bar -foo
  27. Download patch cli/cli/command/config/ls.go

    --- 18.06.0+dfsg1-1/cli/cli/command/config/ls.go 2018-07-18 18:54:54.000000000 +0000 +++ 18.06.1-0ubuntu2/cli/cli/command/config/ls.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,77 +0,0 @@ -package config - -import ( - "context" - "sort" - - "github.com/docker/cli/cli" - "github.com/docker/cli/cli/command" - "github.com/docker/cli/cli/command/formatter" - "github.com/docker/cli/opts" - "github.com/docker/docker/api/types" - "github.com/docker/docker/api/types/swarm" - "github.com/spf13/cobra" - "vbom.ml/util/sortorder" -) - -type byConfigName []swarm.Config - -func (r byConfigName) Len() int { return len(r) } -func (r byConfigName) Swap(i, j int) { r[i], r[j] = r[j], r[i] } -func (r byConfigName) Less(i, j int) bool { - return sortorder.NaturalLess(r[i].Spec.Name, r[j].Spec.Name) -} - -type listOptions struct { - quiet bool - format string - filter opts.FilterOpt -} - -func newConfigListCommand(dockerCli command.Cli) *cobra.Command { - listOpts := listOptions{filter: opts.NewFilterOpt()} - - cmd := &cobra.Command{ - Use: "ls [OPTIONS]", - Aliases: []string{"list"}, - Short: "List configs", - Args: cli.NoArgs, - RunE: func(cmd *cobra.Command, args []string) error { - return runConfigList(dockerCli, listOpts) - }, - } - - flags := cmd.Flags() - flags.BoolVarP(&listOpts.quiet, "quiet", "q", false, "Only display IDs") - flags.StringVarP(&listOpts.format, "format", "", "", "Pretty-print configs using a Go template") - flags.VarP(&listOpts.filter, "filter", "f", "Filter output based on conditions provided") - - return cmd -} - -func runConfigList(dockerCli command.Cli, options listOptions) error { - client := dockerCli.Client() - ctx := context.Background() - - configs, err := client.ConfigList(ctx, types.ConfigListOptions{Filters: options.filter.Value()}) - if err != nil { - return err - } - - format := options.format - if len(format) == 0 { - if len(dockerCli.ConfigFile().ConfigFormat) > 0 && !options.quiet { - format = dockerCli.ConfigFile().ConfigFormat - } else { - format = formatter.TableFormatKey - } - } - - sort.Sort(byConfigName(configs)) - - configCtx := formatter.Context{ - Output: dockerCli.Out(), - Format: formatter.NewConfigFormat(format, options.quiet), - } - return formatter.ConfigWrite(configCtx, configs) -}
  28. Download patch cli/cli/command/checkpoint/testdata/checkpoint-list-with-options.golden

    --- 18.06.0+dfsg1-1/cli/cli/command/checkpoint/testdata/checkpoint-list-with-options.golden 2018-07-18 18:54:54.000000000 +0000 +++ 18.06.1-0ubuntu2/cli/cli/command/checkpoint/testdata/checkpoint-list-with-options.golden 1970-01-01 00:00:00.000000000 +0000 @@ -1,2 +0,0 @@ -CHECKPOINT NAME -checkpoint-foo
  29. Download patch cli/cli/command/container/pause.go

    --- 18.06.0+dfsg1-1/cli/cli/command/container/pause.go 2018-07-18 18:54:54.000000000 +0000 +++ 18.06.1-0ubuntu2/cli/cli/command/container/pause.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,49 +0,0 @@ -package container - -import ( - "context" - "fmt" - "strings" - - "github.com/docker/cli/cli" - "github.com/docker/cli/cli/command" - "github.com/pkg/errors" - "github.com/spf13/cobra" -) - -type pauseOptions struct { - containers []string -} - -// NewPauseCommand creates a new cobra.Command for `docker pause` -func NewPauseCommand(dockerCli command.Cli) *cobra.Command { - var opts pauseOptions - - return &cobra.Command{ - Use: "pause CONTAINER [CONTAINER...]", - Short: "Pause all processes within one or more containers", - Args: cli.RequiresMinArgs(1), - RunE: func(cmd *cobra.Command, args []string) error { - opts.containers = args - return runPause(dockerCli, &opts) - }, - } -} - -func runPause(dockerCli command.Cli, opts *pauseOptions) error { - ctx := context.Background() - - var errs []string - errChan := parallelOperation(ctx, opts.containers, dockerCli.Client().ContainerPause) - for _, container := range opts.containers { - if err := <-errChan; err != nil { - errs = append(errs, err.Error()) - continue - } - fmt.Fprintln(dockerCli.Out(), container) - } - if len(errs) > 0 { - return errors.New(strings.Join(errs, "\n")) - } - return nil -}
  30. Download patch cli/cli/command/container/ps_test.go

    --- 18.06.0+dfsg1-1/cli/cli/command/container/ps_test.go 2018-07-18 18:54:54.000000000 +0000 +++ 18.06.1-0ubuntu2/cli/cli/command/container/ps_test.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,119 +0,0 @@ -package container - -import ( - "testing" - - "github.com/docker/cli/opts" - "gotest.tools/assert" - is "gotest.tools/assert/cmp" -) - -func TestBuildContainerListOptions(t *testing.T) { - filters := opts.NewFilterOpt() - assert.NilError(t, filters.Set("foo=bar")) - assert.NilError(t, filters.Set("baz=foo")) - - contexts := []struct { - psOpts *psOptions - expectedAll bool - expectedSize bool - expectedLimit int - expectedFilters map[string]string - }{ - { - psOpts: &psOptions{ - all: true, - size: true, - last: 5, - filter: filters, - }, - expectedAll: true, - expectedSize: true, - expectedLimit: 5, - expectedFilters: map[string]string{ - "foo": "bar", - "baz": "foo", - }, - }, - { - psOpts: &psOptions{ - all: true, - size: true, - last: -1, - nLatest: true, - }, - expectedAll: true, - expectedSize: true, - expectedLimit: 1, - expectedFilters: make(map[string]string), - }, - { - psOpts: &psOptions{ - all: true, - size: false, - last: 5, - filter: filters, - // With .Size, size should be true - format: "{{.Size}}", - }, - expectedAll: true, - expectedSize: true, - expectedLimit: 5, - expectedFilters: map[string]string{ - "foo": "bar", - "baz": "foo", - }, - }, - { - psOpts: &psOptions{ - all: true, - size: false, - last: 5, - filter: filters, - // With .Size, size should be true - format: "{{.Size}} {{.CreatedAt}} {{.Networks}}", - }, - expectedAll: true, - expectedSize: true, - expectedLimit: 5, - expectedFilters: map[string]string{ - "foo": "bar", - "baz": "foo", - }, - }, - { - psOpts: &psOptions{ - all: true, - size: false, - last: 5, - filter: filters, - // Without .Size, size should be false - format: "{{.CreatedAt}} {{.Networks}}", - }, - expectedAll: true, - expectedSize: false, - expectedLimit: 5, - expectedFilters: map[string]string{ - "foo": "bar", - "baz": "foo", - }, - }, - } - - for _, c := range contexts { - options, err := buildContainerListOptions(c.psOpts) - assert.NilError(t, err) - - assert.Check(t, is.Equal(c.expectedAll, options.All)) - assert.Check(t, is.Equal(c.expectedSize, options.Size)) - assert.Check(t, is.Equal(c.expectedLimit, options.Limit)) - assert.Check(t, is.Equal(len(c.expectedFilters), options.Filters.Len())) - - for k, v := range c.expectedFilters { - f := options.Filters - if !f.ExactMatch(k, v) { - t.Fatalf("Expected filter with key %s to be %s but got %s", k, v, f.Get(k)) - } - } - } -}
  31. Download patch cli/cli/command/container/list.go

    --- 18.06.0+dfsg1-1/cli/cli/command/container/list.go 2018-07-18 18:54:54.000000000 +0000 +++ 18.06.1-0ubuntu2/cli/cli/command/container/list.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,140 +0,0 @@ -package container - -import ( - "context" - "io/ioutil" - - "github.com/docker/cli/cli" - "github.com/docker/cli/cli/command" - "github.com/docker/cli/cli/command/formatter" - "github.com/docker/cli/opts" - "github.com/docker/cli/templates" - "github.com/docker/docker/api/types" - "github.com/spf13/cobra" -) - -type psOptions struct { - quiet bool - size bool - all bool - noTrunc bool - nLatest bool - last int - format string - filter opts.FilterOpt -} - -// NewPsCommand creates a new cobra.Command for `docker ps` -func NewPsCommand(dockerCli command.Cli) *cobra.Command { - options := psOptions{filter: opts.NewFilterOpt()} - - cmd := &cobra.Command{ - Use: "ps [OPTIONS]", - Short: "List containers", - Args: cli.NoArgs, - RunE: func(cmd *cobra.Command, args []string) error { - return runPs(dockerCli, &options) - }, - } - - flags := cmd.Flags() - - flags.BoolVarP(&options.quiet, "quiet", "q", false, "Only display numeric IDs") - flags.BoolVarP(&options.size, "size", "s", false, "Display total file sizes") - flags.BoolVarP(&options.all, "all", "a", false, "Show all containers (default shows just running)") - flags.BoolVar(&options.noTrunc, "no-trunc", false, "Don't truncate output") - flags.BoolVarP(&options.nLatest, "latest", "l", false, "Show the latest created container (includes all states)") - flags.IntVarP(&options.last, "last", "n", -1, "Show n last created containers (includes all states)") - flags.StringVarP(&options.format, "format", "", "", "Pretty-print containers using a Go template") - flags.VarP(&options.filter, "filter", "f", "Filter output based on conditions provided") - - return cmd -} - -func newListCommand(dockerCli command.Cli) *cobra.Command { - cmd := *NewPsCommand(dockerCli) - cmd.Aliases = []string{"ps", "list"} - cmd.Use = "ls [OPTIONS]" - return &cmd -} - -// listOptionsProcessor is used to set any container list options which may only -// be embedded in the format template. -// This is passed directly into tmpl.Execute in order to allow the preprocessor -// to set any list options that were not provided by flags (e.g. `.Size`). -// It is using a `map[string]bool` so that unknown fields passed into the -// template format do not cause errors. These errors will get picked up when -// running through the actual template processor. -type listOptionsProcessor map[string]bool - -// Size sets the size of the map when called by a template execution. -func (o listOptionsProcessor) Size() bool { - o["size"] = true - return true -} - -// Label is needed here as it allows the correct pre-processing -// because Label() is a method with arguments -func (o listOptionsProcessor) Label(name string) string { - return "" -} - -func buildContainerListOptions(opts *psOptions) (*types.ContainerListOptions, error) { - options := &types.ContainerListOptions{ - All: opts.all, - Limit: opts.last, - Size: opts.size, - Filters: opts.filter.Value(), - } - - if opts.nLatest && opts.last == -1 { - options.Limit = 1 - } - - tmpl, err := templates.Parse(opts.format) - - if err != nil { - return nil, err - } - - optionsProcessor := listOptionsProcessor{} - // This shouldn't error out but swallowing the error makes it harder - // to track down if preProcessor issues come up. Ref #24696 - if err := tmpl.Execute(ioutil.Discard, optionsProcessor); err != nil { - return nil, err - } - // At the moment all we need is to capture .Size for preprocessor - options.Size = opts.size || optionsProcessor["size"] - - return options, nil -} - -func runPs(dockerCli command.Cli, options *psOptions) error { - ctx := context.Background() - - listOptions, err := buildContainerListOptions(options) - if err != nil { - return err - } - - containers, err := dockerCli.Client().ContainerList(ctx, *listOptions) - if err != nil { - return err - } - - format := options.format - if len(format) == 0 { - if len(dockerCli.ConfigFile().PsFormat) > 0 && !options.quiet { - format = dockerCli.ConfigFile().PsFormat - } else { - format = formatter.TableFormatKey - } - } - - containerCtx := formatter.Context{ - Output: dockerCli.Out(), - Format: formatter.NewContainerFormat(format, options.quiet, listOptions.Size), - Trunc: !options.noTrunc, - } - return formatter.ContainerWrite(containerCtx, containers) -}
  32. Download patch cli/cli/command/container/hijack.go
  33. Download patch cli/cli/command/formatter/checkpoint.go

    --- 18.06.0+dfsg1-1/cli/cli/command/formatter/checkpoint.go 2018-07-18 18:54:54.000000000 +0000 +++ 18.06.1-0ubuntu2/cli/cli/command/formatter/checkpoint.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,52 +0,0 @@ -package formatter - -import "github.com/docker/docker/api/types" - -const ( - defaultCheckpointFormat = "table {{.Name}}" - - checkpointNameHeader = "CHECKPOINT NAME" -) - -// NewCheckpointFormat returns a format for use with a checkpoint Context -func NewCheckpointFormat(source string) Format { - switch source { - case TableFormatKey: - return defaultCheckpointFormat - } - return Format(source) -} - -// CheckpointWrite writes formatted checkpoints using the Context -func CheckpointWrite(ctx Context, checkpoints []types.Checkpoint) error { - render := func(format func(subContext subContext) error) error { - for _, checkpoint := range checkpoints { - if err := format(&checkpointContext{c: checkpoint}); err != nil { - return err - } - } - return nil - } - return ctx.Write(newCheckpointContext(), render) -} - -type checkpointContext struct { - HeaderContext - c types.Checkpoint -} - -func newCheckpointContext() *checkpointContext { - cpCtx := checkpointContext{} - cpCtx.header = volumeHeaderContext{ - "Name": checkpointNameHeader, - } - return &cpCtx -} - -func (c *checkpointContext) MarshalJSON() ([]byte, error) { - return marshalJSON(c) -} - -func (c *checkpointContext) Name() string { - return c.c.Name -}
  34. Download patch cli/cli/command/container/create.go
  35. Download patch cli/cli/command/checkpoint/create_test.go

    --- 18.06.0+dfsg1-1/cli/cli/command/checkpoint/create_test.go 2018-07-18 18:54:54.000000000 +0000 +++ 18.06.1-0ubuntu2/cli/cli/command/checkpoint/create_test.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,72 +0,0 @@ -package checkpoint - -import ( - "io/ioutil" - "strings" - "testing" - - "github.com/docker/cli/internal/test" - "github.com/docker/docker/api/types" - "github.com/pkg/errors" - "gotest.tools/assert" - is "gotest.tools/assert/cmp" -) - -func TestCheckpointCreateErrors(t *testing.T) { - testCases := []struct { - args []string - checkpointCreateFunc func(container string, options types.CheckpointCreateOptions) error - expectedError string - }{ - { - args: []string{"too-few-arguments"}, - expectedError: "requires exactly 2 arguments", - }, - { - args: []string{"too", "many", "arguments"}, - expectedError: "requires exactly 2 arguments", - }, - { - args: []string{"foo", "bar"}, - checkpointCreateFunc: func(container string, options types.CheckpointCreateOptions) error { - return errors.Errorf("error creating checkpoint for container foo") - }, - expectedError: "error creating checkpoint for container foo", - }, - } - - for _, tc := range testCases { - cli := test.NewFakeCli(&fakeClient{ - checkpointCreateFunc: tc.checkpointCreateFunc, - }) - cmd := newCreateCommand(cli) - cmd.SetArgs(tc.args) - cmd.SetOutput(ioutil.Discard) - assert.ErrorContains(t, cmd.Execute(), tc.expectedError) - } -} - -func TestCheckpointCreateWithOptions(t *testing.T) { - var containerID, checkpointID, checkpointDir string - var exit bool - cli := test.NewFakeCli(&fakeClient{ - checkpointCreateFunc: func(container string, options types.CheckpointCreateOptions) error { - containerID = container - checkpointID = options.CheckpointID - checkpointDir = options.CheckpointDir - exit = options.Exit - return nil - }, - }) - cmd := newCreateCommand(cli) - checkpoint := "checkpoint-bar" - cmd.SetArgs([]string{"container-foo", checkpoint}) - cmd.Flags().Set("leave-running", "true") - cmd.Flags().Set("checkpoint-dir", "/dir/foo") - assert.NilError(t, cmd.Execute()) - assert.Check(t, is.Equal("container-foo", containerID)) - assert.Check(t, is.Equal(checkpoint, checkpointID)) - assert.Check(t, is.Equal("/dir/foo", checkpointDir)) - assert.Check(t, is.Equal(false, exit)) - assert.Check(t, is.Equal(checkpoint, strings.TrimSpace(cli.OutBuffer().String()))) -}
  36. Download patch cli/cli/command/container/wait.go

    --- 18.06.0+dfsg1-1/cli/cli/command/container/wait.go 2018-07-18 18:54:54.000000000 +0000 +++ 18.06.1-0ubuntu2/cli/cli/command/container/wait.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,53 +0,0 @@ -package container - -import ( - "context" - "fmt" - "strings" - - "github.com/docker/cli/cli" - "github.com/docker/cli/cli/command" - "github.com/pkg/errors" - "github.com/spf13/cobra" -) - -type waitOptions struct { - containers []string -} - -// NewWaitCommand creates a new cobra.Command for `docker wait` -func NewWaitCommand(dockerCli command.Cli) *cobra.Command { - var opts waitOptions - - cmd := &cobra.Command{ - Use: "wait CONTAINER [CONTAINER...]", - Short: "Block until one or more containers stop, then print their exit codes", - Args: cli.RequiresMinArgs(1), - RunE: func(cmd *cobra.Command, args []string) error { - opts.containers = args - return runWait(dockerCli, &opts) - }, - } - - return cmd -} - -func runWait(dockerCli command.Cli, opts *waitOptions) error { - ctx := context.Background() - - var errs []string - for _, container := range opts.containers { - resultC, errC := dockerCli.Client().ContainerWait(ctx, container, "") - - select { - case result := <-resultC: - fmt.Fprintf(dockerCli.Out(), "%d\n", result.StatusCode) - case err := <-errC: - errs = append(errs, err.Error()) - } - } - if len(errs) > 0 { - return errors.New(strings.Join(errs, "\n")) - } - return nil -}
  37. Download patch cli/cli/command/config/inspect.go

    --- 18.06.0+dfsg1-1/cli/cli/command/config/inspect.go 2018-07-18 18:54:54.000000000 +0000 +++ 18.06.1-0ubuntu2/cli/cli/command/config/inspect.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,66 +0,0 @@ -package config - -import ( - "context" - "fmt" - "strings" - - "github.com/docker/cli/cli" - "github.com/docker/cli/cli/command" - "github.com/docker/cli/cli/command/formatter" - "github.com/spf13/cobra" -) - -type inspectOptions struct { - names []string - format string - pretty bool -} - -func newConfigInspectCommand(dockerCli command.Cli) *cobra.Command { - opts := inspectOptions{} - cmd := &cobra.Command{ - Use: "inspect [OPTIONS] CONFIG [CONFIG...]", - Short: "Display detailed information on one or more configs", - Args: cli.RequiresMinArgs(1), - RunE: func(cmd *cobra.Command, args []string) error { - opts.names = args - return runConfigInspect(dockerCli, opts) - }, - } - - cmd.Flags().StringVarP(&opts.format, "format", "f", "", "Format the output using the given Go template") - cmd.Flags().BoolVar(&opts.pretty, "pretty", false, "Print the information in a human friendly format") - return cmd -} - -func runConfigInspect(dockerCli command.Cli, opts inspectOptions) error { - client := dockerCli.Client() - ctx := context.Background() - - if opts.pretty { - opts.format = "pretty" - } - - getRef := func(id string) (interface{}, []byte, error) { - return client.ConfigInspectWithRaw(ctx, id) - } - f := opts.format - - // check if the user is trying to apply a template to the pretty format, which - // is not supported - if strings.HasPrefix(f, "pretty") && f != "pretty" { - return fmt.Errorf("Cannot supply extra formatting options to the pretty template") - } - - configCtx := formatter.Context{ - Output: dockerCli.Out(), - Format: formatter.NewConfigFormat(f, false), - } - - if err := formatter.ConfigInspectWrite(configCtx, opts.names, getRef); err != nil { - return cli.StatusError{StatusCode: 1, Status: err.Error()} - } - return nil - -}
  38. Download patch cli/cli/command/checkpoint/list.go

    --- 18.06.0+dfsg1-1/cli/cli/command/checkpoint/list.go 2018-07-18 18:54:54.000000000 +0000 +++ 18.06.1-0ubuntu2/cli/cli/command/checkpoint/list.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,54 +0,0 @@ -package checkpoint - -import ( - "context" - - "github.com/docker/cli/cli" - "github.com/docker/cli/cli/command" - "github.com/docker/cli/cli/command/formatter" - "github.com/docker/docker/api/types" - "github.com/spf13/cobra" -) - -type listOptions struct { - checkpointDir string -} - -func newListCommand(dockerCli command.Cli) *cobra.Command { - var opts listOptions - - cmd := &cobra.Command{ - Use: "ls [OPTIONS] CONTAINER", - Aliases: []string{"list"}, - Short: "List checkpoints for a container", - Args: cli.ExactArgs(1), - RunE: func(cmd *cobra.Command, args []string) error { - return runList(dockerCli, args[0], opts) - }, - } - - flags := cmd.Flags() - flags.StringVarP(&opts.checkpointDir, "checkpoint-dir", "", "", "Use a custom checkpoint storage directory") - - return cmd - -} - -func runList(dockerCli command.Cli, container string, opts listOptions) error { - client := dockerCli.Client() - - listOpts := types.CheckpointListOptions{ - CheckpointDir: opts.checkpointDir, - } - - checkpoints, err := client.CheckpointList(context.Background(), container, listOpts) - if err != nil { - return err - } - - cpCtx := formatter.Context{ - Output: dockerCli.Out(), - Format: formatter.NewCheckpointFormat(formatter.TableFormatKey), - } - return formatter.CheckpointWrite(cpCtx, checkpoints) -}
  39. Download patch cli/cli/command/container/testdata/container-list-without-format-no-trunc.golden

    --- 18.06.0+dfsg1-1/cli/cli/command/container/testdata/container-list-without-format-no-trunc.golden 2018-07-18 18:54:54.000000000 +0000 +++ 18.06.1-0ubuntu2/cli/cli/command/container/testdata/container-list-without-format-no-trunc.golden 1970-01-01 00:00:00.000000000 +0000 @@ -1,3 +0,0 @@ -CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES -container_id busybox:latest "top" Less than a second ago Up 1 second c1 -container_id busybox:latest "top" Less than a second ago Up 1 second c2,foo/bar Binary files 18.06.0+dfsg1-1/cli/cli/command/container/testdata/utf16be.env and 18.06.1-0ubuntu2/cli/cli/command/container/testdata/utf16be.env differ Binary files 18.06.0+dfsg1-1/cli/cli/command/container/testdata/utf16.env and 18.06.1-0ubuntu2/cli/cli/command/container/testdata/utf16.env differ
  40. Download patch cli/cli/command/container/rm.go

    --- 18.06.0+dfsg1-1/cli/cli/command/container/rm.go 2018-07-18 18:54:54.000000000 +0000 +++ 18.06.1-0ubuntu2/cli/cli/command/container/rm.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,73 +0,0 @@ -package container - -import ( - "context" - "fmt" - "strings" - - "github.com/docker/cli/cli" - "github.com/docker/cli/cli/command" - "github.com/docker/docker/api/types" - "github.com/pkg/errors" - "github.com/spf13/cobra" -) - -type rmOptions struct { - rmVolumes bool - rmLink bool - force bool - - containers []string -} - -// NewRmCommand creates a new cobra.Command for `docker rm` -func NewRmCommand(dockerCli command.Cli) *cobra.Command { - var opts rmOptions - - cmd := &cobra.Command{ - Use: "rm [OPTIONS] CONTAINER [CONTAINER...]", - Short: "Remove one or more containers", - Args: cli.RequiresMinArgs(1), - RunE: func(cmd *cobra.Command, args []string) error { - opts.containers = args - return runRm(dockerCli, &opts) - }, - } - - flags := cmd.Flags() - flags.BoolVarP(&opts.rmVolumes, "volumes", "v", false, "Remove the volumes associated with the container") - flags.BoolVarP(&opts.rmLink, "link", "l", false, "Remove the specified link") - flags.BoolVarP(&opts.force, "force", "f", false, "Force the removal of a running container (uses SIGKILL)") - return cmd -} - -func runRm(dockerCli command.Cli, opts *rmOptions) error { - ctx := context.Background() - - var errs []string - options := types.ContainerRemoveOptions{ - RemoveVolumes: opts.rmVolumes, - RemoveLinks: opts.rmLink, - Force: opts.force, - } - - errChan := parallelOperation(ctx, opts.containers, func(ctx context.Context, container string) error { - container = strings.Trim(container, "/") - if container == "" { - return errors.New("Container name cannot be empty") - } - return dockerCli.Client().ContainerRemove(ctx, container, options) - }) - - for _, name := range opts.containers { - if err := <-errChan; err != nil { - errs = append(errs, err.Error()) - continue - } - fmt.Fprintln(dockerCli.Out(), name) - } - if len(errs) > 0 { - return errors.New(strings.Join(errs, "\n")) - } - return nil -}
  41. Download patch cli/cli/command/container/logs.go

    --- 18.06.0+dfsg1-1/cli/cli/command/container/logs.go 2018-07-18 18:54:54.000000000 +0000 +++ 18.06.1-0ubuntu2/cli/cli/command/container/logs.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,80 +0,0 @@ -package container - -import ( - "context" - "io" - - "github.com/docker/cli/cli" - "github.com/docker/cli/cli/command" - "github.com/docker/docker/api/types" - "github.com/docker/docker/pkg/stdcopy" - "github.com/spf13/cobra" -) - -type logsOptions struct { - follow bool - since string - until string - timestamps bool - details bool - tail string - - container string -} - -// NewLogsCommand creates a new cobra.Command for `docker logs` -func NewLogsCommand(dockerCli command.Cli) *cobra.Command { - var opts logsOptions - - cmd := &cobra.Command{ - Use: "logs [OPTIONS] CONTAINER", - Short: "Fetch the logs of a container", - Args: cli.ExactArgs(1), - RunE: func(cmd *cobra.Command, args []string) error { - opts.container = args[0] - return runLogs(dockerCli, &opts) - }, - } - - flags := cmd.Flags() - flags.BoolVarP(&opts.follow, "follow", "f", false, "Follow log output") - flags.StringVar(&opts.since, "since", "", "Show logs since timestamp (e.g. 2013-01-02T13:23:37) or relative (e.g. 42m for 42 minutes)") - flags.StringVar(&opts.until, "until", "", "Show logs before a timestamp (e.g. 2013-01-02T13:23:37) or relative (e.g. 42m for 42 minutes)") - flags.SetAnnotation("until", "version", []string{"1.35"}) - flags.BoolVarP(&opts.timestamps, "timestamps", "t", false, "Show timestamps") - flags.BoolVar(&opts.details, "details", false, "Show extra details provided to logs") - flags.StringVar(&opts.tail, "tail", "all", "Number of lines to show from the end of the logs") - return cmd -} - -func runLogs(dockerCli command.Cli, opts *logsOptions) error { - ctx := context.Background() - - options := types.ContainerLogsOptions{ - ShowStdout: true, - ShowStderr: true, - Since: opts.since, - Until: opts.until, - Timestamps: opts.timestamps, - Follow: opts.follow, - Tail: opts.tail, - Details: opts.details, - } - responseBody, err := dockerCli.Client().ContainerLogs(ctx, opts.container, options) - if err != nil { - return err - } - defer responseBody.Close() - - c, err := dockerCli.Client().ContainerInspect(ctx, opts.container) - if err != nil { - return err - } - - if c.Config.Tty { - _, err = io.Copy(dockerCli.Out(), responseBody) - } else { - _, err = stdcopy.StdCopy(dockerCli.Out(), dockerCli.Err(), responseBody) - } - return err -}
  42. Download patch cli/cli/command/formatter/container_test.go
  43. Download patch cli/cli/command/formatter/config.go

    --- 18.06.0+dfsg1-1/cli/cli/command/formatter/config.go 2018-07-18 18:54:54.000000000 +0000 +++ 18.06.1-0ubuntu2/cli/cli/command/formatter/config.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,171 +0,0 @@ -package formatter - -import ( - "fmt" - "strings" - "time" - - "github.com/docker/cli/cli/command" - "github.com/docker/cli/cli/command/inspect" - "github.com/docker/docker/api/types/swarm" - units "github.com/docker/go-units" -) - -const ( - defaultConfigTableFormat = "table {{.ID}}\t{{.Name}}\t{{.CreatedAt}}\t{{.UpdatedAt}}" - configIDHeader = "ID" - configCreatedHeader = "CREATED" - configUpdatedHeader = "UPDATED" - configInspectPrettyTemplate Format = `ID: {{.ID}} -Name: {{.Name}} -{{- if .Labels }} -Labels: -{{- range $k, $v := .Labels }} - - {{ $k }}{{if $v }}={{ $v }}{{ end }} -{{- end }}{{ end }} -Created at: {{.CreatedAt}} -Updated at: {{.UpdatedAt}} -Data: -{{.Data}}` -) - -// NewConfigFormat returns a Format for rendering using a config Context -func NewConfigFormat(source string, quiet bool) Format { - switch source { - case PrettyFormatKey: - return configInspectPrettyTemplate - case TableFormatKey: - if quiet { - return defaultQuietFormat - } - return defaultConfigTableFormat - } - return Format(source) -} - -// ConfigWrite writes the context -func ConfigWrite(ctx Context, configs []swarm.Config) error { - render := func(format func(subContext subContext) error) error { - for _, config := range configs { - configCtx := &configContext{c: config} - if err := format(configCtx); err != nil { - return err - } - } - return nil - } - return ctx.Write(newConfigContext(), render) -} - -func newConfigContext() *configContext { - cCtx := &configContext{} - - cCtx.header = map[string]string{ - "ID": configIDHeader, - "Name": nameHeader, - "CreatedAt": configCreatedHeader, - "UpdatedAt": configUpdatedHeader, - "Labels": labelsHeader, - } - return cCtx -} - -type configContext struct { - HeaderContext - c swarm.Config -} - -func (c *configContext) MarshalJSON() ([]byte, error) { - return marshalJSON(c) -} - -func (c *configContext) ID() string { - return c.c.ID -} - -func (c *configContext) Name() string { - return c.c.Spec.Annotations.Name -} - -func (c *configContext) CreatedAt() string { - return units.HumanDuration(time.Now().UTC().Sub(c.c.Meta.CreatedAt)) + " ago" -} - -func (c *configContext) UpdatedAt() string { - return units.HumanDuration(time.Now().UTC().Sub(c.c.Meta.UpdatedAt)) + " ago" -} - -func (c *configContext) Labels() string { - mapLabels := c.c.Spec.Annotations.Labels - if mapLabels == nil { - return "" - } - var joinLabels []string - for k, v := range mapLabels { - joinLabels = append(joinLabels, fmt.Sprintf("%s=%s", k, v)) - } - return strings.Join(joinLabels, ",") -} - -func (c *configContext) Label(name string) string { - if c.c.Spec.Annotations.Labels == nil { - return "" - } - return c.c.Spec.Annotations.Labels[name] -} - -// ConfigInspectWrite renders the context for a list of configs -func ConfigInspectWrite(ctx Context, refs []string, getRef inspect.GetRefFunc) error { - if ctx.Format != configInspectPrettyTemplate { - return inspect.Inspect(ctx.Output, refs, string(ctx.Format), getRef) - } - render := func(format func(subContext subContext) error) error { - for _, ref := range refs { - configI, _, err := getRef(ref) - if err != nil { - return err - } - config, ok := configI.(swarm.Config) - if !ok { - return fmt.Errorf("got wrong object to inspect :%v", ok) - } - if err := format(&configInspectContext{Config: config}); err != nil { - return err - } - } - return nil - } - return ctx.Write(&configInspectContext{}, render) -} - -type configInspectContext struct { - swarm.Config - subContext -} - -func (ctx *configInspectContext) ID() string { - return ctx.Config.ID -} - -func (ctx *configInspectContext) Name() string { - return ctx.Config.Spec.Name -} - -func (ctx *configInspectContext) Labels() map[string]string { - return ctx.Config.Spec.Labels -} - -func (ctx *configInspectContext) CreatedAt() string { - return command.PrettyPrint(ctx.Config.CreatedAt) -} - -func (ctx *configInspectContext) UpdatedAt() string { - return command.PrettyPrint(ctx.Config.UpdatedAt) -} - -func (ctx *configInspectContext) Data() string { - if ctx.Config.Spec.Data == nil { - return "" - } - return string(ctx.Config.Spec.Data) -}
  44. Download patch cli/cli/command/container/testdata/container-list-with-format.golden

    --- 18.06.0+dfsg1-1/cli/cli/command/container/testdata/container-list-with-format.golden 2018-07-18 18:54:54.000000000 +0000 +++ 18.06.1-0ubuntu2/cli/cli/command/container/testdata/container-list-with-format.golden 1970-01-01 00:00:00.000000000 +0000 @@ -1,2 +0,0 @@ -c1 busybox:latest some.label=value -c2 busybox:latest foo=bar
  45. Download patch cli/cli/command/container/port.go

    --- 18.06.0+dfsg1-1/cli/cli/command/container/port.go 2018-07-18 18:54:54.000000000 +0000 +++ 18.06.1-0ubuntu2/cli/cli/command/container/port.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,78 +0,0 @@ -package container - -import ( - "context" - "fmt" - "strings" - - "github.com/docker/cli/cli" - "github.com/docker/cli/cli/command" - "github.com/docker/go-connections/nat" - "github.com/pkg/errors" - "github.com/spf13/cobra" -) - -type portOptions struct { - container string - - port string -} - -// NewPortCommand creates a new cobra.Command for `docker port` -func NewPortCommand(dockerCli command.Cli) *cobra.Command { - var opts portOptions - - cmd := &cobra.Command{ - Use: "port CONTAINER [PRIVATE_PORT[/PROTO]]", - Short: "List port mappings or a specific mapping for the container", - Args: cli.RequiresRangeArgs(1, 2), - RunE: func(cmd *cobra.Command, args []string) error { - opts.container = args[0] - if len(args) > 1 { - opts.port = args[1] - } - return runPort(dockerCli, &opts) - }, - } - return cmd -} - -func runPort(dockerCli command.Cli, opts *portOptions) error { - ctx := context.Background() - - c, err := dockerCli.Client().ContainerInspect(ctx, opts.container) - if err != nil { - return err - } - - if opts.port != "" { - port := opts.port - proto := "tcp" - parts := strings.SplitN(port, "/", 2) - - if len(parts) == 2 && len(parts[1]) != 0 { - port = parts[0] - proto = parts[1] - } - natPort := port + "/" + proto - newP, err := nat.NewPort(proto, port) - if err != nil { - return err - } - if frontends, exists := c.NetworkSettings.Ports[newP]; exists && frontends != nil { - for _, frontend := range frontends { - fmt.Fprintf(dockerCli.Out(), "%s:%s\n", frontend.HostIP, frontend.HostPort) - } - return nil - } - return errors.Errorf("Error: No public port '%s' published for %s", natPort, opts.container) - } - - for from, frontends := range c.NetworkSettings.Ports { - for _, frontend := range frontends { - fmt.Fprintf(dockerCli.Out(), "%s -> %s:%s\n", from, frontend.HostIP, frontend.HostPort) - } - } - - return nil -}
  46. Download patch cli/cli/command/container/opts.go
  47. Download patch cli/cli/command/config/testdata/config-list-sort.golden

    --- 18.06.0+dfsg1-1/cli/cli/command/config/testdata/config-list-sort.golden 2018-07-18 18:54:54.000000000 +0000 +++ 18.06.1-0ubuntu2/cli/cli/command/config/testdata/config-list-sort.golden 1970-01-01 00:00:00.000000000 +0000 @@ -1,4 +0,0 @@ -ID NAME CREATED UPDATED -ID-1-foo 1-foo 2 hours ago About an hour ago -ID-2-foo 2-foo 2 hours ago About an hour ago -ID-10-foo 10-foo 2 hours ago About an hour ago
  48. Download patch cli/cli/command/container/update.go

    --- 18.06.0+dfsg1-1/cli/cli/command/container/update.go 2018-07-18 18:54:54.000000000 +0000 +++ 18.06.1-0ubuntu2/cli/cli/command/container/update.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,133 +0,0 @@ -package container - -import ( - "context" - "fmt" - "strings" - - "github.com/docker/cli/cli" - "github.com/docker/cli/cli/command" - "github.com/docker/cli/opts" - containertypes "github.com/docker/docker/api/types/container" - "github.com/pkg/errors" - "github.com/spf13/cobra" -) - -type updateOptions struct { - blkioWeight uint16 - cpuPeriod int64 - cpuQuota int64 - cpuRealtimePeriod int64 - cpuRealtimeRuntime int64 - cpusetCpus string - cpusetMems string - cpuShares int64 - memory opts.MemBytes - memoryReservation opts.MemBytes - memorySwap opts.MemSwapBytes - kernelMemory opts.MemBytes - restartPolicy string - cpus opts.NanoCPUs - - nFlag int - - containers []string -} - -// NewUpdateCommand creates a new cobra.Command for `docker update` -func NewUpdateCommand(dockerCli command.Cli) *cobra.Command { - var options updateOptions - - cmd := &cobra.Command{ - Use: "update [OPTIONS] CONTAINER [CONTAINER...]", - Short: "Update configuration of one or more containers", - Args: cli.RequiresMinArgs(1), - RunE: func(cmd *cobra.Command, args []string) error { - options.containers = args - options.nFlag = cmd.Flags().NFlag() - return runUpdate(dockerCli, &options) - }, - } - - flags := cmd.Flags() - flags.Uint16Var(&options.blkioWeight, "blkio-weight", 0, "Block IO (relative weight), between 10 and 1000, or 0 to disable (default 0)") - flags.Int64Var(&options.cpuPeriod, "cpu-period", 0, "Limit CPU CFS (Completely Fair Scheduler) period") - flags.Int64Var(&options.cpuQuota, "cpu-quota", 0, "Limit CPU CFS (Completely Fair Scheduler) quota") - flags.Int64Var(&options.cpuRealtimePeriod, "cpu-rt-period", 0, "Limit the CPU real-time period in microseconds") - flags.SetAnnotation("cpu-rt-period", "version", []string{"1.25"}) - flags.Int64Var(&options.cpuRealtimeRuntime, "cpu-rt-runtime", 0, "Limit the CPU real-time runtime in microseconds") - flags.SetAnnotation("cpu-rt-runtime", "version", []string{"1.25"}) - flags.StringVar(&options.cpusetCpus, "cpuset-cpus", "", "CPUs in which to allow execution (0-3, 0,1)") - flags.StringVar(&options.cpusetMems, "cpuset-mems", "", "MEMs in which to allow execution (0-3, 0,1)") - flags.Int64VarP(&options.cpuShares, "cpu-shares", "c", 0, "CPU shares (relative weight)") - flags.VarP(&options.memory, "memory", "m", "Memory limit") - flags.Var(&options.memoryReservation, "memory-reservation", "Memory soft limit") - flags.Var(&options.memorySwap, "memory-swap", "Swap limit equal to memory plus swap: '-1' to enable unlimited swap") - flags.Var(&options.kernelMemory, "kernel-memory", "Kernel memory limit") - flags.StringVar(&options.restartPolicy, "restart", "", "Restart policy to apply when a container exits") - - flags.Var(&options.cpus, "cpus", "Number of CPUs") - flags.SetAnnotation("cpus", "version", []string{"1.29"}) - - return cmd -} - -func runUpdate(dockerCli command.Cli, options *updateOptions) error { - var err error - - if options.nFlag == 0 { - return errors.New("you must provide one or more flags when using this command") - } - - var restartPolicy containertypes.RestartPolicy - if options.restartPolicy != "" { - restartPolicy, err = opts.ParseRestartPolicy(options.restartPolicy) - if err != nil { - return err - } - } - - resources := containertypes.Resources{ - BlkioWeight: options.blkioWeight, - CpusetCpus: options.cpusetCpus, - CpusetMems: options.cpusetMems, - CPUShares: options.cpuShares, - Memory: options.memory.Value(), - MemoryReservation: options.memoryReservation.Value(), - MemorySwap: options.memorySwap.Value(), - KernelMemory: options.kernelMemory.Value(), - CPUPeriod: options.cpuPeriod, - CPUQuota: options.cpuQuota, - CPURealtimePeriod: options.cpuRealtimePeriod, - CPURealtimeRuntime: options.cpuRealtimeRuntime, - NanoCPUs: options.cpus.Value(), - } - - updateConfig := containertypes.UpdateConfig{ - Resources: resources, - RestartPolicy: restartPolicy, - } - - ctx := context.Background() - - var ( - warns []string - errs []string - ) - for _, container := range options.containers { - r, err := dockerCli.Client().ContainerUpdate(ctx, container, updateConfig) - if err != nil { - errs = append(errs, err.Error()) - } else { - fmt.Fprintln(dockerCli.Out(), container) - } - warns = append(warns, r.Warnings...) - } - if len(warns) > 0 { - fmt.Fprintln(dockerCli.Out(), strings.Join(warns, "\n")) - } - if len(errs) > 0 { - return errors.New(strings.Join(errs, "\n")) - } - return nil -}
  49. Download patch cli/cli/command/cli.go
  50. Download patch cli/cli/command/formatter/checkpoint_test.go

    --- 18.06.0+dfsg1-1/cli/cli/command/formatter/checkpoint_test.go 2018-07-18 18:54:54.000000000 +0000 +++ 18.06.1-0ubuntu2/cli/cli/command/formatter/checkpoint_test.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,52 +0,0 @@ -package formatter - -import ( - "bytes" - "testing" - - "github.com/docker/docker/api/types" - "gotest.tools/assert" -) - -func TestCheckpointContextFormatWrite(t *testing.T) { - cases := []struct { - context Context - expected string - }{ - { - Context{Format: NewCheckpointFormat(defaultCheckpointFormat)}, - `CHECKPOINT NAME -checkpoint-1 -checkpoint-2 -checkpoint-3 -`, - }, - { - Context{Format: NewCheckpointFormat("{{.Name}}")}, - `checkpoint-1 -checkpoint-2 -checkpoint-3 -`, - }, - { - Context{Format: NewCheckpointFormat("{{.Name}}:")}, - `checkpoint-1: -checkpoint-2: -checkpoint-3: -`, - }, - } - - checkpoints := []types.Checkpoint{ - {Name: "checkpoint-1"}, - {Name: "checkpoint-2"}, - {Name: "checkpoint-3"}, - } - for _, testcase := range cases { - out := bytes.NewBufferString("") - testcase.context.Output = out - err := CheckpointWrite(testcase.context, checkpoints) - assert.NilError(t, err) - assert.Equal(t, out.String(), testcase.expected) - } -}
  51. Download patch cli/cli/command/container/testdata/valid.env

    --- 18.06.0+dfsg1-1/cli/cli/command/container/testdata/valid.env 2018-07-18 18:54:54.000000000 +0000 +++ 18.06.1-0ubuntu2/cli/cli/command/container/testdata/valid.env 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -ENV1=value1
  52. Download patch cli/cli/command/container/start.go
  53. Download patch cli/cli/command/container/run.go
  54. Download patch cli/cli/command/config/create_test.go

    --- 18.06.0+dfsg1-1/cli/cli/command/config/create_test.go 2018-07-18 18:54:54.000000000 +0000 +++ 18.06.1-0ubuntu2/cli/cli/command/config/create_test.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,143 +0,0 @@ -package config - -import ( - "io/ioutil" - "path/filepath" - "reflect" - "strings" - "testing" - - "github.com/docker/cli/internal/test" - "github.com/docker/docker/api/types" - "github.com/docker/docker/api/types/swarm" - "github.com/pkg/errors" - "gotest.tools/assert" - is "gotest.tools/assert/cmp" - "gotest.tools/golden" -) - -const configDataFile = "config-create-with-name.golden" - -func TestConfigCreateErrors(t *testing.T) { - testCases := []struct { - args []string - configCreateFunc func(swarm.ConfigSpec) (types.ConfigCreateResponse, error) - expectedError string - }{ - { - args: []string{"too_few"}, - expectedError: "requires exactly 2 arguments", - }, - {args: []string{"too", "many", "arguments"}, - expectedError: "requires exactly 2 arguments", - }, - { - args: []string{"name", filepath.Join("testdata", configDataFile)}, - configCreateFunc: func(configSpec swarm.ConfigSpec) (types.ConfigCreateResponse, error) { - return types.ConfigCreateResponse{}, errors.Errorf("error creating config") - }, - expectedError: "error creating config", - }, - } - for _, tc := range testCases { - cmd := newConfigCreateCommand( - test.NewFakeCli(&fakeClient{ - configCreateFunc: tc.configCreateFunc, - }), - ) - cmd.SetArgs(tc.args) - cmd.SetOutput(ioutil.Discard) - assert.ErrorContains(t, cmd.Execute(), tc.expectedError) - } -} - -func TestConfigCreateWithName(t *testing.T) { - name := "foo" - var actual []byte - cli := test.NewFakeCli(&fakeClient{ - configCreateFunc: func(spec swarm.ConfigSpec) (types.ConfigCreateResponse, error) { - if spec.Name != name { - return types.ConfigCreateResponse{}, errors.Errorf("expected name %q, got %q", name, spec.Name) - } - - actual = spec.Data - - return types.ConfigCreateResponse{ - ID: "ID-" + spec.Name, - }, nil - }, - }) - - cmd := newConfigCreateCommand(cli) - cmd.SetArgs([]string{name, filepath.Join("testdata", configDataFile)}) - assert.NilError(t, cmd.Execute()) - golden.Assert(t, string(actual), configDataFile) - assert.Check(t, is.Equal("ID-"+name, strings.TrimSpace(cli.OutBuffer().String()))) -} - -func TestConfigCreateWithLabels(t *testing.T) { - expectedLabels := map[string]string{ - "lbl1": "Label-foo", - "lbl2": "Label-bar", - } - name := "foo" - - data, err := ioutil.ReadFile(filepath.Join("testdata", configDataFile)) - assert.NilError(t, err) - - expected := swarm.ConfigSpec{ - Annotations: swarm.Annotations{ - Name: name, - Labels: expectedLabels, - }, - Data: data, - } - - cli := test.NewFakeCli(&fakeClient{ - configCreateFunc: func(spec swarm.ConfigSpec) (types.ConfigCreateResponse, error) { - if !reflect.DeepEqual(spec, expected) { - return types.ConfigCreateResponse{}, errors.Errorf("expected %+v, got %+v", expected, spec) - } - - return types.ConfigCreateResponse{ - ID: "ID-" + spec.Name, - }, nil - }, - }) - - cmd := newConfigCreateCommand(cli) - cmd.SetArgs([]string{name, filepath.Join("testdata", configDataFile)}) - cmd.Flags().Set("label", "lbl1=Label-foo") - cmd.Flags().Set("label", "lbl2=Label-bar") - assert.NilError(t, cmd.Execute()) - assert.Check(t, is.Equal("ID-"+name, strings.TrimSpace(cli.OutBuffer().String()))) -} - -func TestConfigCreateWithTemplatingDriver(t *testing.T) { - expectedDriver := &swarm.Driver{ - Name: "template-driver", - } - name := "foo" - - cli := test.NewFakeCli(&fakeClient{ - configCreateFunc: func(spec swarm.ConfigSpec) (types.ConfigCreateResponse, error) { - if spec.Name != name { - return types.ConfigCreateResponse{}, errors.Errorf("expected name %q, got %q", name, spec.Name) - } - - if spec.Templating.Name != expectedDriver.Name { - return types.ConfigCreateResponse{}, errors.Errorf("expected driver %v, got %v", expectedDriver, spec.Labels) - } - - return types.ConfigCreateResponse{ - ID: "ID-" + spec.Name, - }, nil - }, - }) - - cmd := newConfigCreateCommand(cli) - cmd.SetArgs([]string{name, filepath.Join("testdata", configDataFile)}) - cmd.Flags().Set("template-driver", expectedDriver.Name) - assert.NilError(t, cmd.Execute()) - assert.Check(t, is.Equal("ID-"+name, strings.TrimSpace(cli.OutBuffer().String()))) -}
  55. Download patch cli/cli/command/container/testdata/container-list-format-with-arg.golden

    --- 18.06.0+dfsg1-1/cli/cli/command/container/testdata/container-list-format-with-arg.golden 2018-07-18 18:54:54.000000000 +0000 +++ 18.06.1-0ubuntu2/cli/cli/command/container/testdata/container-list-format-with-arg.golden 1970-01-01 00:00:00.000000000 +0000 @@ -1,2 +0,0 @@ -c1 value -c2
  56. Download patch cli/cli/command/container/rename.go

    --- 18.06.0+dfsg1-1/cli/cli/command/container/rename.go 2018-07-18 18:54:54.000000000 +0000 +++ 18.06.1-0ubuntu2/cli/cli/command/container/rename.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,51 +0,0 @@ -package container - -import ( - "context" - "fmt" - "strings" - - "github.com/docker/cli/cli" - "github.com/docker/cli/cli/command" - "github.com/pkg/errors" - "github.com/spf13/cobra" -) - -type renameOptions struct { - oldName string - newName string -} - -// NewRenameCommand creates a new cobra.Command for `docker rename` -func NewRenameCommand(dockerCli command.Cli) *cobra.Command { - var opts renameOptions - - cmd := &cobra.Command{ - Use: "rename CONTAINER NEW_NAME", - Short: "Rename a container", - Args: cli.ExactArgs(2), - RunE: func(cmd *cobra.Command, args []string) error { - opts.oldName = args[0] - opts.newName = args[1] - return runRename(dockerCli, &opts) - }, - } - return cmd -} - -func runRename(dockerCli command.Cli, opts *renameOptions) error { - ctx := context.Background() - - oldName := strings.TrimSpace(opts.oldName) - newName := strings.TrimSpace(opts.newName) - - if oldName == "" || newName == "" { - return errors.New("Error: Neither old nor new names may be empty") - } - - if err := dockerCli.Client().ContainerRename(ctx, oldName, newName); err != nil { - fmt.Fprintln(dockerCli.Err(), err) - return errors.Errorf("Error: failed to rename container named %s", oldName) - } - return nil -}
  57. Download patch cli/circle.yml

    --- 18.06.0+dfsg1-1/cli/circle.yml 2018-07-18 18:54:54.000000000 +0000 +++ 18.06.1-0ubuntu2/cli/circle.yml 1970-01-01 00:00:00.000000000 +0000 @@ -1,116 +0,0 @@ -version: 2 - -jobs: - - lint: - working_directory: /work - docker: [{image: 'docker:17.06-git'}] - steps: - - checkout - - setup_remote_docker: - reusable: true - exclusive: false - - run: - command: docker version - - run: - name: "Lint" - command: | - dockerfile=dockerfiles/Dockerfile.lint - echo "COPY . ." >> $dockerfile - docker build -f $dockerfile --tag cli-linter:$CIRCLE_BUILD_NUM . - docker run --rm cli-linter:$CIRCLE_BUILD_NUM - - cross: - working_directory: /work - docker: [{image: 'docker:17.06-git'}] - parallelism: 3 - steps: - - checkout - - setup_remote_docker: - reusable: true - exclusive: false - - run: - name: "Cross" - command: | - dockerfile=dockerfiles/Dockerfile.cross - echo "COPY . ." >> $dockerfile - docker build -f $dockerfile --tag cli-builder:$CIRCLE_BUILD_NUM . - name=cross-$CIRCLE_BUILD_NUM-$CIRCLE_NODE_INDEX - docker run \ - -e CROSS_GROUP=$CIRCLE_NODE_INDEX \ - --name $name cli-builder:$CIRCLE_BUILD_NUM \ - make cross - docker cp \ - $name:/go/src/github.com/docker/cli/build \ - /work/build - - store_artifacts: - path: /work/build - - test: - working_directory: /work - docker: [{image: 'docker:17.06-git'}] - steps: - - checkout - - setup_remote_docker: - reusable: true - exclusive: false - - run: - name: "Unit Test with Coverage" - command: | - dockerfile=dockerfiles/Dockerfile.dev - echo "COPY . ." >> $dockerfile - docker build -f $dockerfile --tag cli-builder:$CIRCLE_BUILD_NUM . - docker run --name \ - test-$CIRCLE_BUILD_NUM cli-builder:$CIRCLE_BUILD_NUM \ - make test-coverage - - - run: - name: "Upload to Codecov" - command: | - docker cp \ - test-$CIRCLE_BUILD_NUM:/go/src/github.com/docker/cli/coverage.txt \ - coverage.txt - apk add -U bash curl - curl -s https://codecov.io/bash | bash || \ - echo 'Codecov failed to upload' - - validate: - working_directory: /work - docker: [{image: 'docker:17.06-git'}] - steps: - - checkout - - setup_remote_docker: - reusable: true - exclusive: false - - run: - name: "Validate Vendor, Docs, and Code Generation" - command: | - dockerfile=dockerfiles/Dockerfile.dev - echo "COPY . ." >> $dockerfile - rm -f .dockerignore # include .git - docker build -f $dockerfile --tag cli-builder-with-git:$CIRCLE_BUILD_NUM . - docker run --rm cli-builder-with-git:$CIRCLE_BUILD_NUM \ - make ci-validate - shellcheck: - working_directory: /work - docker: [{image: 'docker:17.06-git'}] - steps: - - checkout - - setup_remote_docker - - run: - name: "Run shellcheck" - command: | - dockerfile=dockerfiles/Dockerfile.shellcheck - echo "COPY . ." >> $dockerfile - docker build -f $dockerfile --tag cli-validator:$CIRCLE_BUILD_NUM . - docker run --rm cli-validator:$CIRCLE_BUILD_NUM \ - make shellcheck -workflows: - version: 2 - ci: - jobs: - - lint - - cross - - test - - validate - - shellcheck
  58. Download patch CHANGELOG.md

    --- 18.06.0+dfsg1-1/CHANGELOG.md 2018-07-18 18:54:54.000000000 +0000 +++ 18.06.1-0ubuntu2/CHANGELOG.md 2018-08-21 17:16:31.000000000 +0000 @@ -3,6 +3,31 @@ For more information on the list of deprecated flags and APIs, have a look at https://docs.docker.com/engine/deprecated/ where you can find the target removal dates +## 18.06.1-ce (2018-08-21) + +### Builder + +- Fix no error if build args are missing during docker build. [docker/engine#25](https://github.com/docker/engine/pull/25) ++ Set BuildKit's ExportedProduct variable to show useful errors. [docker/engine#21](https://github.com/docker/engine/pull/21) + +### Client + ++ Various shell completion script updates. [docker/cli#1229](https://github.com/docker/cli/pull/1229) [docker/cli#1268](https://github.com/docker/cli/pull/1268) [docker/cli#1272](https://github.com/docker/cli/pull/1272) +- Fix `DOCKER_CONFIG` warning message and fallback search. [docker/cli#1241](https://github.com/docker/cli/pull/1241) +- Fix help message flags on `docker stack` commands and sub-commands. [docker/cli#1267](https://github.com/docker/cli/pull/1267) + +### Runtime + +* Disable CRI plugin listening on port 10010 by default. [docker/engine#29](https://github.com/docker/engine/pull/29) +* Update containerd to v1.1.2. [docker/engine#33](https://github.com/docker/engine/pull/33) +- Windows: Do not invoke HCS shutdown if terminate called. [docker/engine#31](https://github.com/docker/engine/pull/31) +* Windows: Select polling-based watcher for Windows log watcher. [docker/engine#34](https://github.com/docker/engine/pull/34) + +### Swarm Mode + +- Fix the condition used for skipping over running tasks. [docker/swarmkit#2677](https://github.com/docker/swarmkit/pull/2677) +- Fix task sorting. [docker/swarmkit#2712](https://github.com/docker/swarmkit/pull/2712) + ## 18.06.0-ce (2018-07-18) ### Important notes about this release
  59. Download patch cli/cli/command/container/export.go

    --- 18.06.0+dfsg1-1/cli/cli/command/container/export.go 2018-07-18 18:54:54.000000000 +0000 +++ 18.06.1-0ubuntu2/cli/cli/command/container/export.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,58 +0,0 @@ -package container - -import ( - "context" - "io" - - "github.com/docker/cli/cli" - "github.com/docker/cli/cli/command" - "github.com/pkg/errors" - "github.com/spf13/cobra" -) - -type exportOptions struct { - container string - output string -} - -// NewExportCommand creates a new `docker export` command -func NewExportCommand(dockerCli command.Cli) *cobra.Command { - var opts exportOptions - - cmd := &cobra.Command{ - Use: "export [OPTIONS] CONTAINER", - Short: "Export a container's filesystem as a tar archive", - Args: cli.ExactArgs(1), - RunE: func(cmd *cobra.Command, args []string) error { - opts.container = args[0] - return runExport(dockerCli, opts) - }, - } - - flags := cmd.Flags() - - flags.StringVarP(&opts.output, "output", "o", "", "Write to a file, instead of STDOUT") - - return cmd -} - -func runExport(dockerCli command.Cli, opts exportOptions) error { - if opts.output == "" && dockerCli.Out().IsTerminal() { - return errors.New("cowardly refusing to save to a terminal. Use the -o flag or redirect") - } - - clnt := dockerCli.Client() - - responseBody, err := clnt.ContainerExport(context.Background(), opts.container) - if err != nil { - return err - } - defer responseBody.Close() - - if opts.output == "" { - _, err := io.Copy(dockerCli.Out(), responseBody) - return err - } - - return command.CopyToFile(opts.output, responseBody) -}
  60. Download patch cli/cli/command/container/cp.go
  61. Download patch cli/cli/command/container/testdata/utf8.env

    --- 18.06.0+dfsg1-1/cli/cli/command/container/testdata/utf8.env 2018-07-18 18:54:54.000000000 +0000 +++ 18.06.1-0ubuntu2/cli/cli/command/container/testdata/utf8.env 1970-01-01 00:00:00.000000000 +0000 @@ -1,3 +0,0 @@ -FOO=BAR -HELLO=您好 -BAR=FOO \ No newline at end of file
  62. Download patch cli/cli/command/config/testdata/config-list-with-filter.golden

    --- 18.06.0+dfsg1-1/cli/cli/command/config/testdata/config-list-with-filter.golden 2018-07-18 18:54:54.000000000 +0000 +++ 18.06.1-0ubuntu2/cli/cli/command/config/testdata/config-list-with-filter.golden 1970-01-01 00:00:00.000000000 +0000 @@ -1,3 +0,0 @@ -ID NAME CREATED UPDATED -ID-bar bar 2 hours ago About an hour ago -ID-foo foo 2 hours ago About an hour ago
  63. Download patch cli/cli/command/config/remove.go

    --- 18.06.0+dfsg1-1/cli/cli/command/config/remove.go 2018-07-18 18:54:54.000000000 +0000 +++ 18.06.1-0ubuntu2/cli/cli/command/config/remove.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,53 +0,0 @@ -package config - -import ( - "context" - "fmt" - "strings" - - "github.com/docker/cli/cli" - "github.com/docker/cli/cli/command" - "github.com/pkg/errors" - "github.com/spf13/cobra" -) - -type removeOptions struct { - names []string -} - -func newConfigRemoveCommand(dockerCli command.Cli) *cobra.Command { - return &cobra.Command{ - Use: "rm CONFIG [CONFIG...]", - Aliases: []string{"remove"}, - Short: "Remove one or more configs", - Args: cli.RequiresMinArgs(1), - RunE: func(cmd *cobra.Command, args []string) error { - opts := removeOptions{ - names: args, - } - return runConfigRemove(dockerCli, opts) - }, - } -} - -func runConfigRemove(dockerCli command.Cli, opts removeOptions) error { - client := dockerCli.Client() - ctx := context.Background() - - var errs []string - - for _, name := range opts.names { - if err := client.ConfigRemove(ctx, name); err != nil { - errs = append(errs, err.Error()) - continue - } - - fmt.Fprintln(dockerCli.Out(), name) - } - - if len(errs) > 0 { - return errors.Errorf("%s", strings.Join(errs, "\n")) - } - - return nil -}
  64. Download patch cli/cli/command/events_utils.go

    --- 18.06.0+dfsg1-1/cli/cli/command/events_utils.go 2018-07-18 18:54:54.000000000 +0000 +++ 18.06.1-0ubuntu2/cli/cli/command/events_utils.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,47 +0,0 @@ -package command - -import ( - "sync" - - eventtypes "github.com/docker/docker/api/types/events" - "github.com/sirupsen/logrus" -) - -// EventHandler is abstract interface for user to customize -// own handle functions of each type of events -type EventHandler interface { - Handle(action string, h func(eventtypes.Message)) - Watch(c <-chan eventtypes.Message) -} - -// InitEventHandler initializes and returns an EventHandler -func InitEventHandler() EventHandler { - return &eventHandler{handlers: make(map[string]func(eventtypes.Message))} -} - -type eventHandler struct { - handlers map[string]func(eventtypes.Message) - mu sync.Mutex -} - -func (w *eventHandler) Handle(action string, h func(eventtypes.Message)) { - w.mu.Lock() - w.handlers[action] = h - w.mu.Unlock() -} - -// Watch ranges over the passed in event chan and processes the events based on the -// handlers created for a given action. -// To stop watching, close the event chan. -func (w *eventHandler) Watch(c <-chan eventtypes.Message) { - for e := range c { - w.mu.Lock() - h, exists := w.handlers[e.Action] - w.mu.Unlock() - if !exists { - continue - } - logrus.Debugf("event handler: received event: %v", e) - go h(e) - } -}
  65. Download patch cli/cli/command/config/testdata/config-create-with-name.golden

    --- 18.06.0+dfsg1-1/cli/cli/command/config/testdata/config-create-with-name.golden 2018-07-18 18:54:54.000000000 +0000 +++ 18.06.1-0ubuntu2/cli/cli/command/config/testdata/config-create-with-name.golden 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -config_foo_bar
  66. Download patch cli/cli/command/container/cp_test.go

    --- 18.06.0+dfsg1-1/cli/cli/command/container/cp_test.go 2018-07-18 18:54:54.000000000 +0000 +++ 18.06.1-0ubuntu2/cli/cli/command/container/cp_test.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,192 +0,0 @@ -package container - -import ( - "io" - "io/ioutil" - "os" - "runtime" - "strings" - "testing" - - "github.com/docker/cli/internal/test" - "github.com/docker/docker/api/types" - "github.com/docker/docker/pkg/archive" - "gotest.tools/assert" - is "gotest.tools/assert/cmp" - "gotest.tools/fs" - "gotest.tools/skip" -) - -func TestRunCopyWithInvalidArguments(t *testing.T) { - var testcases = []struct { - doc string - options copyOptions - expectedErr string - }{ - { - doc: "copy between container", - options: copyOptions{ - source: "first:/path", - destination: "second:/path", - }, - expectedErr: "copying between containers is not supported", - }, - { - doc: "copy without a container", - options: copyOptions{ - source: "./source", - destination: "./dest", - }, - expectedErr: "must specify at least one container source", - }, - } - for _, testcase := range testcases { - t.Run(testcase.doc, func(t *testing.T) { - err := runCopy(test.NewFakeCli(nil), testcase.options) - assert.Error(t, err, testcase.expectedErr) - }) - } -} - -func TestRunCopyFromContainerToStdout(t *testing.T) { - tarContent := "the tar content" - - fakeClient := &fakeClient{ - containerCopyFromFunc: func(container, srcPath string) (io.ReadCloser, types.ContainerPathStat, error) { - assert.Check(t, is.Equal("container", container)) - return ioutil.NopCloser(strings.NewReader(tarContent)), types.ContainerPathStat{}, nil - }, - } - options := copyOptions{source: "container:/path", destination: "-"} - cli := test.NewFakeCli(fakeClient) - err := runCopy(cli, options) - assert.NilError(t, err) - assert.Check(t, is.Equal(tarContent, cli.OutBuffer().String())) - assert.Check(t, is.Equal("", cli.ErrBuffer().String())) -} - -func TestRunCopyFromContainerToFilesystem(t *testing.T) { - destDir := fs.NewDir(t, "cp-test", - fs.WithFile("file1", "content\n")) - defer destDir.Remove() - - fakeClient := &fakeClient{ - containerCopyFromFunc: func(container, srcPath string) (io.ReadCloser, types.ContainerPathStat, error) { - assert.Check(t, is.Equal("container", container)) - readCloser, err := archive.TarWithOptions(destDir.Path(), &archive.TarOptions{}) - return readCloser, types.ContainerPathStat{}, err - }, - } - options := copyOptions{source: "container:/path", destination: destDir.Path()} - cli := test.NewFakeCli(fakeClient) - err := runCopy(cli, options) - assert.NilError(t, err) - assert.Check(t, is.Equal("", cli.OutBuffer().String())) - assert.Check(t, is.Equal("", cli.ErrBuffer().String())) - - content, err := ioutil.ReadFile(destDir.Join("file1")) - assert.NilError(t, err) - assert.Check(t, is.Equal("content\n", string(content))) -} - -func TestRunCopyFromContainerToFilesystemMissingDestinationDirectory(t *testing.T) { - destDir := fs.NewDir(t, "cp-test", - fs.WithFile("file1", "content\n")) - defer destDir.Remove() - - fakeClient := &fakeClient{ - containerCopyFromFunc: func(container, srcPath string) (io.ReadCloser, types.ContainerPathStat, error) { - assert.Check(t, is.Equal("container", container)) - readCloser, err := archive.TarWithOptions(destDir.Path(), &archive.TarOptions{}) - return readCloser, types.ContainerPathStat{}, err - }, - } - - options := copyOptions{ - source: "container:/path", - destination: destDir.Join("missing", "foo"), - } - cli := test.NewFakeCli(fakeClient) - err := runCopy(cli, options) - assert.ErrorContains(t, err, destDir.Join("missing")) -} - -func TestRunCopyToContainerFromFileWithTrailingSlash(t *testing.T) { - srcFile := fs.NewFile(t, t.Name()) - defer srcFile.Remove() - - options := copyOptions{ - source: srcFile.Path() + string(os.PathSeparator), - destination: "container:/path", - } - cli := test.NewFakeCli(&fakeClient{}) - err := runCopy(cli, options) - - expectedError := "not a directory" - if runtime.GOOS == "windows" { - expectedError = "The filename, directory name, or volume label syntax is incorrect" - } - assert.ErrorContains(t, err, expectedError) -} - -func TestRunCopyToContainerSourceDoesNotExist(t *testing.T) { - options := copyOptions{ - source: "/does/not/exist", - destination: "container:/path", - } - cli := test.NewFakeCli(&fakeClient{}) - err := runCopy(cli, options) - expected := "no such file or directory" - if runtime.GOOS == "windows" { - expected = "cannot find the file specified" - } - assert.ErrorContains(t, err, expected) -} - -func TestSplitCpArg(t *testing.T) { - var testcases = []struct { - doc string - path string - os string - expectedContainer string - expectedPath string - }{ - { - doc: "absolute path with colon", - os: "linux", - path: "/abs/path:withcolon", - expectedPath: "/abs/path:withcolon", - }, - { - doc: "relative path with colon", - path: "./relative:path", - expectedPath: "./relative:path", - }, - { - doc: "absolute path with drive", - os: "windows", - path: `d:\abs\path`, - expectedPath: `d:\abs\path`, - }, - { - doc: "no separator", - path: "relative/path", - expectedPath: "relative/path", - }, - { - doc: "with separator", - path: "container:/opt/foo", - expectedPath: "/opt/foo", - expectedContainer: "container", - }, - } - for _, testcase := range testcases { - t.Run(testcase.doc, func(t *testing.T) { - skip.If(t, testcase.os != "" && testcase.os != runtime.GOOS) - - container, path := splitCpArg(testcase.path) - assert.Check(t, is.Equal(testcase.expectedContainer, container)) - assert.Check(t, is.Equal(testcase.expectedPath, path)) - }) - } -}
  67. Download patch cli/cli/command/container/attach.go

    --- 18.06.0+dfsg1-1/cli/cli/command/container/attach.go 2018-07-18 18:54:54.000000000 +0000 +++ 18.06.1-0ubuntu2/cli/cli/command/container/attach.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,181 +0,0 @@ -package container - -import ( - "context" - "fmt" - "io" - "net/http/httputil" - - "github.com/docker/cli/cli" - "github.com/docker/cli/cli/command" - "github.com/docker/docker/api/types" - "github.com/docker/docker/api/types/container" - "github.com/docker/docker/client" - "github.com/docker/docker/pkg/signal" - "github.com/pkg/errors" - "github.com/sirupsen/logrus" - "github.com/spf13/cobra" -) - -type attachOptions struct { - noStdin bool - proxy bool - detachKeys string - - container string -} - -func inspectContainerAndCheckState(ctx context.Context, cli client.APIClient, args string) (*types.ContainerJSON, error) { - c, err := cli.ContainerInspect(ctx, args) - if err != nil { - return nil, err - } - if !c.State.Running { - return nil, errors.New("You cannot attach to a stopped container, start it first") - } - if c.State.Paused { - return nil, errors.New("You cannot attach to a paused container, unpause it first") - } - if c.State.Restarting { - return nil, errors.New("You cannot attach to a restarting container, wait until it is running") - } - - return &c, nil -} - -// NewAttachCommand creates a new cobra.Command for `docker attach` -func NewAttachCommand(dockerCli command.Cli) *cobra.Command { - var opts attachOptions - - cmd := &cobra.Command{ - Use: "attach [OPTIONS] CONTAINER", - Short: "Attach local standard input, output, and error streams to a running container", - Args: cli.ExactArgs(1), - RunE: func(cmd *cobra.Command, args []string) error { - opts.container = args[0] - return runAttach(dockerCli, &opts) - }, - } - - flags := cmd.Flags() - flags.BoolVar(&opts.noStdin, "no-stdin", false, "Do not attach STDIN") - flags.BoolVar(&opts.proxy, "sig-proxy", true, "Proxy all received signals to the process") - flags.StringVar(&opts.detachKeys, "detach-keys", "", "Override the key sequence for detaching a container") - return cmd -} - -func runAttach(dockerCli command.Cli, opts *attachOptions) error { - ctx := context.Background() - client := dockerCli.Client() - - // request channel to wait for client - resultC, errC := client.ContainerWait(ctx, opts.container, "") - - c, err := inspectContainerAndCheckState(ctx, client, opts.container) - if err != nil { - return err - } - - if err := dockerCli.In().CheckTty(!opts.noStdin, c.Config.Tty); err != nil { - return err - } - - if opts.detachKeys != "" { - dockerCli.ConfigFile().DetachKeys = opts.detachKeys - } - - options := types.ContainerAttachOptions{ - Stream: true, - Stdin: !opts.noStdin && c.Config.OpenStdin, - Stdout: true, - Stderr: true, - DetachKeys: dockerCli.ConfigFile().DetachKeys, - } - - var in io.ReadCloser - if options.Stdin { - in = dockerCli.In() - } - - if opts.proxy && !c.Config.Tty { - sigc := ForwardAllSignals(ctx, dockerCli, opts.container) - defer signal.StopCatch(sigc) - } - - resp, errAttach := client.ContainerAttach(ctx, opts.container, options) - if errAttach != nil && errAttach != httputil.ErrPersistEOF { - // ContainerAttach returns an ErrPersistEOF (connection closed) - // means server met an error and put it in Hijacked connection - // keep the error and read detailed error message from hijacked connection later - return errAttach - } - defer resp.Close() - - // If use docker attach command to attach to a stop container, it will return - // "You cannot attach to a stopped container" error, it's ok, but when - // attach to a running container, it(docker attach) use inspect to check - // the container's state, if it pass the state check on the client side, - // and then the container is stopped, docker attach command still attach to - // the container and not exit. - // - // Recheck the container's state to avoid attach block. - _, err = inspectContainerAndCheckState(ctx, client, opts.container) - if err != nil { - return err - } - - if c.Config.Tty && dockerCli.Out().IsTerminal() { - resizeTTY(ctx, dockerCli, opts.container) - } - - streamer := hijackedIOStreamer{ - streams: dockerCli, - inputStream: in, - outputStream: dockerCli.Out(), - errorStream: dockerCli.Err(), - resp: resp, - tty: c.Config.Tty, - detachKeys: options.DetachKeys, - } - - if err := streamer.stream(ctx); err != nil { - return err - } - - if errAttach != nil { - return errAttach - } - - return getExitStatus(errC, resultC) -} - -func getExitStatus(errC <-chan error, resultC <-chan container.ContainerWaitOKBody) error { - select { - case result := <-resultC: - if result.Error != nil { - return fmt.Errorf(result.Error.Message) - } - if result.StatusCode != 0 { - return cli.StatusError{StatusCode: int(result.StatusCode)} - } - case err := <-errC: - return err - } - - return nil -} - -func resizeTTY(ctx context.Context, dockerCli command.Cli, containerID string) { - height, width := dockerCli.Out().GetTtySize() - // To handle the case where a user repeatedly attaches/detaches without resizing their - // terminal, the only way to get the shell prompt to display for attaches 2+ is to artificially - // resize it, then go back to normal. Without this, every attach after the first will - // require the user to manually resize or hit enter. - resizeTtyTo(ctx, dockerCli.Client(), containerID, height+1, width+1, false) - - // After the above resizing occurs, the call to MonitorTtySize below will handle resetting back - // to the actual size. - if err := MonitorTtySize(ctx, dockerCli, containerID, false); err != nil { - logrus.Debugf("Error monitoring TTY size: %s", err) - } -}
  68. Download patch cli/cli/command/config/testdata/config-inspect-without-format.multiple-configs-with-labels.golden

    --- 18.06.0+dfsg1-1/cli/cli/command/config/testdata/config-inspect-without-format.multiple-configs-with-labels.golden 2018-07-18 18:54:54.000000000 +0000 +++ 18.06.1-0ubuntu2/cli/cli/command/config/testdata/config-inspect-without-format.multiple-configs-with-labels.golden 1970-01-01 00:00:00.000000000 +0000 @@ -1,26 +0,0 @@ -[ - { - "ID": "ID-foo", - "Version": {}, - "CreatedAt": "0001-01-01T00:00:00Z", - "UpdatedAt": "0001-01-01T00:00:00Z", - "Spec": { - "Name": "foo", - "Labels": { - "label1": "label-foo" - } - } - }, - { - "ID": "ID-bar", - "Version": {}, - "CreatedAt": "0001-01-01T00:00:00Z", - "UpdatedAt": "0001-01-01T00:00:00Z", - "Spec": { - "Name": "bar", - "Labels": { - "label1": "label-foo" - } - } - } -]
  69. Download patch cli/cli/command/checkpoint/client_test.go

    --- 18.06.0+dfsg1-1/cli/cli/command/checkpoint/client_test.go 2018-07-18 18:54:54.000000000 +0000 +++ 18.06.1-0ubuntu2/cli/cli/command/checkpoint/client_test.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,36 +0,0 @@ -package checkpoint - -import ( - "context" - - "github.com/docker/docker/api/types" - "github.com/docker/docker/client" -) - -type fakeClient struct { - client.Client - checkpointCreateFunc func(container string, options types.CheckpointCreateOptions) error - checkpointDeleteFunc func(container string, options types.CheckpointDeleteOptions) error - checkpointListFunc func(container string, options types.CheckpointListOptions) ([]types.Checkpoint, error) -} - -func (cli *fakeClient) CheckpointCreate(ctx context.Context, container string, options types.CheckpointCreateOptions) error { - if cli.checkpointCreateFunc != nil { - return cli.checkpointCreateFunc(container, options) - } - return nil -} - -func (cli *fakeClient) CheckpointDelete(ctx context.Context, container string, options types.CheckpointDeleteOptions) error { - if cli.checkpointDeleteFunc != nil { - return cli.checkpointDeleteFunc(container, options) - } - return nil -} - -func (cli *fakeClient) CheckpointList(ctx context.Context, container string, options types.CheckpointListOptions) ([]types.Checkpoint, error) { - if cli.checkpointListFunc != nil { - return cli.checkpointListFunc(container, options) - } - return []types.Checkpoint{}, nil -}
  70. Download patch cli/cli/command/config/ls_test.go

    --- 18.06.0+dfsg1-1/cli/cli/command/config/ls_test.go 2018-07-18 18:54:54.000000000 +0000 +++ 18.06.1-0ubuntu2/cli/cli/command/config/ls_test.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,158 +0,0 @@ -package config - -import ( - "io/ioutil" - "testing" - "time" - - "github.com/docker/cli/cli/config/configfile" - "github.com/docker/cli/internal/test" - "github.com/docker/docker/api/types" - "github.com/docker/docker/api/types/swarm" - "github.com/pkg/errors" - // Import builders to get the builder function as package function - . "github.com/docker/cli/internal/test/builders" - "gotest.tools/assert" - is "gotest.tools/assert/cmp" - "gotest.tools/golden" -) - -func TestConfigListErrors(t *testing.T) { - testCases := []struct { - args []string - configListFunc func(types.ConfigListOptions) ([]swarm.Config, error) - expectedError string - }{ - { - args: []string{"foo"}, - expectedError: "accepts no argument", - }, - { - configListFunc: func(options types.ConfigListOptions) ([]swarm.Config, error) { - return []swarm.Config{}, errors.Errorf("error listing configs") - }, - expectedError: "error listing configs", - }, - } - for _, tc := range testCases { - cmd := newConfigListCommand( - test.NewFakeCli(&fakeClient{ - configListFunc: tc.configListFunc, - }), - ) - cmd.SetArgs(tc.args) - cmd.SetOutput(ioutil.Discard) - assert.ErrorContains(t, cmd.Execute(), tc.expectedError) - } -} - -func TestConfigList(t *testing.T) { - cli := test.NewFakeCli(&fakeClient{ - configListFunc: func(options types.ConfigListOptions) ([]swarm.Config, error) { - return []swarm.Config{ - *Config(ConfigID("ID-1-foo"), - ConfigName("1-foo"), - ConfigVersion(swarm.Version{Index: 10}), - ConfigCreatedAt(time.Now().Add(-2*time.Hour)), - ConfigUpdatedAt(time.Now().Add(-1*time.Hour)), - ), - *Config(ConfigID("ID-10-foo"), - ConfigName("10-foo"), - ConfigVersion(swarm.Version{Index: 11}), - ConfigCreatedAt(time.Now().Add(-2*time.Hour)), - ConfigUpdatedAt(time.Now().Add(-1*time.Hour)), - ), - *Config(ConfigID("ID-2-foo"), - ConfigName("2-foo"), - ConfigVersion(swarm.Version{Index: 11}), - ConfigCreatedAt(time.Now().Add(-2*time.Hour)), - ConfigUpdatedAt(time.Now().Add(-1*time.Hour)), - ), - }, nil - }, - }) - cmd := newConfigListCommand(cli) - assert.NilError(t, cmd.Execute()) - golden.Assert(t, cli.OutBuffer().String(), "config-list-sort.golden") -} - -func TestConfigListWithQuietOption(t *testing.T) { - cli := test.NewFakeCli(&fakeClient{ - configListFunc: func(options types.ConfigListOptions) ([]swarm.Config, error) { - return []swarm.Config{ - *Config(ConfigID("ID-foo"), ConfigName("foo")), - *Config(ConfigID("ID-bar"), ConfigName("bar"), ConfigLabels(map[string]string{ - "label": "label-bar", - })), - }, nil - }, - }) - cmd := newConfigListCommand(cli) - cmd.Flags().Set("quiet", "true") - assert.NilError(t, cmd.Execute()) - golden.Assert(t, cli.OutBuffer().String(), "config-list-with-quiet-option.golden") -} - -func TestConfigListWithConfigFormat(t *testing.T) { - cli := test.NewFakeCli(&fakeClient{ - configListFunc: func(options types.ConfigListOptions) ([]swarm.Config, error) { - return []swarm.Config{ - *Config(ConfigID("ID-foo"), ConfigName("foo")), - *Config(ConfigID("ID-bar"), ConfigName("bar"), ConfigLabels(map[string]string{ - "label": "label-bar", - })), - }, nil - }, - }) - cli.SetConfigFile(&configfile.ConfigFile{ - ConfigFormat: "{{ .Name }} {{ .Labels }}", - }) - cmd := newConfigListCommand(cli) - assert.NilError(t, cmd.Execute()) - golden.Assert(t, cli.OutBuffer().String(), "config-list-with-config-format.golden") -} - -func TestConfigListWithFormat(t *testing.T) { - cli := test.NewFakeCli(&fakeClient{ - configListFunc: func(options types.ConfigListOptions) ([]swarm.Config, error) { - return []swarm.Config{ - *Config(ConfigID("ID-foo"), ConfigName("foo")), - *Config(ConfigID("ID-bar"), ConfigName("bar"), ConfigLabels(map[string]string{ - "label": "label-bar", - })), - }, nil - }, - }) - cmd := newConfigListCommand(cli) - cmd.Flags().Set("format", "{{ .Name }} {{ .Labels }}") - assert.NilError(t, cmd.Execute()) - golden.Assert(t, cli.OutBuffer().String(), "config-list-with-format.golden") -} - -func TestConfigListWithFilter(t *testing.T) { - cli := test.NewFakeCli(&fakeClient{ - configListFunc: func(options types.ConfigListOptions) ([]swarm.Config, error) { - assert.Check(t, is.Equal("foo", options.Filters.Get("name")[0])) - assert.Check(t, is.Equal("lbl1=Label-bar", options.Filters.Get("label")[0])) - return []swarm.Config{ - *Config(ConfigID("ID-foo"), - ConfigName("foo"), - ConfigVersion(swarm.Version{Index: 10}), - ConfigCreatedAt(time.Now().Add(-2*time.Hour)), - ConfigUpdatedAt(time.Now().Add(-1*time.Hour)), - ), - *Config(ConfigID("ID-bar"), - ConfigName("bar"), - ConfigVersion(swarm.Version{Index: 11}), - ConfigCreatedAt(time.Now().Add(-2*time.Hour)), - ConfigUpdatedAt(time.Now().Add(-1*time.Hour)), - ), - }, nil - }, - }) - cmd := newConfigListCommand(cli) - cmd.Flags().Set("filter", "name=foo") - cmd.Flags().Set("filter", "label=lbl1=Label-bar") - assert.NilError(t, cmd.Execute()) - golden.Assert(t, cli.OutBuffer().String(), "config-list-with-filter.golden") -}
  71. Download patch cli/cli/command/bundlefile/bundlefile.go

    --- 18.06.0+dfsg1-1/cli/cli/command/bundlefile/bundlefile.go 2018-07-18 18:54:54.000000000 +0000 +++ 18.06.1-0ubuntu2/cli/cli/command/bundlefile/bundlefile.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,70 +0,0 @@ -package bundlefile - -import ( - "encoding/json" - "io" - - "github.com/pkg/errors" -) - -// Bundlefile stores the contents of a bundlefile -type Bundlefile struct { - Version string - Services map[string]Service -} - -// Service is a service from a bundlefile -type Service struct { - Image string - Command []string `json:",omitempty"` - Args []string `json:",omitempty"` - Env []string `json:",omitempty"` - Labels map[string]string `json:",omitempty"` - Ports []Port `json:",omitempty"` - WorkingDir *string `json:",omitempty"` - User *string `json:",omitempty"` - Networks []string `json:",omitempty"` -} - -// Port is a port as defined in a bundlefile -type Port struct { - Protocol string - Port uint32 -} - -// LoadFile loads a bundlefile from a path to the file -func LoadFile(reader io.Reader) (*Bundlefile, error) { - bundlefile := &Bundlefile{} - - decoder := json.NewDecoder(reader) - if err := decoder.Decode(bundlefile); err != nil { - switch jsonErr := err.(type) { - case *json.SyntaxError: - return nil, errors.Errorf( - "JSON syntax error at byte %v: %s", - jsonErr.Offset, - jsonErr.Error()) - case *json.UnmarshalTypeError: - return nil, errors.Errorf( - "Unexpected type at byte %v. Expected %s but received %s.", - jsonErr.Offset, - jsonErr.Type, - jsonErr.Value) - } - return nil, err - } - - return bundlefile, nil -} - -// Print writes the contents of the bundlefile to the output writer -// as human readable json -func Print(out io.Writer, bundle *Bundlefile) error { - bytes, err := json.MarshalIndent(*bundle, "", " ") - if err != nil { - return err - } - - _, err = out.Write(bytes) - return err -}
  72. Download patch cli/cli/command/container/testdata/valid.label

    --- 18.06.0+dfsg1-1/cli/cli/command/container/testdata/valid.label 2018-07-18 18:54:54.000000000 +0000 +++ 18.06.1-0ubuntu2/cli/cli/command/container/testdata/valid.label 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -LABEL1=value1
  73. Download patch cli/cli/command/config/inspect_test.go

    --- 18.06.0+dfsg1-1/cli/cli/command/config/inspect_test.go 2018-07-18 18:54:54.000000000 +0000 +++ 18.06.1-0ubuntu2/cli/cli/command/config/inspect_test.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,172 +0,0 @@ -package config - -import ( - "fmt" - "io/ioutil" - "testing" - "time" - - "github.com/docker/cli/internal/test" - "github.com/docker/docker/api/types/swarm" - "github.com/pkg/errors" - // Import builders to get the builder function as package function - . "github.com/docker/cli/internal/test/builders" - "gotest.tools/assert" - "gotest.tools/golden" -) - -func TestConfigInspectErrors(t *testing.T) { - testCases := []struct { - args []string - flags map[string]string - configInspectFunc func(configID string) (swarm.Config, []byte, error) - expectedError string - }{ - { - expectedError: "requires at least 1 argument", - }, - { - args: []string{"foo"}, - configInspectFunc: func(configID string) (swarm.Config, []byte, error) { - return swarm.Config{}, nil, errors.Errorf("error while inspecting the config") - }, - expectedError: "error while inspecting the config", - }, - { - args: []string{"foo"}, - flags: map[string]string{ - "format": "{{invalid format}}", - }, - expectedError: "Template parsing error", - }, - { - args: []string{"foo", "bar"}, - configInspectFunc: func(configID string) (swarm.Config, []byte, error) { - if configID == "foo" { - return *Config(ConfigName("foo")), nil, nil - } - return swarm.Config{}, nil, errors.Errorf("error while inspecting the config") - }, - expectedError: "error while inspecting the config", - }, - } - for _, tc := range testCases { - cmd := newConfigInspectCommand( - test.NewFakeCli(&fakeClient{ - configInspectFunc: tc.configInspectFunc, - }), - ) - cmd.SetArgs(tc.args) - for key, value := range tc.flags { - cmd.Flags().Set(key, value) - } - cmd.SetOutput(ioutil.Discard) - assert.ErrorContains(t, cmd.Execute(), tc.expectedError) - } -} - -func TestConfigInspectWithoutFormat(t *testing.T) { - testCases := []struct { - name string - args []string - configInspectFunc func(configID string) (swarm.Config, []byte, error) - }{ - { - name: "single-config", - args: []string{"foo"}, - configInspectFunc: func(name string) (swarm.Config, []byte, error) { - if name != "foo" { - return swarm.Config{}, nil, errors.Errorf("Invalid name, expected %s, got %s", "foo", name) - } - return *Config(ConfigID("ID-foo"), ConfigName("foo")), nil, nil - }, - }, - { - name: "multiple-configs-with-labels", - args: []string{"foo", "bar"}, - configInspectFunc: func(name string) (swarm.Config, []byte, error) { - return *Config(ConfigID("ID-"+name), ConfigName(name), ConfigLabels(map[string]string{ - "label1": "label-foo", - })), nil, nil - }, - }, - } - for _, tc := range testCases { - cli := test.NewFakeCli(&fakeClient{configInspectFunc: tc.configInspectFunc}) - cmd := newConfigInspectCommand(cli) - cmd.SetArgs(tc.args) - assert.NilError(t, cmd.Execute()) - golden.Assert(t, cli.OutBuffer().String(), fmt.Sprintf("config-inspect-without-format.%s.golden", tc.name)) - } -} - -func TestConfigInspectWithFormat(t *testing.T) { - configInspectFunc := func(name string) (swarm.Config, []byte, error) { - return *Config(ConfigName("foo"), ConfigLabels(map[string]string{ - "label1": "label-foo", - })), nil, nil - } - testCases := []struct { - name string - format string - args []string - configInspectFunc func(name string) (swarm.Config, []byte, error) - }{ - { - name: "simple-template", - format: "{{.Spec.Name}}", - args: []string{"foo"}, - configInspectFunc: configInspectFunc, - }, - { - name: "json-template", - format: "{{json .Spec.Labels}}", - args: []string{"foo"}, - configInspectFunc: configInspectFunc, - }, - } - for _, tc := range testCases { - cli := test.NewFakeCli(&fakeClient{ - configInspectFunc: tc.configInspectFunc, - }) - cmd := newConfigInspectCommand(cli) - cmd.SetArgs(tc.args) - cmd.Flags().Set("format", tc.format) - assert.NilError(t, cmd.Execute()) - golden.Assert(t, cli.OutBuffer().String(), fmt.Sprintf("config-inspect-with-format.%s.golden", tc.name)) - } -} - -func TestConfigInspectPretty(t *testing.T) { - testCases := []struct { - name string - configInspectFunc func(string) (swarm.Config, []byte, error) - }{ - { - name: "simple", - configInspectFunc: func(id string) (swarm.Config, []byte, error) { - return *Config( - ConfigLabels(map[string]string{ - "lbl1": "value1", - }), - ConfigID("configID"), - ConfigName("configName"), - ConfigCreatedAt(time.Time{}), - ConfigUpdatedAt(time.Time{}), - ConfigData([]byte("payload here")), - ), []byte{}, nil - }, - }, - } - for _, tc := range testCases { - cli := test.NewFakeCli(&fakeClient{ - configInspectFunc: tc.configInspectFunc, - }) - cmd := newConfigInspectCommand(cli) - - cmd.SetArgs([]string{"configID"}) - cmd.Flags().Set("pretty", "true") - assert.NilError(t, cmd.Execute()) - golden.Assert(t, cli.OutBuffer().String(), fmt.Sprintf("config-inspect-pretty.%s.golden", tc.name)) - } -}
  74. Download patch cli/cli/command/config/cmd.go

    --- 18.06.0+dfsg1-1/cli/cli/command/config/cmd.go 2018-07-18 18:54:54.000000000 +0000 +++ 18.06.1-0ubuntu2/cli/cli/command/config/cmd.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,29 +0,0 @@ -package config - -import ( - "github.com/spf13/cobra" - - "github.com/docker/cli/cli" - "github.com/docker/cli/cli/command" -) - -// NewConfigCommand returns a cobra command for `config` subcommands -func NewConfigCommand(dockerCli command.Cli) *cobra.Command { - cmd := &cobra.Command{ - Use: "config", - Short: "Manage Docker configs", - Args: cli.NoArgs, - RunE: command.ShowHelp(dockerCli.Err()), - Annotations: map[string]string{ - "version": "1.30", - "swarm": "", - }, - } - cmd.AddCommand( - newConfigListCommand(dockerCli), - newConfigCreateCommand(dockerCli), - newConfigInspectCommand(dockerCli), - newConfigRemoveCommand(dockerCli), - ) - return cmd -}
  75. Download patch cli/cli/command/container/testdata/container-list-with-config-format.golden

    --- 18.06.0+dfsg1-1/cli/cli/command/container/testdata/container-list-with-config-format.golden 2018-07-18 18:54:54.000000000 +0000 +++ 18.06.1-0ubuntu2/cli/cli/command/container/testdata/container-list-with-config-format.golden 1970-01-01 00:00:00.000000000 +0000 @@ -1,2 +0,0 @@ -c1 busybox:latest some.label=value -c2 busybox:latest foo=bar
  76. Download patch cli/cli/command/container/create_test.go

    --- 18.06.0+dfsg1-1/cli/cli/command/container/create_test.go 2018-07-18 18:54:54.000000000 +0000 +++ 18.06.1-0ubuntu2/cli/cli/command/container/create_test.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,172 +0,0 @@ -package container - -import ( - "context" - "fmt" - "io" - "io/ioutil" - "os" - "runtime" - "strings" - "testing" - - "github.com/docker/cli/internal/test" - "github.com/docker/cli/internal/test/notary" - "github.com/docker/docker/api/types" - "github.com/docker/docker/api/types/container" - "github.com/docker/docker/api/types/network" - "github.com/google/go-cmp/cmp" - "github.com/pkg/errors" - "gotest.tools/assert" - is "gotest.tools/assert/cmp" - "gotest.tools/fs" -) - -func TestCIDFileNoOPWithNoFilename(t *testing.T) { - file, err := newCIDFile("") - assert.NilError(t, err) - assert.DeepEqual(t, &cidFile{}, file, cmp.AllowUnexported(cidFile{})) - - assert.NilError(t, file.Write("id")) - assert.NilError(t, file.Close()) -} - -func TestNewCIDFileWhenFileAlreadyExists(t *testing.T) { - tempfile := fs.NewFile(t, "test-cid-file") - defer tempfile.Remove() - - _, err := newCIDFile(tempfile.Path()) - assert.ErrorContains(t, err, "Container ID file found") -} - -func TestCIDFileCloseWithNoWrite(t *testing.T) { - tempdir := fs.NewDir(t, "test-cid-file") - defer tempdir.Remove() - - path := tempdir.Join("cidfile") - file, err := newCIDFile(path) - assert.NilError(t, err) - assert.Check(t, is.Equal(file.path, path)) - - assert.NilError(t, file.Close()) - _, err = os.Stat(path) - assert.Check(t, os.IsNotExist(err)) -} - -func TestCIDFileCloseWithWrite(t *testing.T) { - tempdir := fs.NewDir(t, "test-cid-file") - defer tempdir.Remove() - - path := tempdir.Join("cidfile") - file, err := newCIDFile(path) - assert.NilError(t, err) - - content := "id" - assert.NilError(t, file.Write(content)) - - actual, err := ioutil.ReadFile(path) - assert.NilError(t, err) - assert.Check(t, is.Equal(content, string(actual))) - - assert.NilError(t, file.Close()) - _, err = os.Stat(path) - assert.NilError(t, err) -} - -func TestCreateContainerPullsImageIfMissing(t *testing.T) { - imageName := "does-not-exist-locally" - responseCounter := 0 - containerID := "abcdef" - - client := &fakeClient{ - createContainerFunc: func( - config *container.Config, - hostConfig *container.HostConfig, - networkingConfig *network.NetworkingConfig, - containerName string, - ) (container.ContainerCreateCreatedBody, error) { - defer func() { responseCounter++ }() - switch responseCounter { - case 0: - return container.ContainerCreateCreatedBody{}, fakeNotFound{} - case 1: - return container.ContainerCreateCreatedBody{ID: containerID}, nil - default: - return container.ContainerCreateCreatedBody{}, errors.New("unexpected") - } - }, - imageCreateFunc: func(parentReference string, options types.ImageCreateOptions) (io.ReadCloser, error) { - return ioutil.NopCloser(strings.NewReader("")), nil - }, - infoFunc: func() (types.Info, error) { - return types.Info{IndexServerAddress: "http://indexserver"}, nil - }, - } - cli := test.NewFakeCli(client) - config := &containerConfig{ - Config: &container.Config{ - Image: imageName, - }, - HostConfig: &container.HostConfig{}, - } - body, err := createContainer(context.Background(), cli, config, &createOptions{ - name: "name", - platform: runtime.GOOS, - untrusted: true, - }) - assert.NilError(t, err) - expected := container.ContainerCreateCreatedBody{ID: containerID} - assert.Check(t, is.DeepEqual(expected, *body)) - stderr := cli.ErrBuffer().String() - assert.Check(t, is.Contains(stderr, "Unable to find image 'does-not-exist-locally:latest' locally")) -} - -func TestNewCreateCommandWithContentTrustErrors(t *testing.T) { - testCases := []struct { - name string - args []string - expectedError string - notaryFunc test.NotaryClientFuncType - }{ - { - name: "offline-notary-server", - notaryFunc: notary.GetOfflineNotaryRepository, - expectedError: "client is offline", - args: []string{"image:tag"}, - }, - { - name: "uninitialized-notary-server", - notaryFunc: notary.GetUninitializedNotaryRepository, - expectedError: "remote trust data does not exist", - args: []string{"image:tag"}, - }, - { - name: "empty-notary-server", - notaryFunc: notary.GetEmptyTargetsNotaryRepository, - expectedError: "No valid trust data for tag", - args: []string{"image:tag"}, - }, - } - for _, tc := range testCases { - cli := test.NewFakeCli(&fakeClient{ - createContainerFunc: func(config *container.Config, - hostConfig *container.HostConfig, - networkingConfig *network.NetworkingConfig, - containerName string, - ) (container.ContainerCreateCreatedBody, error) { - return container.ContainerCreateCreatedBody{}, fmt.Errorf("shouldn't try to pull image") - }, - }, test.EnableContentTrust) - cli.SetNotaryClient(tc.notaryFunc) - cmd := NewCreateCommand(cli) - cmd.SetOutput(ioutil.Discard) - cmd.SetArgs(tc.args) - err := cmd.Execute() - assert.ErrorContains(t, err, tc.expectedError) - } -} - -type fakeNotFound struct{} - -func (f fakeNotFound) NotFound() bool { return true } -func (f fakeNotFound) Error() string { return "error fake not found" }
  77. Download patch cli/cli/cobra.go

    --- 18.06.0+dfsg1-1/cli/cli/cobra.go 2018-07-18 18:54:54.000000000 +0000 +++ 18.06.1-0ubuntu2/cli/cli/cobra.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,152 +0,0 @@ -package cli - -import ( - "fmt" - "strings" - - "github.com/docker/docker/pkg/term" - "github.com/pkg/errors" - "github.com/spf13/cobra" -) - -// SetupRootCommand sets default usage, help, and error handling for the -// root command. -func SetupRootCommand(rootCmd *cobra.Command) { - cobra.AddTemplateFunc("hasSubCommands", hasSubCommands) - cobra.AddTemplateFunc("hasManagementSubCommands", hasManagementSubCommands) - cobra.AddTemplateFunc("operationSubCommands", operationSubCommands) - cobra.AddTemplateFunc("managementSubCommands", managementSubCommands) - cobra.AddTemplateFunc("wrappedFlagUsages", wrappedFlagUsages) - - rootCmd.SetUsageTemplate(usageTemplate) - rootCmd.SetHelpTemplate(helpTemplate) - rootCmd.SetFlagErrorFunc(FlagErrorFunc) - rootCmd.SetHelpCommand(helpCommand) - rootCmd.SetVersionTemplate("Docker version {{.Version}}\n") - - rootCmd.PersistentFlags().BoolP("help", "h", false, "Print usage") - rootCmd.PersistentFlags().MarkShorthandDeprecated("help", "please use --help") - rootCmd.PersistentFlags().Lookup("help").Hidden = true -} - -// FlagErrorFunc prints an error message which matches the format of the -// docker/cli/cli error messages -func FlagErrorFunc(cmd *cobra.Command, err error) error { - if err == nil { - return nil - } - - usage := "" - if cmd.HasSubCommands() { - usage = "\n\n" + cmd.UsageString() - } - return StatusError{ - Status: fmt.Sprintf("%s\nSee '%s --help'.%s", err, cmd.CommandPath(), usage), - StatusCode: 125, - } -} - -var helpCommand = &cobra.Command{ - Use: "help [command]", - Short: "Help about the command", - PersistentPreRun: func(cmd *cobra.Command, args []string) {}, - PersistentPostRun: func(cmd *cobra.Command, args []string) {}, - RunE: func(c *cobra.Command, args []string) error { - cmd, args, e := c.Root().Find(args) - if cmd == nil || e != nil || len(args) > 0 { - return errors.Errorf("unknown help topic: %v", strings.Join(args, " ")) - } - - helpFunc := cmd.HelpFunc() - helpFunc(cmd, args) - return nil - }, -} - -func hasSubCommands(cmd *cobra.Command) bool { - return len(operationSubCommands(cmd)) > 0 -} - -func hasManagementSubCommands(cmd *cobra.Command) bool { - return len(managementSubCommands(cmd)) > 0 -} - -func operationSubCommands(cmd *cobra.Command) []*cobra.Command { - cmds := []*cobra.Command{} - for _, sub := range cmd.Commands() { - if sub.IsAvailableCommand() && !sub.HasSubCommands() { - cmds = append(cmds, sub) - } - } - return cmds -} - -func wrappedFlagUsages(cmd *cobra.Command) string { - width := 80 - if ws, err := term.GetWinsize(0); err == nil { - width = int(ws.Width) - } - return cmd.Flags().FlagUsagesWrapped(width - 1) -} - -func managementSubCommands(cmd *cobra.Command) []*cobra.Command { - cmds := []*cobra.Command{} - for _, sub := range cmd.Commands() { - if sub.IsAvailableCommand() && sub.HasSubCommands() { - cmds = append(cmds, sub) - } - } - return cmds -} - -var usageTemplate = `Usage: - -{{- if not .HasSubCommands}} {{.UseLine}}{{end}} -{{- if .HasSubCommands}} {{ .CommandPath}}{{- if .HasAvailableFlags}} [OPTIONS]{{end}} COMMAND{{end}} - -{{ .Short | trim }} - -{{- if gt .Aliases 0}} - -Aliases: - {{.NameAndAliases}} - -{{- end}} -{{- if .HasExample}} - -Examples: -{{ .Example }} - -{{- end}} -{{- if .HasAvailableFlags}} - -Options: -{{ wrappedFlagUsages . | trimRightSpace}} - -{{- end}} -{{- if hasManagementSubCommands . }} - -Management Commands: - -{{- range managementSubCommands . }} - {{rpad .Name .NamePadding }} {{.Short}} -{{- end}} - -{{- end}} -{{- if hasSubCommands .}} - -Commands: - -{{- range operationSubCommands . }} - {{rpad .Name .NamePadding }} {{.Short}} -{{- end}} -{{- end}} - -{{- if .HasSubCommands }} - -Run '{{.CommandPath}} COMMAND --help' for more information on a command. -{{- end}} -` - -var helpTemplate = ` -{{if or .Runnable .HasSubCommands}}{{.UsageString}}{{end}}`
  78. Download patch cli/cli/command/container/testdata/container-list-format-name-name.golden

    --- 18.06.0+dfsg1-1/cli/cli/command/container/testdata/container-list-format-name-name.golden 2018-07-18 18:54:54.000000000 +0000 +++ 18.06.1-0ubuntu2/cli/cli/command/container/testdata/container-list-format-name-name.golden 1970-01-01 00:00:00.000000000 +0000 @@ -1,2 +0,0 @@ -c1 c1 -c2 c2
  79. Download patch cli/appveyor.yml

    --- 18.06.0+dfsg1-1/cli/appveyor.yml 2018-07-18 18:54:54.000000000 +0000 +++ 18.06.1-0ubuntu2/cli/appveyor.yml 1970-01-01 00:00:00.000000000 +0000 @@ -1,23 +0,0 @@ -version: "{build}" - -clone_folder: c:\gopath\src\github.com\docker\cli - -environment: - GOPATH: c:\gopath - GOVERSION: 1.10.3 - DEPVERSION: v0.4.1 - -install: - - rmdir c:\go /s /q - - appveyor DownloadFile https://storage.googleapis.com/golang/go%GOVERSION%.windows-amd64.msi - - msiexec /i go%GOVERSION%.windows-amd64.msi /q - - go version - - go env - -deploy: false - -build_script: - - ps: .\scripts\make.ps1 -Binary - -test_script: - - ps: .\scripts\make.ps1 -TestUnit \ No newline at end of file
  80. Download patch cli/cli/command/container/restart.go

    --- 18.06.0+dfsg1-1/cli/cli/command/container/restart.go 2018-07-18 18:54:54.000000000 +0000 +++ 18.06.1-0ubuntu2/cli/cli/command/container/restart.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,62 +0,0 @@ -package container - -import ( - "context" - "fmt" - "strings" - "time" - - "github.com/docker/cli/cli" - "github.com/docker/cli/cli/command" - "github.com/pkg/errors" - "github.com/spf13/cobra" -) - -type restartOptions struct { - nSeconds int - nSecondsChanged bool - - containers []string -} - -// NewRestartCommand creates a new cobra.Command for `docker restart` -func NewRestartCommand(dockerCli command.Cli) *cobra.Command { - var opts restartOptions - - cmd := &cobra.Command{ - Use: "restart [OPTIONS] CONTAINER [CONTAINER...]", - Short: "Restart one or more containers", - Args: cli.RequiresMinArgs(1), - RunE: func(cmd *cobra.Command, args []string) error { - opts.containers = args - opts.nSecondsChanged = cmd.Flags().Changed("time") - return runRestart(dockerCli, &opts) - }, - } - - flags := cmd.Flags() - flags.IntVarP(&opts.nSeconds, "time", "t", 10, "Seconds to wait for stop before killing the container") - return cmd -} - -func runRestart(dockerCli command.Cli, opts *restartOptions) error { - ctx := context.Background() - var errs []string - var timeout *time.Duration - if opts.nSecondsChanged { - timeoutValue := time.Duration(opts.nSeconds) * time.Second - timeout = &timeoutValue - } - - for _, name := range opts.containers { - if err := dockerCli.Client().ContainerRestart(ctx, name, timeout); err != nil { - errs = append(errs, err.Error()) - continue - } - fmt.Fprintln(dockerCli.Out(), name) - } - if len(errs) > 0 { - return errors.New(strings.Join(errs, "\n")) - } - return nil -}
  81. Download patch cli/cli/command/config/testdata/config-list-with-format.golden

    --- 18.06.0+dfsg1-1/cli/cli/command/config/testdata/config-list-with-format.golden 2018-07-18 18:54:54.000000000 +0000 +++ 18.06.1-0ubuntu2/cli/cli/command/config/testdata/config-list-with-format.golden 1970-01-01 00:00:00.000000000 +0000 @@ -1,2 +0,0 @@ -bar label=label-bar -foo
  82. Download patch cli/cli/command/commands/commands.go

    --- 18.06.0+dfsg1-1/cli/cli/command/commands/commands.go 2018-07-18 18:54:54.000000000 +0000 +++ 18.06.1-0ubuntu2/cli/cli/command/commands/commands.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,133 +0,0 @@ -package commands - -import ( - "os" - - "github.com/docker/cli/cli/command" - "github.com/docker/cli/cli/command/checkpoint" - "github.com/docker/cli/cli/command/config" - "github.com/docker/cli/cli/command/container" - "github.com/docker/cli/cli/command/image" - "github.com/docker/cli/cli/command/manifest" - "github.com/docker/cli/cli/command/network" - "github.com/docker/cli/cli/command/node" - "github.com/docker/cli/cli/command/plugin" - "github.com/docker/cli/cli/command/registry" - "github.com/docker/cli/cli/command/secret" - "github.com/docker/cli/cli/command/service" - "github.com/docker/cli/cli/command/stack" - "github.com/docker/cli/cli/command/swarm" - "github.com/docker/cli/cli/command/system" - "github.com/docker/cli/cli/command/trust" - "github.com/docker/cli/cli/command/volume" - "github.com/spf13/cobra" -) - -// AddCommands adds all the commands from cli/command to the root command -func AddCommands(cmd *cobra.Command, dockerCli command.Cli) { - cmd.AddCommand( - // checkpoint - checkpoint.NewCheckpointCommand(dockerCli), - - // config - config.NewConfigCommand(dockerCli), - - // container - container.NewContainerCommand(dockerCli), - container.NewRunCommand(dockerCli), - - // image - image.NewImageCommand(dockerCli), - image.NewBuildCommand(dockerCli), - - // manifest - manifest.NewManifestCommand(dockerCli), - - // network - network.NewNetworkCommand(dockerCli), - - // node - node.NewNodeCommand(dockerCli), - - // plugin - plugin.NewPluginCommand(dockerCli), - - // registry - registry.NewLoginCommand(dockerCli), - registry.NewLogoutCommand(dockerCli), - registry.NewSearchCommand(dockerCli), - - // secret - secret.NewSecretCommand(dockerCli), - - // service - service.NewServiceCommand(dockerCli), - - // system - system.NewSystemCommand(dockerCli), - system.NewVersionCommand(dockerCli), - - // stack - stack.NewStackCommand(dockerCli), - stack.NewTopLevelDeployCommand(dockerCli), - - // swarm - swarm.NewSwarmCommand(dockerCli), - - // trust - trust.NewTrustCommand(dockerCli), - - // volume - volume.NewVolumeCommand(dockerCli), - - // legacy commands may be hidden - hide(system.NewEventsCommand(dockerCli)), - hide(system.NewInfoCommand(dockerCli)), - hide(system.NewInspectCommand(dockerCli)), - hide(container.NewAttachCommand(dockerCli)), - hide(container.NewCommitCommand(dockerCli)), - hide(container.NewCopyCommand(dockerCli)), - hide(container.NewCreateCommand(dockerCli)), - hide(container.NewDiffCommand(dockerCli)), - hide(container.NewExecCommand(dockerCli)), - hide(container.NewExportCommand(dockerCli)), - hide(container.NewKillCommand(dockerCli)), - hide(container.NewLogsCommand(dockerCli)), - hide(container.NewPauseCommand(dockerCli)), - hide(container.NewPortCommand(dockerCli)), - hide(container.NewPsCommand(dockerCli)), - hide(container.NewRenameCommand(dockerCli)), - hide(container.NewRestartCommand(dockerCli)), - hide(container.NewRmCommand(dockerCli)), - hide(container.NewStartCommand(dockerCli)), - hide(container.NewStatsCommand(dockerCli)), - hide(container.NewStopCommand(dockerCli)), - hide(container.NewTopCommand(dockerCli)), - hide(container.NewUnpauseCommand(dockerCli)), - hide(container.NewUpdateCommand(dockerCli)), - hide(container.NewWaitCommand(dockerCli)), - hide(image.NewHistoryCommand(dockerCli)), - hide(image.NewImagesCommand(dockerCli)), - hide(image.NewImportCommand(dockerCli)), - hide(image.NewLoadCommand(dockerCli)), - hide(image.NewPullCommand(dockerCli)), - hide(image.NewPushCommand(dockerCli)), - hide(image.NewRemoveCommand(dockerCli)), - hide(image.NewSaveCommand(dockerCli)), - hide(image.NewTagCommand(dockerCli)), - ) - -} - -func hide(cmd *cobra.Command) *cobra.Command { - // If the environment variable with name "DOCKER_HIDE_LEGACY_COMMANDS" is not empty, - // these legacy commands (such as `docker ps`, `docker exec`, etc) - // will not be shown in output console. - if os.Getenv("DOCKER_HIDE_LEGACY_COMMANDS") == "" { - return cmd - } - cmdCopy := *cmd - cmdCopy.Hidden = true - cmdCopy.Aliases = []string{} - return &cmdCopy -}
  83. Download patch cli/cli/command/container/stop.go

    --- 18.06.0+dfsg1-1/cli/cli/command/container/stop.go 2018-07-18 18:54:54.000000000 +0000 +++ 18.06.1-0ubuntu2/cli/cli/command/container/stop.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,67 +0,0 @@ -package container - -import ( - "context" - "fmt" - "strings" - "time" - - "github.com/docker/cli/cli" - "github.com/docker/cli/cli/command" - "github.com/pkg/errors" - "github.com/spf13/cobra" -) - -type stopOptions struct { - time int - timeChanged bool - - containers []string -} - -// NewStopCommand creates a new cobra.Command for `docker stop` -func NewStopCommand(dockerCli command.Cli) *cobra.Command { - var opts stopOptions - - cmd := &cobra.Command{ - Use: "stop [OPTIONS] CONTAINER [CONTAINER...]", - Short: "Stop one or more running containers", - Args: cli.RequiresMinArgs(1), - RunE: func(cmd *cobra.Command, args []string) error { - opts.containers = args - opts.timeChanged = cmd.Flags().Changed("time") - return runStop(dockerCli, &opts) - }, - } - - flags := cmd.Flags() - flags.IntVarP(&opts.time, "time", "t", 10, "Seconds to wait for stop before killing it") - return cmd -} - -func runStop(dockerCli command.Cli, opts *stopOptions) error { - ctx := context.Background() - - var timeout *time.Duration - if opts.timeChanged { - timeoutValue := time.Duration(opts.time) * time.Second - timeout = &timeoutValue - } - - var errs []string - - errChan := parallelOperation(ctx, opts.containers, func(ctx context.Context, id string) error { - return dockerCli.Client().ContainerStop(ctx, id, timeout) - }) - for _, container := range opts.containers { - if err := <-errChan; err != nil { - errs = append(errs, err.Error()) - continue - } - fmt.Fprintln(dockerCli.Out(), container) - } - if len(errs) > 0 { - return errors.New(strings.Join(errs, "\n")) - } - return nil -}
  84. Download patch cli/cli/command/container/attach_test.go

    --- 18.06.0+dfsg1-1/cli/cli/command/container/attach_test.go 2018-07-18 18:54:54.000000000 +0000 +++ 18.06.1-0ubuntu2/cli/cli/command/container/attach_test.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,129 +0,0 @@ -package container - -import ( - "fmt" - "io/ioutil" - "testing" - - "github.com/docker/cli/cli" - "github.com/docker/cli/internal/test" - "github.com/docker/docker/api/types" - "github.com/docker/docker/api/types/container" - "github.com/pkg/errors" - "gotest.tools/assert" -) - -func TestNewAttachCommandErrors(t *testing.T) { - testCases := []struct { - name string - args []string - expectedError string - containerInspectFunc func(img string) (types.ContainerJSON, error) - }{ - { - name: "client-error", - args: []string{"5cb5bb5e4a3b"}, - expectedError: "something went wrong", - containerInspectFunc: func(containerID string) (types.ContainerJSON, error) { - return types.ContainerJSON{}, errors.Errorf("something went wrong") - }, - }, - { - name: "client-stopped", - args: []string{"5cb5bb5e4a3b"}, - expectedError: "You cannot attach to a stopped container", - containerInspectFunc: func(containerID string) (types.ContainerJSON, error) { - c := types.ContainerJSON{} - c.ContainerJSONBase = &types.ContainerJSONBase{} - c.ContainerJSONBase.State = &types.ContainerState{Running: false} - return c, nil - }, - }, - { - name: "client-paused", - args: []string{"5cb5bb5e4a3b"}, - expectedError: "You cannot attach to a paused container", - containerInspectFunc: func(containerID string) (types.ContainerJSON, error) { - c := types.ContainerJSON{} - c.ContainerJSONBase = &types.ContainerJSONBase{} - c.ContainerJSONBase.State = &types.ContainerState{ - Running: true, - Paused: true, - } - return c, nil - }, - }, - { - name: "client-restarting", - args: []string{"5cb5bb5e4a3b"}, - expectedError: "You cannot attach to a restarting container", - containerInspectFunc: func(containerID string) (types.ContainerJSON, error) { - c := types.ContainerJSON{} - c.ContainerJSONBase = &types.ContainerJSONBase{} - c.ContainerJSONBase.State = &types.ContainerState{ - Running: true, - Paused: false, - Restarting: true, - } - return c, nil - }, - }, - } - for _, tc := range testCases { - cmd := NewAttachCommand(test.NewFakeCli(&fakeClient{inspectFunc: tc.containerInspectFunc})) - cmd.SetOutput(ioutil.Discard) - cmd.SetArgs(tc.args) - assert.ErrorContains(t, cmd.Execute(), tc.expectedError) - } -} - -func TestGetExitStatus(t *testing.T) { - var ( - expectedErr = fmt.Errorf("unexpected error") - errC = make(chan error, 1) - resultC = make(chan container.ContainerWaitOKBody, 1) - ) - - testcases := []struct { - result *container.ContainerWaitOKBody - err error - expectedError error - }{ - { - result: &container.ContainerWaitOKBody{ - StatusCode: 0, - }, - }, - { - err: expectedErr, - expectedError: expectedErr, - }, - { - result: &container.ContainerWaitOKBody{ - Error: &container.ContainerWaitOKBodyError{Message: expectedErr.Error()}, - }, - expectedError: expectedErr, - }, - { - result: &container.ContainerWaitOKBody{ - StatusCode: 15, - }, - expectedError: cli.StatusError{StatusCode: 15}, - }, - } - - for _, testcase := range testcases { - if testcase.err != nil { - errC <- testcase.err - } - if testcase.result != nil { - resultC <- *testcase.result - } - err := getExitStatus(errC, resultC) - if testcase.expectedError == nil { - assert.NilError(t, err) - } else { - assert.Error(t, err, testcase.expectedError.Error()) - } - } -}
  85. Download patch cli/cli/command/container/utils_test.go

    --- 18.06.0+dfsg1-1/cli/cli/command/container/utils_test.go 2018-07-18 18:54:54.000000000 +0000 +++ 18.06.1-0ubuntu2/cli/cli/command/container/utils_test.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,70 +0,0 @@ -package container - -import ( - "context" - "strings" - "testing" - - "github.com/docker/cli/internal/test" - "github.com/docker/docker/api" - "github.com/docker/docker/api/types/container" - "github.com/pkg/errors" - "gotest.tools/assert" - is "gotest.tools/assert/cmp" -) - -func waitFn(cid string) (<-chan container.ContainerWaitOKBody, <-chan error) { - resC := make(chan container.ContainerWaitOKBody) - errC := make(chan error, 1) - var res container.ContainerWaitOKBody - - go func() { - switch { - case strings.Contains(cid, "exit-code-42"): - res.StatusCode = 42 - resC <- res - case strings.Contains(cid, "non-existent"): - err := errors.Errorf("No such container: %v", cid) - errC <- err - case strings.Contains(cid, "wait-error"): - res.Error = &container.ContainerWaitOKBodyError{Message: "removal failed"} - resC <- res - default: - // normal exit - resC <- res - } - }() - - return resC, errC -} - -func TestWaitExitOrRemoved(t *testing.T) { - testcases := []struct { - cid string - exitCode int - }{ - { - cid: "normal-container", - exitCode: 0, - }, - { - cid: "give-me-exit-code-42", - exitCode: 42, - }, - { - cid: "i-want-a-wait-error", - exitCode: 125, - }, - { - cid: "non-existent-container-id", - exitCode: 125, - }, - } - - client := test.NewFakeCli(&fakeClient{waitFunc: waitFn, Version: api.DefaultVersion}) - for _, testcase := range testcases { - statusC := waitExitOrRemoved(context.Background(), client, testcase.cid, true) - exitCode := <-statusC - assert.Check(t, is.Equal(testcase.exitCode, exitCode)) - } -}
  86. Download patch cli/cli/command/container/kill.go

    --- 18.06.0+dfsg1-1/cli/cli/command/container/kill.go 2018-07-18 18:54:54.000000000 +0000 +++ 18.06.1-0ubuntu2/cli/cli/command/container/kill.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,56 +0,0 @@ -package container - -import ( - "context" - "fmt" - "strings" - - "github.com/docker/cli/cli" - "github.com/docker/cli/cli/command" - "github.com/pkg/errors" - "github.com/spf13/cobra" -) - -type killOptions struct { - signal string - - containers []string -} - -// NewKillCommand creates a new cobra.Command for `docker kill` -func NewKillCommand(dockerCli command.Cli) *cobra.Command { - var opts killOptions - - cmd := &cobra.Command{ - Use: "kill [OPTIONS] CONTAINER [CONTAINER...]", - Short: "Kill one or more running containers", - Args: cli.RequiresMinArgs(1), - RunE: func(cmd *cobra.Command, args []string) error { - opts.containers = args - return runKill(dockerCli, &opts) - }, - } - - flags := cmd.Flags() - flags.StringVarP(&opts.signal, "signal", "s", "KILL", "Signal to send to the container") - return cmd -} - -func runKill(dockerCli command.Cli, opts *killOptions) error { - var errs []string - ctx := context.Background() - errChan := parallelOperation(ctx, opts.containers, func(ctx context.Context, container string) error { - return dockerCli.Client().ContainerKill(ctx, container, opts.signal) - }) - for _, name := range opts.containers { - if err := <-errChan; err != nil { - errs = append(errs, err.Error()) - } else { - fmt.Fprintln(dockerCli.Out(), name) - } - } - if len(errs) > 0 { - return errors.New(strings.Join(errs, "\n")) - } - return nil -}
  87. Download patch cli/cli/command/container/stats_helpers.go
  88. Download patch cli/cli/command/container/diff.go

    --- 18.06.0+dfsg1-1/cli/cli/command/container/diff.go 2018-07-18 18:54:54.000000000 +0000 +++ 18.06.1-0ubuntu2/cli/cli/command/container/diff.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,47 +0,0 @@ -package container - -import ( - "context" - - "github.com/docker/cli/cli" - "github.com/docker/cli/cli/command" - "github.com/docker/cli/cli/command/formatter" - "github.com/pkg/errors" - "github.com/spf13/cobra" -) - -type diffOptions struct { - container string -} - -// NewDiffCommand creates a new cobra.Command for `docker diff` -func NewDiffCommand(dockerCli command.Cli) *cobra.Command { - var opts diffOptions - - return &cobra.Command{ - Use: "diff CONTAINER", - Short: "Inspect changes to files or directories on a container's filesystem", - Args: cli.ExactArgs(1), - RunE: func(cmd *cobra.Command, args []string) error { - opts.container = args[0] - return runDiff(dockerCli, &opts) - }, - } -} - -func runDiff(dockerCli command.Cli, opts *diffOptions) error { - if opts.container == "" { - return errors.New("Container name cannot be empty") - } - ctx := context.Background() - - changes, err := dockerCli.Client().ContainerDiff(ctx, opts.container) - if err != nil { - return err - } - diffCtx := formatter.Context{ - Output: dockerCli.Out(), - Format: formatter.NewDiffFormat("{{.Type}} {{.Path}}"), - } - return formatter.DiffWrite(diffCtx, changes) -}
  89. Download patch cli/cli/command/config/testdata/config-list-with-quiet-option.golden

    --- 18.06.0+dfsg1-1/cli/cli/command/config/testdata/config-list-with-quiet-option.golden 2018-07-18 18:54:54.000000000 +0000 +++ 18.06.1-0ubuntu2/cli/cli/command/config/testdata/config-list-with-quiet-option.golden 1970-01-01 00:00:00.000000000 +0000 @@ -1,2 +0,0 @@ -ID-bar -ID-foo
  90. Download patch cli/cli/command/container/cmd.go

    --- 18.06.0+dfsg1-1/cli/cli/command/container/cmd.go 2018-07-18 18:54:54.000000000 +0000 +++ 18.06.1-0ubuntu2/cli/cli/command/container/cmd.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,45 +0,0 @@ -package container - -import ( - "github.com/docker/cli/cli" - "github.com/docker/cli/cli/command" - "github.com/spf13/cobra" -) - -// NewContainerCommand returns a cobra command for `container` subcommands -func NewContainerCommand(dockerCli command.Cli) *cobra.Command { - cmd := &cobra.Command{ - Use: "container", - Short: "Manage containers", - Args: cli.NoArgs, - RunE: command.ShowHelp(dockerCli.Err()), - } - cmd.AddCommand( - NewAttachCommand(dockerCli), - NewCommitCommand(dockerCli), - NewCopyCommand(dockerCli), - NewCreateCommand(dockerCli), - NewDiffCommand(dockerCli), - NewExecCommand(dockerCli), - NewExportCommand(dockerCli), - NewKillCommand(dockerCli), - NewLogsCommand(dockerCli), - NewPauseCommand(dockerCli), - NewPortCommand(dockerCli), - NewRenameCommand(dockerCli), - NewRestartCommand(dockerCli), - NewRmCommand(dockerCli), - NewRunCommand(dockerCli), - NewStartCommand(dockerCli), - NewStatsCommand(dockerCli), - NewStopCommand(dockerCli), - NewTopCommand(dockerCli), - NewUnpauseCommand(dockerCli), - NewUpdateCommand(dockerCli), - NewWaitCommand(dockerCli), - newListCommand(dockerCli), - newInspectCommand(dockerCli), - NewPruneCommand(dockerCli), - ) - return cmd -}
  91. Download patch cli/cli/command/bundlefile/bundlefile_test.go

    --- 18.06.0+dfsg1-1/cli/cli/command/bundlefile/bundlefile_test.go 2018-07-18 18:54:54.000000000 +0000 +++ 18.06.1-0ubuntu2/cli/cli/command/bundlefile/bundlefile_test.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,78 +0,0 @@ -package bundlefile - -import ( - "bytes" - "strings" - "testing" - - "gotest.tools/assert" - is "gotest.tools/assert/cmp" -) - -func TestLoadFileV01Success(t *testing.T) { - reader := strings.NewReader(`{ - "Version": "0.1", - "Services": { - "redis": { - "Image": "redis@sha256:4b24131101fa0117bcaa18ac37055fffd9176aa1a240392bb8ea85e0be50f2ce", - "Networks": ["default"] - }, - "web": { - "Image": "dockercloud/hello-world@sha256:fe79a2cfbd17eefc344fb8419420808df95a1e22d93b7f621a7399fd1e9dca1d", - "Networks": ["default"], - "User": "web" - } - } - }`) - - bundle, err := LoadFile(reader) - assert.NilError(t, err) - assert.Check(t, is.Equal("0.1", bundle.Version)) - assert.Check(t, is.Len(bundle.Services, 2)) -} - -func TestLoadFileSyntaxError(t *testing.T) { - reader := strings.NewReader(`{ - "Version": "0.1", - "Services": unquoted string - }`) - - _, err := LoadFile(reader) - assert.Error(t, err, "JSON syntax error at byte 37: invalid character 'u' looking for beginning of value") -} - -func TestLoadFileTypeError(t *testing.T) { - reader := strings.NewReader(`{ - "Version": "0.1", - "Services": { - "web": { - "Image": "redis", - "Networks": "none" - } - } - }`) - - _, err := LoadFile(reader) - assert.Error(t, err, "Unexpected type at byte 94. Expected []string but received string.") -} - -func TestPrint(t *testing.T) { - var buffer bytes.Buffer - bundle := &Bundlefile{ - Version: "0.1", - Services: map[string]Service{ - "web": { - Image: "image", - Command: []string{"echo", "something"}, - }, - }, - } - assert.Check(t, Print(&buffer, bundle)) - output := buffer.String() - assert.Check(t, is.Contains(output, "\"Image\": \"image\"")) - assert.Check(t, is.Contains(output, - `"Command": [ - "echo", - "something" - ]`)) -}
  92. Download patch cli/AUTHORS
  93. Download patch cli/cli/command/container/commit.go

    --- 18.06.0+dfsg1-1/cli/cli/command/container/commit.go 2018-07-18 18:54:54.000000000 +0000 +++ 18.06.1-0ubuntu2/cli/cli/command/container/commit.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,75 +0,0 @@ -package container - -import ( - "context" - "fmt" - - "github.com/docker/cli/cli" - "github.com/docker/cli/cli/command" - "github.com/docker/cli/opts" - "github.com/docker/docker/api/types" - "github.com/spf13/cobra" -) - -type commitOptions struct { - container string - reference string - - pause bool - comment string - author string - changes opts.ListOpts -} - -// NewCommitCommand creates a new cobra.Command for `docker commit` -func NewCommitCommand(dockerCli command.Cli) *cobra.Command { - var options commitOptions - - cmd := &cobra.Command{ - Use: "commit [OPTIONS] CONTAINER [REPOSITORY[:TAG]]", - Short: "Create a new image from a container's changes", - Args: cli.RequiresRangeArgs(1, 2), - RunE: func(cmd *cobra.Command, args []string) error { - options.container = args[0] - if len(args) > 1 { - options.reference = args[1] - } - return runCommit(dockerCli, &options) - }, - } - - flags := cmd.Flags() - flags.SetInterspersed(false) - - flags.BoolVarP(&options.pause, "pause", "p", true, "Pause container during commit") - flags.StringVarP(&options.comment, "message", "m", "", "Commit message") - flags.StringVarP(&options.author, "author", "a", "", "Author (e.g., \"John Hannibal Smith <hannibal@a-team.com>\")") - - options.changes = opts.NewListOpts(nil) - flags.VarP(&options.changes, "change", "c", "Apply Dockerfile instruction to the created image") - - return cmd -} - -func runCommit(dockerCli command.Cli, options *commitOptions) error { - ctx := context.Background() - - name := options.container - reference := options.reference - - commitOptions := types.ContainerCommitOptions{ - Reference: reference, - Comment: options.comment, - Author: options.author, - Changes: options.changes.GetAll(), - Pause: options.pause, - } - - response, err := dockerCli.Client().ContainerCommit(ctx, name, commitOptions) - if err != nil { - return err - } - - fmt.Fprintln(dockerCli.Out(), response.ID) - return nil -}
  94. Download patch cli/cli/command/container/stats.go
  95. Download patch cli/cli/command/container/logs_test.go

    --- 18.06.0+dfsg1-1/cli/cli/command/container/logs_test.go 2018-07-18 18:54:54.000000000 +0000 +++ 18.06.1-0ubuntu2/cli/cli/command/container/logs_test.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,62 +0,0 @@ -package container - -import ( - "io" - "io/ioutil" - "strings" - "testing" - - "github.com/docker/cli/internal/test" - "github.com/docker/docker/api/types" - "github.com/docker/docker/api/types/container" - "gotest.tools/assert" - is "gotest.tools/assert/cmp" -) - -var logFn = func(expectedOut string) func(string, types.ContainerLogsOptions) (io.ReadCloser, error) { - return func(container string, opts types.ContainerLogsOptions) (io.ReadCloser, error) { - return ioutil.NopCloser(strings.NewReader(expectedOut)), nil - } -} - -func TestRunLogs(t *testing.T) { - inspectFn := func(containerID string) (types.ContainerJSON, error) { - return types.ContainerJSON{ - Config: &container.Config{Tty: true}, - ContainerJSONBase: &types.ContainerJSONBase{State: &types.ContainerState{Running: false}}, - }, nil - } - - var testcases = []struct { - doc string - options *logsOptions - client fakeClient - expectedError string - expectedOut string - expectedErr string - }{ - { - doc: "successful logs", - expectedOut: "foo", - options: &logsOptions{}, - client: fakeClient{logFunc: logFn("foo"), inspectFunc: inspectFn}, - }, - } - - for _, testcase := range testcases { - t.Run(testcase.doc, func(t *testing.T) { - cli := test.NewFakeCli(&testcase.client) - - err := runLogs(cli, testcase.options) - if testcase.expectedError != "" { - assert.ErrorContains(t, err, testcase.expectedError) - } else { - if !assert.Check(t, err) { - return - } - } - assert.Check(t, is.Equal(testcase.expectedOut, cli.OutBuffer().String())) - assert.Check(t, is.Equal(testcase.expectedErr, cli.ErrBuffer().String())) - }) - } -}
  96. Download patch cli/cli/command/config/remove_test.go

    --- 18.06.0+dfsg1-1/cli/cli/command/config/remove_test.go 2018-07-18 18:54:54.000000000 +0000 +++ 18.06.1-0ubuntu2/cli/cli/command/config/remove_test.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,79 +0,0 @@ -package config - -import ( - "io/ioutil" - "strings" - "testing" - - "github.com/docker/cli/internal/test" - "github.com/pkg/errors" - "gotest.tools/assert" - is "gotest.tools/assert/cmp" -) - -func TestConfigRemoveErrors(t *testing.T) { - testCases := []struct { - args []string - configRemoveFunc func(string) error - expectedError string - }{ - { - args: []string{}, - expectedError: "requires at least 1 argument.", - }, - { - args: []string{"foo"}, - configRemoveFunc: func(name string) error { - return errors.Errorf("error removing config") - }, - expectedError: "error removing config", - }, - } - for _, tc := range testCases { - cmd := newConfigRemoveCommand( - test.NewFakeCli(&fakeClient{ - configRemoveFunc: tc.configRemoveFunc, - }), - ) - cmd.SetArgs(tc.args) - cmd.SetOutput(ioutil.Discard) - assert.ErrorContains(t, cmd.Execute(), tc.expectedError) - } -} - -func TestConfigRemoveWithName(t *testing.T) { - names := []string{"foo", "bar"} - var removedConfigs []string - cli := test.NewFakeCli(&fakeClient{ - configRemoveFunc: func(name string) error { - removedConfigs = append(removedConfigs, name) - return nil - }, - }) - cmd := newConfigRemoveCommand(cli) - cmd.SetArgs(names) - assert.NilError(t, cmd.Execute()) - assert.Check(t, is.DeepEqual(names, strings.Split(strings.TrimSpace(cli.OutBuffer().String()), "\n"))) - assert.Check(t, is.DeepEqual(names, removedConfigs)) -} - -func TestConfigRemoveContinueAfterError(t *testing.T) { - names := []string{"foo", "bar"} - var removedConfigs []string - - cli := test.NewFakeCli(&fakeClient{ - configRemoveFunc: func(name string) error { - removedConfigs = append(removedConfigs, name) - if name == "foo" { - return errors.Errorf("error removing config: %s", name) - } - return nil - }, - }) - - cmd := newConfigRemoveCommand(cli) - cmd.SetArgs(names) - cmd.SetOutput(ioutil.Discard) - assert.Error(t, cmd.Execute(), "error removing config: foo") - assert.Check(t, is.DeepEqual(names, removedConfigs)) -}
  97. Download patch cli/cli/command/config/client_test.go

    --- 18.06.0+dfsg1-1/cli/cli/command/config/client_test.go 2018-07-18 18:54:54.000000000 +0000 +++ 18.06.1-0ubuntu2/cli/cli/command/config/client_test.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,45 +0,0 @@ -package config - -import ( - "context" - - "github.com/docker/docker/api/types" - "github.com/docker/docker/api/types/swarm" - "github.com/docker/docker/client" -) - -type fakeClient struct { - client.Client - configCreateFunc func(swarm.ConfigSpec) (types.ConfigCreateResponse, error) - configInspectFunc func(string) (swarm.Config, []byte, error) - configListFunc func(types.ConfigListOptions) ([]swarm.Config, error) - configRemoveFunc func(string) error -} - -func (c *fakeClient) ConfigCreate(ctx context.Context, spec swarm.ConfigSpec) (types.ConfigCreateResponse, error) { - if c.configCreateFunc != nil { - return c.configCreateFunc(spec) - } - return types.ConfigCreateResponse{}, nil -} - -func (c *fakeClient) ConfigInspectWithRaw(ctx context.Context, id string) (swarm.Config, []byte, error) { - if c.configInspectFunc != nil { - return c.configInspectFunc(id) - } - return swarm.Config{}, nil, nil -} - -func (c *fakeClient) ConfigList(ctx context.Context, options types.ConfigListOptions) ([]swarm.Config, error) { - if c.configListFunc != nil { - return c.configListFunc(options) - } - return []swarm.Config{}, nil -} - -func (c *fakeClient) ConfigRemove(ctx context.Context, name string) error { - if c.configRemoveFunc != nil { - return c.configRemoveFunc(name) - } - return nil -}
  98. Download patch cli/cli/command/container/tty.go

    --- 18.06.0+dfsg1-1/cli/cli/command/container/tty.go 2018-07-18 18:54:54.000000000 +0000 +++ 18.06.1-0ubuntu2/cli/cli/command/container/tty.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,103 +0,0 @@ -package container - -import ( - "context" - "fmt" - "os" - gosignal "os/signal" - "runtime" - "time" - - "github.com/docker/cli/cli/command" - "github.com/docker/docker/api/types" - "github.com/docker/docker/client" - "github.com/docker/docker/pkg/signal" - "github.com/sirupsen/logrus" -) - -// resizeTtyTo resizes tty to specific height and width -func resizeTtyTo(ctx context.Context, client client.ContainerAPIClient, id string, height, width uint, isExec bool) { - if height == 0 && width == 0 { - return - } - - options := types.ResizeOptions{ - Height: height, - Width: width, - } - - var err error - if isExec { - err = client.ContainerExecResize(ctx, id, options) - } else { - err = client.ContainerResize(ctx, id, options) - } - - if err != nil { - logrus.Debugf("Error resize: %s", err) - } -} - -// MonitorTtySize updates the container tty size when the terminal tty changes size -func MonitorTtySize(ctx context.Context, cli command.Cli, id string, isExec bool) error { - resizeTty := func() { - height, width := cli.Out().GetTtySize() - resizeTtyTo(ctx, cli.Client(), id, height, width, isExec) - } - - resizeTty() - - if runtime.GOOS == "windows" { - go func() { - prevH, prevW := cli.Out().GetTtySize() - for { - time.Sleep(time.Millisecond * 250) - h, w := cli.Out().GetTtySize() - - if prevW != w || prevH != h { - resizeTty() - } - prevH = h - prevW = w - } - }() - } else { - sigchan := make(chan os.Signal, 1) - gosignal.Notify(sigchan, signal.SIGWINCH) - go func() { - for range sigchan { - resizeTty() - } - }() - } - return nil -} - -// ForwardAllSignals forwards signals to the container -func ForwardAllSignals(ctx context.Context, cli command.Cli, cid string) chan os.Signal { - sigc := make(chan os.Signal, 128) - signal.CatchAll(sigc) - go func() { - for s := range sigc { - if s == signal.SIGCHLD || s == signal.SIGPIPE { - continue - } - var sig string - for sigStr, sigN := range signal.SignalMap { - if sigN == s { - sig = sigStr - break - } - } - if sig == "" { - fmt.Fprintf(cli.Err(), "Unsupported signal: %v. Discarding.\n", s) - continue - } - - if err := cli.Client().ContainerKill(ctx, cid, sig); err != nil { - logrus.Debugf("Error sending signal: %s", err) - } - } - }() - return sigc -}
  99. Download patch cli/cli/command/container/top.go

    --- 18.06.0+dfsg1-1/cli/cli/command/container/top.go 2018-07-18 18:54:54.000000000 +0000 +++ 18.06.1-0ubuntu2/cli/cli/command/container/top.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,57 +0,0 @@ -package container - -import ( - "context" - "fmt" - "strings" - "text/tabwriter" - - "github.com/docker/cli/cli" - "github.com/docker/cli/cli/command" - "github.com/spf13/cobra" -) - -type topOptions struct { - container string - - args []string -} - -// NewTopCommand creates a new cobra.Command for `docker top` -func NewTopCommand(dockerCli command.Cli) *cobra.Command { - var opts topOptions - - cmd := &cobra.Command{ - Use: "top CONTAINER [ps OPTIONS]", - Short: "Display the running processes of a container", - Args: cli.RequiresMinArgs(1), - RunE: func(cmd *cobra.Command, args []string) error { - opts.container = args[0] - opts.args = args[1:] - return runTop(dockerCli, &opts) - }, - } - - flags := cmd.Flags() - flags.SetInterspersed(false) - - return cmd -} - -func runTop(dockerCli command.Cli, opts *topOptions) error { - ctx := context.Background() - - procList, err := dockerCli.Client().ContainerTop(ctx, opts.container, opts.args) - if err != nil { - return err - } - - w := tabwriter.NewWriter(dockerCli.Out(), 20, 1, 3, ' ', 0) - fmt.Fprintln(w, strings.Join(procList.Titles, "\t")) - - for _, proc := range procList.Processes { - fmt.Fprintln(w, strings.Join(proc, "\t")) - } - w.Flush() - return nil -}
  100. Download patch cli/cli/command/container/utils.go

    --- 18.06.0+dfsg1-1/cli/cli/command/container/utils.go 2018-07-18 18:54:54.000000000 +0000 +++ 18.06.1-0ubuntu2/cli/cli/command/container/utils.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,162 +0,0 @@ -package container - -import ( - "context" - "strconv" - - "github.com/docker/cli/cli/command" - "github.com/docker/docker/api/types" - "github.com/docker/docker/api/types/container" - "github.com/docker/docker/api/types/events" - "github.com/docker/docker/api/types/filters" - "github.com/docker/docker/api/types/versions" - "github.com/sirupsen/logrus" -) - -func waitExitOrRemoved(ctx context.Context, dockerCli command.Cli, containerID string, waitRemove bool) <-chan int { - if len(containerID) == 0 { - // containerID can never be empty - panic("Internal Error: waitExitOrRemoved needs a containerID as parameter") - } - - // Older versions used the Events API, and even older versions did not - // support server-side removal. This legacyWaitExitOrRemoved method - // preserves that old behavior and any issues it may have. - if versions.LessThan(dockerCli.Client().ClientVersion(), "1.30") { - return legacyWaitExitOrRemoved(ctx, dockerCli, containerID, waitRemove) - } - - condition := container.WaitConditionNextExit - if waitRemove { - condition = container.WaitConditionRemoved - } - - resultC, errC := dockerCli.Client().ContainerWait(ctx, containerID, condition) - - statusC := make(chan int) - go func() { - select { - case result := <-resultC: - if result.Error != nil { - logrus.Errorf("Error waiting for container: %v", result.Error.Message) - statusC <- 125 - } else { - statusC <- int(result.StatusCode) - } - case err := <-errC: - logrus.Errorf("error waiting for container: %v", err) - statusC <- 125 - } - }() - - return statusC -} - -func legacyWaitExitOrRemoved(ctx context.Context, dockerCli command.Cli, containerID string, waitRemove bool) <-chan int { - var removeErr error - statusChan := make(chan int) - exitCode := 125 - - // Get events via Events API - f := filters.NewArgs() - f.Add("type", "container") - f.Add("container", containerID) - options := types.EventsOptions{ - Filters: f, - } - eventCtx, cancel := context.WithCancel(ctx) - eventq, errq := dockerCli.Client().Events(eventCtx, options) - - eventProcessor := func(e events.Message) bool { - stopProcessing := false - switch e.Status { - case "die": - if v, ok := e.Actor.Attributes["exitCode"]; ok { - code, cerr := strconv.Atoi(v) - if cerr != nil { - logrus.Errorf("failed to convert exitcode '%q' to int: %v", v, cerr) - } else { - exitCode = code - } - } - if !waitRemove { - stopProcessing = true - } else { - // If we are talking to an older daemon, `AutoRemove` is not supported. - // We need to fall back to the old behavior, which is client-side removal - if versions.LessThan(dockerCli.Client().ClientVersion(), "1.25") { - go func() { - removeErr = dockerCli.Client().ContainerRemove(ctx, containerID, types.ContainerRemoveOptions{RemoveVolumes: true}) - if removeErr != nil { - logrus.Errorf("error removing container: %v", removeErr) - cancel() // cancel the event Q - } - }() - } - } - case "detach": - exitCode = 0 - stopProcessing = true - case "destroy": - stopProcessing = true - } - return stopProcessing - } - - go func() { - defer func() { - statusChan <- exitCode // must always send an exit code or the caller will block - cancel() - }() - - for { - select { - case <-eventCtx.Done(): - if removeErr != nil { - return - } - case evt := <-eventq: - if eventProcessor(evt) { - return - } - case err := <-errq: - logrus.Errorf("error getting events from daemon: %v", err) - return - } - } - }() - - return statusChan -} - -func parallelOperation(ctx context.Context, containers []string, op func(ctx context.Context, container string) error) chan error { - if len(containers) == 0 { - return nil - } - const defaultParallel int = 50 - sem := make(chan struct{}, defaultParallel) - errChan := make(chan error) - - // make sure result is printed in correct order - output := map[string]chan error{} - for _, c := range containers { - output[c] = make(chan error, 1) - } - go func() { - for _, c := range containers { - err := <-output[c] - errChan <- err - } - }() - - go func() { - for _, c := range containers { - sem <- struct{}{} // Wait for active queue sem to drain. - go func(container string) { - output[container] <- op(ctx, container) - <-sem - }(c) - } - }() - return errChan -}
  101. ...

Debian ( Changelog | PTS | Bugs ) Ubuntu ( Changelog | txt | LP | Bugs ) | Diff from Ubuntu

Source: golang-1.10

golang-1.10 (1.10.4-2ubuntu1) cosmic; urgency=medium * Merge from Debian unstable. Remaining change: - Do not distribute un-built from source race detector runtime files and recommend golang-race-detector-runtime instead (see Debian bug #807455). * d/patches/disable-cmd-go-tests.patch: disable cmd/go tests which consistently time out on the amd64 Launchpad builders (but pass on my machine and other architectures) -- Michael Hudson-Doyle <michael.hudson@ubuntu.com> Wed, 19 Sep 2018 10:14:24 +0200

Modifications :
  1. Download patch debian/rules

    --- 1.10.4-2/debian/rules 2018-09-21 09:18:53.000000000 +0000 +++ 1.10.4-2ubuntu1/debian/rules 2018-09-19 08:14:24.000000000 +0000 @@ -82,6 +82,9 @@ override_dh_install-indep: override_dh_install-arch: dh_install --fail-missing + # Remove .syso files of the race detector; they are binary files that + # are not built from source in the go source distribution. + find $(CURDIR)/debian/golang-$(GOVER)-src/usr/share/go-$(GOVER)/src/runtime/race -type f -name '*.syso' -delete # Remove Plan9 rc(1) scripts find debian/golang-$(GOVER)-src/usr/share/go-$(GOVER)/src -type f -name '*.rc' -delete # Remove empty /usr/share/go-$(GOVER)/src from golang-$(GOVER)-go, it is provided by golang-$(GOVER)-src
  2. Download patch debian/control

    --- 1.10.4-2/debian/control 2018-09-21 09:18:53.000000000 +0000 +++ 1.10.4-2ubuntu1/debian/control 2018-09-19 08:14:24.000000000 +0000 @@ -5,7 +5,8 @@ Source: golang-1.10 Section: devel Priority: optional -Maintainer: Go Compiler Team <pkg-golang-devel@lists.alioth.debian.org> +Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com> +XSBC-Original-Maintainer: Go Compiler Team <pkg-golang-devel@lists.alioth.debian.org> Uploaders: Michael Stapelberg <stapelberg@debian.org>, Paul Tagliamonte <paultag@debian.org>, Tianon Gravi <tianon@debian.org>, @@ -24,7 +25,11 @@ Depends: golang-1.10-src (>= ${source:Ve ${misc:Depends}, ${perl:Depends}, ${shlibs:Depends} -Recommends: g++, gcc, libc6-dev, pkg-config +Recommends: g++, + gcc, + golang-1.10-race-detector-runtime [amd64], + libc6-dev, + pkg-config Suggests: bzr, ca-certificates, git, mercurial, subversion Description: Go programming language compiler, linker, compiled stdlib The Go programming language is an open source project to make programmers more
  3. Download patch debian/control.in

    --- 1.10.4-2/debian/control.in 2018-09-21 09:18:53.000000000 +0000 +++ 1.10.4-2ubuntu1/debian/control.in 2018-09-19 08:14:24.000000000 +0000 @@ -1,7 +1,8 @@ Source: golang-X.Y Section: devel Priority: optional -Maintainer: Go Compiler Team <pkg-golang-devel@lists.alioth.debian.org> +Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com> +XSBC-Original-Maintainer: Go Compiler Team <pkg-golang-devel@lists.alioth.debian.org> Uploaders: Michael Stapelberg <stapelberg@debian.org>, Paul Tagliamonte <paultag@debian.org>, Tianon Gravi <tianon@debian.org>, @@ -20,7 +21,11 @@ Depends: golang-X.Y-src (>= ${source:Ver ${misc:Depends}, ${perl:Depends}, ${shlibs:Depends} -Recommends: g++, gcc, libc6-dev, pkg-config +Recommends: g++, + gcc, + golang-X.Y-race-detector-runtime [amd64], + libc6-dev, + pkg-config Suggests: bzr, ca-certificates, git, mercurial, subversion Description: Go programming language compiler, linker, compiled stdlib The Go programming language is an open source project to make programmers more
  4. Download patch debian/patches/disable-cmd-go-tests.patch

    --- 1.10.4-2/debian/patches/disable-cmd-go-tests.patch 1970-01-01 00:00:00.000000000 +0000 +++ 1.10.4-2ubuntu1/debian/patches/disable-cmd-go-tests.patch 2018-09-19 08:14:24.000000000 +0000 @@ -0,0 +1,10 @@ +--- a/src/cmd/go/go_test.go ++++ b/src/cmd/go/go_test.go +@@ -103,6 +103,7 @@ + // The TestMain function creates a go command for testing purposes and + // deletes it after the tests have been run. + func TestMain(m *testing.M) { ++ os.Exit(0) + if os.Getenv("GO_GCFLAGS") != "" { + fmt.Fprintf(os.Stderr, "testing: warning: no tests to run\n") // magic string for cmd/go + fmt.Printf("cmd/go test is not compatible with $GO_GCFLAGS being set\n")
  5. Download patch debian/patches/series

    --- 1.10.4-2/debian/patches/series 2018-09-21 09:24:20.000000000 +0000 +++ 1.10.4-2ubuntu1/debian/patches/series 2018-09-19 08:14:24.000000000 +0000 @@ -1,3 +1,4 @@ 0002-reproducible-BUILD_PATH_PREFIX_MAP.patch only-consider-executable-segments.patch arm64-arm64asm-recognise-new-ssbb-pssbb-mnemonics-fr.patch +disable-cmd-go-tests.patch
  6. Download patch debian/gbp.conf.in

    --- 1.10.4-2/debian/gbp.conf.in 2018-09-21 09:18:53.000000000 +0000 +++ 1.10.4-2ubuntu1/debian/gbp.conf.in 2018-09-19 08:14:24.000000000 +0000 @@ -1,5 +1,5 @@ [DEFAULT] -debian-branch = golang-X.Y +debian-branch = ubuntu-X.Y debian-tag = debian/%(version)s upstream-branch = upstream-X.Y upstream-tag = upstream/%(version)s
  7. Download patch debian/gbp.conf

    --- 1.10.4-2/debian/gbp.conf 2018-09-21 09:18:53.000000000 +0000 +++ 1.10.4-2ubuntu1/debian/gbp.conf 2018-09-19 08:14:24.000000000 +0000 @@ -3,7 +3,7 @@ # [DEFAULT] -debian-branch = golang-1.10 +debian-branch = ubuntu-1.10 debian-tag = debian/%(version)s upstream-branch = upstream-1.10 upstream-tag = upstream/%(version)s

Debian ( Changelog | PTS | Bugs ) Ubuntu ( Changelog | txt | LP | Bugs ) | Diff from Ubuntu

Source: golang-1.8

golang-1.8 (1.8.3-2ubuntu1) artful; urgency=medium * Merge from Debian unstable. Remaining changes: - Do not distribute un-built from source race detector runtime files and recommend golang-race-detector-runtime instead (see Debian bug #807455). - Build Go standard library into a shared library. - Backport d/patches/cl-40401--more-robust-ABI-hash.patch from upstream to make the ABIs of shared libraries slightly more robust. - Backport d/patches/i386-shlib-fix.patch from upstream to fix a problem with shared libraries on i386. -- Michael Hudson-Doyle <michael.hudson@ubuntu.com> Tue, 15 Aug 2017 13:03:20 +1200

Modifications :
  1. Download patch .pc/cl-40401--more-robust-ABI-hash.patch/misc/cgo/testshared/shared_test.go
  2. Download patch src/cmd/internal/obj/x86/obj6.go

    --- 1.8.3-2/src/cmd/internal/obj/x86/obj6.go 2017-05-24 18:15:12.000000000 +0000 +++ 1.8.3-2ubuntu1/src/cmd/internal/obj/x86/obj6.go 2017-08-24 00:11:44.000000000 +0000 @@ -322,15 +322,13 @@ func progedit(ctxt *obj.Link, p *obj.Pro // Rewrite p, if necessary, to access global data via the global offset table. func rewriteToUseGot(ctxt *obj.Link, p *obj.Prog) { - var add, lea, mov obj.As + var lea, mov obj.As var reg int16 if p.Mode == 64 { - add = AADDQ lea = ALEAQ mov = AMOVQ reg = REG_R15 } else { - add = AADDL lea = ALEAL mov = AMOVL reg = REG_CX @@ -347,8 +345,10 @@ func rewriteToUseGot(ctxt *obj.Link, p * // ADUFFxxx $offset // becomes // $MOV runtime.duffxxx@GOT, $reg - // $ADD $offset, $reg + // $LEA $offset($reg), $reg // CALL $reg + // (we use LEAx rather than ADDx because ADDx clobbers + // flags and duffzero on 386 does not otherwise do so) var sym *obj.LSym if p.As == obj.ADUFFZERO { sym = obj.Linklookup(ctxt, "runtime.duffzero", 0) @@ -365,9 +365,10 @@ func rewriteToUseGot(ctxt *obj.Link, p * p.To.Offset = 0 p.To.Sym = nil p1 := obj.Appendp(ctxt, p) - p1.As = add - p1.From.Type = obj.TYPE_CONST + p1.As = lea + p1.From.Type = obj.TYPE_MEM p1.From.Offset = offset + p1.From.Reg = reg p1.To.Type = obj.TYPE_REG p1.To.Reg = reg p2 := obj.Appendp(ctxt, p1)
  3. Download patch debian/rules

    --- 1.8.3-2/debian/rules 2017-07-24 20:51:01.000000000 +0000 +++ 1.8.3-2ubuntu1/debian/rules 2017-08-15 01:01:11.000000000 +0000 @@ -18,6 +18,10 @@ ifneq (,$(findstring nocheck,$(DEB_BUILD RUN_TESTS := false endif +shlib_archs = $(shell GOVER=$(GOVER) perl debian/helpers/getshlibarches.pl) + +multiarch := $(shell dpkg-architecture -qDEB_HOST_MULTIARCH) + %: +dh --parallel $(opt_no_act) $@ @@ -47,7 +51,7 @@ override_dh_auto_clean: gencontrol override_dh_prep: dh_prep - @set -e; cd debian; for x in golang-X.Y-*; do \ + @set -e; cd debian; for x in *golang-X.Y-*; do \ sed -e 's/X.Y/$(GOVER)/g' $$x > golang-$(GOVER)-$${x##golang-X.Y-}; \ done @@ -80,7 +84,13 @@ override_dh_install-indep: dh_install --fail-missing override_dh_install-arch: + set -ex; \ + export PATH="$(GOROOT)/bin:$$PATH"; \ + $(CURDIR)/debian/helpers/installshlib.sh dh_install --fail-missing + # Remove .syso files of the race detector; they are binary files that + # are not built from source in the go source distribution. + find $(CURDIR)/debian/golang-$(GOVER)-src/usr/share/go-$(GOVER)/src/runtime/race -type f -name '*.syso' -delete # Remove Plan9 rc(1) scripts find debian/golang-$(GOVER)-src/usr/share/go-$(GOVER)/src -type f -name '*.rc' -delete # Remove empty /usr/share/go-$(GOVER)/src from golang-$(GOVER)-go, it is provided by golang-$(GOVER)-src @@ -95,12 +105,21 @@ override_dh_strip: override_dh_shlibdeps: dh_shlibdeps -Xtestdata -Xtest +override_dh_makeshlibs: + LDIR=$(CURDIR)/debian/libgolang-$(GOVER)-std1/usr/lib/$(multiarch); \ + HASH=$$(LD_LIBRARY_PATH=$$LDIR:$$LD_LIBRARY_PATH $(CURDIR)/bin/readabihash $$LDIR/libgolang-$(GOVER)-std.so.1); \ + dh_makeshlibs -Vlibgolang-$(GOVER)-std1-$$HASH; \ + echo "golang:Provides=libgolang-$(GOVER)-std1-$$HASH" >> $(CURDIR)/debian/libgolang-$(GOVER)-std1.substvars + override_dh_auto_build-arch: [ -f VERSION ] || echo "debian snapshot +$$(dpkg-parsechangelog -SVersion)" > VERSION export GOROOT_BOOTSTRAP=$$(env -i go env GOROOT) \ && cd src \ && $(CURDIR)/debian/helpers/goenv.sh \ bash ./make.bash --no-banner + $(CURDIR)/bin/go install -v -buildmode=shared \ + -ldflags '-extldflags "-Wl,-soname=libgolang-$(GOVER)-std.so.1"' \ + std opt_no_act := ifneq (,$(findstring n,$(MAKEFLAGS)))
  4. Download patch debian/control

    --- 1.8.3-2/debian/control 2017-07-24 20:51:01.000000000 +0000 +++ 1.8.3-2ubuntu1/debian/control 2017-08-15 01:01:11.000000000 +0000 @@ -5,7 +5,8 @@ Source: golang-1.8 Section: devel Priority: optional -Maintainer: Go Compiler Team <pkg-golang-devel@lists.alioth.debian.org> +Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com> +XSBC-Original-Maintainer: Go Compiler Team <pkg-golang-devel@lists.alioth.debian.org> Uploaders: Michael Stapelberg <stapelberg@debian.org>, Paul Tagliamonte <paultag@debian.org>, Tianon Gravi <tianon@debian.org>, @@ -24,7 +25,11 @@ Depends: golang-1.8-src (>= ${source:Ver ${misc:Depends}, ${perl:Depends}, ${shlibs:Depends} -Recommends: g++, gcc, libc6-dev, pkg-config +Recommends: g++, + gcc, + golang-1.8-race-detector-runtime [amd64], + libc6-dev, + pkg-config Suggests: bzr, ca-certificates, git, mercurial, subversion Description: Go programming language compiler, linker, compiled stdlib The Go programming language is an open source project to make programmers more @@ -96,3 +101,25 @@ Description: Go programming language com . This package is a metapackage that, when installed, guarantees that (most of) a full Go development environment is installed. + +Package: libgolang-1.8-std1 +Architecture: amd64 arm64 armhf i386 ppc64el s390x +Pre-Depends: ${misc:Pre-Depends} +Provides: ${golang:Provides} +Depends: ${misc:Depends}, ${perl:Depends}, ${shlibs:Depends} +Description: Go standard shared library + This package contains the Go standard library built as a shared library. + Packages should not depend on this package directly but rather the ABI-stamped + value in Provides:. dpkg-shlibdeps will do this automatically. + +Package: golang-1.8-go-shared-dev +Architecture: amd64 arm64 armhf i386 ppc64el s390x +Pre-Depends: ${misc:Pre-Depends} +Depends: golang-1.8-go (= ${binary:Version}), + libgolang-1.8-std1 (= ${binary:Version}), + ${misc:Depends}, + ${perl:Depends}, + ${shlibs:Depends} +Description: Go standard shared library support files + This package contains the files necessary to link against the shared + library packaged in libgolang-1.8-std1.
  5. Download patch src/cmd/link/internal/ld/lib.go
  6. Download patch debian/libgolang-X.Y-std1.lintian-overrides

    --- 1.8.3-2/debian/libgolang-X.Y-std1.lintian-overrides 1970-01-01 00:00:00.000000000 +0000 +++ 1.8.3-2ubuntu1/debian/libgolang-X.Y-std1.lintian-overrides 2017-08-15 01:01:11.000000000 +0000 @@ -0,0 +1,3 @@ +# Go shared libraries are not linked by the system linker so +# the .so symlinks are not where lintian expects. +libgolang-std1: dev-pkg-without-shlib-symlink
  7. Download patch debian/control.in

    --- 1.8.3-2/debian/control.in 2017-07-24 20:51:01.000000000 +0000 +++ 1.8.3-2ubuntu1/debian/control.in 2017-08-15 01:01:11.000000000 +0000 @@ -1,7 +1,8 @@ Source: golang-X.Y Section: devel Priority: optional -Maintainer: Go Compiler Team <pkg-golang-devel@lists.alioth.debian.org> +Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com> +XSBC-Original-Maintainer: Go Compiler Team <pkg-golang-devel@lists.alioth.debian.org> Uploaders: Michael Stapelberg <stapelberg@debian.org>, Paul Tagliamonte <paultag@debian.org>, Tianon Gravi <tianon@debian.org>, @@ -20,7 +21,11 @@ Depends: golang-X.Y-src (>= ${source:Ver ${misc:Depends}, ${perl:Depends}, ${shlibs:Depends} -Recommends: g++, gcc, libc6-dev, pkg-config +Recommends: g++, + gcc, + golang-X.Y-race-detector-runtime [amd64], + libc6-dev, + pkg-config Suggests: bzr, ca-certificates, git, mercurial, subversion Description: Go programming language compiler, linker, compiled stdlib The Go programming language is an open source project to make programmers more @@ -92,3 +97,25 @@ Description: Go programming language com . This package is a metapackage that, when installed, guarantees that (most of) a full Go development environment is installed. + +Package: libgolang-X.Y-std1 +Architecture: amd64 arm64 armhf i386 ppc64el s390x +Pre-Depends: ${misc:Pre-Depends} +Provides: ${golang:Provides} +Depends: ${misc:Depends}, ${perl:Depends}, ${shlibs:Depends} +Description: Go standard shared library + This package contains the Go standard library built as a shared library. + Packages should not depend on this package directly but rather the ABI-stamped + value in Provides:. dpkg-shlibdeps will do this automatically. + +Package: golang-X.Y-go-shared-dev +Architecture: amd64 arm64 armhf i386 ppc64el s390x +Pre-Depends: ${misc:Pre-Depends} +Depends: golang-X.Y-go (= ${binary:Version}), + libgolang-X.Y-std1 (= ${binary:Version}), + ${misc:Depends}, + ${perl:Depends}, + ${shlibs:Depends} +Description: Go standard shared library support files + This package contains the files necessary to link against the shared + library packaged in libgolang-X.Y-std1.
  8. Download patch .pc/applied-patches

    --- 1.8.3-2/.pc/applied-patches 2017-08-24 00:11:43.386431442 +0000 +++ 1.8.3-2ubuntu1/.pc/applied-patches 2017-08-24 00:11:44.458461131 +0000 @@ -1 +1,3 @@ +i386-shlib-fix.patch +cl-40401--more-robust-ABI-hash.patch 0001-Fix-FTBFS-with-Perl-526.patch
  9. Download patch .pc/cl-40401--more-robust-ABI-hash.patch/src/cmd/link/internal/ld/lib.go
  10. Download patch misc/cgo/testshared/shared_test.go

    --- 1.8.3-2/misc/cgo/testshared/shared_test.go 2017-05-24 18:15:12.000000000 +0000 +++ 1.8.3-2ubuntu1/misc/cgo/testshared/shared_test.go 2017-08-24 00:11:44.000000000 +0000 @@ -759,6 +759,13 @@ func appendFile(path, content string) { } } +func writeFile(path, content string) { + err := ioutil.WriteFile(path, []byte(content), 0644) + if err != nil { + log.Fatalf("ioutil.WriteFile failed: %v", err) + } +} + func TestABIChecking(t *testing.T) { goCmd(t, "install", "-buildmode=shared", "-linkshared", "depBase") goCmd(t, "install", "-linkshared", "exe") @@ -797,9 +804,10 @@ func TestABIChecking(t *testing.T) { run(t, "rebuilt exe", "./bin/exe") // If we make a change which does not break ABI (such as adding an unexported - // function) and rebuild libdepBase.so, exe still works. + // function) and rebuild libdepBase.so, exe still works, even if new function + // is in a file by itself. resetFileStamps() - appendFile("src/depBase/dep.go", "func noABIBreak() {}\n") + writeFile("src/depBase/dep2.go", "package depBase\nfunc noABIBreak() {}\n") goCmd(t, "install", "-buildmode=shared", "-linkshared", "depBase") run(t, "after non-ABI breaking change", "./bin/exe") }
  11. Download patch .pc/i386-shlib-fix.patch/src/cmd/internal/obj/x86/obj6.go
  12. Download patch debian/patches/series

    --- 1.8.3-2/debian/patches/series 2017-07-24 20:51:01.000000000 +0000 +++ 1.8.3-2ubuntu1/debian/patches/series 2017-08-15 01:01:50.000000000 +0000 @@ -1 +1,3 @@ +i386-shlib-fix.patch +cl-40401--more-robust-ABI-hash.patch 0001-Fix-FTBFS-with-Perl-526.patch
  13. Download patch debian/gbp.conf.in

    --- 1.8.3-2/debian/gbp.conf.in 2017-07-24 20:51:01.000000000 +0000 +++ 1.8.3-2ubuntu1/debian/gbp.conf.in 2017-08-15 01:01:11.000000000 +0000 @@ -1,9 +1,9 @@ [DEFAULT] -debian-branch = golang-X.Y +debian-branch = ubuntu-X.Y debian-tag = debian/%(version)s upstream-branch = upstream-X.Y upstream-tag = upstream/%(version)s pristine-tar = True -[dch] +[git-dch] meta = 1
  14. Download patch debian/patches/i386-shlib-fix.patch

    --- 1.8.3-2/debian/patches/i386-shlib-fix.patch 1970-01-01 00:00:00.000000000 +0000 +++ 1.8.3-2ubuntu1/debian/patches/i386-shlib-fix.patch 2017-08-15 01:01:11.000000000 +0000 @@ -0,0 +1,63 @@ +commit a735b8bec8fd3782748777ad9bb2e49bcaf10e4f +Author: Michael Hudson-Doyle <michael.hudson@canonical.com> +Date: Thu Apr 27 11:56:42 2017 +1200 + + cmd/internal/obj/x86: use LEAx rather than ADDx when calling DUFFxxxx via GOT + + DUFFZERO on 386 is not marked as clobbering flags, but rewriteToUseGot rewrote + "ADUFFZERO $offset" to "MOVL runtime.duffxxx@GOT, CX; ADDL $offset, CX; CALL CX" + which does. Luckily the fix is easier than figuring out what the problem was: + replace the ADDL $offset, CX with LEAL $offset(CX), CX. + + On amd64 DUFFZERO clobbers flags, on arm, arm64 and ppc64 ADD does not clobber + flags and s390x does not use the duff functions, so I'm fairly confident this + is the only fix required. + + I don't know how to write a test though. + + Change-Id: I69b0958f5f45771d61db5f5ecb4ded94e8960d4d + +--- a/src/cmd/internal/obj/x86/obj6.go ++++ b/src/cmd/internal/obj/x86/obj6.go +@@ -322,15 +322,13 @@ + + // Rewrite p, if necessary, to access global data via the global offset table. + func rewriteToUseGot(ctxt *obj.Link, p *obj.Prog) { +- var add, lea, mov obj.As ++ var lea, mov obj.As + var reg int16 + if p.Mode == 64 { +- add = AADDQ + lea = ALEAQ + mov = AMOVQ + reg = REG_R15 + } else { +- add = AADDL + lea = ALEAL + mov = AMOVL + reg = REG_CX +@@ -347,8 +345,10 @@ + // ADUFFxxx $offset + // becomes + // $MOV runtime.duffxxx@GOT, $reg +- // $ADD $offset, $reg ++ // $LEA $offset($reg), $reg + // CALL $reg ++ // (we use LEAx rather than ADDx because ADDx clobbers ++ // flags and duffzero on 386 does not otherwise do so) + var sym *obj.LSym + if p.As == obj.ADUFFZERO { + sym = obj.Linklookup(ctxt, "runtime.duffzero", 0) +@@ -365,9 +365,10 @@ + p.To.Offset = 0 + p.To.Sym = nil + p1 := obj.Appendp(ctxt, p) +- p1.As = add +- p1.From.Type = obj.TYPE_CONST ++ p1.As = lea ++ p1.From.Type = obj.TYPE_MEM + p1.From.Offset = offset ++ p1.From.Reg = reg + p1.To.Type = obj.TYPE_REG + p1.To.Reg = reg + p2 := obj.Appendp(ctxt, p1)
  15. Download patch debian/patches/cl-40401--more-robust-ABI-hash.patch

    --- 1.8.3-2/debian/patches/cl-40401--more-robust-ABI-hash.patch 1970-01-01 00:00:00.000000000 +0000 +++ 1.8.3-2ubuntu1/debian/patches/cl-40401--more-robust-ABI-hash.patch 2017-08-15 01:01:11.000000000 +0000 @@ -0,0 +1,89 @@ +From 533ed967c6e842b4f9b9b503d20b3af698a4e022 Mon Sep 17 00:00:00 2001 +From: Michael Hudson-Doyle <michael.hudson@canonical.com> +Date: Wed, 12 Apr 2017 16:08:46 +1200 +Subject: [PATCH] cmd/link: only include the version info and export data in ABI hash + +Previously the "ABI hash" for a package (used to determine if a loaded shared +library has the ABI expected by its loader) was the hash of the entire +__.PKGDEF file. But that means it depends on the build ID generated by the go +tool for the package, which means that if a file is added (even a .c or .h +file!) to the package, the ABI changes, perhaps uncessarily. + +Fixes #19920 + +Change-Id: If919481e1a03afb350c8a9c7a0666bb90ee90270 +Reviewed-on: https://go-review.googlesource.com/40401 +Run-TryBot: Michael Hudson-Doyle <michael.hudson@canonical.com> +TryBot-Result: Gobot Gobot <gobot@golang.org> +Reviewed-by: Ian Lance Taylor <iant@golang.org> +--- + +--- a/misc/cgo/testshared/shared_test.go ++++ b/misc/cgo/testshared/shared_test.go +@@ -759,6 +759,13 @@ + } + } + ++func writeFile(path, content string) { ++ err := ioutil.WriteFile(path, []byte(content), 0644) ++ if err != nil { ++ log.Fatalf("ioutil.WriteFile failed: %v", err) ++ } ++} ++ + func TestABIChecking(t *testing.T) { + goCmd(t, "install", "-buildmode=shared", "-linkshared", "depBase") + goCmd(t, "install", "-linkshared", "exe") +@@ -797,9 +804,10 @@ + run(t, "rebuilt exe", "./bin/exe") + + // If we make a change which does not break ABI (such as adding an unexported +- // function) and rebuild libdepBase.so, exe still works. ++ // function) and rebuild libdepBase.so, exe still works, even if new function ++ // is in a file by itself. + resetFileStamps() +- appendFile("src/depBase/dep.go", "func noABIBreak() {}\n") ++ writeFile("src/depBase/dep2.go", "package depBase\nfunc noABIBreak() {}\n") + goCmd(t, "install", "-buildmode=shared", "-linkshared", "depBase") + run(t, "after non-ABI breaking change", "./bin/exe") + } +--- a/src/cmd/link/internal/ld/lib.go ++++ b/src/cmd/link/internal/ld/lib.go +@@ -709,10 +709,35 @@ + } + + h := sha1.New() +- if _, err := io.CopyN(h, f, atolwhex(arhdr.size)); err != nil { +- Errorf(nil, "bad read of %s for hash generation: %v", lib.File, err) ++ ++ // To compute the hash of a package, we hash the first line of ++ // __.PKGDEF (which contains the toolchain version and any ++ // GOEXPERIMENT flags) and the export data (which is between ++ // the first two occurences of "\n$$"). ++ ++ pkgDefBytes := make([]byte, atolwhex(arhdr.size)) ++ _, err = io.ReadFull(f, pkgDefBytes) ++ if err != nil { ++ Errorf(nil, "%s: error reading package data: %v", lib.File, err) ++ return ++ } ++ firstEOL := bytes.Index(pkgDefBytes, []byte("\n")) ++ if firstEOL < 0 { ++ Errorf(nil, "cannot parse package data of %s for hash generation, no newline found", lib.File) ++ return ++ } ++ firstDoubleDollar := bytes.Index(pkgDefBytes, []byte("\n$$")) ++ if firstDoubleDollar < 0 { ++ Errorf(nil, "cannot parse package data of %s for hash generation, no \\n$$ found", lib.File) ++ return ++ } ++ secondDoubleDollar := bytes.Index(pkgDefBytes[firstDoubleDollar+1:], []byte("\n$$")) ++ if secondDoubleDollar < 0 { ++ Errorf(nil, "cannot parse package data of %s for hash generation, only one \\n$$ found", lib.File) + return + } ++ h.Write(pkgDefBytes[0:firstEOL]) ++ h.Write(pkgDefBytes[firstDoubleDollar : firstDoubleDollar+secondDoubleDollar]) + lib.hash = hex.EncodeToString(h.Sum(nil)) + } +
  16. Download patch debian/helpers/readabihash.go

    --- 1.8.3-2/debian/helpers/readabihash.go 1970-01-01 00:00:00.000000000 +0000 +++ 1.8.3-2ubuntu1/debian/helpers/readabihash.go 2017-08-15 01:01:11.000000000 +0000 @@ -0,0 +1,85 @@ +package main + +import ( + "debug/elf" + "encoding/binary" + "fmt" + "io" + "log" + "os" +) + +func rnd(v int32, r int32) int32 { + if r <= 0 { + return v + } + v += r - 1 + c := v % r + if c < 0 { + c += r + } + v -= c + return v +} + +func readwithpad(r io.Reader, sz int32) ([]byte, error) { + full := rnd(sz, 4) + data := make([]byte, full) + _, err := r.Read(data) + if err != nil { + return nil, err + } + data = data[:sz] + return data, nil +} + +func readnote(filename, name string, type_ int32) ([]byte, error) { + f, err := elf.Open(filename) + if err != nil { + return nil, err + } + for _, sect := range f.Sections { + if sect.Type != elf.SHT_NOTE { + continue + } + r := sect.Open() + for { + var namesize, descsize, nt_type int32 + err = binary.Read(r, f.ByteOrder, &namesize) + if err != nil { + if err == io.EOF { + break + } + return nil, fmt.Errorf("read namesize failed", err) + } + err = binary.Read(r, f.ByteOrder, &descsize) + if err != nil { + return nil, fmt.Errorf("read descsize failed", err) + } + err = binary.Read(r, f.ByteOrder, &nt_type) + if err != nil { + return nil, fmt.Errorf("read type failed", err) + } + nt_name, err := readwithpad(r, namesize) + if err != nil { + return nil, fmt.Errorf("read name failed", err) + } + desc, err := readwithpad(r, descsize) + if err != nil { + return nil, fmt.Errorf("read desc failed", err) + } + if name == string(nt_name) && type_ == nt_type { + return desc, nil + } + } + } + return nil, nil +} + +func main() { + desc, err := readnote(os.Args[1], "Go\x00\x00", 2) + if err != nil { + log.Fatalf("readnote failed: %v", err) + } + fmt.Printf("%x\n", desc) +}
  17. Download patch debian/helpers/installshlib.sh

    --- 1.8.3-2/debian/helpers/installshlib.sh 1970-01-01 00:00:00.000000000 +0000 +++ 1.8.3-2ubuntu1/debian/helpers/installshlib.sh 2017-08-15 01:01:11.000000000 +0000 @@ -0,0 +1,17 @@ +#!/bin/bash +set -eux +GOARCH=$(./bin/go env GOARCH) + +./bin/go build -o ./bin/readabihash -linkshared -ldflags="-r ''" debian/helpers/readabihash.go + +TRIPLET=$(dpkg-architecture -qDEB_HOST_MULTIARCH) + +mkdir -p debian/libgolang-${GOVER}-std1/usr/lib/${TRIPLET} +mv pkg/linux_${GOARCH}_dynlink/libstd.so debian/libgolang-${GOVER}-std1/usr/lib/${TRIPLET}/libgolang-${GOVER}-std.so.1 + +ln -s ../../../${TRIPLET}/libgolang-${GOVER}-std.so.1 pkg/linux_${GOARCH}_dynlink/libstd.so + +mkdir -p debian/golang-${GOVER}-go-shared-dev/usr/lib/go-${GOVER}/pkg/ +mv pkg/linux_${GOARCH}_dynlink/ debian/golang-${GOVER}-go-shared-dev/usr/lib/go-${GOVER}/pkg/ + +cp bin/readabihash debian/golang-${GOVER}-go-shared-dev/usr/lib/go-${GOVER}/pkg/
  18. Download patch debian/gbp.conf

    --- 1.8.3-2/debian/gbp.conf 2017-07-24 20:51:01.000000000 +0000 +++ 1.8.3-2ubuntu1/debian/gbp.conf 2017-08-15 01:01:11.000000000 +0000 @@ -3,11 +3,11 @@ # [DEFAULT] -debian-branch = golang-1.8 +debian-branch = ubuntu-1.8 debian-tag = debian/%(version)s upstream-branch = upstream-1.8 upstream-tag = upstream/%(version)s pristine-tar = True -[dch] +[git-dch] meta = 1

Debian ( Changelog | PTS | Bugs ) Ubuntu ( Changelog | txt | LP | Bugs ) | Diff from Ubuntu

Source: golang-1.9

golang-1.9 (1.9.4-1ubuntu1) bionic; urgency=medium * Merge from Debian unstable. Remaining change: - Do not distribute un-built from source race detector runtime files and recommend golang-race-detector-runtime instead (see Debian bug #807455). -- Michael Hudson-Doyle <michael.hudson@ubuntu.com> Thu, 08 Feb 2018 10:52:06 +1300

Modifications :
  1. Download patch debian/rules

    --- 1.9.4-1/debian/rules 2018-02-07 21:33:29.000000000 +0000 +++ 1.9.4-1ubuntu1/debian/rules 2018-02-07 22:28:50.000000000 +0000 @@ -81,6 +81,9 @@ override_dh_install-indep: override_dh_install-arch: dh_install --fail-missing + # Remove .syso files of the race detector; they are binary files that + # are not built from source in the go source distribution. + find $(CURDIR)/debian/golang-$(GOVER)-src/usr/share/go-$(GOVER)/src/runtime/race -type f -name '*.syso' -delete # Remove Plan9 rc(1) scripts find debian/golang-$(GOVER)-src/usr/share/go-$(GOVER)/src -type f -name '*.rc' -delete # Remove empty /usr/share/go-$(GOVER)/src from golang-$(GOVER)-go, it is provided by golang-$(GOVER)-src
  2. Download patch debian/control

    --- 1.9.4-1/debian/control 2018-02-07 21:33:29.000000000 +0000 +++ 1.9.4-1ubuntu1/debian/control 2018-02-07 22:28:50.000000000 +0000 @@ -5,7 +5,8 @@ Source: golang-1.9 Section: devel Priority: optional -Maintainer: Go Compiler Team <pkg-golang-devel@lists.alioth.debian.org> +Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com> +XSBC-Original-Maintainer: Go Compiler Team <pkg-golang-devel@lists.alioth.debian.org> Uploaders: Michael Stapelberg <stapelberg@debian.org>, Paul Tagliamonte <paultag@debian.org>, Tianon Gravi <tianon@debian.org>, @@ -24,7 +25,11 @@ Depends: golang-1.9-src (>= ${source:Ver ${misc:Depends}, ${perl:Depends}, ${shlibs:Depends} -Recommends: g++, gcc, libc6-dev, pkg-config +Recommends: g++, + gcc, + golang-1.9-race-detector-runtime [amd64], + libc6-dev, + pkg-config Suggests: bzr, ca-certificates, git, mercurial, subversion Description: Go programming language compiler, linker, compiled stdlib The Go programming language is an open source project to make programmers more
  3. Download patch debian/control.in

    --- 1.9.4-1/debian/control.in 2018-02-07 21:33:29.000000000 +0000 +++ 1.9.4-1ubuntu1/debian/control.in 2018-02-07 22:28:50.000000000 +0000 @@ -1,7 +1,8 @@ Source: golang-X.Y Section: devel Priority: optional -Maintainer: Go Compiler Team <pkg-golang-devel@lists.alioth.debian.org> +Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com> +XSBC-Original-Maintainer: Go Compiler Team <pkg-golang-devel@lists.alioth.debian.org> Uploaders: Michael Stapelberg <stapelberg@debian.org>, Paul Tagliamonte <paultag@debian.org>, Tianon Gravi <tianon@debian.org>, @@ -20,7 +21,11 @@ Depends: golang-X.Y-src (>= ${source:Ver ${misc:Depends}, ${perl:Depends}, ${shlibs:Depends} -Recommends: g++, gcc, libc6-dev, pkg-config +Recommends: g++, + gcc, + golang-X.Y-race-detector-runtime [amd64], + libc6-dev, + pkg-config Suggests: bzr, ca-certificates, git, mercurial, subversion Description: Go programming language compiler, linker, compiled stdlib The Go programming language is an open source project to make programmers more
  4. Download patch debian/gbp.conf.in

    --- 1.9.4-1/debian/gbp.conf.in 2018-02-07 21:33:29.000000000 +0000 +++ 1.9.4-1ubuntu1/debian/gbp.conf.in 2018-02-07 22:25:01.000000000 +0000 @@ -1,5 +1,5 @@ [DEFAULT] -debian-branch = golang-X.Y +debian-branch = ubuntu-X.Y debian-tag = debian/%(version)s upstream-branch = upstream-X.Y upstream-tag = upstream/%(version)s
  5. Download patch debian/gbp.conf

    --- 1.9.4-1/debian/gbp.conf 2018-02-07 21:33:29.000000000 +0000 +++ 1.9.4-1ubuntu1/debian/gbp.conf 2018-02-07 22:28:50.000000000 +0000 @@ -3,7 +3,7 @@ # [DEFAULT] -debian-branch = golang-1.9 +debian-branch = ubuntu-1.9 debian-tag = debian/%(version)s upstream-branch = upstream-1.9 upstream-tag = upstream/%(version)s

Debian ( Changelog | PTS | Bugs ) Ubuntu ( Changelog | txt | LP | Bugs ) | Diff from Ubuntu

Source: golang-defaults

golang-defaults (2:1.10~4ubuntu1) bionic; urgency=medium * Merge with Debian stable. Remaining change: - Build and recommend golang-race-detector-runtime on amd64. -- Michael Hudson-Doyle <michael.hudson@ubuntu.com> Wed, 28 Feb 2018 22:11:52 +1300

Modifications :
  1. Download patch debian/control

    --- 2:1.10~1/debian/control 2018-02-17 12:06:01.000000000 +0000 +++ 2:1.10~4ubuntu1/debian/control 2018-02-28 09:09:29.000000000 +0000 @@ -1,7 +1,8 @@ Source: golang-defaults Section: devel Priority: optional -Maintainer: Go Compiler Team <pkg-golang-devel@lists.alioth.debian.org> +Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com> +XSBC-Original-Maintainer: Go Compiler Team <pkg-golang-devel@lists.alioth.debian.org> Uploaders: Michael Stapelberg <stapelberg@debian.org>, Paul Tagliamonte <paultag@debian.org>, Tianon Gravi <tianon@debian.org>, @@ -14,7 +15,7 @@ Vcs-Browser: https://anonscm.debian.org/ Vcs-Git: https://anonscm.debian.org/git/pkg-golang/golang-defaults.git Package: golang-go -Architecture: amd64 arm64 armel armhf i386 mips mips64el mipsel ppc64 ppc64el +Architecture: amd64 arm64 armel armhf i386 mips mips64el mipsel ppc64 ppc64el s390x Conflicts: gccgo-go Depends: golang-${golang:GOVER}-go, golang-src (>= ${source:Version}), @@ -51,6 +52,7 @@ Replaces: golang-doc (<< 2:1.6.1+1~), golang-go-windows-amd64, golang-go.tools (<< 1:0.0~git20151026.0.0f9d71c-1~), golang-golang-x-tools (<< 1:0.0~git20151026.0.0f9d71c-1~) +Recommends: golang-race-detector-runtime [amd64] Description: Go programming language compiler, linker, compiled stdlib The Go programming language is an open source project to make programmers more productive. Go is expressive, concise, clean, and efficient. Its concurrency @@ -89,7 +91,7 @@ Description: Go programming language -- Package: gccgo-go Architecture: any -Depends: gccgo-7, ${misc:Depends} +Depends: gccgo-8, ${misc:Depends} Conflicts: golang-go Description: Go programming language -- gccgo The Go programming language is an open source project to make programmers more @@ -105,7 +107,7 @@ Description: Go programming language -- It conflicts with golang-go. Package: golang-src -Architecture: amd64 arm64 armel armhf i386 mips mips64el mipsel ppc64 ppc64el +Architecture: amd64 arm64 armel armhf i386 mips mips64el mipsel ppc64 ppc64el s390x Depends: golang-${golang:GOVER}-src, ${misc:Depends} Description: Go programming language - source files The Go programming language is an open source project to make programmers more @@ -148,7 +150,7 @@ Depends: golang-${golang:GOVER}, golang-go (>= ${source:Version}), golang-src (>= ${source:Version}), ${misc:Depends} -Architecture: amd64 arm64 armel armhf i386 mips mips64 mipsel ppc64 ppc64el +Architecture: amd64 arm64 armel armhf i386 mips mips64 mipsel ppc64 ppc64el s390x Description: Go programming language compiler - metapackage The Go programming language is an open source project to make programmers more productive. Go is expressive, concise, clean, and @@ -162,3 +164,16 @@ Description: Go programming language com . This package is a metapackage that, when installed, guarantees that (most of) a full Go development environment is installed. + +Package: golang-race-detector-runtime +Architecture: amd64 +Depends: golang-${golang:GOVER}-race-detector-runtime, ${misc:Depends} +Description: Runtime support for Go's race detector + The runtime support for the race detector is included as a binary + file in the go source distribution so this package exists to build it + from source on trusted infrastructure. + . + Installing this package will make the -race flag to the go tool functional. + . + This is a dependency package that depends on the race detector runtime for the + default version of Go.
  2. Download patch debian/gccgo-go.links
  1. desktop-base
  2. docker.io
  3. golang-1.10
  4. golang-1.8
  5. golang-1.9
  6. golang-defaults