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 (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 api/server/router/plugin/plugin_routes.go
  2. Download patch api/types/container/host_config.go
  3. Download patch api/types/port.go

    --- 1.13.1~ds3-4/api/types/port.go 2017-02-08 05:58:41.000000000 +0000 +++ 17.12.1-0ubuntu5/api/types/port.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,23 +0,0 @@ -package types - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -// Port An open port on a container -// swagger:model Port -type Port struct { - - // IP - IP string `json:"IP,omitempty"` - - // Port on the container - // Required: true - PrivatePort uint16 `json:"PrivatePort"` - - // Port exposed on the host - PublicPort uint16 `json:"PublicPort,omitempty"` - - // type - // Required: true - Type string `json:"Type"` -}
  4. Download patch api/server/router/network/filter.go

    --- 1.13.1~ds3-4/api/server/router/network/filter.go 2017-02-08 05:58:41.000000000 +0000 +++ 17.12.1-0ubuntu5/api/server/router/network/filter.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,96 +0,0 @@ -package network - -import ( - "fmt" - - "github.com/docker/docker/api/types" - "github.com/docker/docker/api/types/filters" - "github.com/docker/docker/runconfig" -) - -var ( - // AcceptedFilters is an acceptable filters for validation - AcceptedFilters = map[string]bool{ - "driver": true, - "type": true, - "name": true, - "id": true, - "label": true, - } -) - -func filterNetworkByType(nws []types.NetworkResource, netType string) (retNws []types.NetworkResource, err error) { - switch netType { - case "builtin": - for _, nw := range nws { - if runconfig.IsPreDefinedNetwork(nw.Name) { - retNws = append(retNws, nw) - } - } - case "custom": - for _, nw := range nws { - if !runconfig.IsPreDefinedNetwork(nw.Name) { - retNws = append(retNws, nw) - } - } - default: - return nil, fmt.Errorf("Invalid filter: 'type'='%s'", netType) - } - return retNws, nil -} - -// filterNetworks filters network list according to user specified filter -// and returns user chosen networks -func filterNetworks(nws []types.NetworkResource, filter filters.Args) ([]types.NetworkResource, error) { - // if filter is empty, return original network list - if filter.Len() == 0 { - return nws, nil - } - - if err := filter.Validate(AcceptedFilters); err != nil { - return nil, err - } - - displayNet := []types.NetworkResource{} - for _, nw := range nws { - if filter.Include("driver") { - if !filter.ExactMatch("driver", nw.Driver) { - continue - } - } - if filter.Include("name") { - if !filter.Match("name", nw.Name) { - continue - } - } - if filter.Include("id") { - if !filter.Match("id", nw.ID) { - continue - } - } - if filter.Include("label") { - if !filter.MatchKVList("label", nw.Labels) { - continue - } - } - displayNet = append(displayNet, nw) - } - - if filter.Include("type") { - var typeNet []types.NetworkResource - errFilter := filter.WalkValues("type", func(fval string) error { - passList, err := filterNetworkByType(displayNet, fval) - if err != nil { - return err - } - typeNet = append(typeNet, passList...) - return nil - }) - if errFilter != nil { - return nil, errFilter - } - displayNet = typeNet - } - - return displayNet, nil -}
  5. Download patch api/server/router/container/inspect.go

    --- 1.13.1~ds3-4/api/server/router/container/inspect.go 2017-02-08 05:58:41.000000000 +0000 +++ 17.12.1-0ubuntu5/api/server/router/container/inspect.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,21 +0,0 @@ -package container - -import ( - "net/http" - - "github.com/docker/docker/api/server/httputils" - "golang.org/x/net/context" -) - -// getContainersByName inspects container's configuration and serializes it as json. -func (s *containerRouter) getContainersByName(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error { - displaySize := httputils.BoolValue(r, "size") - - version := httputils.VersionFromContext(ctx) - json, err := s.backend.ContainerInspect(vars["name"], displaySize, version) - if err != nil { - return err - } - - return httputils.WriteJSON(w, http.StatusOK, json) -}
  6. Download patch api/server/middleware.go

    --- 1.13.1~ds3-4/api/server/middleware.go 2017-02-08 05:58:41.000000000 +0000 +++ 17.12.1-0ubuntu5/api/server/middleware.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,24 +0,0 @@ -package server - -import ( - "github.com/Sirupsen/logrus" - "github.com/docker/docker/api/server/httputils" - "github.com/docker/docker/api/server/middleware" -) - -// handlerWithGlobalMiddlewares wraps the handler function for a request with -// the server's global middlewares. The order of the middlewares is backwards, -// meaning that the first in the list will be evaluated last. -func (s *Server) handlerWithGlobalMiddlewares(handler httputils.APIFunc) httputils.APIFunc { - next := handler - - for _, m := range s.middlewares { - next = m.WrapHandler(next) - } - - if s.cfg.Logging && logrus.GetLevel() == logrus.DebugLevel { - next = middleware.DebugRequestMiddleware(next) - } - - return next -}
  7. Download patch api/server/router/swarm/cluster.go

    --- 1.13.1~ds3-4/api/server/router/swarm/cluster.go 2017-02-08 05:58:41.000000000 +0000 +++ 17.12.1-0ubuntu5/api/server/router/swarm/cluster.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,52 +0,0 @@ -package swarm - -import "github.com/docker/docker/api/server/router" - -// swarmRouter is a router to talk with the build controller -type swarmRouter struct { - backend Backend - routes []router.Route -} - -// NewRouter initializes a new build router -func NewRouter(b Backend) router.Router { - r := &swarmRouter{ - backend: b, - } - r.initRoutes() - return r -} - -// Routes returns the available routers to the swarm controller -func (sr *swarmRouter) Routes() []router.Route { - return sr.routes -} - -func (sr *swarmRouter) initRoutes() { - sr.routes = []router.Route{ - router.NewPostRoute("/swarm/init", sr.initCluster), - router.NewPostRoute("/swarm/join", sr.joinCluster), - router.NewPostRoute("/swarm/leave", sr.leaveCluster), - router.NewGetRoute("/swarm", sr.inspectCluster), - router.NewGetRoute("/swarm/unlockkey", sr.getUnlockKey), - router.NewPostRoute("/swarm/update", sr.updateCluster), - router.NewPostRoute("/swarm/unlock", sr.unlockCluster), - router.NewGetRoute("/services", sr.getServices), - router.NewGetRoute("/services/{id}", sr.getService), - router.NewPostRoute("/services/create", sr.createService), - router.NewPostRoute("/services/{id}/update", sr.updateService), - router.NewDeleteRoute("/services/{id}", sr.removeService), - router.Experimental(router.Cancellable(router.NewGetRoute("/services/{id}/logs", sr.getServiceLogs))), - router.NewGetRoute("/nodes", sr.getNodes), - router.NewGetRoute("/nodes/{id}", sr.getNode), - router.NewDeleteRoute("/nodes/{id}", sr.removeNode), - router.NewPostRoute("/nodes/{id}/update", sr.updateNode), - router.NewGetRoute("/tasks", sr.getTasks), - router.NewGetRoute("/tasks/{id}", sr.getTask), - router.NewGetRoute("/secrets", sr.getSecrets), - router.NewPostRoute("/secrets/create", sr.createSecret), - router.NewDeleteRoute("/secrets/{id}", sr.removeSecret), - router.NewGetRoute("/secrets/{id}", sr.getSecret), - router.NewPostRoute("/secrets/{id}/update", sr.updateSecret), - } -}
  8. Download patch api/types/events/events.go

    --- 1.13.1~ds3-4/api/types/events/events.go 2017-02-08 05:58:41.000000000 +0000 +++ 17.12.1-0ubuntu5/api/types/events/events.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,42 +0,0 @@ -package events - -const ( - // ContainerEventType is the event type that containers generate - ContainerEventType = "container" - // DaemonEventType is the event type that daemon generate - DaemonEventType = "daemon" - // ImageEventType is the event type that images generate - ImageEventType = "image" - // NetworkEventType is the event type that networks generate - NetworkEventType = "network" - // PluginEventType is the event type that plugins generate - PluginEventType = "plugin" - // VolumeEventType is the event type that volumes generate - VolumeEventType = "volume" -) - -// Actor describes something that generates events, -// like a container, or a network, or a volume. -// It has a defined name and a set or attributes. -// The container attributes are its labels, other actors -// can generate these attributes from other properties. -type Actor struct { - ID string - Attributes map[string]string -} - -// Message represents the information an event contains -type Message struct { - // Deprecated information from JSONMessage. - // With data only in container events. - Status string `json:"status,omitempty"` - ID string `json:"id,omitempty"` - From string `json:"from,omitempty"` - - Type string - Action string - Actor Actor - - Time int64 `json:"time,omitempty"` - TimeNano int64 `json:"timeNano,omitempty"` -}
  9. Download patch api/fixtures/keyfile

    --- 1.13.1~ds3-4/api/fixtures/keyfile 2017-02-08 05:58:41.000000000 +0000 +++ 17.12.1-0ubuntu5/api/fixtures/keyfile 1970-01-01 00:00:00.000000000 +0000 @@ -1,7 +0,0 @@ ------BEGIN EC PRIVATE KEY----- -keyID: AWX2:I27X:WQFX:IOMK:CNAK:O7PW:VYNB:ZLKC:CVAE:YJP2:SI4A:XXAY - -MHcCAQEEILHTRWdcpKWsnORxSFyBnndJ4ROU41hMtr/GCiLVvwBQoAoGCCqGSM49 -AwEHoUQDQgAElpVFbQ2V2UQKajqdE3fVxJ+/pE/YuEFOxWbOxF2be19BY209/iky -NzeFFK7SLpQ4CBJ7zDVXOHsMzrkY/GquGA== ------END EC PRIVATE KEY-----
  10. Download patch api/types/mount/mount.go

    --- 1.13.1~ds3-4/api/types/mount/mount.go 2017-02-08 05:58:41.000000000 +0000 +++ 17.12.1-0ubuntu5/api/types/mount/mount.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,113 +0,0 @@ -package mount - -import ( - "os" -) - -// Type represents the type of a mount. -type Type string - -// Type constants -const ( - // TypeBind is the type for mounting host dir - TypeBind Type = "bind" - // TypeVolume is the type for remote storage volumes - TypeVolume Type = "volume" - // TypeTmpfs is the type for mounting tmpfs - TypeTmpfs Type = "tmpfs" -) - -// Mount represents a mount (volume). -type Mount struct { - Type Type `json:",omitempty"` - // Source specifies the name of the mount. Depending on mount type, this - // may be a volume name or a host path, or even ignored. - // Source is not supported for tmpfs (must be an empty value) - Source string `json:",omitempty"` - Target string `json:",omitempty"` - ReadOnly bool `json:",omitempty"` - - BindOptions *BindOptions `json:",omitempty"` - VolumeOptions *VolumeOptions `json:",omitempty"` - TmpfsOptions *TmpfsOptions `json:",omitempty"` -} - -// Propagation represents the propagation of a mount. -type Propagation string - -const ( - // PropagationRPrivate RPRIVATE - PropagationRPrivate Propagation = "rprivate" - // PropagationPrivate PRIVATE - PropagationPrivate Propagation = "private" - // PropagationRShared RSHARED - PropagationRShared Propagation = "rshared" - // PropagationShared SHARED - PropagationShared Propagation = "shared" - // PropagationRSlave RSLAVE - PropagationRSlave Propagation = "rslave" - // PropagationSlave SLAVE - PropagationSlave Propagation = "slave" -) - -// Propagations is the list of all valid mount propagations -var Propagations = []Propagation{ - PropagationRPrivate, - PropagationPrivate, - PropagationRShared, - PropagationShared, - PropagationRSlave, - PropagationSlave, -} - -// BindOptions defines options specific to mounts of type "bind". -type BindOptions struct { - Propagation Propagation `json:",omitempty"` -} - -// VolumeOptions represents the options for a mount of type volume. -type VolumeOptions struct { - NoCopy bool `json:",omitempty"` - Labels map[string]string `json:",omitempty"` - DriverConfig *Driver `json:",omitempty"` -} - -// Driver represents a volume driver. -type Driver struct { - Name string `json:",omitempty"` - Options map[string]string `json:",omitempty"` -} - -// TmpfsOptions defines options specific to mounts of type "tmpfs". -type TmpfsOptions struct { - // Size sets the size of the tmpfs, in bytes. - // - // This will be converted to an operating system specific value - // depending on the host. For example, on linux, it will be convered to - // use a 'k', 'm' or 'g' syntax. BSD, though not widely supported with - // docker, uses a straight byte value. - // - // Percentages are not supported. - SizeBytes int64 `json:",omitempty"` - // Mode of the tmpfs upon creation - Mode os.FileMode `json:",omitempty"` - - // TODO(stevvooe): There are several more tmpfs flags, specified in the - // daemon, that are accepted. Only the most basic are added for now. - // - // From docker/docker/pkg/mount/flags.go: - // - // var validFlags = map[string]bool{ - // "": true, - // "size": true, X - // "mode": true, X - // "uid": true, - // "gid": true, - // "nr_inodes": true, - // "nr_blocks": true, - // "mpol": true, - // } - // - // Some of these may be straightforward to add, but others, such as - // uid/gid have implications in a clustered system. -}
  11. Download patch api/templates/server/operation.gotmpl

    --- 1.13.1~ds3-4/api/templates/server/operation.gotmpl 2017-02-08 05:58:41.000000000 +0000 +++ 17.12.1-0ubuntu5/api/templates/server/operation.gotmpl 1970-01-01 00:00:00.000000000 +0000 @@ -1,26 +0,0 @@ -package {{ .Package }} - -// ---------------------------------------------------------------------------- -// DO NOT EDIT THIS FILE -// This file was generated by `swagger generate operation` -// -// See hack/swagger-gen.sh -// ---------------------------------------------------------------------------- - -import ( - "net/http" - - context "golang.org/x/net/context" - - {{ range .DefaultImports }}{{ printf "%q" . }} - {{ end }} - {{ range $key, $value := .Imports }}{{ $key }} {{ printf "%q" $value }} - {{ end }} -) - - -{{ range .ExtraSchemas }} -// {{ .Name }} {{ template "docstring" . }} -// swagger:model {{ .Name }} -{{ template "schema" . }} -{{ end }}
  12. Download patch api/server/router/plugin/backend.go

    --- 1.13.1~ds3-4/api/server/router/plugin/backend.go 2017-02-08 05:58:41.000000000 +0000 +++ 17.12.1-0ubuntu5/api/server/router/plugin/backend.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,25 +0,0 @@ -package plugin - -import ( - "io" - "net/http" - - enginetypes "github.com/docker/docker/api/types" - "github.com/docker/docker/reference" - "golang.org/x/net/context" -) - -// Backend for Plugin -type Backend interface { - Disable(name string, config *enginetypes.PluginDisableConfig) error - Enable(name string, config *enginetypes.PluginEnableConfig) error - List() ([]enginetypes.Plugin, error) - Inspect(name string) (*enginetypes.Plugin, error) - Remove(name string, config *enginetypes.PluginRmConfig) error - Set(name string, args []string) error - Privileges(ctx context.Context, ref reference.Named, metaHeaders http.Header, authConfig *enginetypes.AuthConfig) (enginetypes.PluginPrivileges, error) - Pull(ctx context.Context, ref reference.Named, name string, metaHeaders http.Header, authConfig *enginetypes.AuthConfig, privileges enginetypes.PluginPrivileges, outStream io.Writer) error - Push(ctx context.Context, name string, metaHeaders http.Header, authConfig *enginetypes.AuthConfig, outStream io.Writer) error - Upgrade(ctx context.Context, ref reference.Named, name string, metaHeaders http.Header, authConfig *enginetypes.AuthConfig, privileges enginetypes.PluginPrivileges, outStream io.Writer) error - CreateFromContext(ctx context.Context, tarCtx io.ReadCloser, options *enginetypes.PluginCreateOptions) error -}
  13. Download patch api/server/middleware/cors.go

    --- 1.13.1~ds3-4/api/server/middleware/cors.go 2017-02-08 05:58:41.000000000 +0000 +++ 17.12.1-0ubuntu5/api/server/middleware/cors.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,37 +0,0 @@ -package middleware - -import ( - "net/http" - - "github.com/Sirupsen/logrus" - "golang.org/x/net/context" -) - -// CORSMiddleware injects CORS headers to each request -// when it's configured. -type CORSMiddleware struct { - defaultHeaders string -} - -// NewCORSMiddleware creates a new CORSMiddleware with default headers. -func NewCORSMiddleware(d string) CORSMiddleware { - return CORSMiddleware{defaultHeaders: d} -} - -// WrapHandler returns a new handler function wrapping the previous one in the request chain. -func (c CORSMiddleware) WrapHandler(handler func(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error) func(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error { - return func(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error { - // If "api-cors-header" is not given, but "api-enable-cors" is true, we set cors to "*" - // otherwise, all head values will be passed to HTTP handler - corsHeaders := c.defaultHeaders - if corsHeaders == "" { - corsHeaders = "*" - } - - logrus.Debugf("CORS header is enabled and set to: %s", corsHeaders) - w.Header().Add("Access-Control-Allow-Origin", corsHeaders) - w.Header().Add("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept, X-Registry-Auth") - w.Header().Add("Access-Control-Allow-Methods", "HEAD, GET, POST, DELETE, PUT, OPTIONS") - return handler(ctx, w, r, vars) - } -}
  14. Download patch api/server/router_swapper.go

    --- 1.13.1~ds3-4/api/server/router_swapper.go 2017-02-08 05:58:41.000000000 +0000 +++ 17.12.1-0ubuntu5/api/server/router_swapper.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,30 +0,0 @@ -package server - -import ( - "net/http" - "sync" - - "github.com/gorilla/mux" -) - -// routerSwapper is an http.Handler that allows you to swap -// mux routers. -type routerSwapper struct { - mu sync.Mutex - router *mux.Router -} - -// Swap changes the old router with the new one. -func (rs *routerSwapper) Swap(newRouter *mux.Router) { - rs.mu.Lock() - rs.router = newRouter - rs.mu.Unlock() -} - -// ServeHTTP makes the routerSwapper to implement the http.Handler interface. -func (rs *routerSwapper) ServeHTTP(w http.ResponseWriter, r *http.Request) { - rs.mu.Lock() - router := rs.router - rs.mu.Unlock() - router.ServeHTTP(w, r) -}
  15. Download patch api/types/image_summary.go

    --- 1.13.1~ds3-4/api/types/image_summary.go 2017-02-08 05:58:41.000000000 +0000 +++ 17.12.1-0ubuntu5/api/types/image_summary.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,49 +0,0 @@ -package types - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -// ImageSummary image summary -// swagger:model ImageSummary -type ImageSummary struct { - - // containers - // Required: true - Containers int64 `json:"Containers"` - - // created - // Required: true - Created int64 `json:"Created"` - - // Id - // Required: true - ID string `json:"Id"` - - // labels - // Required: true - Labels map[string]string `json:"Labels"` - - // parent Id - // Required: true - ParentID string `json:"ParentId"` - - // repo digests - // Required: true - RepoDigests []string `json:"RepoDigests"` - - // repo tags - // Required: true - RepoTags []string `json:"RepoTags"` - - // shared size - // Required: true - SharedSize int64 `json:"SharedSize"` - - // size - // Required: true - Size int64 `json:"Size"` - - // virtual size - // Required: true - VirtualSize int64 `json:"VirtualSize"` -}
  16. Download patch api/types/container/container_wait.go

    --- 1.13.1~ds3-4/api/types/container/container_wait.go 2017-02-08 05:58:41.000000000 +0000 +++ 17.12.1-0ubuntu5/api/types/container/container_wait.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,17 +0,0 @@ -package container - -// ---------------------------------------------------------------------------- -// DO NOT EDIT THIS FILE -// This file was generated by `swagger generate operation` -// -// See hack/swagger-gen.sh -// ---------------------------------------------------------------------------- - -// ContainerWaitOKBody container wait o k body -// swagger:model ContainerWaitOKBody -type ContainerWaitOKBody struct { - - // Exit code of the container - // Required: true - StatusCode int64 `json:"StatusCode"` -}
  17. Download patch api/types/container/container_create.go

    --- 1.13.1~ds3-4/api/types/container/container_create.go 2017-02-08 05:58:41.000000000 +0000 +++ 17.12.1-0ubuntu5/api/types/container/container_create.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,21 +0,0 @@ -package container - -// ---------------------------------------------------------------------------- -// DO NOT EDIT THIS FILE -// This file was generated by `swagger generate operation` -// -// See hack/swagger-gen.sh -// ---------------------------------------------------------------------------- - -// ContainerCreateCreatedBody container create created body -// swagger:model ContainerCreateCreatedBody -type ContainerCreateCreatedBody struct { - - // The ID of the created container - // Required: true - ID string `json:"Id"` - - // Warnings encountered when creating the container - // Required: true - Warnings []string `json:"Warnings"` -}
  18. Download patch api/types/backend/backend.go

    --- 1.13.1~ds3-4/api/types/backend/backend.go 2017-02-08 05:58:41.000000000 +0000 +++ 17.12.1-0ubuntu5/api/types/backend/backend.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,84 +0,0 @@ -// Package backend includes types to send information to server backends. -package backend - -import ( - "io" - - "github.com/docker/docker/api/types" - "github.com/docker/docker/pkg/streamformatter" -) - -// ContainerAttachConfig holds the streams to use when connecting to a container to view logs. -type ContainerAttachConfig struct { - GetStreams func() (io.ReadCloser, io.Writer, io.Writer, error) - UseStdin bool - UseStdout bool - UseStderr bool - Logs bool - Stream bool - DetachKeys string - - // Used to signify that streams are multiplexed and therefore need a StdWriter to encode stdout/sderr messages accordingly. - // TODO @cpuguy83: This shouldn't be needed. It was only added so that http and websocket endpoints can use the same function, and the websocket function was not using a stdwriter prior to this change... - // HOWEVER, the websocket endpoint is using a single stream and SHOULD be encoded with stdout/stderr as is done for HTTP since it is still just a single stream. - // Since such a change is an API change unrelated to the current changeset we'll keep it as is here and change separately. - MuxStreams bool -} - -// ContainerLogsConfig holds configs for logging operations. Exists -// for users of the backend to to pass it a logging configuration. -type ContainerLogsConfig struct { - types.ContainerLogsOptions - OutStream io.Writer -} - -// ContainerStatsConfig holds information for configuring the runtime -// behavior of a backend.ContainerStats() call. -type ContainerStatsConfig struct { - Stream bool - OutStream io.Writer - Version string -} - -// ExecInspect holds information about a running process started -// with docker exec. -type ExecInspect struct { - ID string - Running bool - ExitCode *int - ProcessConfig *ExecProcessConfig - OpenStdin bool - OpenStderr bool - OpenStdout bool - CanRemove bool - ContainerID string - DetachKeys []byte - Pid int -} - -// ExecProcessConfig holds information about the exec process -// running on the host. -type ExecProcessConfig struct { - Tty bool `json:"tty"` - Entrypoint string `json:"entrypoint"` - Arguments []string `json:"arguments"` - Privileged *bool `json:"privileged,omitempty"` - User string `json:"user,omitempty"` -} - -// ContainerCommitConfig is a wrapper around -// types.ContainerCommitConfig that also -// transports configuration changes for a container. -type ContainerCommitConfig struct { - types.ContainerCommitConfig - Changes []string -} - -// ProgressWriter is an interface -// to transport progress streams. -type ProgressWriter struct { - Output io.Writer - StdoutFormatter *streamformatter.StdoutFormatter - StderrFormatter *streamformatter.StderrFormatter - ProgressReaderFunc func(io.ReadCloser) io.ReadCloser -}
  19. Download patch api/server/router/network/network_routes.go
  20. Download patch api/server/router/image/image.go

    --- 1.13.1~ds3-4/api/server/router/image/image.go 2017-02-08 05:58:41.000000000 +0000 +++ 17.12.1-0ubuntu5/api/server/router/image/image.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,50 +0,0 @@ -package image - -import ( - "github.com/docker/docker/api/server/httputils" - "github.com/docker/docker/api/server/router" -) - -// imageRouter is a router to talk with the image controller -type imageRouter struct { - backend Backend - decoder httputils.ContainerDecoder - routes []router.Route -} - -// NewRouter initializes a new image router -func NewRouter(backend Backend, decoder httputils.ContainerDecoder) router.Router { - r := &imageRouter{ - backend: backend, - decoder: decoder, - } - r.initRoutes() - return r -} - -// Routes returns the available routes to the image controller -func (r *imageRouter) Routes() []router.Route { - return r.routes -} - -// initRoutes initializes the routes in the image router -func (r *imageRouter) initRoutes() { - r.routes = []router.Route{ - // GET - router.NewGetRoute("/images/json", r.getImagesJSON), - router.NewGetRoute("/images/search", r.getImagesSearch), - router.NewGetRoute("/images/get", r.getImagesGet), - router.NewGetRoute("/images/{name:.*}/get", r.getImagesGet), - router.NewGetRoute("/images/{name:.*}/history", r.getImagesHistory), - router.NewGetRoute("/images/{name:.*}/json", r.getImagesByName), - // POST - router.NewPostRoute("/commit", r.postCommit), - router.NewPostRoute("/images/load", r.postImagesLoad), - router.Cancellable(router.NewPostRoute("/images/create", r.postImagesCreate)), - router.Cancellable(router.NewPostRoute("/images/{name:.*}/push", r.postImagesPush)), - router.NewPostRoute("/images/{name:.*}/tag", r.postImagesTag), - router.NewPostRoute("/images/prune", r.postImagesPrune), - // DELETE - router.NewDeleteRoute("/images/{name:.*}", r.deleteImages), - } -}
  21. Download patch api/server/httputils/httputils.go

    --- 1.13.1~ds3-4/api/server/httputils/httputils.go 2017-02-08 05:58:41.000000000 +0000 +++ 17.12.1-0ubuntu5/api/server/httputils/httputils.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,90 +0,0 @@ -package httputils - -import ( - "fmt" - "io" - "net/http" - "strings" - - "golang.org/x/net/context" - - "github.com/docker/docker/api" -) - -// APIVersionKey is the client's requested API version. -const APIVersionKey = "api-version" - -// UAStringKey is used as key type for user-agent string in net/context struct -const UAStringKey = "upstream-user-agent" - -// APIFunc is an adapter to allow the use of ordinary functions as Docker API endpoints. -// Any function that has the appropriate signature can be registered as an API endpoint (e.g. getVersion). -type APIFunc func(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error - -// HijackConnection interrupts the http response writer to get the -// underlying connection and operate with it. -func HijackConnection(w http.ResponseWriter) (io.ReadCloser, io.Writer, error) { - conn, _, err := w.(http.Hijacker).Hijack() - if err != nil { - return nil, nil, err - } - // Flush the options to make sure the client sets the raw mode - conn.Write([]byte{}) - return conn, conn, nil -} - -// CloseStreams ensures that a list for http streams are properly closed. -func CloseStreams(streams ...interface{}) { - for _, stream := range streams { - if tcpc, ok := stream.(interface { - CloseWrite() error - }); ok { - tcpc.CloseWrite() - } else if closer, ok := stream.(io.Closer); ok { - closer.Close() - } - } -} - -// CheckForJSON makes sure that the request's Content-Type is application/json. -func CheckForJSON(r *http.Request) error { - ct := r.Header.Get("Content-Type") - - // No Content-Type header is ok as long as there's no Body - if ct == "" { - if r.Body == nil || r.ContentLength == 0 { - return nil - } - } - - // Otherwise it better be json - if api.MatchesContentType(ct, "application/json") { - return nil - } - return fmt.Errorf("Content-Type specified (%s) must be 'application/json'", ct) -} - -// ParseForm ensures the request form is parsed even with invalid content types. -// If we don't do this, POST method without Content-type (even with empty body) will fail. -func ParseForm(r *http.Request) error { - if r == nil { - return nil - } - if err := r.ParseForm(); err != nil && !strings.HasPrefix(err.Error(), "mime:") { - return err - } - return nil -} - -// VersionFromContext returns an API version from the context using APIVersionKey. -// It panics if the context value does not have version.Version type. -func VersionFromContext(ctx context.Context) (ver string) { - if ctx == nil { - return - } - val := ctx.Value(APIVersionKey) - if val == nil { - return - } - return val.(string) -}
  22. Download patch api/server/server_test.go

    --- 1.13.1~ds3-4/api/server/server_test.go 2017-02-08 05:58:41.000000000 +0000 +++ 17.12.1-0ubuntu5/api/server/server_test.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,46 +0,0 @@ -package server - -import ( - "net/http" - "net/http/httptest" - "strings" - "testing" - - "github.com/docker/docker/api" - "github.com/docker/docker/api/server/httputils" - "github.com/docker/docker/api/server/middleware" - - "golang.org/x/net/context" -) - -func TestMiddlewares(t *testing.T) { - cfg := &Config{ - Version: "0.1omega2", - } - srv := &Server{ - cfg: cfg, - } - - srv.UseMiddleware(middleware.NewVersionMiddleware("0.1omega2", api.DefaultVersion, api.MinVersion)) - - req, _ := http.NewRequest("GET", "/containers/json", nil) - resp := httptest.NewRecorder() - ctx := context.Background() - - localHandler := func(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error { - if httputils.VersionFromContext(ctx) == "" { - t.Fatalf("Expected version, got empty string") - } - - if sv := w.Header().Get("Server"); !strings.Contains(sv, "Docker/0.1omega2") { - t.Fatalf("Expected server version in the header `Docker/0.1omega2`, got %s", sv) - } - - return nil - } - - handlerFunc := srv.handlerWithGlobalMiddlewares(localHandler) - if err := handlerFunc(ctx, resp, req, map[string]string{}); err != nil { - t.Fatal(err) - } -}
  23. Download patch api/types/filters/parse_test.go
  24. Download patch api/server/router/container/backend.go

    --- 1.13.1~ds3-4/api/server/router/container/backend.go 2017-02-08 05:58:41.000000000 +0000 +++ 17.12.1-0ubuntu5/api/server/router/container/backend.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,79 +0,0 @@ -package container - -import ( - "io" - "time" - - "golang.org/x/net/context" - - "github.com/docker/docker/api/types" - "github.com/docker/docker/api/types/backend" - "github.com/docker/docker/api/types/container" - "github.com/docker/docker/api/types/filters" - "github.com/docker/docker/pkg/archive" -) - -// execBackend includes functions to implement to provide exec functionality. -type execBackend interface { - ContainerExecCreate(name string, config *types.ExecConfig) (string, error) - ContainerExecInspect(id string) (*backend.ExecInspect, error) - ContainerExecResize(name string, height, width int) error - ContainerExecStart(ctx context.Context, name string, stdin io.ReadCloser, stdout io.Writer, stderr io.Writer) error - ExecExists(name string) (bool, error) -} - -// copyBackend includes functions to implement to provide container copy functionality. -type copyBackend interface { - ContainerArchivePath(name string, path string) (content io.ReadCloser, stat *types.ContainerPathStat, err error) - ContainerCopy(name string, res string) (io.ReadCloser, error) - ContainerExport(name string, out io.Writer) error - ContainerExtractToDir(name, path string, noOverwriteDirNonDir bool, content io.Reader) error - ContainerStatPath(name string, path string) (stat *types.ContainerPathStat, err error) -} - -// stateBackend includes functions to implement to provide container state lifecycle functionality. -type stateBackend interface { - ContainerCreate(config types.ContainerCreateConfig) (container.ContainerCreateCreatedBody, error) - ContainerKill(name string, sig uint64) error - ContainerPause(name string) error - ContainerRename(oldName, newName string) error - ContainerResize(name string, height, width int) error - ContainerRestart(name string, seconds *int) error - ContainerRm(name string, config *types.ContainerRmConfig) error - ContainerStart(name string, hostConfig *container.HostConfig, checkpoint string, checkpointDir string) error - ContainerStop(name string, seconds *int) error - ContainerUnpause(name string) error - ContainerUpdate(name string, hostConfig *container.HostConfig) (container.ContainerUpdateOKBody, error) - ContainerWait(name string, timeout time.Duration) (int, error) -} - -// monitorBackend includes functions to implement to provide containers monitoring functionality. -type monitorBackend interface { - ContainerChanges(name string) ([]archive.Change, error) - ContainerInspect(name string, size bool, version string) (interface{}, error) - ContainerLogs(ctx context.Context, name string, config *backend.ContainerLogsConfig, started chan struct{}) error - ContainerStats(ctx context.Context, name string, config *backend.ContainerStatsConfig) error - ContainerTop(name string, psArgs string) (*types.ContainerProcessList, error) - - Containers(config *types.ContainerListOptions) ([]*types.Container, error) -} - -// attachBackend includes function to implement to provide container attaching functionality. -type attachBackend interface { - ContainerAttach(name string, c *backend.ContainerAttachConfig) error -} - -// systemBackend includes functions to implement to provide system wide containers functionality -type systemBackend interface { - ContainersPrune(pruneFilters filters.Args) (*types.ContainersPruneReport, error) -} - -// Backend is all the methods that need to be implemented to provide container specific functionality. -type Backend interface { - execBackend - copyBackend - stateBackend - monitorBackend - attachBackend - systemBackend -}
  25. Download patch api/types/service_update_response.go

    --- 1.13.1~ds3-4/api/types/service_update_response.go 2017-02-08 05:58:41.000000000 +0000 +++ 17.12.1-0ubuntu5/api/types/service_update_response.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,12 +0,0 @@ -package types - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -// ServiceUpdateResponse service update response -// swagger:model ServiceUpdateResponse -type ServiceUpdateResponse struct { - - // Optional warning messages - Warnings []string `json:"Warnings"` -}
  26. Download patch api/types/plugin_env.go

    --- 1.13.1~ds3-4/api/types/plugin_env.go 2017-02-08 05:58:41.000000000 +0000 +++ 17.12.1-0ubuntu5/api/types/plugin_env.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,25 +0,0 @@ -package types - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -// PluginEnv plugin env -// swagger:model PluginEnv -type PluginEnv struct { - - // description - // Required: true - Description string `json:"Description"` - - // name - // Required: true - Name string `json:"Name"` - - // settable - // Required: true - Settable []string `json:"Settable"` - - // value - // Required: true - Value *string `json:"Value"` -}
  27. Download patch api/types/client.go
  28. Download patch api/types/auth.go

    --- 1.13.1~ds3-4/api/types/auth.go 2017-02-08 05:58:41.000000000 +0000 +++ 17.12.1-0ubuntu5/api/types/auth.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,22 +0,0 @@ -package types - -// AuthConfig contains authorization information for connecting to a Registry -type AuthConfig struct { - Username string `json:"username,omitempty"` - Password string `json:"password,omitempty"` - Auth string `json:"auth,omitempty"` - - // Email is an optional value associated with the username. - // This field is deprecated and will be removed in a later - // version of docker. - Email string `json:"email,omitempty"` - - ServerAddress string `json:"serveraddress,omitempty"` - - // IdentityToken is used to authenticate the user and get - // an access token for the registry. - IdentityToken string `json:"identitytoken,omitempty"` - - // RegistryToken is a bearer token to be sent to a registry - RegistryToken string `json:"registrytoken,omitempty"` -}
  29. Download patch api/server/httputils/httputils_write_json.go

    --- 1.13.1~ds3-4/api/server/httputils/httputils_write_json.go 2017-02-08 05:58:41.000000000 +0000 +++ 17.12.1-0ubuntu5/api/server/httputils/httputils_write_json.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,17 +0,0 @@ -// +build go1.7 - -package httputils - -import ( - "encoding/json" - "net/http" -) - -// WriteJSON writes the value v to the http response stream as json with standard json encoding. -func WriteJSON(w http.ResponseWriter, code int, v interface{}) error { - w.Header().Set("Content-Type", "application/json") - w.WriteHeader(code) - enc := json.NewEncoder(w) - enc.SetEscapeHTML(false) - return enc.Encode(v) -}
  30. Download patch api/server/httputils/errors.go

    --- 1.13.1~ds3-4/api/server/httputils/errors.go 2017-02-08 05:58:41.000000000 +0000 +++ 17.12.1-0ubuntu5/api/server/httputils/errors.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,101 +0,0 @@ -package httputils - -import ( - "net/http" - "strings" - - "github.com/Sirupsen/logrus" - "github.com/docker/docker/api/types" - "github.com/docker/docker/api/types/versions" - "github.com/gorilla/mux" - "google.golang.org/grpc" -) - -// httpStatusError is an interface -// that errors with custom status codes -// implement to tell the api layer -// which response status to set. -type httpStatusError interface { - HTTPErrorStatusCode() int -} - -// inputValidationError is an interface -// that errors generated by invalid -// inputs can implement to tell the -// api layer to set a 400 status code -// in the response. -type inputValidationError interface { - IsValidationError() bool -} - -// GetHTTPErrorStatusCode retrieves status code from error message -func GetHTTPErrorStatusCode(err error) int { - if err == nil { - logrus.WithFields(logrus.Fields{"error": err}).Error("unexpected HTTP error handling") - return http.StatusInternalServerError - } - - var statusCode int - errMsg := err.Error() - - switch e := err.(type) { - case httpStatusError: - statusCode = e.HTTPErrorStatusCode() - case inputValidationError: - statusCode = http.StatusBadRequest - default: - // FIXME: this is brittle and should not be necessary, but we still need to identify if - // there are errors falling back into this logic. - // If we need to differentiate between different possible error types, - // we should create appropriate error types that implement the httpStatusError interface. - errStr := strings.ToLower(errMsg) - for _, status := range []struct { - keyword string - code int - }{ - {"not found", http.StatusNotFound}, - {"no such", http.StatusNotFound}, - {"bad parameter", http.StatusBadRequest}, - {"no command", http.StatusBadRequest}, - {"conflict", http.StatusConflict}, - {"impossible", http.StatusNotAcceptable}, - {"wrong login/password", http.StatusUnauthorized}, - {"unauthorized", http.StatusUnauthorized}, - {"hasn't been activated", http.StatusForbidden}, - {"this node", http.StatusServiceUnavailable}, - } { - if strings.Contains(errStr, status.keyword) { - statusCode = status.code - break - } - } - } - - if statusCode == 0 { - statusCode = http.StatusInternalServerError - } - - return statusCode -} - -func apiVersionSupportsJSONErrors(version string) bool { - const firstAPIVersionWithJSONErrors = "1.23" - return version == "" || versions.GreaterThan(version, firstAPIVersionWithJSONErrors) -} - -// MakeErrorHandler makes an HTTP handler that decodes a Docker error and -// returns it in the response. -func MakeErrorHandler(err error) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - statusCode := GetHTTPErrorStatusCode(err) - vars := mux.Vars(r) - if apiVersionSupportsJSONErrors(vars["version"]) { - response := &types.ErrorResponse{ - Message: err.Error(), - } - WriteJSON(w, statusCode, response) - } else { - http.Error(w, grpc.ErrorDesc(err), statusCode) - } - } -}
  31. Download patch api/types/strslice/strslice_test.go

    --- 1.13.1~ds3-4/api/types/strslice/strslice_test.go 2017-02-08 05:58:41.000000000 +0000 +++ 17.12.1-0ubuntu5/api/types/strslice/strslice_test.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,86 +0,0 @@ -package strslice - -import ( - "encoding/json" - "reflect" - "testing" -) - -func TestStrSliceMarshalJSON(t *testing.T) { - for _, testcase := range []struct { - input StrSlice - expected string - }{ - // MADNESS(stevvooe): No clue why nil would be "" but empty would be - // "null". Had to make a change here that may affect compatibility. - {input: nil, expected: "null"}, - {StrSlice{}, "[]"}, - {StrSlice{"/bin/sh", "-c", "echo"}, `["/bin/sh","-c","echo"]`}, - } { - data, err := json.Marshal(testcase.input) - if err != nil { - t.Fatal(err) - } - if string(data) != testcase.expected { - t.Fatalf("%#v: expected %v, got %v", testcase.input, testcase.expected, string(data)) - } - } -} - -func TestStrSliceUnmarshalJSON(t *testing.T) { - parts := map[string][]string{ - "": {"default", "values"}, - "[]": {}, - `["/bin/sh","-c","echo"]`: {"/bin/sh", "-c", "echo"}, - } - for json, expectedParts := range parts { - strs := StrSlice{"default", "values"} - if err := strs.UnmarshalJSON([]byte(json)); err != nil { - t.Fatal(err) - } - - actualParts := []string(strs) - if !reflect.DeepEqual(actualParts, expectedParts) { - t.Fatalf("%#v: expected %v, got %v", json, expectedParts, actualParts) - } - - } -} - -func TestStrSliceUnmarshalString(t *testing.T) { - var e StrSlice - echo, err := json.Marshal("echo") - if err != nil { - t.Fatal(err) - } - if err := json.Unmarshal(echo, &e); err != nil { - t.Fatal(err) - } - - if len(e) != 1 { - t.Fatalf("expected 1 element after unmarshal: %q", e) - } - - if e[0] != "echo" { - t.Fatalf("expected `echo`, got: %q", e[0]) - } -} - -func TestStrSliceUnmarshalSlice(t *testing.T) { - var e StrSlice - echo, err := json.Marshal([]string{"echo"}) - if err != nil { - t.Fatal(err) - } - if err := json.Unmarshal(echo, &e); err != nil { - t.Fatal(err) - } - - if len(e) != 1 { - t.Fatalf("expected 1 element after unmarshal: %q", e) - } - - if e[0] != "echo" { - t.Fatalf("expected `echo`, got: %q", e[0]) - } -}
  32. Download patch api/server/router/container/container_routes.go
  33. Download patch api/server/router/swarm/backend.go

    --- 1.13.1~ds3-4/api/server/router/swarm/backend.go 2017-02-08 05:58:41.000000000 +0000 +++ 17.12.1-0ubuntu5/api/server/router/swarm/backend.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,36 +0,0 @@ -package swarm - -import ( - basictypes "github.com/docker/docker/api/types" - "github.com/docker/docker/api/types/backend" - types "github.com/docker/docker/api/types/swarm" - "golang.org/x/net/context" -) - -// Backend abstracts an swarm commands manager. -type Backend interface { - Init(req types.InitRequest) (string, error) - Join(req types.JoinRequest) error - Leave(force bool) error - Inspect() (types.Swarm, error) - Update(uint64, types.Spec, types.UpdateFlags) error - GetUnlockKey() (string, error) - UnlockSwarm(req types.UnlockRequest) error - GetServices(basictypes.ServiceListOptions) ([]types.Service, error) - GetService(string) (types.Service, error) - CreateService(types.ServiceSpec, string) (*basictypes.ServiceCreateResponse, error) - UpdateService(string, uint64, types.ServiceSpec, string, string) (*basictypes.ServiceUpdateResponse, error) - RemoveService(string) error - ServiceLogs(context.Context, string, *backend.ContainerLogsConfig, chan struct{}) error - GetNodes(basictypes.NodeListOptions) ([]types.Node, error) - GetNode(string) (types.Node, error) - UpdateNode(string, uint64, types.NodeSpec) error - RemoveNode(string, bool) error - GetTasks(basictypes.TaskListOptions) ([]types.Task, error) - GetTask(string) (types.Task, error) - GetSecrets(opts basictypes.SecretListOptions) ([]types.Secret, error) - CreateSecret(s types.SecretSpec) (string, error) - RemoveSecret(id string) error - GetSecret(id string) (types.Secret, error) - UpdateSecret(id string, version uint64, spec types.SecretSpec) error -}
  34. Download patch api/server/middleware/middleware.go

    --- 1.13.1~ds3-4/api/server/middleware/middleware.go 2017-02-08 05:58:41.000000000 +0000 +++ 17.12.1-0ubuntu5/api/server/middleware/middleware.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,13 +0,0 @@ -package middleware - -import ( - "net/http" - - "golang.org/x/net/context" -) - -// Middleware is an interface to allow the use of ordinary functions as Docker API filters. -// Any struct that has the appropriate signature can be registered as a middleware. -type Middleware interface { - WrapHandler(func(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error) func(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error -}
  35. Download patch api/common_windows.go

    --- 1.13.1~ds3-4/api/common_windows.go 2017-02-08 05:58:41.000000000 +0000 +++ 17.12.1-0ubuntu5/api/common_windows.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,8 +0,0 @@ -package api - -// MinVersion represents Minimum REST API version supported -// Technically the first daemon API version released on Windows is v1.25 in -// engine version 1.13. However, some clients are explicitly using downlevel -// APIs (eg docker-compose v2.1 file format) and that is just too restrictive. -// Hence also allowing 1.24 on Windows. -const MinVersion string = "1.24"
  36. Download patch api/types/filters/parse.go
  37. Download patch api/types/stats.go

    --- 1.13.1~ds3-4/api/types/stats.go 2017-02-08 05:58:41.000000000 +0000 +++ 17.12.1-0ubuntu5/api/types/stats.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,178 +0,0 @@ -// Package types is used for API stability in the types and response to the -// consumers of the API stats endpoint. -package types - -import "time" - -// ThrottlingData stores CPU throttling stats of one running container. -// Not used on Windows. -type ThrottlingData struct { - // Number of periods with throttling active - Periods uint64 `json:"periods"` - // Number of periods when the container hits its throttling limit. - ThrottledPeriods uint64 `json:"throttled_periods"` - // Aggregate time the container was throttled for in nanoseconds. - ThrottledTime uint64 `json:"throttled_time"` -} - -// CPUUsage stores All CPU stats aggregated since container inception. -type CPUUsage struct { - // Total CPU time consumed. - // Units: nanoseconds (Linux) - // Units: 100's of nanoseconds (Windows) - TotalUsage uint64 `json:"total_usage"` - - // Total CPU time consumed per core (Linux). Not used on Windows. - // Units: nanoseconds. - PercpuUsage []uint64 `json:"percpu_usage,omitempty"` - - // Time spent by tasks of the cgroup in kernel mode (Linux). - // Time spent by all container processes in kernel mode (Windows). - // Units: nanoseconds (Linux). - // Units: 100's of nanoseconds (Windows). Not populated for Hyper-V Containers. - UsageInKernelmode uint64 `json:"usage_in_kernelmode"` - - // Time spent by tasks of the cgroup in user mode (Linux). - // Time spent by all container processes in user mode (Windows). - // Units: nanoseconds (Linux). - // Units: 100's of nanoseconds (Windows). Not populated for Hyper-V Containers - UsageInUsermode uint64 `json:"usage_in_usermode"` -} - -// CPUStats aggregates and wraps all CPU related info of container -type CPUStats struct { - // CPU Usage. Linux and Windows. - CPUUsage CPUUsage `json:"cpu_usage"` - - // System Usage. Linux only. - SystemUsage uint64 `json:"system_cpu_usage,omitempty"` - - // Throttling Data. Linux only. - ThrottlingData ThrottlingData `json:"throttling_data,omitempty"` -} - -// MemoryStats aggregates all memory stats since container inception on Linux. -// Windows returns stats for commit and private working set only. -type MemoryStats struct { - // Linux Memory Stats - - // current res_counter usage for memory - Usage uint64 `json:"usage,omitempty"` - // maximum usage ever recorded. - MaxUsage uint64 `json:"max_usage,omitempty"` - // TODO(vishh): Export these as stronger types. - // all the stats exported via memory.stat. - Stats map[string]uint64 `json:"stats,omitempty"` - // number of times memory usage hits limits. - Failcnt uint64 `json:"failcnt,omitempty"` - Limit uint64 `json:"limit,omitempty"` - - // Windows Memory Stats - // See https://technet.microsoft.com/en-us/magazine/ff382715.aspx - - // committed bytes - Commit uint64 `json:"commitbytes,omitempty"` - // peak committed bytes - CommitPeak uint64 `json:"commitpeakbytes,omitempty"` - // private working set - PrivateWorkingSet uint64 `json:"privateworkingset,omitempty"` -} - -// BlkioStatEntry is one small entity to store a piece of Blkio stats -// Not used on Windows. -type BlkioStatEntry struct { - Major uint64 `json:"major"` - Minor uint64 `json:"minor"` - Op string `json:"op"` - Value uint64 `json:"value"` -} - -// BlkioStats stores All IO service stats for data read and write. -// This is a Linux specific structure as the differences between expressing -// block I/O on Windows and Linux are sufficiently significant to make -// little sense attempting to morph into a combined structure. -type BlkioStats struct { - // number of bytes transferred to and from the block device - IoServiceBytesRecursive []BlkioStatEntry `json:"io_service_bytes_recursive"` - IoServicedRecursive []BlkioStatEntry `json:"io_serviced_recursive"` - IoQueuedRecursive []BlkioStatEntry `json:"io_queue_recursive"` - IoServiceTimeRecursive []BlkioStatEntry `json:"io_service_time_recursive"` - IoWaitTimeRecursive []BlkioStatEntry `json:"io_wait_time_recursive"` - IoMergedRecursive []BlkioStatEntry `json:"io_merged_recursive"` - IoTimeRecursive []BlkioStatEntry `json:"io_time_recursive"` - SectorsRecursive []BlkioStatEntry `json:"sectors_recursive"` -} - -// StorageStats is the disk I/O stats for read/write on Windows. -type StorageStats struct { - ReadCountNormalized uint64 `json:"read_count_normalized,omitempty"` - ReadSizeBytes uint64 `json:"read_size_bytes,omitempty"` - WriteCountNormalized uint64 `json:"write_count_normalized,omitempty"` - WriteSizeBytes uint64 `json:"write_size_bytes,omitempty"` -} - -// NetworkStats aggregates the network stats of one container -type NetworkStats struct { - // Bytes received. Windows and Linux. - RxBytes uint64 `json:"rx_bytes"` - // Packets received. Windows and Linux. - RxPackets uint64 `json:"rx_packets"` - // Received errors. Not used on Windows. Note that we dont `omitempty` this - // field as it is expected in the >=v1.21 API stats structure. - RxErrors uint64 `json:"rx_errors"` - // Incoming packets dropped. Windows and Linux. - RxDropped uint64 `json:"rx_dropped"` - // Bytes sent. Windows and Linux. - TxBytes uint64 `json:"tx_bytes"` - // Packets sent. Windows and Linux. - TxPackets uint64 `json:"tx_packets"` - // Sent errors. Not used on Windows. Note that we dont `omitempty` this - // field as it is expected in the >=v1.21 API stats structure. - TxErrors uint64 `json:"tx_errors"` - // Outgoing packets dropped. Windows and Linux. - TxDropped uint64 `json:"tx_dropped"` - // Endpoint ID. Not used on Linux. - EndpointID string `json:"endpoint_id,omitempty"` - // Instance ID. Not used on Linux. - InstanceID string `json:"instance_id,omitempty"` -} - -// PidsStats contains the stats of a container's pids -type PidsStats struct { - // Current is the number of pids in the cgroup - Current uint64 `json:"current,omitempty"` - // Limit is the hard limit on the number of pids in the cgroup. - // A "Limit" of 0 means that there is no limit. - Limit uint64 `json:"limit,omitempty"` -} - -// Stats is Ultimate struct aggregating all types of stats of one container -type Stats struct { - // Common stats - Read time.Time `json:"read"` - PreRead time.Time `json:"preread"` - - // Linux specific stats, not populated on Windows. - PidsStats PidsStats `json:"pids_stats,omitempty"` - BlkioStats BlkioStats `json:"blkio_stats,omitempty"` - - // Windows specific stats, not populated on Linux. - NumProcs uint32 `json:"num_procs"` - StorageStats StorageStats `json:"storage_stats,omitempty"` - - // Shared stats - CPUStats CPUStats `json:"cpu_stats,omitempty"` - PreCPUStats CPUStats `json:"precpu_stats,omitempty"` // "Pre"="Previous" - MemoryStats MemoryStats `json:"memory_stats,omitempty"` -} - -// StatsJSON is newly used Networks -type StatsJSON struct { - Stats - - Name string `json:"name,omitempty"` - ID string `json:"id,omitempty"` - - // Networks request version >=1.21 - Networks map[string]NetworkStats `json:"networks,omitempty"` -}
  38. Download patch api/types/container/container_update.go

    --- 1.13.1~ds3-4/api/types/container/container_update.go 2017-02-08 05:58:41.000000000 +0000 +++ 17.12.1-0ubuntu5/api/types/container/container_update.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,17 +0,0 @@ -package container - -// ---------------------------------------------------------------------------- -// DO NOT EDIT THIS FILE -// This file was generated by `swagger generate operation` -// -// See hack/swagger-gen.sh -// ---------------------------------------------------------------------------- - -// ContainerUpdateOKBody container update o k body -// swagger:model ContainerUpdateOKBody -type ContainerUpdateOKBody struct { - - // warnings - // Required: true - Warnings []string `json:"Warnings"` -}
  39. Download patch api/server/middleware/experimental.go

    --- 1.13.1~ds3-4/api/server/middleware/experimental.go 2017-02-08 05:58:41.000000000 +0000 +++ 17.12.1-0ubuntu5/api/server/middleware/experimental.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,29 +0,0 @@ -package middleware - -import ( - "net/http" - - "golang.org/x/net/context" -) - -// ExperimentalMiddleware is a the middleware in charge of adding the -// 'Docker-Experimental' header to every outgoing request -type ExperimentalMiddleware struct { - experimental string -} - -// NewExperimentalMiddleware creates a new ExperimentalMiddleware -func NewExperimentalMiddleware(experimentalEnabled bool) ExperimentalMiddleware { - if experimentalEnabled { - return ExperimentalMiddleware{"true"} - } - return ExperimentalMiddleware{"false"} -} - -// WrapHandler returns a new handler function wrapping the previous one in the request chain. -func (e ExperimentalMiddleware) WrapHandler(handler func(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error) func(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error { - return func(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error { - w.Header().Set("Docker-Experimental", e.experimental) - return handler(ctx, w, r, vars) - } -}
  40. Download patch api/server/middleware/debug.go

    --- 1.13.1~ds3-4/api/server/middleware/debug.go 2017-02-08 05:58:41.000000000 +0000 +++ 17.12.1-0ubuntu5/api/server/middleware/debug.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,76 +0,0 @@ -package middleware - -import ( - "bufio" - "encoding/json" - "io" - "net/http" - "strings" - - "github.com/Sirupsen/logrus" - "github.com/docker/docker/api/server/httputils" - "github.com/docker/docker/pkg/ioutils" - "golang.org/x/net/context" -) - -// DebugRequestMiddleware dumps the request to logger -func DebugRequestMiddleware(handler func(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error) func(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error { - return func(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error { - logrus.Debugf("Calling %s %s", r.Method, r.RequestURI) - - if r.Method != "POST" { - return handler(ctx, w, r, vars) - } - if err := httputils.CheckForJSON(r); err != nil { - return handler(ctx, w, r, vars) - } - maxBodySize := 4096 // 4KB - if r.ContentLength > int64(maxBodySize) { - return handler(ctx, w, r, vars) - } - - body := r.Body - bufReader := bufio.NewReaderSize(body, maxBodySize) - r.Body = ioutils.NewReadCloserWrapper(bufReader, func() error { return body.Close() }) - - b, err := bufReader.Peek(maxBodySize) - if err != io.EOF { - // either there was an error reading, or the buffer is full (in which case the request is too large) - return handler(ctx, w, r, vars) - } - - var postForm map[string]interface{} - if err := json.Unmarshal(b, &postForm); err == nil { - maskSecretKeys(postForm) - formStr, errMarshal := json.Marshal(postForm) - if errMarshal == nil { - logrus.Debugf("form data: %s", string(formStr)) - } else { - logrus.Debugf("form data: %q", postForm) - } - } - - return handler(ctx, w, r, vars) - } -} - -func maskSecretKeys(inp interface{}) { - if arr, ok := inp.([]interface{}); ok { - for _, f := range arr { - maskSecretKeys(f) - } - return - } - if form, ok := inp.(map[string]interface{}); ok { - loop0: - for k, v := range form { - for _, m := range []string{"password", "secret", "jointoken", "unlockkey"} { - if strings.EqualFold(m, k) { - form[k] = "*****" - continue loop0 - } - } - maskSecretKeys(v) - } - } -}
  41. Download patch api/types/registry/authenticate.go

    --- 1.13.1~ds3-4/api/types/registry/authenticate.go 2017-02-08 05:58:41.000000000 +0000 +++ 17.12.1-0ubuntu5/api/types/registry/authenticate.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,21 +0,0 @@ -package registry - -// ---------------------------------------------------------------------------- -// DO NOT EDIT THIS FILE -// This file was generated by `swagger generate operation` -// -// See hack/swagger-gen.sh -// ---------------------------------------------------------------------------- - -// AuthenticateOKBody authenticate o k body -// swagger:model AuthenticateOKBody -type AuthenticateOKBody struct { - - // An opaque token used to authenticate a user after a successful login - // Required: true - IdentityToken string `json:"IdentityToken"` - - // The status of the authentication - // Required: true - Status string `json:"Status"` -}
  42. Download patch api/server/server.go
  43. Download patch api/server/httputils/form.go

    --- 1.13.1~ds3-4/api/server/httputils/form.go 2017-02-08 05:58:41.000000000 +0000 +++ 17.12.1-0ubuntu5/api/server/httputils/form.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,73 +0,0 @@ -package httputils - -import ( - "fmt" - "net/http" - "path/filepath" - "strconv" - "strings" -) - -// BoolValue transforms a form value in different formats into a boolean type. -func BoolValue(r *http.Request, k string) bool { - s := strings.ToLower(strings.TrimSpace(r.FormValue(k))) - return !(s == "" || s == "0" || s == "no" || s == "false" || s == "none") -} - -// BoolValueOrDefault returns the default bool passed if the query param is -// missing, otherwise it's just a proxy to boolValue above -func BoolValueOrDefault(r *http.Request, k string, d bool) bool { - if _, ok := r.Form[k]; !ok { - return d - } - return BoolValue(r, k) -} - -// Int64ValueOrZero parses a form value into an int64 type. -// It returns 0 if the parsing fails. -func Int64ValueOrZero(r *http.Request, k string) int64 { - val, err := Int64ValueOrDefault(r, k, 0) - if err != nil { - return 0 - } - return val -} - -// Int64ValueOrDefault parses a form value into an int64 type. If there is an -// error, returns the error. If there is no value returns the default value. -func Int64ValueOrDefault(r *http.Request, field string, def int64) (int64, error) { - if r.Form.Get(field) != "" { - value, err := strconv.ParseInt(r.Form.Get(field), 10, 64) - if err != nil { - return value, err - } - return value, nil - } - return def, nil -} - -// ArchiveOptions stores archive information for different operations. -type ArchiveOptions struct { - Name string - Path string -} - -// ArchiveFormValues parses form values and turns them into ArchiveOptions. -// It fails if the archive name and path are not in the request. -func ArchiveFormValues(r *http.Request, vars map[string]string) (ArchiveOptions, error) { - if err := ParseForm(r); err != nil { - return ArchiveOptions{}, err - } - - name := vars["name"] - path := filepath.FromSlash(r.Form.Get("path")) - - switch { - case name == "": - return ArchiveOptions{}, fmt.Errorf("bad parameter: 'name' cannot be empty") - case path == "": - return ArchiveOptions{}, fmt.Errorf("bad parameter: 'path' cannot be empty") - } - - return ArchiveOptions{name, path}, nil -}
  44. Download patch api/types/id_response.go

    --- 1.13.1~ds3-4/api/types/id_response.go 2017-02-08 05:58:41.000000000 +0000 +++ 17.12.1-0ubuntu5/api/types/id_response.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,13 +0,0 @@ -package types - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -// IDResponse Response to an API call that returns just an Id -// swagger:model IdResponse -type IDResponse struct { - - // The id of the newly created object. - // Required: true - ID string `json:"Id"` -}
  45. Download patch api/server/router/volume/backend.go

    --- 1.13.1~ds3-4/api/server/router/volume/backend.go 2017-02-08 05:58:41.000000000 +0000 +++ 17.12.1-0ubuntu5/api/server/router/volume/backend.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,17 +0,0 @@ -package volume - -import ( - // TODO return types need to be refactored into pkg - "github.com/docker/docker/api/types" - "github.com/docker/docker/api/types/filters" -) - -// Backend is the methods that need to be implemented to provide -// volume specific functionality -type Backend interface { - Volumes(filter string) ([]*types.Volume, []string, error) - VolumeInspect(name string) (*types.Volume, error) - VolumeCreate(name, driverName string, opts, labels map[string]string) (*types.Volume, error) - VolumeRm(name string, force bool) error - VolumesPrune(pruneFilters filters.Args) (*types.VolumesPruneReport, error) -}
  46. Download patch api/server/httputils/httputils_write_json_go16.go

    --- 1.13.1~ds3-4/api/server/httputils/httputils_write_json_go16.go 2017-02-08 05:58:41.000000000 +0000 +++ 17.12.1-0ubuntu5/api/server/httputils/httputils_write_json_go16.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,16 +0,0 @@ -// +build go1.6,!go1.7 - -package httputils - -import ( - "encoding/json" - "net/http" -) - -// WriteJSON writes the value v to the http response stream as json with standard json encoding. -func WriteJSON(w http.ResponseWriter, code int, v interface{}) error { - w.Header().Set("Content-Type", "application/json") - w.WriteHeader(code) - enc := json.NewEncoder(w) - return enc.Encode(v) -}
  47. Download patch api/types/network/network.go

    --- 1.13.1~ds3-4/api/types/network/network.go 2017-02-08 05:58:41.000000000 +0000 +++ 17.12.1-0ubuntu5/api/types/network/network.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,59 +0,0 @@ -package network - -// Address represents an IP address -type Address struct { - Addr string - PrefixLen int -} - -// IPAM represents IP Address Management -type IPAM struct { - Driver string - Options map[string]string //Per network IPAM driver options - Config []IPAMConfig -} - -// IPAMConfig represents IPAM configurations -type IPAMConfig struct { - Subnet string `json:",omitempty"` - IPRange string `json:",omitempty"` - Gateway string `json:",omitempty"` - AuxAddress map[string]string `json:"AuxiliaryAddresses,omitempty"` -} - -// EndpointIPAMConfig represents IPAM configurations for the endpoint -type EndpointIPAMConfig struct { - IPv4Address string `json:",omitempty"` - IPv6Address string `json:",omitempty"` - LinkLocalIPs []string `json:",omitempty"` -} - -// PeerInfo represents one peer of a overlay network -type PeerInfo struct { - Name string - IP string -} - -// EndpointSettings stores the network endpoint details -type EndpointSettings struct { - // Configurations - IPAMConfig *EndpointIPAMConfig - Links []string - Aliases []string - // Operational data - NetworkID string - EndpointID string - Gateway string - IPAddress string - IPPrefixLen int - IPv6Gateway string - GlobalIPv6Address string - GlobalIPv6PrefixLen int - MacAddress string -} - -// NetworkingConfig represents the container's networking configuration for each of its interfaces -// Carries the networking configs specified in the `docker run` and `docker network connect` commands -type NetworkingConfig struct { - EndpointsConfig map[string]*EndpointSettings // Endpoint configs for each connecting network -}
  48. Download patch api/server/router/build/backend.go

    --- 1.13.1~ds3-4/api/server/router/build/backend.go 2017-02-08 05:58:41.000000000 +0000 +++ 17.12.1-0ubuntu5/api/server/router/build/backend.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,20 +0,0 @@ -package build - -import ( - "io" - - "github.com/docker/docker/api/types" - "github.com/docker/docker/api/types/backend" - "golang.org/x/net/context" -) - -// Backend abstracts an image builder whose only purpose is to build an image referenced by an imageID. -type Backend interface { - // Build builds a Docker image referenced by an imageID string. - // - // Note: Tagging an image should not be done by a Builder, it should instead be done - // by the caller. - // - // TODO: make this return a reference instead of string - BuildFromContext(ctx context.Context, src io.ReadCloser, remote string, buildOptions *types.ImageBuildOptions, pg backend.ProgressWriter) (string, error) -}
  49. Download patch api/types/swarm/container.go

    --- 1.13.1~ds3-4/api/types/swarm/container.go 2017-02-08 05:58:41.000000000 +0000 +++ 17.12.1-0ubuntu5/api/types/swarm/container.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,46 +0,0 @@ -package swarm - -import ( - "time" - - "github.com/docker/docker/api/types/container" - "github.com/docker/docker/api/types/mount" -) - -// DNSConfig specifies DNS related configurations in resolver configuration file (resolv.conf) -// Detailed documentation is available in: -// http://man7.org/linux/man-pages/man5/resolv.conf.5.html -// `nameserver`, `search`, `options` have been supported. -// TODO: `domain` is not supported yet. -type DNSConfig struct { - // Nameservers specifies the IP addresses of the name servers - Nameservers []string `json:",omitempty"` - // Search specifies the search list for host-name lookup - Search []string `json:",omitempty"` - // Options allows certain internal resolver variables to be modified - Options []string `json:",omitempty"` -} - -// ContainerSpec represents the spec of a container. -type ContainerSpec struct { - Image string `json:",omitempty"` - Labels map[string]string `json:",omitempty"` - Command []string `json:",omitempty"` - Args []string `json:",omitempty"` - Hostname string `json:",omitempty"` - Env []string `json:",omitempty"` - Dir string `json:",omitempty"` - User string `json:",omitempty"` - Groups []string `json:",omitempty"` - TTY bool `json:",omitempty"` - OpenStdin bool `json:",omitempty"` - Mounts []mount.Mount `json:",omitempty"` - StopGracePeriod *time.Duration `json:",omitempty"` - Healthcheck *container.HealthConfig `json:",omitempty"` - // The format of extra hosts on swarmkit is specified in: - // http://man7.org/linux/man-pages/man5/hosts.5.html - // IP_address canonical_hostname [aliases...] - Hosts []string `json:",omitempty"` - DNSConfig *DNSConfig `json:",omitempty"` - Secrets []*SecretReference `json:",omitempty"` -}
  50. Download patch api/server/profiler.go

    --- 1.13.1~ds3-4/api/server/profiler.go 2017-02-08 05:58:41.000000000 +0000 +++ 17.12.1-0ubuntu5/api/server/profiler.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,41 +0,0 @@ -package server - -import ( - "expvar" - "fmt" - "net/http" - "net/http/pprof" - - "github.com/gorilla/mux" -) - -const debugPathPrefix = "/debug/" - -func profilerSetup(mainRouter *mux.Router) { - var r = mainRouter.PathPrefix(debugPathPrefix).Subrouter() - r.HandleFunc("/vars", expVars) - r.HandleFunc("/pprof/", pprof.Index) - r.HandleFunc("/pprof/cmdline", pprof.Cmdline) - r.HandleFunc("/pprof/profile", pprof.Profile) - r.HandleFunc("/pprof/symbol", pprof.Symbol) - r.HandleFunc("/pprof/trace", pprof.Trace) - r.HandleFunc("/pprof/block", pprof.Handler("block").ServeHTTP) - r.HandleFunc("/pprof/heap", pprof.Handler("heap").ServeHTTP) - r.HandleFunc("/pprof/goroutine", pprof.Handler("goroutine").ServeHTTP) - r.HandleFunc("/pprof/threadcreate", pprof.Handler("threadcreate").ServeHTTP) -} - -// Replicated from expvar.go as not public. -func expVars(w http.ResponseWriter, r *http.Request) { - first := true - w.Header().Set("Content-Type", "application/json; charset=utf-8") - fmt.Fprintf(w, "{\n") - expvar.Do(func(kv expvar.KeyValue) { - if !first { - fmt.Fprintf(w, ",\n") - } - first = false - fmt.Fprintf(w, "%q: %s", kv.Key, kv.Value) - }) - fmt.Fprintf(w, "\n}\n") -}
  51. Download patch api/server/router/checkpoint/checkpoint_routes.go

    --- 1.13.1~ds3-4/api/server/router/checkpoint/checkpoint_routes.go 2017-02-08 05:58:41.000000000 +0000 +++ 17.12.1-0ubuntu5/api/server/router/checkpoint/checkpoint_routes.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,65 +0,0 @@ -package checkpoint - -import ( - "encoding/json" - "net/http" - - "github.com/docker/docker/api/server/httputils" - "github.com/docker/docker/api/types" - "golang.org/x/net/context" -) - -func (s *checkpointRouter) postContainerCheckpoint(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error { - if err := httputils.ParseForm(r); err != nil { - return err - } - - var options types.CheckpointCreateOptions - - decoder := json.NewDecoder(r.Body) - if err := decoder.Decode(&options); err != nil { - return err - } - - err := s.backend.CheckpointCreate(vars["name"], options) - if err != nil { - return err - } - - w.WriteHeader(http.StatusCreated) - return nil -} - -func (s *checkpointRouter) getContainerCheckpoints(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error { - if err := httputils.ParseForm(r); err != nil { - return err - } - - checkpoints, err := s.backend.CheckpointList(vars["name"], types.CheckpointListOptions{ - CheckpointDir: r.Form.Get("dir"), - }) - - if err != nil { - return err - } - - return httputils.WriteJSON(w, http.StatusOK, checkpoints) -} - -func (s *checkpointRouter) deleteContainerCheckpoint(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error { - if err := httputils.ParseForm(r); err != nil { - return err - } - - err := s.backend.CheckpointDelete(vars["name"], types.CheckpointDeleteOptions{ - CheckpointDir: r.Form.Get("dir"), - CheckpointID: vars["checkpoint"], - }) - - if err != nil { - return err - } - - w.WriteHeader(http.StatusNoContent) - return nil -}
  52. Download patch api/types/reference/image_reference.go

    --- 1.13.1~ds3-4/api/types/reference/image_reference.go 2017-02-08 05:58:41.000000000 +0000 +++ 17.12.1-0ubuntu5/api/types/reference/image_reference.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,34 +0,0 @@ -package reference - -import ( - distreference "github.com/docker/distribution/reference" -) - -// Parse parses the given references and returns the repository and -// tag (if present) from it. If there is an error during parsing, it will -// return an error. -func Parse(ref string) (string, string, error) { - distributionRef, err := distreference.ParseNamed(ref) - if err != nil { - return "", "", err - } - - tag := GetTagFromNamedRef(distributionRef) - return distributionRef.Name(), tag, nil -} - -// GetTagFromNamedRef returns a tag from the specified reference. -// This function is necessary as long as the docker "server" api makes the distinction between repository -// and tags. -func GetTagFromNamedRef(ref distreference.Named) string { - var tag string - switch x := ref.(type) { - case distreference.Digested: - tag = x.Digest().String() - case distreference.NamedTagged: - tag = x.Tag() - default: - tag = "latest" - } - return tag -}
  53. Download patch api/server/router/system/system_routes.go

    --- 1.13.1~ds3-4/api/server/router/system/system_routes.go 2017-02-08 05:58:41.000000000 +0000 +++ 17.12.1-0ubuntu5/api/server/router/system/system_routes.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,186 +0,0 @@ -package system - -import ( - "encoding/json" - "fmt" - "net/http" - "time" - - "github.com/Sirupsen/logrus" - "github.com/docker/docker/api" - "github.com/docker/docker/api/errors" - "github.com/docker/docker/api/server/httputils" - "github.com/docker/docker/api/types" - "github.com/docker/docker/api/types/events" - "github.com/docker/docker/api/types/filters" - "github.com/docker/docker/api/types/registry" - timetypes "github.com/docker/docker/api/types/time" - "github.com/docker/docker/api/types/versions" - "github.com/docker/docker/pkg/ioutils" - "golang.org/x/net/context" -) - -func optionsHandler(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error { - w.WriteHeader(http.StatusOK) - return nil -} - -func pingHandler(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error { - _, err := w.Write([]byte{'O', 'K'}) - return err -} - -func (s *systemRouter) getInfo(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error { - info, err := s.backend.SystemInfo() - if err != nil { - return err - } - if s.clusterProvider != nil { - info.Swarm = s.clusterProvider.Info() - } - - if versions.LessThan(httputils.VersionFromContext(ctx), "1.25") { - // TODO: handle this conversion in engine-api - type oldInfo struct { - *types.Info - ExecutionDriver string - } - old := &oldInfo{ - Info: info, - ExecutionDriver: "<not supported>", - } - nameOnlySecurityOptions := []string{} - kvSecOpts, err := types.DecodeSecurityOptions(old.SecurityOptions) - if err != nil { - return err - } - for _, s := range kvSecOpts { - nameOnlySecurityOptions = append(nameOnlySecurityOptions, s.Name) - } - old.SecurityOptions = nameOnlySecurityOptions - return httputils.WriteJSON(w, http.StatusOK, old) - } - return httputils.WriteJSON(w, http.StatusOK, info) -} - -func (s *systemRouter) getVersion(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error { - info := s.backend.SystemVersion() - info.APIVersion = api.DefaultVersion - - return httputils.WriteJSON(w, http.StatusOK, info) -} - -func (s *systemRouter) getDiskUsage(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error { - du, err := s.backend.SystemDiskUsage() - if err != nil { - return err - } - - return httputils.WriteJSON(w, http.StatusOK, du) -} - -func (s *systemRouter) getEvents(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error { - if err := httputils.ParseForm(r); err != nil { - return err - } - - since, err := eventTime(r.Form.Get("since")) - if err != nil { - return err - } - until, err := eventTime(r.Form.Get("until")) - if err != nil { - return err - } - - var ( - timeout <-chan time.Time - onlyPastEvents bool - ) - if !until.IsZero() { - if until.Before(since) { - return errors.NewBadRequestError(fmt.Errorf("`since` time (%s) cannot be after `until` time (%s)", r.Form.Get("since"), r.Form.Get("until"))) - } - - now := time.Now() - - onlyPastEvents = until.Before(now) - - if !onlyPastEvents { - dur := until.Sub(now) - timeout = time.NewTimer(dur).C - } - } - - ef, err := filters.FromParam(r.Form.Get("filters")) - if err != nil { - return err - } - - w.Header().Set("Content-Type", "application/json") - output := ioutils.NewWriteFlusher(w) - defer output.Close() - output.Flush() - - enc := json.NewEncoder(output) - - buffered, l := s.backend.SubscribeToEvents(since, until, ef) - defer s.backend.UnsubscribeFromEvents(l) - - for _, ev := range buffered { - if err := enc.Encode(ev); err != nil { - return err - } - } - - if onlyPastEvents { - return nil - } - - for { - select { - case ev := <-l: - jev, ok := ev.(events.Message) - if !ok { - logrus.Warnf("unexpected event message: %q", ev) - continue - } - if err := enc.Encode(jev); err != nil { - return err - } - case <-timeout: - return nil - case <-ctx.Done(): - logrus.Debug("Client context cancelled, stop sending events") - return nil - } - } -} - -func (s *systemRouter) postAuth(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error { - var config *types.AuthConfig - err := json.NewDecoder(r.Body).Decode(&config) - r.Body.Close() - if err != nil { - return err - } - status, token, err := s.backend.AuthenticateToRegistry(ctx, config) - if err != nil { - return err - } - return httputils.WriteJSON(w, http.StatusOK, &registry.AuthenticateOKBody{ - Status: status, - IdentityToken: token, - }) -} - -func eventTime(formTime string) (time.Time, error) { - t, tNano, err := timetypes.ParseTimestamps(formTime, -1) - if err != nil { - return time.Time{}, err - } - if t == -1 { - return time.Time{}, nil - } - return time.Unix(t, tNano), nil -}
  54. Download patch api/server/router/system/backend.go

    --- 1.13.1~ds3-4/api/server/router/system/backend.go 2017-02-08 05:58:41.000000000 +0000 +++ 17.12.1-0ubuntu5/api/server/router/system/backend.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,21 +0,0 @@ -package system - -import ( - "time" - - "github.com/docker/docker/api/types" - "github.com/docker/docker/api/types/events" - "github.com/docker/docker/api/types/filters" - "golang.org/x/net/context" -) - -// Backend is the methods that need to be implemented to provide -// system specific functionality. -type Backend interface { - SystemInfo() (*types.Info, error) - SystemVersion() types.Version - SystemDiskUsage() (*types.DiskUsage, error) - SubscribeToEvents(since, until time.Time, ef filters.Args) ([]events.Message, chan interface{}) - UnsubscribeFromEvents(chan interface{}) - AuthenticateToRegistry(ctx context.Context, authConfig *types.AuthConfig) (string, string, error) -}
  55. Download patch api/types/plugin_interface_type.go

    --- 1.13.1~ds3-4/api/types/plugin_interface_type.go 2017-02-08 05:58:41.000000000 +0000 +++ 17.12.1-0ubuntu5/api/types/plugin_interface_type.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,21 +0,0 @@ -package types - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -// PluginInterfaceType plugin interface type -// swagger:model PluginInterfaceType -type PluginInterfaceType struct { - - // capability - // Required: true - Capability string `json:"Capability"` - - // prefix - // Required: true - Prefix string `json:"Prefix"` - - // version - // Required: true - Version string `json:"Version"` -}
  56. Download patch api/types/container/hostconfig_unix.go

    --- 1.13.1~ds3-4/api/types/container/hostconfig_unix.go 2017-02-08 05:58:41.000000000 +0000 +++ 17.12.1-0ubuntu5/api/types/container/hostconfig_unix.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,81 +0,0 @@ -// +build !windows - -package container - -import "strings" - -// IsValid indicates if an isolation technology is valid -func (i Isolation) IsValid() bool { - return i.IsDefault() -} - -// IsPrivate indicates whether container uses its private network stack. -func (n NetworkMode) IsPrivate() bool { - return !(n.IsHost() || n.IsContainer()) -} - -// IsDefault indicates whether container uses the default network stack. -func (n NetworkMode) IsDefault() bool { - return n == "default" -} - -// NetworkName returns the name of the network stack. -func (n NetworkMode) NetworkName() string { - if n.IsBridge() { - return "bridge" - } else if n.IsHost() { - return "host" - } else if n.IsContainer() { - return "container" - } else if n.IsNone() { - return "none" - } else if n.IsDefault() { - return "default" - } else if n.IsUserDefined() { - return n.UserDefined() - } - return "" -} - -// IsBridge indicates whether container uses the bridge network stack -func (n NetworkMode) IsBridge() bool { - return n == "bridge" -} - -// IsHost indicates whether container uses the host network stack. -func (n NetworkMode) IsHost() bool { - return n == "host" -} - -// IsContainer indicates whether container uses a container network stack. -func (n NetworkMode) IsContainer() bool { - parts := strings.SplitN(string(n), ":", 2) - return len(parts) > 1 && parts[0] == "container" -} - -// IsNone indicates whether container isn't using a network stack. -func (n NetworkMode) IsNone() bool { - return n == "none" -} - -// ConnectedContainer is the id of the container which network this container is connected to. -func (n NetworkMode) ConnectedContainer() string { - parts := strings.SplitN(string(n), ":", 2) - if len(parts) > 1 { - return parts[1] - } - return "" -} - -// IsUserDefined indicates user-created network -func (n NetworkMode) IsUserDefined() bool { - return !n.IsDefault() && !n.IsBridge() && !n.IsHost() && !n.IsNone() && !n.IsContainer() -} - -//UserDefined indicates user-created network -func (n NetworkMode) UserDefined() string { - if n.IsUserDefined() { - return string(n) - } - return "" -}
  57. Download patch api/types/configs.go

    --- 1.13.1~ds3-4/api/types/configs.go 2017-02-08 05:58:41.000000000 +0000 +++ 17.12.1-0ubuntu5/api/types/configs.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,69 +0,0 @@ -package types - -import ( - "github.com/docker/docker/api/types/container" - "github.com/docker/docker/api/types/network" -) - -// configs holds structs used for internal communication between the -// frontend (such as an http server) and the backend (such as the -// docker daemon). - -// ContainerCreateConfig is the parameter set to ContainerCreate() -type ContainerCreateConfig struct { - Name string - Config *container.Config - HostConfig *container.HostConfig - NetworkingConfig *network.NetworkingConfig - AdjustCPUShares bool -} - -// ContainerRmConfig holds arguments for the container remove -// operation. This struct is used to tell the backend what operations -// to perform. -type ContainerRmConfig struct { - ForceRemove, RemoveVolume, RemoveLink bool -} - -// ContainerCommitConfig contains build configs for commit operation, -// and is used when making a commit with the current state of the container. -type ContainerCommitConfig struct { - Pause bool - Repo string - Tag string - Author string - Comment string - // merge container config into commit config before commit - MergeConfigs bool - Config *container.Config -} - -// ExecConfig is a small subset of the Config struct that holds the configuration -// for the exec feature of docker. -type ExecConfig struct { - User string // User that will run the command - Privileged bool // Is the container in privileged mode - Tty bool // Attach standard streams to a tty. - AttachStdin bool // Attach the standard input, makes possible user interaction - AttachStderr bool // Attach the standard error - AttachStdout bool // Attach the standard output - Detach bool // Execute in detach mode - DetachKeys string // Escape keys for detach - Env []string // Environment variables - Cmd []string // Execution commands and args -} - -// PluginRmConfig holds arguments for plugin remove. -type PluginRmConfig struct { - ForceRemove bool -} - -// PluginEnableConfig holds arguments for plugin enable -type PluginEnableConfig struct { - Timeout int -} - -// PluginDisableConfig holds arguments for plugin disable. -type PluginDisableConfig struct { - ForceDisable bool -}
  58. Download patch api/types/plugin_responses.go

    --- 1.13.1~ds3-4/api/types/plugin_responses.go 2017-02-08 05:58:41.000000000 +0000 +++ 17.12.1-0ubuntu5/api/types/plugin_responses.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,64 +0,0 @@ -package types - -import ( - "encoding/json" - "fmt" -) - -// PluginsListResponse contains the response for the Engine API -type PluginsListResponse []*Plugin - -const ( - authzDriver = "AuthzDriver" - graphDriver = "GraphDriver" - ipamDriver = "IpamDriver" - networkDriver = "NetworkDriver" - volumeDriver = "VolumeDriver" -) - -// UnmarshalJSON implements json.Unmarshaler for PluginInterfaceType -func (t *PluginInterfaceType) UnmarshalJSON(p []byte) error { - versionIndex := len(p) - prefixIndex := 0 - if len(p) < 2 || p[0] != '"' || p[len(p)-1] != '"' { - return fmt.Errorf("%q is not a plugin interface type", p) - } - p = p[1 : len(p)-1] -loop: - for i, b := range p { - switch b { - case '.': - prefixIndex = i - case '/': - versionIndex = i - break loop - } - } - t.Prefix = string(p[:prefixIndex]) - t.Capability = string(p[prefixIndex+1 : versionIndex]) - if versionIndex < len(p) { - t.Version = string(p[versionIndex+1:]) - } - return nil -} - -// MarshalJSON implements json.Marshaler for PluginInterfaceType -func (t *PluginInterfaceType) MarshalJSON() ([]byte, error) { - return json.Marshal(t.String()) -} - -// String implements fmt.Stringer for PluginInterfaceType -func (t PluginInterfaceType) String() string { - return fmt.Sprintf("%s.%s/%s", t.Prefix, t.Capability, t.Version) -} - -// PluginPrivilege describes a permission the user has to accept -// upon installing a plugin. -type PluginPrivilege struct { - Name string - Description string - Value []string -} - -// PluginPrivileges is a list of PluginPrivilege -type PluginPrivileges []PluginPrivilege
  59. Download patch api/types/plugin_mount.go

    --- 1.13.1~ds3-4/api/types/plugin_mount.go 2017-02-08 05:58:41.000000000 +0000 +++ 17.12.1-0ubuntu5/api/types/plugin_mount.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,37 +0,0 @@ -package types - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -// PluginMount plugin mount -// swagger:model PluginMount -type PluginMount struct { - - // description - // Required: true - Description string `json:"Description"` - - // destination - // Required: true - Destination string `json:"Destination"` - - // name - // Required: true - Name string `json:"Name"` - - // options - // Required: true - Options []string `json:"Options"` - - // settable - // Required: true - Settable []string `json:"Settable"` - - // source - // Required: true - Source *string `json:"Source"` - - // type - // Required: true - Type string `json:"Type"` -}
  60. Download patch api/server/httputils/form_test.go

    --- 1.13.1~ds3-4/api/server/httputils/form_test.go 2017-02-08 05:58:41.000000000 +0000 +++ 17.12.1-0ubuntu5/api/server/httputils/form_test.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,105 +0,0 @@ -package httputils - -import ( - "net/http" - "net/url" - "testing" -) - -func TestBoolValue(t *testing.T) { - cases := map[string]bool{ - "": false, - "0": false, - "no": false, - "false": false, - "none": false, - "1": true, - "yes": true, - "true": true, - "one": true, - "100": true, - } - - for c, e := range cases { - v := url.Values{} - v.Set("test", c) - r, _ := http.NewRequest("POST", "", nil) - r.Form = v - - a := BoolValue(r, "test") - if a != e { - t.Fatalf("Value: %s, expected: %v, actual: %v", c, e, a) - } - } -} - -func TestBoolValueOrDefault(t *testing.T) { - r, _ := http.NewRequest("GET", "", nil) - if !BoolValueOrDefault(r, "queryparam", true) { - t.Fatal("Expected to get true default value, got false") - } - - v := url.Values{} - v.Set("param", "") - r, _ = http.NewRequest("GET", "", nil) - r.Form = v - if BoolValueOrDefault(r, "param", true) { - t.Fatal("Expected not to get true") - } -} - -func TestInt64ValueOrZero(t *testing.T) { - cases := map[string]int64{ - "": 0, - "asdf": 0, - "0": 0, - "1": 1, - } - - for c, e := range cases { - v := url.Values{} - v.Set("test", c) - r, _ := http.NewRequest("POST", "", nil) - r.Form = v - - a := Int64ValueOrZero(r, "test") - if a != e { - t.Fatalf("Value: %s, expected: %v, actual: %v", c, e, a) - } - } -} - -func TestInt64ValueOrDefault(t *testing.T) { - cases := map[string]int64{ - "": -1, - "-1": -1, - "42": 42, - } - - for c, e := range cases { - v := url.Values{} - v.Set("test", c) - r, _ := http.NewRequest("POST", "", nil) - r.Form = v - - a, err := Int64ValueOrDefault(r, "test", -1) - if a != e { - t.Fatalf("Value: %s, expected: %v, actual: %v", c, e, a) - } - if err != nil { - t.Fatalf("Error should be nil, but received: %s", err) - } - } -} - -func TestInt64ValueOrDefaultWithError(t *testing.T) { - v := url.Values{} - v.Set("test", "invalid") - r, _ := http.NewRequest("POST", "", nil) - r.Form = v - - _, err := Int64ValueOrDefault(r, "test", -1) - if err == nil { - t.Fatalf("Expected an error.") - } -}
  61. Download patch api/README.md

    --- 1.13.1~ds3-4/api/README.md 2017-02-08 05:58:41.000000000 +0000 +++ 17.12.1-0ubuntu5/api/README.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,42 +0,0 @@ -# Working on the Engine API - -The Engine API is an HTTP API used by the command-line client to communicate with the daemon. It can also be used by third-party software to control the daemon. - -It consists of various components in this repository: - -- `api/swagger.yaml` A Swagger definition of the API. -- `api/types/` Types shared by both the client and server, representing various objects, options, responses, etc. Most are written manually, but some are automatically generated from the Swagger definition. See [#27919](https://github.com/docker/docker/issues/27919) for progress on this. -- `cli/` The command-line client. -- `client/` The Go client used by the command-line client. It can also be used by third-party Go programs. -- `daemon/` The daemon, which serves the API. - -## Swagger definition - -The API is defined by the [Swagger](http://swagger.io/specification/) definition in `api/swagger.yaml`. This definition can be used to: - -1. To automatically generate documentation. -2. To automatically generate the Go server and client. (A work-in-progress.) -3. Provide a machine readable version of the API for introspecting what it can do, automatically generating clients for other languages, etc. - -## Updating the API documentation - -The API documentation is generated entirely from `api/swagger.yaml`. If you make updates to the API, you'll need to edit this file to represent the change in the documentation. - -The file is split into two main sections: - -- `definitions`, which defines re-usable objects used in requests and responses -- `paths`, which defines the API endpoints (and some inline objects which don't need to be reusable) - -To make an edit, first look for the endpoint you want to edit under `paths`, then make the required edits. Endpoints may reference reusable objects with `$ref`, which can be found in the `definitions` section. - -There is hopefully enough example material in the file for you to copy a similar pattern from elsewhere in the file (e.g. adding new fields or endpoints), but for the full reference, see the [Swagger specification](https://github.com/docker/docker/issues/27919) - -`swagger.yaml` is validated by `hack/validate/swagger` to ensure it is a valid Swagger definition. This is useful for when you are making edits to ensure you are doing the right thing. - -## Viewing the API documentation - -When you make edits to `swagger.yaml`, you may want to check the generated API documentation to ensure it renders correctly. - -All the documentation generation is done in the documentation repository, [docker/docker.github.io](https://github.com/docker/docker.github.io). The Swagger definition is vendored periodically into this repository, but you can manually copy over the Swagger definition to test changes. - -Copy `api/swagger.yaml` in this repository to `engine/api/[VERSION_NUMBER]/swagger.yaml` in the documentation repository, overwriting what is already there. Then, run `docker-compose up` in the documentation repository and browse to [http://localhost:4000/engine/api/](http://localhost:4000/engine/api/) when it finishes rendering.
  62. Download patch api/server/router/experimental.go

    --- 1.13.1~ds3-4/api/server/router/experimental.go 2017-02-08 05:58:41.000000000 +0000 +++ 17.12.1-0ubuntu5/api/server/router/experimental.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,67 +0,0 @@ -package router - -import ( - "errors" - "net/http" - - "golang.org/x/net/context" - - apierrors "github.com/docker/docker/api/errors" - "github.com/docker/docker/api/server/httputils" -) - -var ( - errExperimentalFeature = errors.New("This experimental feature is disabled by default. Start the Docker daemon with --experimental in order to enable it.") -) - -// ExperimentalRoute defines an experimental API route that can be enabled or disabled. -type ExperimentalRoute interface { - Route - - Enable() - Disable() -} - -// experimentalRoute defines an experimental API route that can be enabled or disabled. -// It implements ExperimentalRoute -type experimentalRoute struct { - local Route - handler httputils.APIFunc -} - -// Enable enables this experimental route -func (r *experimentalRoute) Enable() { - r.handler = r.local.Handler() -} - -// Disable disables the experimental route -func (r *experimentalRoute) Disable() { - r.handler = experimentalHandler -} - -func experimentalHandler(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error { - return apierrors.NewErrorWithStatusCode(errExperimentalFeature, http.StatusNotImplemented) -} - -// Handler returns returns the APIFunc to let the server wrap it in middlewares. -func (r *experimentalRoute) Handler() httputils.APIFunc { - return r.handler -} - -// Method returns the http method that the route responds to. -func (r *experimentalRoute) Method() string { - return r.local.Method() -} - -// Path returns the subpath where the route responds to. -func (r *experimentalRoute) Path() string { - return r.local.Path() -} - -// Experimental will mark a route as experimental. -func Experimental(r Route) Route { - return &experimentalRoute{ - local: r, - handler: experimentalHandler, - } -}
  63. Download patch api/server/router/checkpoint/backend.go

    --- 1.13.1~ds3-4/api/server/router/checkpoint/backend.go 2017-02-08 05:58:41.000000000 +0000 +++ 17.12.1-0ubuntu5/api/server/router/checkpoint/backend.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,10 +0,0 @@ -package checkpoint - -import "github.com/docker/docker/api/types" - -// Backend for Checkpoint -type Backend interface { - CheckpointCreate(container string, config types.CheckpointCreateOptions) error - CheckpointDelete(container string, config types.CheckpointDeleteOptions) error - CheckpointList(container string, config types.CheckpointListOptions) ([]types.Checkpoint, error) -}
  64. Download patch api/server/middleware/version.go

    --- 1.13.1~ds3-4/api/server/middleware/version.go 2017-02-08 05:58:41.000000000 +0000 +++ 17.12.1-0ubuntu5/api/server/middleware/version.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,50 +0,0 @@ -package middleware - -import ( - "fmt" - "net/http" - "runtime" - - "github.com/docker/docker/api/errors" - "github.com/docker/docker/api/types/versions" - "golang.org/x/net/context" -) - -// VersionMiddleware is a middleware that -// validates the client and server versions. -type VersionMiddleware struct { - serverVersion string - defaultVersion string - minVersion string -} - -// NewVersionMiddleware creates a new VersionMiddleware -// with the default versions. -func NewVersionMiddleware(s, d, m string) VersionMiddleware { - return VersionMiddleware{ - serverVersion: s, - defaultVersion: d, - minVersion: m, - } -} - -// WrapHandler returns a new handler function wrapping the previous one in the request chain. -func (v VersionMiddleware) WrapHandler(handler func(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error) func(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error { - return func(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error { - apiVersion := vars["version"] - if apiVersion == "" { - apiVersion = v.defaultVersion - } - - if versions.LessThan(apiVersion, v.minVersion) { - return errors.NewBadRequestError(fmt.Errorf("client version %s is too old. Minimum supported API version is %s, please upgrade your client to a newer version", apiVersion, v.minVersion)) - } - - header := fmt.Sprintf("Docker/%s (%s)", v.serverVersion, runtime.GOOS) - w.Header().Set("Server", header) - w.Header().Set("API-Version", v.defaultVersion) - ctx = context.WithValue(ctx, "api-version", apiVersion) - return handler(ctx, w, r, vars) - } - -}
  65. Download patch api/types/swarm/common.go

    --- 1.13.1~ds3-4/api/types/swarm/common.go 2017-02-08 05:58:41.000000000 +0000 +++ 17.12.1-0ubuntu5/api/types/swarm/common.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,27 +0,0 @@ -package swarm - -import "time" - -// Version represents the internal object version. -type Version struct { - Index uint64 `json:",omitempty"` -} - -// Meta is a base object inherited by most of the other once. -type Meta struct { - Version Version `json:",omitempty"` - CreatedAt time.Time `json:",omitempty"` - UpdatedAt time.Time `json:",omitempty"` -} - -// Annotations represents how to describe an object. -type Annotations struct { - Name string `json:",omitempty"` - Labels map[string]string `json:",omitempty"` -} - -// Driver represents a driver (network, logging). -type Driver struct { - Name string `json:",omitempty"` - Options map[string]string `json:",omitempty"` -}
  66. Download patch api/types/error_response.go

    --- 1.13.1~ds3-4/api/types/error_response.go 2017-02-08 05:58:41.000000000 +0000 +++ 17.12.1-0ubuntu5/api/types/error_response.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,13 +0,0 @@ -package types - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -// ErrorResponse Represents an error. -// swagger:model ErrorResponse -type ErrorResponse struct { - - // The error message. - // Required: true - Message string `json:"message"` -}
  67. Download patch api/swagger-gen.yaml

    --- 1.13.1~ds3-4/api/swagger-gen.yaml 2017-02-08 05:58:41.000000000 +0000 +++ 17.12.1-0ubuntu5/api/swagger-gen.yaml 1970-01-01 00:00:00.000000000 +0000 @@ -1,12 +0,0 @@ - -layout: - models: - - name: definition - source: asset:model - target: "{{ joinFilePath .Target .ModelPackage }}" - file_name: "{{ (snakize (pascalize .Name)) }}.go" - operations: - - name: handler - source: asset:serverOperation - target: "{{ joinFilePath .Target .APIPackage .Package }}" - file_name: "{{ (snakize (pascalize .Name)) }}.go"
  68. Download patch api/server/router/router.go

    --- 1.13.1~ds3-4/api/server/router/router.go 2017-02-08 05:58:41.000000000 +0000 +++ 17.12.1-0ubuntu5/api/server/router/router.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,19 +0,0 @@ -package router - -import "github.com/docker/docker/api/server/httputils" - -// Router defines an interface to specify a group of routes to add to the docker server. -type Router interface { - // Routes returns the list of routes to add to the docker server. - Routes() []Route -} - -// Route defines an individual API route in the docker server. -type Route interface { - // Handler returns the raw function to create the http handler. - Handler() httputils.APIFunc - // Method returns the http method that the route responds to. - Method() string - // Path returns the subpath where the route responds to. - Path() string -}
  69. Download patch api/types/registry/registry.go

    --- 1.13.1~ds3-4/api/types/registry/registry.go 2017-02-08 05:58:41.000000000 +0000 +++ 17.12.1-0ubuntu5/api/types/registry/registry.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,104 +0,0 @@ -package registry - -import ( - "encoding/json" - "net" -) - -// ServiceConfig stores daemon registry services configuration. -type ServiceConfig struct { - InsecureRegistryCIDRs []*NetIPNet `json:"InsecureRegistryCIDRs"` - IndexConfigs map[string]*IndexInfo `json:"IndexConfigs"` - Mirrors []string -} - -// NetIPNet is the net.IPNet type, which can be marshalled and -// unmarshalled to JSON -type NetIPNet net.IPNet - -// String returns the CIDR notation of ipnet -func (ipnet *NetIPNet) String() string { - return (*net.IPNet)(ipnet).String() -} - -// MarshalJSON returns the JSON representation of the IPNet -func (ipnet *NetIPNet) MarshalJSON() ([]byte, error) { - return json.Marshal((*net.IPNet)(ipnet).String()) -} - -// UnmarshalJSON sets the IPNet from a byte array of JSON -func (ipnet *NetIPNet) UnmarshalJSON(b []byte) (err error) { - var ipnetStr string - if err = json.Unmarshal(b, &ipnetStr); err == nil { - var cidr *net.IPNet - if _, cidr, err = net.ParseCIDR(ipnetStr); err == nil { - *ipnet = NetIPNet(*cidr) - } - } - return -} - -// IndexInfo contains information about a registry -// -// RepositoryInfo Examples: -// { -// "Index" : { -// "Name" : "docker.io", -// "Mirrors" : ["https://registry-2.docker.io/v1/", "https://registry-3.docker.io/v1/"], -// "Secure" : true, -// "Official" : true, -// }, -// "RemoteName" : "library/debian", -// "LocalName" : "debian", -// "CanonicalName" : "docker.io/debian" -// "Official" : true, -// } -// -// { -// "Index" : { -// "Name" : "127.0.0.1:5000", -// "Mirrors" : [], -// "Secure" : false, -// "Official" : false, -// }, -// "RemoteName" : "user/repo", -// "LocalName" : "127.0.0.1:5000/user/repo", -// "CanonicalName" : "127.0.0.1:5000/user/repo", -// "Official" : false, -// } -type IndexInfo struct { - // Name is the name of the registry, such as "docker.io" - Name string - // Mirrors is a list of mirrors, expressed as URIs - Mirrors []string - // Secure is set to false if the registry is part of the list of - // insecure registries. Insecure registries accept HTTP and/or accept - // HTTPS with certificates from unknown CAs. - Secure bool - // Official indicates whether this is an official registry - Official bool -} - -// SearchResult describes a search result returned from a registry -type SearchResult struct { - // StarCount indicates the number of stars this repository has - StarCount int `json:"star_count"` - // IsOfficial is true if the result is from an official repository. - IsOfficial bool `json:"is_official"` - // Name is the name of the repository - Name string `json:"name"` - // IsAutomated indicates whether the result is automated - IsAutomated bool `json:"is_automated"` - // Description is a textual description of the repository - Description string `json:"description"` -} - -// SearchResults lists a collection search results returned from a registry -type SearchResults struct { - // Query contains the query string that generated the search results - Query string `json:"query"` - // NumResults indicates the number of results the query returned - NumResults int `json:"num_results"` - // Results is a slice containing the actual results for the search - Results []SearchResult `json:"results"` -}
  70. Download patch api/types/blkiodev/blkio.go

    --- 1.13.1~ds3-4/api/types/blkiodev/blkio.go 2017-02-08 05:58:41.000000000 +0000 +++ 17.12.1-0ubuntu5/api/types/blkiodev/blkio.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,23 +0,0 @@ -package blkiodev - -import "fmt" - -// WeightDevice is a structure that holds device:weight pair -type WeightDevice struct { - Path string - Weight uint16 -} - -func (w *WeightDevice) String() string { - return fmt.Sprintf("%s:%d", w.Path, w.Weight) -} - -// ThrottleDevice is a structure that holds device:rate_per_second pair -type ThrottleDevice struct { - Path string - Rate uint64 -} - -func (t *ThrottleDevice) String() string { - return fmt.Sprintf("%s:%d", t.Path, t.Rate) -}
  71. Download patch api/server/router/network/network.go

    --- 1.13.1~ds3-4/api/server/router/network/network.go 2017-02-08 05:58:41.000000000 +0000 +++ 17.12.1-0ubuntu5/api/server/router/network/network.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,44 +0,0 @@ -package network - -import ( - "github.com/docker/docker/api/server/router" - "github.com/docker/docker/daemon/cluster" -) - -// networkRouter is a router to talk with the network controller -type networkRouter struct { - backend Backend - clusterProvider *cluster.Cluster - routes []router.Route -} - -// NewRouter initializes a new network router -func NewRouter(b Backend, c *cluster.Cluster) router.Router { - r := &networkRouter{ - backend: b, - clusterProvider: c, - } - r.initRoutes() - return r -} - -// Routes returns the available routes to the network controller -func (r *networkRouter) Routes() []router.Route { - return r.routes -} - -func (r *networkRouter) initRoutes() { - r.routes = []router.Route{ - // GET - router.NewGetRoute("/networks", r.getNetworksList), - router.NewGetRoute("/networks/", r.getNetworksList), - router.NewGetRoute("/networks/{id:.+}", r.getNetwork), - // POST - router.NewPostRoute("/networks/create", r.postNetworkCreate), - router.NewPostRoute("/networks/{id:.*}/connect", r.postNetworkConnect), - router.NewPostRoute("/networks/{id:.*}/disconnect", r.postNetworkDisconnect), - router.NewPostRoute("/networks/prune", r.postNetworksPrune), - // DELETE - router.NewDeleteRoute("/networks/{id:.*}", r.deleteNetwork), - } -}
  72. Download patch api/server/router/local.go

    --- 1.13.1~ds3-4/api/server/router/local.go 2017-02-08 05:58:41.000000000 +0000 +++ 17.12.1-0ubuntu5/api/server/router/local.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,96 +0,0 @@ -package router - -import ( - "net/http" - - "github.com/docker/docker/api/server/httputils" - "golang.org/x/net/context" -) - -// localRoute defines an individual API route to connect -// with the docker daemon. It implements Route. -type localRoute struct { - method string - path string - handler httputils.APIFunc -} - -// Handler returns the APIFunc to let the server wrap it in middlewares. -func (l localRoute) Handler() httputils.APIFunc { - return l.handler -} - -// Method returns the http method that the route responds to. -func (l localRoute) Method() string { - return l.method -} - -// Path returns the subpath where the route responds to. -func (l localRoute) Path() string { - return l.path -} - -// NewRoute initializes a new local route for the router. -func NewRoute(method, path string, handler httputils.APIFunc) Route { - return localRoute{method, path, handler} -} - -// NewGetRoute initializes a new route with the http method GET. -func NewGetRoute(path string, handler httputils.APIFunc) Route { - return NewRoute("GET", path, handler) -} - -// NewPostRoute initializes a new route with the http method POST. -func NewPostRoute(path string, handler httputils.APIFunc) Route { - return NewRoute("POST", path, handler) -} - -// NewPutRoute initializes a new route with the http method PUT. -func NewPutRoute(path string, handler httputils.APIFunc) Route { - return NewRoute("PUT", path, handler) -} - -// NewDeleteRoute initializes a new route with the http method DELETE. -func NewDeleteRoute(path string, handler httputils.APIFunc) Route { - return NewRoute("DELETE", path, handler) -} - -// NewOptionsRoute initializes a new route with the http method OPTIONS. -func NewOptionsRoute(path string, handler httputils.APIFunc) Route { - return NewRoute("OPTIONS", path, handler) -} - -// NewHeadRoute initializes a new route with the http method HEAD. -func NewHeadRoute(path string, handler httputils.APIFunc) Route { - return NewRoute("HEAD", path, handler) -} - -func cancellableHandler(h httputils.APIFunc) httputils.APIFunc { - return func(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error { - if notifier, ok := w.(http.CloseNotifier); ok { - notify := notifier.CloseNotify() - notifyCtx, cancel := context.WithCancel(ctx) - finished := make(chan struct{}) - defer close(finished) - ctx = notifyCtx - go func() { - select { - case <-notify: - cancel() - case <-finished: - } - }() - } - return h(ctx, w, r, vars) - } -} - -// Cancellable makes new route which embeds http.CloseNotifier feature to -// context.Context of handler. -func Cancellable(r Route) Route { - return localRoute{ - method: r.Method(), - path: r.Path(), - handler: cancellableHandler(r.Handler()), - } -}
  73. Download patch api/types/strslice/strslice.go

    --- 1.13.1~ds3-4/api/types/strslice/strslice.go 2017-02-08 05:58:41.000000000 +0000 +++ 17.12.1-0ubuntu5/api/types/strslice/strslice.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,30 +0,0 @@ -package strslice - -import "encoding/json" - -// StrSlice represents a string or an array of strings. -// We need to override the json decoder to accept both options. -type StrSlice []string - -// UnmarshalJSON decodes the byte slice whether it's a string or an array of -// strings. This method is needed to implement json.Unmarshaler. -func (e *StrSlice) UnmarshalJSON(b []byte) error { - if len(b) == 0 { - // With no input, we preserve the existing value by returning nil and - // leaving the target alone. This allows defining default values for - // the type. - return nil - } - - p := make([]string, 0, 1) - if err := json.Unmarshal(b, &p); err != nil { - var s string - if err := json.Unmarshal(b, &s); err != nil { - return err - } - p = append(p, s) - } - - *e = p - return nil -}
  74. Download patch api/server/router/plugin/plugin.go

    --- 1.13.1~ds3-4/api/server/router/plugin/plugin.go 2017-02-08 05:58:41.000000000 +0000 +++ 17.12.1-0ubuntu5/api/server/router/plugin/plugin.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,39 +0,0 @@ -package plugin - -import "github.com/docker/docker/api/server/router" - -// pluginRouter is a router to talk with the plugin controller -type pluginRouter struct { - backend Backend - routes []router.Route -} - -// NewRouter initializes a new plugin router -func NewRouter(b Backend) router.Router { - r := &pluginRouter{ - backend: b, - } - r.initRoutes() - return r -} - -// Routes returns the available routers to the plugin controller -func (r *pluginRouter) Routes() []router.Route { - return r.routes -} - -func (r *pluginRouter) initRoutes() { - r.routes = []router.Route{ - router.NewGetRoute("/plugins", r.listPlugins), - router.NewGetRoute("/plugins/{name:.*}/json", r.inspectPlugin), - router.NewGetRoute("/plugins/privileges", r.getPrivileges), - router.NewDeleteRoute("/plugins/{name:.*}", r.removePlugin), - router.NewPostRoute("/plugins/{name:.*}/enable", r.enablePlugin), // PATCH? - router.NewPostRoute("/plugins/{name:.*}/disable", r.disablePlugin), - router.Cancellable(router.NewPostRoute("/plugins/pull", r.pullPlugin)), - router.Cancellable(router.NewPostRoute("/plugins/{name:.*}/push", r.pushPlugin)), - router.Cancellable(router.NewPostRoute("/plugins/{name:.*}/upgrade", r.upgradePlugin)), - router.NewPostRoute("/plugins/{name:.*}/set", r.setPlugin), - router.NewPostRoute("/plugins/create", r.createPlugin), - } -}
  75. Download patch api/server/router/image/image_routes.go
  76. Download patch api/server/httputils/decoder.go

    --- 1.13.1~ds3-4/api/server/httputils/decoder.go 2017-02-08 05:58:41.000000000 +0000 +++ 17.12.1-0ubuntu5/api/server/httputils/decoder.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,16 +0,0 @@ -package httputils - -import ( - "io" - - "github.com/docker/docker/api/types/container" - "github.com/docker/docker/api/types/network" -) - -// ContainerDecoder specifies how -// to translate an io.Reader into -// container configuration. -type ContainerDecoder interface { - DecodeConfig(src io.Reader) (*container.Config, *container.HostConfig, *network.NetworkingConfig, error) - DecodeHostConfig(src io.Reader) (*container.HostConfig, error) -}
  77. Download patch api/types/container/hostconfig_windows.go

    --- 1.13.1~ds3-4/api/types/container/hostconfig_windows.go 2017-02-08 05:58:41.000000000 +0000 +++ 17.12.1-0ubuntu5/api/types/container/hostconfig_windows.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,87 +0,0 @@ -package container - -import ( - "strings" -) - -// IsDefault indicates whether container uses the default network stack. -func (n NetworkMode) IsDefault() bool { - return n == "default" -} - -// IsNone indicates whether container isn't using a network stack. -func (n NetworkMode) IsNone() bool { - return n == "none" -} - -// IsContainer indicates whether container uses a container network stack. -// Returns false as windows doesn't support this mode -func (n NetworkMode) IsContainer() bool { - return false -} - -// IsBridge indicates whether container uses the bridge network stack -// in windows it is given the name NAT -func (n NetworkMode) IsBridge() bool { - return n == "nat" -} - -// IsHost indicates whether container uses the host network stack. -// returns false as this is not supported by windows -func (n NetworkMode) IsHost() bool { - return false -} - -// IsPrivate indicates whether container uses its private network stack. -func (n NetworkMode) IsPrivate() bool { - return !(n.IsHost() || n.IsContainer()) -} - -// ConnectedContainer is the id of the container which network this container is connected to. -// Returns blank string on windows -func (n NetworkMode) ConnectedContainer() string { - return "" -} - -// IsUserDefined indicates user-created network -func (n NetworkMode) IsUserDefined() bool { - return !n.IsDefault() && !n.IsNone() && !n.IsBridge() -} - -// IsHyperV indicates the use of a Hyper-V partition for isolation -func (i Isolation) IsHyperV() bool { - return strings.ToLower(string(i)) == "hyperv" -} - -// IsProcess indicates the use of process isolation -func (i Isolation) IsProcess() bool { - return strings.ToLower(string(i)) == "process" -} - -// IsValid indicates if an isolation technology is valid -func (i Isolation) IsValid() bool { - return i.IsDefault() || i.IsHyperV() || i.IsProcess() -} - -// NetworkName returns the name of the network stack. -func (n NetworkMode) NetworkName() string { - if n.IsDefault() { - return "default" - } else if n.IsBridge() { - return "nat" - } else if n.IsNone() { - return "none" - } else if n.IsUserDefined() { - return n.UserDefined() - } - - return "" -} - -//UserDefined indicates user-created network -func (n NetworkMode) UserDefined() string { - if n.IsUserDefined() { - return string(n) - } - return "" -}
  78. Download patch api/server/middleware/version_test.go

    --- 1.13.1~ds3-4/api/server/middleware/version_test.go 2017-02-08 05:58:41.000000000 +0000 +++ 17.12.1-0ubuntu5/api/server/middleware/version_test.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,57 +0,0 @@ -package middleware - -import ( - "net/http" - "net/http/httptest" - "strings" - "testing" - - "github.com/docker/docker/api/server/httputils" - "golang.org/x/net/context" -) - -func TestVersionMiddleware(t *testing.T) { - handler := func(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error { - if httputils.VersionFromContext(ctx) == "" { - t.Fatalf("Expected version, got empty string") - } - return nil - } - - defaultVersion := "1.10.0" - minVersion := "1.2.0" - m := NewVersionMiddleware(defaultVersion, defaultVersion, minVersion) - h := m.WrapHandler(handler) - - req, _ := http.NewRequest("GET", "/containers/json", nil) - resp := httptest.NewRecorder() - ctx := context.Background() - if err := h(ctx, resp, req, map[string]string{}); err != nil { - t.Fatal(err) - } -} - -func TestVersionMiddlewareWithErrors(t *testing.T) { - handler := func(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error { - if httputils.VersionFromContext(ctx) == "" { - t.Fatalf("Expected version, got empty string") - } - return nil - } - - defaultVersion := "1.10.0" - minVersion := "1.2.0" - m := NewVersionMiddleware(defaultVersion, defaultVersion, minVersion) - h := m.WrapHandler(handler) - - req, _ := http.NewRequest("GET", "/containers/json", nil) - resp := httptest.NewRecorder() - ctx := context.Background() - - vars := map[string]string{"version": "0.1"} - err := h(ctx, resp, req, vars) - - if !strings.Contains(err.Error(), "client version 0.1 is too old. Minimum supported API version is 1.2.0") { - t.Fatalf("Expected too old client error, got %v", err) - } -}
  79. Download patch api/server/router/container/container.go

    --- 1.13.1~ds3-4/api/server/router/container/container.go 2017-02-08 05:58:41.000000000 +0000 +++ 17.12.1-0ubuntu5/api/server/router/container/container.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,77 +0,0 @@ -package container - -import ( - "github.com/docker/docker/api/server/httputils" - "github.com/docker/docker/api/server/router" -) - -type validationError struct { - error -} - -func (validationError) IsValidationError() bool { - return true -} - -// containerRouter is a router to talk with the container controller -type containerRouter struct { - backend Backend - decoder httputils.ContainerDecoder - routes []router.Route -} - -// NewRouter initializes a new container router -func NewRouter(b Backend, decoder httputils.ContainerDecoder) router.Router { - r := &containerRouter{ - backend: b, - decoder: decoder, - } - r.initRoutes() - return r -} - -// Routes returns the available routes to the container controller -func (r *containerRouter) Routes() []router.Route { - return r.routes -} - -// initRoutes initializes the routes in container router -func (r *containerRouter) initRoutes() { - r.routes = []router.Route{ - // HEAD - router.NewHeadRoute("/containers/{name:.*}/archive", r.headContainersArchive), - // GET - router.NewGetRoute("/containers/json", r.getContainersJSON), - router.NewGetRoute("/containers/{name:.*}/export", r.getContainersExport), - router.NewGetRoute("/containers/{name:.*}/changes", r.getContainersChanges), - router.NewGetRoute("/containers/{name:.*}/json", r.getContainersByName), - router.NewGetRoute("/containers/{name:.*}/top", r.getContainersTop), - router.Cancellable(router.NewGetRoute("/containers/{name:.*}/logs", r.getContainersLogs)), - router.Cancellable(router.NewGetRoute("/containers/{name:.*}/stats", r.getContainersStats)), - router.NewGetRoute("/containers/{name:.*}/attach/ws", r.wsContainersAttach), - router.NewGetRoute("/exec/{id:.*}/json", r.getExecByID), - router.NewGetRoute("/containers/{name:.*}/archive", r.getContainersArchive), - // POST - router.NewPostRoute("/containers/create", r.postContainersCreate), - router.NewPostRoute("/containers/{name:.*}/kill", r.postContainersKill), - router.NewPostRoute("/containers/{name:.*}/pause", r.postContainersPause), - router.NewPostRoute("/containers/{name:.*}/unpause", r.postContainersUnpause), - router.NewPostRoute("/containers/{name:.*}/restart", r.postContainersRestart), - router.NewPostRoute("/containers/{name:.*}/start", r.postContainersStart), - router.NewPostRoute("/containers/{name:.*}/stop", r.postContainersStop), - router.NewPostRoute("/containers/{name:.*}/wait", r.postContainersWait), - router.NewPostRoute("/containers/{name:.*}/resize", r.postContainersResize), - router.NewPostRoute("/containers/{name:.*}/attach", r.postContainersAttach), - router.NewPostRoute("/containers/{name:.*}/copy", r.postContainersCopy), // Deprecated since 1.8, Errors out since 1.12 - router.NewPostRoute("/containers/{name:.*}/exec", r.postContainerExecCreate), - router.NewPostRoute("/exec/{name:.*}/start", r.postContainerExecStart), - router.NewPostRoute("/exec/{name:.*}/resize", r.postContainerExecResize), - router.NewPostRoute("/containers/{name:.*}/rename", r.postContainerRename), - router.NewPostRoute("/containers/{name:.*}/update", r.postContainerUpdate), - router.NewPostRoute("/containers/prune", r.postContainersPrune), - // PUT - router.NewPutRoute("/containers/{name:.*}/archive", r.putContainersArchive), - // DELETE - router.NewDeleteRoute("/containers/{name:.*}", r.deleteContainers), - } -}
  80. Download patch api/types/plugin_device.go

    --- 1.13.1~ds3-4/api/types/plugin_device.go 2017-02-08 05:58:41.000000000 +0000 +++ 17.12.1-0ubuntu5/api/types/plugin_device.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,25 +0,0 @@ -package types - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -// PluginDevice plugin device -// swagger:model PluginDevice -type PluginDevice struct { - - // description - // Required: true - Description string `json:"Description"` - - // name - // Required: true - Name string `json:"Name"` - - // path - // Required: true - Path *string `json:"Path"` - - // settable - // Required: true - Settable []string `json:"Settable"` -}
  81. Download patch api/server/router/image/backend.go

    --- 1.13.1~ds3-4/api/server/router/image/backend.go 2017-02-08 05:58:41.000000000 +0000 +++ 17.12.1-0ubuntu5/api/server/router/image/backend.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,45 +0,0 @@ -package image - -import ( - "io" - - "github.com/docker/docker/api/types" - "github.com/docker/docker/api/types/backend" - "github.com/docker/docker/api/types/filters" - "github.com/docker/docker/api/types/registry" - "golang.org/x/net/context" -) - -// Backend is all the methods that need to be implemented -// to provide image specific functionality. -type Backend interface { - containerBackend - imageBackend - importExportBackend - registryBackend -} - -type containerBackend interface { - Commit(name string, config *backend.ContainerCommitConfig) (imageID string, err error) -} - -type imageBackend interface { - ImageDelete(imageRef string, force, prune bool) ([]types.ImageDelete, error) - ImageHistory(imageName string) ([]*types.ImageHistory, error) - Images(imageFilters filters.Args, all bool, withExtraAttrs bool) ([]*types.ImageSummary, error) - LookupImage(name string) (*types.ImageInspect, error) - TagImage(imageName, repository, tag string) error - ImagesPrune(pruneFilters filters.Args) (*types.ImagesPruneReport, error) -} - -type importExportBackend interface { - LoadImage(inTar io.ReadCloser, outStream io.Writer, quiet bool) error - ImportImage(src string, repository, tag string, msg string, inConfig io.ReadCloser, outStream io.Writer, changes []string) error - ExportImage(names []string, outStream io.Writer) error -} - -type registryBackend interface { - PullImage(ctx context.Context, image, tag string, metaHeaders map[string][]string, authConfig *types.AuthConfig, outStream io.Writer) error - PushImage(ctx context.Context, image, tag string, metaHeaders map[string][]string, authConfig *types.AuthConfig, outStream io.Writer) error - SearchRegistryForImages(ctx context.Context, filtersArgs string, term string, limit int, authConfig *types.AuthConfig, metaHeaders map[string][]string) (*registry.SearchResults, error) -}
  82. Download patch api/errors/errors.go

    --- 1.13.1~ds3-4/api/errors/errors.go 2017-02-08 05:58:41.000000000 +0000 +++ 17.12.1-0ubuntu5/api/errors/errors.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,47 +0,0 @@ -package errors - -import "net/http" - -// apiError is an error wrapper that also -// holds information about response status codes. -type apiError struct { - error - statusCode int -} - -// HTTPErrorStatusCode returns a status code. -func (e apiError) HTTPErrorStatusCode() int { - return e.statusCode -} - -// NewErrorWithStatusCode allows you to associate -// a specific HTTP Status Code to an error. -// The Server will take that code and set -// it as the response status. -func NewErrorWithStatusCode(err error, code int) error { - return apiError{err, code} -} - -// NewBadRequestError creates a new API error -// that has the 400 HTTP status code associated to it. -func NewBadRequestError(err error) error { - return NewErrorWithStatusCode(err, http.StatusBadRequest) -} - -// NewRequestForbiddenError creates a new API error -// that has the 403 HTTP status code associated to it. -func NewRequestForbiddenError(err error) error { - return NewErrorWithStatusCode(err, http.StatusForbidden) -} - -// NewRequestNotFoundError creates a new API error -// that has the 404 HTTP status code associated to it. -func NewRequestNotFoundError(err error) error { - return NewErrorWithStatusCode(err, http.StatusNotFound) -} - -// NewRequestConflictError creates a new API error -// that has the 409 HTTP status code associated to it. -func NewRequestConflictError(err error) error { - return NewErrorWithStatusCode(err, http.StatusConflict) -}
  83. Download patch api/types/reference/image_reference_test.go

    --- 1.13.1~ds3-4/api/types/reference/image_reference_test.go 2017-02-08 05:58:41.000000000 +0000 +++ 17.12.1-0ubuntu5/api/types/reference/image_reference_test.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,72 +0,0 @@ -package reference - -import ( - "testing" -) - -func TestParse(t *testing.T) { - testCases := []struct { - ref string - expectedName string - expectedTag string - expectedError bool - }{ - { - ref: "", - expectedName: "", - expectedTag: "", - expectedError: true, - }, - { - ref: "repository", - expectedName: "repository", - expectedTag: "latest", - expectedError: false, - }, - { - ref: "repository:tag", - expectedName: "repository", - expectedTag: "tag", - expectedError: false, - }, - { - ref: "test.com/repository", - expectedName: "test.com/repository", - expectedTag: "latest", - expectedError: false, - }, - { - ref: "test.com:5000/test/repository", - expectedName: "test.com:5000/test/repository", - expectedTag: "latest", - expectedError: false, - }, - { - ref: "test.com:5000/repo@sha256:ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", - expectedName: "test.com:5000/repo", - expectedTag: "sha256:ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", - expectedError: false, - }, - { - ref: "test.com:5000/repo:tag@sha256:ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", - expectedName: "test.com:5000/repo", - expectedTag: "sha256:ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", - expectedError: false, - }, - } - - for _, c := range testCases { - name, tag, err := Parse(c.ref) - if err != nil && c.expectedError { - continue - } else if err != nil { - t.Fatalf("error with %s: %s", c.ref, err.Error()) - } - if name != c.expectedName { - t.Fatalf("expected name %s, got %s", c.expectedName, name) - } - if tag != c.expectedTag { - t.Fatalf("expected tag %s, got %s", c.expectedTag, tag) - } - } -}
  84. Download patch api/types/plugin.go

    --- 1.13.1~ds3-4/api/types/plugin.go 2017-02-08 05:58:41.000000000 +0000 +++ 17.12.1-0ubuntu5/api/types/plugin.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,189 +0,0 @@ -package types - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -// Plugin A plugin for the Engine API -// swagger:model Plugin -type Plugin struct { - - // config - // Required: true - Config PluginConfig `json:"Config"` - - // True when the plugin is running. False when the plugin is not running, only installed. - // Required: true - Enabled bool `json:"Enabled"` - - // Id - ID string `json:"Id,omitempty"` - - // name - // Required: true - Name string `json:"Name"` - - // plugin remote reference used to push/pull the plugin - PluginReference string `json:"PluginReference,omitempty"` - - // settings - // Required: true - Settings PluginSettings `json:"Settings"` -} - -// PluginConfig The config of a plugin. -// swagger:model PluginConfig -type PluginConfig struct { - - // args - // Required: true - Args PluginConfigArgs `json:"Args"` - - // description - // Required: true - Description string `json:"Description"` - - // documentation - // Required: true - Documentation string `json:"Documentation"` - - // entrypoint - // Required: true - Entrypoint []string `json:"Entrypoint"` - - // env - // Required: true - Env []PluginEnv `json:"Env"` - - // interface - // Required: true - Interface PluginConfigInterface `json:"Interface"` - - // linux - // Required: true - Linux PluginConfigLinux `json:"Linux"` - - // mounts - // Required: true - Mounts []PluginMount `json:"Mounts"` - - // network - // Required: true - Network PluginConfigNetwork `json:"Network"` - - // propagated mount - // Required: true - PropagatedMount string `json:"PropagatedMount"` - - // user - User PluginConfigUser `json:"User,omitempty"` - - // work dir - // Required: true - WorkDir string `json:"WorkDir"` - - // rootfs - Rootfs *PluginConfigRootfs `json:"rootfs,omitempty"` -} - -// PluginConfigArgs plugin config args -// swagger:model PluginConfigArgs -type PluginConfigArgs struct { - - // description - // Required: true - Description string `json:"Description"` - - // name - // Required: true - Name string `json:"Name"` - - // settable - // Required: true - Settable []string `json:"Settable"` - - // value - // Required: true - Value []string `json:"Value"` -} - -// PluginConfigInterface The interface between Docker and the plugin -// swagger:model PluginConfigInterface -type PluginConfigInterface struct { - - // socket - // Required: true - Socket string `json:"Socket"` - - // types - // Required: true - Types []PluginInterfaceType `json:"Types"` -} - -// PluginConfigLinux plugin config linux -// swagger:model PluginConfigLinux -type PluginConfigLinux struct { - - // allow all devices - // Required: true - AllowAllDevices bool `json:"AllowAllDevices"` - - // capabilities - // Required: true - Capabilities []string `json:"Capabilities"` - - // devices - // Required: true - Devices []PluginDevice `json:"Devices"` -} - -// PluginConfigNetwork plugin config network -// swagger:model PluginConfigNetwork -type PluginConfigNetwork struct { - - // type - // Required: true - Type string `json:"Type"` -} - -// PluginConfigRootfs plugin config rootfs -// swagger:model PluginConfigRootfs -type PluginConfigRootfs struct { - - // diff ids - DiffIds []string `json:"diff_ids"` - - // type - Type string `json:"type,omitempty"` -} - -// PluginConfigUser plugin config user -// swagger:model PluginConfigUser -type PluginConfigUser struct { - - // g ID - GID uint32 `json:"GID,omitempty"` - - // UID - UID uint32 `json:"UID,omitempty"` -} - -// PluginSettings Settings that can be modified by users. -// swagger:model PluginSettings -type PluginSettings struct { - - // args - // Required: true - Args []string `json:"Args"` - - // devices - // Required: true - Devices []PluginDevice `json:"Devices"` - - // env - // Required: true - Env []string `json:"Env"` - - // mounts - // Required: true - Mounts []PluginMount `json:"Mounts"` -}
  85. Download patch api/server/router/volume/volume_routes.go

    --- 1.13.1~ds3-4/api/server/router/volume/volume_routes.go 2017-02-08 05:58:41.000000000 +0000 +++ 17.12.1-0ubuntu5/api/server/router/volume/volume_routes.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,80 +0,0 @@ -package volume - -import ( - "encoding/json" - "net/http" - - "github.com/docker/docker/api/server/httputils" - "github.com/docker/docker/api/types/filters" - volumetypes "github.com/docker/docker/api/types/volume" - "golang.org/x/net/context" -) - -func (v *volumeRouter) getVolumesList(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error { - if err := httputils.ParseForm(r); err != nil { - return err - } - - volumes, warnings, err := v.backend.Volumes(r.Form.Get("filters")) - if err != nil { - return err - } - return httputils.WriteJSON(w, http.StatusOK, &volumetypes.VolumesListOKBody{Volumes: volumes, Warnings: warnings}) -} - -func (v *volumeRouter) getVolumeByName(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error { - if err := httputils.ParseForm(r); err != nil { - return err - } - - volume, err := v.backend.VolumeInspect(vars["name"]) - if err != nil { - return err - } - return httputils.WriteJSON(w, http.StatusOK, volume) -} - -func (v *volumeRouter) postVolumesCreate(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error { - if err := httputils.ParseForm(r); err != nil { - return err - } - - if err := httputils.CheckForJSON(r); err != nil { - return err - } - - var req volumetypes.VolumesCreateBody - if err := json.NewDecoder(r.Body).Decode(&req); err != nil { - return err - } - - volume, err := v.backend.VolumeCreate(req.Name, req.Driver, req.DriverOpts, req.Labels) - if err != nil { - return err - } - return httputils.WriteJSON(w, http.StatusCreated, volume) -} - -func (v *volumeRouter) deleteVolumes(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error { - if err := httputils.ParseForm(r); err != nil { - return err - } - force := httputils.BoolValue(r, "force") - if err := v.backend.VolumeRm(vars["name"], force); err != nil { - return err - } - w.WriteHeader(http.StatusNoContent) - return nil -} - -func (v *volumeRouter) postVolumesPrune(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error { - if err := httputils.ParseForm(r); err != nil { - return err - } - - pruneReport, err := v.backend.VolumesPrune(filters.Args{}) - if err != nil { - return err - } - return httputils.WriteJSON(w, http.StatusOK, pruneReport) -}
  86. Download patch api/server/router/swarm/cluster_routes.go
  87. Download patch api/common_test.go
  88. Download patch api/server/router/container/exec.go

    --- 1.13.1~ds3-4/api/server/router/container/exec.go 2017-02-08 05:58:41.000000000 +0000 +++ 17.12.1-0ubuntu5/api/server/router/container/exec.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,140 +0,0 @@ -package container - -import ( - "encoding/json" - "fmt" - "io" - "net/http" - "strconv" - - "github.com/Sirupsen/logrus" - "github.com/docker/docker/api/server/httputils" - "github.com/docker/docker/api/types" - "github.com/docker/docker/api/types/versions" - "github.com/docker/docker/pkg/stdcopy" - "golang.org/x/net/context" -) - -func (s *containerRouter) getExecByID(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error { - eConfig, err := s.backend.ContainerExecInspect(vars["id"]) - if err != nil { - return err - } - - return httputils.WriteJSON(w, http.StatusOK, eConfig) -} - -func (s *containerRouter) postContainerExecCreate(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error { - if err := httputils.ParseForm(r); err != nil { - return err - } - if err := httputils.CheckForJSON(r); err != nil { - return err - } - name := vars["name"] - - execConfig := &types.ExecConfig{} - if err := json.NewDecoder(r.Body).Decode(execConfig); err != nil { - return err - } - - if len(execConfig.Cmd) == 0 { - return fmt.Errorf("No exec command specified") - } - - // Register an instance of Exec in container. - id, err := s.backend.ContainerExecCreate(name, execConfig) - if err != nil { - logrus.Errorf("Error setting up exec command in container %s: %v", name, err) - return err - } - - return httputils.WriteJSON(w, http.StatusCreated, &types.IDResponse{ - ID: id, - }) -} - -// TODO(vishh): Refactor the code to avoid having to specify stream config as part of both create and start. -func (s *containerRouter) postContainerExecStart(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error { - if err := httputils.ParseForm(r); err != nil { - return err - } - - version := httputils.VersionFromContext(ctx) - if versions.GreaterThan(version, "1.21") { - if err := httputils.CheckForJSON(r); err != nil { - return err - } - } - - var ( - execName = vars["name"] - stdin, inStream io.ReadCloser - stdout, stderr, outStream io.Writer - ) - - execStartCheck := &types.ExecStartCheck{} - if err := json.NewDecoder(r.Body).Decode(execStartCheck); err != nil { - return err - } - - if exists, err := s.backend.ExecExists(execName); !exists { - return err - } - - if !execStartCheck.Detach { - var err error - // Setting up the streaming http interface. - inStream, outStream, err = httputils.HijackConnection(w) - if err != nil { - return err - } - defer httputils.CloseStreams(inStream, outStream) - - if _, ok := r.Header["Upgrade"]; ok { - fmt.Fprint(outStream, "HTTP/1.1 101 UPGRADED\r\nContent-Type: application/vnd.docker.raw-stream\r\nConnection: Upgrade\r\nUpgrade: tcp\r\n") - } else { - fmt.Fprint(outStream, "HTTP/1.1 200 OK\r\nContent-Type: application/vnd.docker.raw-stream\r\n") - } - - // copy headers that were removed as part of hijack - if err := w.Header().WriteSubset(outStream, nil); err != nil { - return err - } - fmt.Fprint(outStream, "\r\n") - - stdin = inStream - stdout = outStream - if !execStartCheck.Tty { - stderr = stdcopy.NewStdWriter(outStream, stdcopy.Stderr) - stdout = stdcopy.NewStdWriter(outStream, stdcopy.Stdout) - } - } - - // Now run the user process in container. - // Maybe we should we pass ctx here if we're not detaching? - if err := s.backend.ContainerExecStart(context.Background(), execName, stdin, stdout, stderr); err != nil { - if execStartCheck.Detach { - return err - } - stdout.Write([]byte(err.Error() + "\r\n")) - logrus.Errorf("Error running exec in container: %v", err) - } - return nil -} - -func (s *containerRouter) postContainerExecResize(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error { - if err := httputils.ParseForm(r); err != nil { - return err - } - height, err := strconv.Atoi(r.Form.Get("h")) - if err != nil { - return err - } - width, err := strconv.Atoi(r.Form.Get("w")) - if err != nil { - return err - } - - return s.backend.ContainerExecResize(vars["name"], height, width) -}
  89. Download patch api/types/seccomp.go

    --- 1.13.1~ds3-4/api/types/seccomp.go 2017-02-08 05:58:41.000000000 +0000 +++ 17.12.1-0ubuntu5/api/types/seccomp.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,93 +0,0 @@ -package types - -// Seccomp represents the config for a seccomp profile for syscall restriction. -type Seccomp struct { - DefaultAction Action `json:"defaultAction"` - // Architectures is kept to maintain backward compatibility with the old - // seccomp profile. - Architectures []Arch `json:"architectures,omitempty"` - ArchMap []Architecture `json:"archMap,omitempty"` - Syscalls []*Syscall `json:"syscalls"` -} - -// Architecture is used to represent an specific architecture -// and its sub-architectures -type Architecture struct { - Arch Arch `json:"architecture"` - SubArches []Arch `json:"subArchitectures"` -} - -// Arch used for architectures -type Arch string - -// Additional architectures permitted to be used for system calls -// By default only the native architecture of the kernel is permitted -const ( - ArchX86 Arch = "SCMP_ARCH_X86" - ArchX86_64 Arch = "SCMP_ARCH_X86_64" - ArchX32 Arch = "SCMP_ARCH_X32" - ArchARM Arch = "SCMP_ARCH_ARM" - ArchAARCH64 Arch = "SCMP_ARCH_AARCH64" - ArchMIPS Arch = "SCMP_ARCH_MIPS" - ArchMIPS64 Arch = "SCMP_ARCH_MIPS64" - ArchMIPS64N32 Arch = "SCMP_ARCH_MIPS64N32" - ArchMIPSEL Arch = "SCMP_ARCH_MIPSEL" - ArchMIPSEL64 Arch = "SCMP_ARCH_MIPSEL64" - ArchMIPSEL64N32 Arch = "SCMP_ARCH_MIPSEL64N32" - ArchPPC Arch = "SCMP_ARCH_PPC" - ArchPPC64 Arch = "SCMP_ARCH_PPC64" - ArchPPC64LE Arch = "SCMP_ARCH_PPC64LE" - ArchS390 Arch = "SCMP_ARCH_S390" - ArchS390X Arch = "SCMP_ARCH_S390X" -) - -// Action taken upon Seccomp rule match -type Action string - -// Define actions for Seccomp rules -const ( - ActKill Action = "SCMP_ACT_KILL" - ActTrap Action = "SCMP_ACT_TRAP" - ActErrno Action = "SCMP_ACT_ERRNO" - ActTrace Action = "SCMP_ACT_TRACE" - ActAllow Action = "SCMP_ACT_ALLOW" -) - -// Operator used to match syscall arguments in Seccomp -type Operator string - -// Define operators for syscall arguments in Seccomp -const ( - OpNotEqual Operator = "SCMP_CMP_NE" - OpLessThan Operator = "SCMP_CMP_LT" - OpLessEqual Operator = "SCMP_CMP_LE" - OpEqualTo Operator = "SCMP_CMP_EQ" - OpGreaterEqual Operator = "SCMP_CMP_GE" - OpGreaterThan Operator = "SCMP_CMP_GT" - OpMaskedEqual Operator = "SCMP_CMP_MASKED_EQ" -) - -// Arg used for matching specific syscall arguments in Seccomp -type Arg struct { - Index uint `json:"index"` - Value uint64 `json:"value"` - ValueTwo uint64 `json:"valueTwo"` - Op Operator `json:"op"` -} - -// Filter is used to conditionally apply Seccomp rules -type Filter struct { - Caps []string `json:"caps,omitempty"` - Arches []string `json:"arches,omitempty"` -} - -// Syscall is used to match a group of syscalls in Seccomp -type Syscall struct { - Name string `json:"name,omitempty"` - Names []string `json:"names,omitempty"` - Action Action `json:"action"` - Args []*Arg `json:"args"` - Comment string `json:"comment"` - Includes Filter `json:"includes"` - Excludes Filter `json:"excludes"` -}
  90. Download patch api/server/router/network/backend.go

    --- 1.13.1~ds3-4/api/server/router/network/backend.go 2017-02-08 05:58:41.000000000 +0000 +++ 17.12.1-0ubuntu5/api/server/router/network/backend.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,22 +0,0 @@ -package network - -import ( - "github.com/docker/docker/api/types" - "github.com/docker/docker/api/types/filters" - "github.com/docker/docker/api/types/network" - "github.com/docker/libnetwork" -) - -// Backend is all the methods that need to be implemented -// to provide network specific functionality. -type Backend interface { - FindNetwork(idName string) (libnetwork.Network, error) - GetNetworkByName(idName string) (libnetwork.Network, error) - GetNetworksByID(partialID string) []libnetwork.Network - GetNetworks() []libnetwork.Network - CreateNetwork(nc types.NetworkCreateRequest) (*types.NetworkCreateResponse, error) - ConnectContainerToNetwork(containerName, networkName string, endpointConfig *network.EndpointSettings) error - DisconnectContainerFromNetwork(containerName string, networkName string, force bool) error - DeleteNetwork(name string) error - NetworksPrune(pruneFilters filters.Args) (*types.NetworksPruneReport, error) -}
  91. Download patch api/server/router/build/build.go

    --- 1.13.1~ds3-4/api/server/router/build/build.go 2017-02-08 05:58:41.000000000 +0000 +++ 17.12.1-0ubuntu5/api/server/router/build/build.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,29 +0,0 @@ -package build - -import "github.com/docker/docker/api/server/router" - -// buildRouter is a router to talk with the build controller -type buildRouter struct { - backend Backend - routes []router.Route -} - -// NewRouter initializes a new build router -func NewRouter(b Backend) router.Router { - r := &buildRouter{ - backend: b, - } - r.initRoutes() - return r -} - -// Routes returns the available routers to the build controller -func (r *buildRouter) Routes() []router.Route { - return r.routes -} - -func (r *buildRouter) initRoutes() { - r.routes = []router.Route{ - router.Cancellable(router.NewPostRoute("/build", r.postBuild)), - } -}
  92. Download patch api/server/router/volume/volume.go

    --- 1.13.1~ds3-4/api/server/router/volume/volume.go 2017-02-08 05:58:41.000000000 +0000 +++ 17.12.1-0ubuntu5/api/server/router/volume/volume.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,36 +0,0 @@ -package volume - -import "github.com/docker/docker/api/server/router" - -// volumeRouter is a router to talk with the volumes controller -type volumeRouter struct { - backend Backend - routes []router.Route -} - -// NewRouter initializes a new volume router -func NewRouter(b Backend) router.Router { - r := &volumeRouter{ - backend: b, - } - r.initRoutes() - return r -} - -// Routes returns the available routes to the volumes controller -func (r *volumeRouter) Routes() []router.Route { - return r.routes -} - -func (r *volumeRouter) initRoutes() { - r.routes = []router.Route{ - // GET - router.NewGetRoute("/volumes", r.getVolumesList), - router.NewGetRoute("/volumes/{name:.*}", r.getVolumeByName), - // POST - router.NewPostRoute("/volumes/create", r.postVolumesCreate), - router.NewPostRoute("/volumes/prune", r.postVolumesPrune), - // DELETE - router.NewDeleteRoute("/volumes/{name:.*}", r.deleteVolumes), - } -}
  93. Download patch api/server/router/checkpoint/checkpoint.go

    --- 1.13.1~ds3-4/api/server/router/checkpoint/checkpoint.go 2017-02-08 05:58:41.000000000 +0000 +++ 17.12.1-0ubuntu5/api/server/router/checkpoint/checkpoint.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,36 +0,0 @@ -package checkpoint - -import ( - "github.com/docker/docker/api/server/httputils" - "github.com/docker/docker/api/server/router" -) - -// checkpointRouter is a router to talk with the checkpoint controller -type checkpointRouter struct { - backend Backend - decoder httputils.ContainerDecoder - routes []router.Route -} - -// NewRouter initializes a new checkpoint router -func NewRouter(b Backend, decoder httputils.ContainerDecoder) router.Router { - r := &checkpointRouter{ - backend: b, - decoder: decoder, - } - r.initRoutes() - return r -} - -// Routes returns the available routers to the checkpoint controller -func (r *checkpointRouter) Routes() []router.Route { - return r.routes -} - -func (r *checkpointRouter) initRoutes() { - r.routes = []router.Route{ - router.Experimental(router.NewGetRoute("/containers/{name:.*}/checkpoints", r.getContainerCheckpoints)), - router.Experimental(router.NewPostRoute("/containers/{name:.*}/checkpoints", r.postContainerCheckpoint)), - router.Experimental(router.NewDeleteRoute("/containers/{name}/checkpoints/{checkpoint}", r.deleteContainerCheckpoint)), - } -}
  94. Download patch api/common.go

    --- 1.13.1~ds3-4/api/common.go 2017-02-08 05:58:41.000000000 +0000 +++ 17.12.1-0ubuntu5/api/common.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,166 +0,0 @@ -package api - -import ( - "encoding/json" - "encoding/pem" - "fmt" - "mime" - "os" - "path/filepath" - "sort" - "strconv" - "strings" - - "github.com/Sirupsen/logrus" - "github.com/docker/docker/api/types" - "github.com/docker/docker/pkg/ioutils" - "github.com/docker/docker/pkg/system" - "github.com/docker/libtrust" -) - -// Common constants for daemon and client. -const ( - // DefaultVersion of Current REST API - DefaultVersion string = "1.26" - - // NoBaseImageSpecifier is the symbol used by the FROM - // command to specify that no base image is to be used. - NoBaseImageSpecifier string = "scratch" -) - -// byPortInfo is a temporary type used to sort types.Port by its fields -type byPortInfo []types.Port - -func (r byPortInfo) Len() int { return len(r) } -func (r byPortInfo) Swap(i, j int) { r[i], r[j] = r[j], r[i] } -func (r byPortInfo) Less(i, j int) bool { - if r[i].PrivatePort != r[j].PrivatePort { - return r[i].PrivatePort < r[j].PrivatePort - } - - if r[i].IP != r[j].IP { - return r[i].IP < r[j].IP - } - - if r[i].PublicPort != r[j].PublicPort { - return r[i].PublicPort < r[j].PublicPort - } - - return r[i].Type < r[j].Type -} - -// DisplayablePorts returns formatted string representing open ports of container -// e.g. "0.0.0.0:80->9090/tcp, 9988/tcp" -// it's used by command 'docker ps' -func DisplayablePorts(ports []types.Port) string { - type portGroup struct { - first uint16 - last uint16 - } - groupMap := make(map[string]*portGroup) - var result []string - var hostMappings []string - var groupMapKeys []string - sort.Sort(byPortInfo(ports)) - for _, port := range ports { - current := port.PrivatePort - portKey := port.Type - if port.IP != "" { - if port.PublicPort != current { - hostMappings = append(hostMappings, fmt.Sprintf("%s:%d->%d/%s", port.IP, port.PublicPort, port.PrivatePort, port.Type)) - continue - } - portKey = fmt.Sprintf("%s/%s", port.IP, port.Type) - } - group := groupMap[portKey] - - if group == nil { - groupMap[portKey] = &portGroup{first: current, last: current} - // record order that groupMap keys are created - groupMapKeys = append(groupMapKeys, portKey) - continue - } - if current == (group.last + 1) { - group.last = current - continue - } - - result = append(result, formGroup(portKey, group.first, group.last)) - groupMap[portKey] = &portGroup{first: current, last: current} - } - for _, portKey := range groupMapKeys { - g := groupMap[portKey] - result = append(result, formGroup(portKey, g.first, g.last)) - } - result = append(result, hostMappings...) - return strings.Join(result, ", ") -} - -func formGroup(key string, start, last uint16) string { - parts := strings.Split(key, "/") - groupType := parts[0] - var ip string - if len(parts) > 1 { - ip = parts[0] - groupType = parts[1] - } - group := strconv.Itoa(int(start)) - if start != last { - group = fmt.Sprintf("%s-%d", group, last) - } - if ip != "" { - group = fmt.Sprintf("%s:%s->%s", ip, group, group) - } - return fmt.Sprintf("%s/%s", group, groupType) -} - -// MatchesContentType validates the content type against the expected one -func MatchesContentType(contentType, expectedType string) bool { - mimetype, _, err := mime.ParseMediaType(contentType) - if err != nil { - logrus.Errorf("Error parsing media type: %s error: %v", contentType, err) - } - return err == nil && mimetype == expectedType -} - -// LoadOrCreateTrustKey attempts to load the libtrust key at the given path, -// otherwise generates a new one -func LoadOrCreateTrustKey(trustKeyPath string) (libtrust.PrivateKey, error) { - err := system.MkdirAll(filepath.Dir(trustKeyPath), 0700) - if err != nil { - return nil, err - } - trustKey, err := libtrust.LoadKeyFile(trustKeyPath) - if err == libtrust.ErrKeyFileDoesNotExist { - trustKey, err = libtrust.GenerateECP256PrivateKey() - if err != nil { - return nil, fmt.Errorf("Error generating key: %s", err) - } - encodedKey, err := serializePrivateKey(trustKey, filepath.Ext(trustKeyPath)) - if err != nil { - return nil, fmt.Errorf("Error serializing key: %s", err) - } - if err := ioutils.AtomicWriteFile(trustKeyPath, encodedKey, os.FileMode(0600)); err != nil { - return nil, fmt.Errorf("Error saving key file: %s", err) - } - } else if err != nil { - return nil, fmt.Errorf("Error loading key file %s: %s", trustKeyPath, err) - } - return trustKey, nil -} - -func serializePrivateKey(key libtrust.PrivateKey, ext string) (encoded []byte, err error) { - if ext == ".json" || ext == ".jwk" { - encoded, err = json.Marshal(key) - if err != nil { - return nil, fmt.Errorf("unable to encode private key JWK: %s", err) - } - } else { - pemBlock, err := key.PEMBlock() - if err != nil { - return nil, fmt.Errorf("unable to encode private key PEM: %s", err) - } - encoded = pem.EncodeToMemory(pemBlock) - } - return -}
  95. Download patch api/server/router/build/build_routes.go
  96. Download patch api/common_unix.go

    --- 1.13.1~ds3-4/api/common_unix.go 2017-02-08 05:58:41.000000000 +0000 +++ 17.12.1-0ubuntu5/api/common_unix.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,6 +0,0 @@ -// +build !windows - -package api - -// MinVersion represents Minimum REST API version supported -const MinVersion string = "1.12"
  97. Download patch api/types/container/config.go

    --- 1.13.1~ds3-4/api/types/container/config.go 2017-02-08 05:58:41.000000000 +0000 +++ 17.12.1-0ubuntu5/api/types/container/config.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,62 +0,0 @@ -package container - -import ( - "time" - - "github.com/docker/docker/api/types/strslice" - "github.com/docker/go-connections/nat" -) - -// HealthConfig holds configuration settings for the HEALTHCHECK feature. -type HealthConfig struct { - // Test is the test to perform to check that the container is healthy. - // An empty slice means to inherit the default. - // The options are: - // {} : inherit healthcheck - // {"NONE"} : disable healthcheck - // {"CMD", args...} : exec arguments directly - // {"CMD-SHELL", command} : run command with system's default shell - Test []string `json:",omitempty"` - - // Zero means to inherit. Durations are expressed as integer nanoseconds. - Interval time.Duration `json:",omitempty"` // Interval is the time to wait between checks. - Timeout time.Duration `json:",omitempty"` // Timeout is the time to wait before considering the check to have hung. - - // Retries is the number of consecutive failures needed to consider a container as unhealthy. - // Zero means inherit. - Retries int `json:",omitempty"` -} - -// Config contains the configuration data about a container. -// It should hold only portable information about the container. -// Here, "portable" means "independent from the host we are running on". -// Non-portable information *should* appear in HostConfig. -// All fields added to this struct must be marked `omitempty` to keep getting -// predictable hashes from the old `v1Compatibility` configuration. -type Config struct { - Hostname string // Hostname - Domainname string // Domainname - User string // User that will run the command(s) inside the container, also support user:group - AttachStdin bool // Attach the standard input, makes possible user interaction - AttachStdout bool // Attach the standard output - AttachStderr bool // Attach the standard error - ExposedPorts nat.PortSet `json:",omitempty"` // List of exposed ports - Tty bool // Attach standard streams to a tty, including stdin if it is not closed. - OpenStdin bool // Open stdin - StdinOnce bool // If true, close stdin after the 1 attached client disconnects. - Env []string // List of environment variable to set in the container - Cmd strslice.StrSlice // Command to run when starting the container - Healthcheck *HealthConfig `json:",omitempty"` // Healthcheck describes how to check the container is healthy - ArgsEscaped bool `json:",omitempty"` // True if command is already escaped (Windows specific) - Image string // Name of the image as it was passed by the operator (e.g. could be symbolic) - Volumes map[string]struct{} // List of volumes (mounts) used for the container - WorkingDir string // Current directory (PWD) in the command will be launched - Entrypoint strslice.StrSlice // Entrypoint to run when starting the container - NetworkDisabled bool `json:",omitempty"` // Is network disabled - MacAddress string `json:",omitempty"` // Mac Address of the container - OnBuild []string // ONBUILD metadata that were defined on the image Dockerfile - Labels map[string]string // List of labels set to this container - StopSignal string `json:",omitempty"` // Signal to stop a container - StopTimeout *int `json:",omitempty"` // Timeout (in seconds) to stop a container - Shell strslice.StrSlice `json:",omitempty"` // Shell for shell-form of RUN, CMD, ENTRYPOINT -}
  98. Download patch api/server/router/container/copy.go

    --- 1.13.1~ds3-4/api/server/router/container/copy.go 2017-02-08 05:58:41.000000000 +0000 +++ 17.12.1-0ubuntu5/api/server/router/container/copy.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,119 +0,0 @@ -package container - -import ( - "encoding/base64" - "encoding/json" - "fmt" - "io" - "net/http" - "os" - "strings" - - "github.com/docker/docker/api/server/httputils" - "github.com/docker/docker/api/types" - "github.com/docker/docker/api/types/versions" - "golang.org/x/net/context" -) - -// postContainersCopy is deprecated in favor of getContainersArchive. -func (s *containerRouter) postContainersCopy(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error { - // Deprecated since 1.8, Errors out since 1.12 - version := httputils.VersionFromContext(ctx) - if versions.GreaterThanOrEqualTo(version, "1.24") { - w.WriteHeader(http.StatusNotFound) - return nil - } - if err := httputils.CheckForJSON(r); err != nil { - return err - } - - cfg := types.CopyConfig{} - if err := json.NewDecoder(r.Body).Decode(&cfg); err != nil { - return err - } - - if cfg.Resource == "" { - return fmt.Errorf("Path cannot be empty") - } - - data, err := s.backend.ContainerCopy(vars["name"], cfg.Resource) - if err != nil { - if strings.Contains(strings.ToLower(err.Error()), "no such container") { - w.WriteHeader(http.StatusNotFound) - return nil - } - if os.IsNotExist(err) { - return fmt.Errorf("Could not find the file %s in container %s", cfg.Resource, vars["name"]) - } - return err - } - defer data.Close() - - w.Header().Set("Content-Type", "application/x-tar") - if _, err := io.Copy(w, data); err != nil { - return err - } - - return nil -} - -// // Encode the stat to JSON, base64 encode, and place in a header. -func setContainerPathStatHeader(stat *types.ContainerPathStat, header http.Header) error { - statJSON, err := json.Marshal(stat) - if err != nil { - return err - } - - header.Set( - "X-Docker-Container-Path-Stat", - base64.StdEncoding.EncodeToString(statJSON), - ) - - return nil -} - -func (s *containerRouter) headContainersArchive(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error { - v, err := httputils.ArchiveFormValues(r, vars) - if err != nil { - return err - } - - stat, err := s.backend.ContainerStatPath(v.Name, v.Path) - if err != nil { - return err - } - - return setContainerPathStatHeader(stat, w.Header()) -} - -func (s *containerRouter) getContainersArchive(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error { - v, err := httputils.ArchiveFormValues(r, vars) - if err != nil { - return err - } - - tarArchive, stat, err := s.backend.ContainerArchivePath(v.Name, v.Path) - if err != nil { - return err - } - defer tarArchive.Close() - - if err := setContainerPathStatHeader(stat, w.Header()); err != nil { - return err - } - - w.Header().Set("Content-Type", "application/x-tar") - _, err = io.Copy(w, tarArchive) - - return err -} - -func (s *containerRouter) putContainersArchive(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error { - v, err := httputils.ArchiveFormValues(r, vars) - if err != nil { - return err - } - - noOverwriteDirNonDir := httputils.BoolValue(r, "noOverwriteDirNonDir") - return s.backend.ContainerExtractToDir(v.Name, v.Path, noOverwriteDirNonDir, r.Body) -}
  99. Download patch api/swagger.yaml
  100. Download patch api/server/router/system/system.go

    --- 1.13.1~ds3-4/api/server/router/system/system.go 2017-02-08 05:58:41.000000000 +0000 +++ 17.12.1-0ubuntu5/api/server/router/system/system.go 1970-01-01 00:00:00.000000000 +0000 @@ -1,39 +0,0 @@ -package system - -import ( - "github.com/docker/docker/api/server/router" - "github.com/docker/docker/daemon/cluster" -) - -// systemRouter provides information about the Docker system overall. -// It gathers information about host, daemon and container events. -type systemRouter struct { - backend Backend - clusterProvider *cluster.Cluster - routes []router.Route -} - -// NewRouter initializes a new system router -func NewRouter(b Backend, c *cluster.Cluster) router.Router { - r := &systemRouter{ - backend: b, - clusterProvider: c, - } - - r.routes = []router.Route{ - router.NewOptionsRoute("/{anyroute:.*}", optionsHandler), - router.NewGetRoute("/_ping", pingHandler), - router.Cancellable(router.NewGetRoute("/events", r.getEvents)), - router.NewGetRoute("/info", r.getInfo), - router.NewGetRoute("/version", r.getVersion), - router.NewGetRoute("/system/df", r.getDiskUsage), - router.NewPostRoute("/auth", r.postAuth), - } - - return r -} - -// Routes returns all the API routes dedicated to the docker system -func (s *systemRouter) Routes() []router.Route { - return s.routes -}
  101. ...

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

Source: golang-1.10

golang-1.10 (1.10.1-1ubuntu2) bionic; urgency=medium * Add d/patches/0001-cmd-link-do-not-pass-no-pie-to-host-linker-when-link.patch to fix ftbfs on arm64. -- Michael Hudson-Doyle <michael.hudson@ubuntu.com> Mon, 09 Apr 2018 11:07:21 +1200 golang-1.10 (1.10.1-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> Tue, 03 Apr 2018 16:08:51 +1200

Modifications :
  1. Download patch debian/rules

    --- 1.10.1-1/debian/rules 2018-04-03 03:29:01.000000000 +0000 +++ 1.10.1-1ubuntu2/debian/rules 2018-04-03 04:08:01.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.1-1/debian/control 2018-04-03 03:29:01.000000000 +0000 +++ 1.10.1-1ubuntu2/debian/control 2018-04-08 23:07:42.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.1-1/debian/control.in 2018-04-03 03:29:01.000000000 +0000 +++ 1.10.1-1ubuntu2/debian/control.in 2018-04-03 04:08:02.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/0001-cmd-link-do-not-pass-no-pie-to-host-linker-when-link.patch
  5. Download patch debian/patches/series

    --- 1.10.1-1/debian/patches/series 2018-04-03 03:29:01.000000000 +0000 +++ 1.10.1-1ubuntu2/debian/patches/series 2018-04-04 23:16:01.000000000 +0000 @@ -1 +1,2 @@ 0002-reproducible-BUILD_PATH_PREFIX_MAP.patch +0001-cmd-link-do-not-pass-no-pie-to-host-linker-when-link.patch
  6. Download patch debian/gbp.conf.in

    --- 1.10.1-1/debian/gbp.conf.in 2018-04-03 03:29:01.000000000 +0000 +++ 1.10.1-1ubuntu2/debian/gbp.conf.in 2018-04-03 04:08: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
  7. Download patch debian/gbp.conf

    --- 1.10.1-1/debian/gbp.conf 2018-04-03 03:29:01.000000000 +0000 +++ 1.10.1-1ubuntu2/debian/gbp.conf 2018-04-08 23:07:42.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