From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:38629) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gcptT-0004gj-US for guix-patches@gnu.org; Fri, 28 Dec 2018 06:01:37 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gcpdi-0000Iy-Qk for guix-patches@gnu.org; Fri, 28 Dec 2018 05:45:18 -0500 Received: from debbugs.gnu.org ([208.118.235.43]:60622) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gcpEM-0000Xj-Dy for guix-patches@gnu.org; Fri, 28 Dec 2018 05:19:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1gcpEM-0001LH-6x for guix-patches@gnu.org; Fri, 28 Dec 2018 05:19:02 -0500 Subject: [bug#33893] [PATCH 2/2] gnu: Add docker-cli. Resent-Message-ID: From: Danny Milosavljevic Date: Fri, 28 Dec 2018 11:17:51 +0100 Message-Id: <20181228101751.676-2-dannym@scratchpost.org> In-Reply-To: <20181228101751.676-1-dannym@scratchpost.org> References: <20181228101311.30793-1-dannym@scratchpost.org> <20181228101751.676-1-dannym@scratchpost.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: 33893@debbugs.gnu.org * gnu/packages/docker.scm (docker-cli): New variable. Export it. --- gnu/packages/docker.scm | 61 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) diff --git a/gnu/packages/docker.scm b/gnu/packages/docker.scm index 3d1a90fc7..caf70cbc9 100644 --- a/gnu/packages/docker.scm +++ b/gnu/packages/docker.scm @@ -24,8 +24,10 @@ #:use-module (guix download) #:use-module (guix git-download) #:use-module (guix build-system gnu) + #:use-module (guix build-system go) #:use-module (guix build-system python) #:use-module (guix utils) + #:use-module (gnu packages autotools) #:use-module (gnu packages check) #:use-module (gnu packages golang) #:use-module (gnu packages linux) @@ -225,3 +227,62 @@ management, secret management, configuration management, networking, provisioning etc.") (home-page "https://mobyproject.org/") (license license:asl2.0))) + +(define-public docker-cli + (package + (name "docker-cli") + (version %docker-version) + (source + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/docker/cli.git") + (commit (string-append "v" version)))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "1ivisys20kphvbqlazc3bsg7pk0ykj9gjx5d4yg439x4n13jxwvb")))) + (build-system go-build-system) + (arguments + `(#:import-path "github.com/docker/cli" + ;; TODO: Tests require a running Docker daemon. + #:tests? #f + #:phases + (modify-phases %standard-phases + (add-before 'build 'setup-environment-2 + (lambda _ + ;; Respectively, strip the symbol table and debug + ;; information, and the DWARF symbol table. + (setenv "LDFLAGS" "-s -w") + (symlink "src/github.com/docker/cli/scripts" "./scripts") + (symlink "src/github.com/docker/cli/docker.Makefile" "./docker.Makefile") + #t)) + (replace 'build + (lambda _ + (invoke "./scripts/build/dynbinary"))) + (replace 'check + (lambda* (#:key make-flags tests? #:allow-other-keys) + (setenv "PATH" (string-append (getcwd) "/build:" (getenv "PATH"))) + (if tests? + ;; Use the newly-built docker client for the tests. + (with-directory-excursion "src/github.com/docker/cli" + ;; TODO: Run test-e2e as well? + (apply invoke "make" "-f" "docker.Makefile" "test-unit" + (or make-flags '()))) + #t))) + (replace 'install + (lambda* (#:key outputs #:allow-other-keys) + (let* ((out (assoc-ref outputs "out")) + (out-bin (string-append out "/bin"))) + (chdir "build") + (install-file (readlink "docker") out-bin) + (install-file "docker" out-bin) + #t)))))) + (native-inputs + `(("go" ,go) + ("libltdl" ,libltdl) + ("pkg-config" ,pkg-config))) + (synopsis "Command line interface to Docker") + (description "This package provides a command line interface to Docker.") + (home-page "http://www.docker.com/") + (license license:asl2.0)))