From e82c98abe93c749296c831691c7c67c736f0807f Mon Sep 17 00:00:00 2001 From: Leo Famulari Date: Wed, 9 Jan 2019 15:37:44 -0500 Subject: gnu: aria2: Fix CVE-2019-3500. * gnu/packages/patches/aria2-CVE-2019-3500.patch: New file. * gnu/local.mk (dist_patch_DATA): Add it. * gnu/packages/bittorrent.scm (aria2)[source]: Use it. --- gnu/local.mk | 1 + 1 file changed, 1 insertion(+) (limited to 'gnu/local.mk') diff --git a/gnu/local.mk b/gnu/local.mk index bc54b61c21..6344144f08 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -586,6 +586,7 @@ dist_patch_DATA = \ %D%/packages/patches/antlr3-3_3-fix-java8-compilation.patch \ %D%/packages/patches/ao-cad-aarch64-support.patch \ %D%/packages/patches/apr-skip-getservbyname-test.patch \ + %D%/packages/patches/aria2-CVE-2019-3500.patch \ %D%/packages/patches/aspell-default-dict-dir.patch \ %D%/packages/patches/ath9k-htc-firmware-binutils.patch \ %D%/packages/patches/ath9k-htc-firmware-gcc.patch \ -- cgit v1.2.3 From f87ea24a821c1cee8f9a8f0d38d7f02fa43d8383 Mon Sep 17 00:00:00 2001 From: Danny Milosavljevic Date: Mon, 7 Jan 2019 20:01:34 +0100 Subject: gnu: Add docker. * gnu/packages/docker.scm (docker): New variable. * gnu/packages/patches/docker-engine-test-noinstall.patch: New file. * gnu/packages/patches/docker-fix-tests.patch: New file. * gnu/local.mk (dist_patch_DATA): Add them. --- gnu/local.mk | 2 + gnu/packages/docker.scm | 178 +++++++++++++++++++++ .../patches/docker-engine-test-noinstall.patch | 23 +++ gnu/packages/patches/docker-fix-tests.patch | 28 ++++ 4 files changed, 231 insertions(+) create mode 100644 gnu/packages/patches/docker-engine-test-noinstall.patch create mode 100644 gnu/packages/patches/docker-fix-tests.patch (limited to 'gnu/local.mk') diff --git a/gnu/local.mk b/gnu/local.mk index 6344144f08..25363869dd 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -663,6 +663,8 @@ dist_patch_DATA = \ %D%/packages/patches/docbook-xsl-nonrecursive-string-subst.patch \ %D%/packages/patches/doc++-include-directives.patch \ %D%/packages/patches/doc++-segfault-fix.patch \ + %D%/packages/patches/docker-engine-test-noinstall.patch \ + %D%/packages/patches/docker-fix-tests.patch \ %D%/packages/patches/dovecot-trees-support-dovecot-2.3.patch \ %D%/packages/patches/doxygen-test.patch \ %D%/packages/patches/dropbear-CVE-2018-15599.patch \ diff --git a/gnu/packages/docker.scm b/gnu/packages/docker.scm index d928c4e61e..31bb34b4a6 100644 --- a/gnu/packages/docker.scm +++ b/gnu/packages/docker.scm @@ -23,10 +23,12 @@ #:use-module (guix packages) #: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 check) + #:use-module (gnu packages compression) #:use-module (gnu packages golang) #:use-module (gnu packages linux) #:use-module (gnu packages pkg-config) @@ -34,6 +36,8 @@ #:use-module (gnu packages python-web) #:use-module (gnu packages virtualization)) +(define %docker-version "18.09.0") + (define-public python-docker-py (package (name "python-docker-py") @@ -210,3 +214,177 @@ It includes image transfer and storage, container execution and supervision, network attachments.") (home-page "http://containerd.io/") (license license:asl2.0))) + +(define-public docker + (package + (name "docker") + (version %docker-version) + (source + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/docker/engine.git") + (commit (string-append "v" version)))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "1liqbx58grqih6m8hz9y20y5waflv19pv15l3wl64skap2bsn21c")) + (patches + (search-patches "docker-engine-test-noinstall.patch" + "docker-fix-tests.patch")))) + (build-system gnu-build-system) + (arguments + `(#:modules + ((guix build gnu-build-system) + ((guix build go-build-system) #:prefix go:) + (guix build utils)) + #:imported-modules + (,@%gnu-build-system-modules + (guix build go-build-system)) + #:phases + (modify-phases %standard-phases + (add-after 'unpack 'patch-paths + (lambda* (#:key inputs #:allow-other-keys) + (substitute* "builder/builder-next/executor_unix.go" + (("CommandCandidates:.*runc.*") + (string-append "CommandCandidates: []string{\"" + (assoc-ref inputs "runc") + "/sbin/runc\"},\n"))) + (substitute* "vendor/github.com/containerd/go-runc/runc.go" + (("DefaultCommand = .*") + (string-append "DefaultCommand = \"" + (assoc-ref inputs "runc") + "/sbin/runc\"\n"))) + (substitute* "vendor/github.com/containerd/containerd/runtime/v1/linux/runtime.go" + (("defaultRuntime[ \t]*=.*") + (string-append "defaultRuntime = \"" + (assoc-ref inputs "runc") + "/sbin/runc\"\n")) + (("defaultShim[ \t]*=.*") + (string-append "defaultShim = \"" + (assoc-ref inputs "containerd") + "/bin/containerd-shim\"\n"))) + (substitute* "daemon/daemon_unix.go" + (("DefaultShimBinary = .*") + (string-append "DefaultShimBinary = \"" + (assoc-ref inputs "containerd") + "/bin/containerd-shim\"\n")) + (("DefaultRuntimeBinary = .*") + (string-append "DefaultRuntimeBinary = \"" + (assoc-ref inputs "runc") + "/sbin/runc\"\n")) + (("DefaultRuntimeName = .*") + (string-append "DefaultRuntimeName = \"" + (assoc-ref inputs "runc") + "/sbin/runc\"\n"))) + (substitute* "daemon/config/config.go" + (("StockRuntimeName = .*") + (string-append "StockRuntimeName = \"" + (assoc-ref inputs "runc") + "/sbin/runc\"\n"))) + (substitute* "vendor/github.com/moby/buildkit/executor/runcexecutor/executor.go" + (("var defaultCommandCandidates = .*") + (string-append "var defaultCommandCandidates = []string{\"" + (assoc-ref inputs "runc") "/sbin/runc\"}"))) + (let ((source-files (filter (lambda (name) + (not (string-contains name "test"))) + (find-files "." "\\.go$")))) + (let-syntax ((substitute-LookPath + (lambda (x) + (syntax-case x () + ((substitute-LookPath source-text package + relative-path) + #`(substitute* source-files + ((#,(string-append "exec\\.LookPath\\(\"" + (syntax->datum + #'source-text) + "\")")) + (string-append "\"" + (assoc-ref inputs package) + relative-path + "\", error(nil)")))))))) + (substitute-LookPath "ps" "procps" "/bin/ps") + (substitute-LookPath "mkfs.xfs" "xfsprogs" "/bin/mkfs.xfs") + (substitute-LookPath "lvmdiskscan" "lvm2" "/sbin/lvmdiskscan") + (substitute-LookPath "pvdisplay" "lvm2" "/sbin/pvdisplay") + (substitute-LookPath "blkid" "util-linux" "/sbin/blkid") + (substitute-LookPath "unpigz" "pigz" "/bin/unpigz") + (substitute-LookPath "iptables" "iptables" "/sbin/iptables") + (substitute-LookPath "ip" "iproute2" "/sbin/ip"))) + #t)) + (add-after 'patch-paths 'delete-failing-tests + (lambda _ + ;; Needs internet access. + (delete-file "builder/remotecontext/git/gitutils_test.go") + ;; Permission denied. + (delete-file "daemon/graphdriver/devmapper/devmapper_test.go") + ;; Operation not permitted (idtools.MkdirAllAndChown). + (delete-file "daemon/graphdriver/vfs/vfs_test.go") + ;; Timeouts after 5 min. + (delete-file "plugin/manager_linux_test.go") + #t)) + (replace 'configure + (lambda _ + (setenv "DOCKER_GITCOMMIT" (string-append "v" ,%docker-version)) + ;; Automatically use bundled dependencies. + ;; TODO: Unbundle - see file "vendor.conf". + (setenv "AUTO_GOPATH" "1") + ;; Respectively, strip the symbol table and debug + ;; information, and the DWARF symbol table. + (setenv "LDFLAGS" "-s -w") + ;; Make build faster + (setenv "GOCACHE" "/tmp") + #t)) + (add-before 'build 'setup-environment + (assoc-ref go:%standard-phases 'setup-environment)) + (replace 'build + (lambda _ + ;; Our LD doesn't like the statically linked relocatable things + ;; that go produces, so install the dynamic version of + ;; dockerd instead. + (invoke "hack/make.sh" "dynbinary"))) + (replace 'check + (lambda _ + ;; The build process generated a file because the environment + ;; variable "AUTO_GOPATH" was set. Use it. + (setenv "GOPATH" (string-append (getcwd) "/.gopath")) + ;; ".gopath/src/github.com/docker/docker" is a link to the current + ;; directory and chdir would canonicalize to that. + ;; But go needs to have the uncanonicalized directory name, so + ;; store that. + (setenv "PWD" (string-append (getcwd) + "/.gopath/src/github.com/docker/docker")) + (with-directory-excursion ".gopath/src/github.com/docker/docker" + (invoke "hack/test/unit")) + (setenv "PWD" #f) + #t)) + (replace 'install + (lambda* (#:key outputs #:allow-other-keys) + (let* ((out (assoc-ref outputs "out")) + (out-bin (string-append out "/bin"))) + (install-file "bundles/dynbinary-daemon/dockerd" out-bin) + (install-file "bundles/dynbinary-daemon/dockerd-dev" out-bin) + #t)))))) + (inputs + `(("btrfs-progs" ,btrfs-progs) + ("containerd" ,containerd) ; for containerd-shim + ("runc" ,runc) + ("iproute2" ,iproute) + ("iptables" ,iptables) + ("libseccomp" ,libseccomp) + ("pigz" ,pigz) + ("procps" ,procps) + ("util-linux" ,util-linux) + ("lvm2" ,lvm2) + ("xfsprogs" ,xfsprogs))) + (native-inputs + `(("eudev" ,eudev) ; TODO: Should be propagated by lvm2 (.pc -> .pc) + ("go" ,go) + ("pkg-config" ,pkg-config))) + (synopsis "Docker container component library, and daemon") + (description "This package provides a framework to assemble specialized +container systems. It includes components for orchestration, image +management, secret management, configuration management, networking, +provisioning etc.") + (home-page "https://mobyproject.org/") + (license license:asl2.0))) diff --git a/gnu/packages/patches/docker-engine-test-noinstall.patch b/gnu/packages/patches/docker-engine-test-noinstall.patch new file mode 100644 index 0000000000..85d56a3465 --- /dev/null +++ b/gnu/packages/patches/docker-engine-test-noinstall.patch @@ -0,0 +1,23 @@ +Last-Update: 2018-06-18 +Forwarded: not-needed +Author: Dmitry Smirnov +Description: prevents test-time installation that causes FTBFS. +~~~~ + go test net: open /usr/lib/go-1.10/pkg/linux_amd64/net.a: permission denied +~~~~ + +--- a/hack/test/unit ++++ b/hack/test/unit +@@ -18,12 +18,8 @@ + + exclude_paths="/vendor/|/integration" + pkg_list=$(go list $TESTDIRS | grep -vE "($exclude_paths)") + +-# install test dependencies once before running tests for each package. This +-# significantly reduces the runtime. +-go test -i "${BUILDFLAGS[@]}" $pkg_list +- + for pkg in $pkg_list; do + go test "${BUILDFLAGS[@]}" \ + -cover \ + -coverprofile=profile.out \ diff --git a/gnu/packages/patches/docker-fix-tests.patch b/gnu/packages/patches/docker-fix-tests.patch new file mode 100644 index 0000000000..3e3e318e25 --- /dev/null +++ b/gnu/packages/patches/docker-fix-tests.patch @@ -0,0 +1,28 @@ +Author: Danny Milosavljevic +The socket name ended up too long inside the container. +Use a shorter one. +--- a/pkg/authorization/authz_unix_test.go 2019-01-10 01:55:02.997985947 +0100 ++++ b/pkg/authorization/authz_unix_test.go 2019-01-10 02:03:21.177439757 +0100 +@@ -24,7 +24,7 @@ + ) + + const ( +- pluginAddress = "authz-test-plugin.sock" ++ pluginAddress = "/tmp/authz-test-plugin.sock" + ) + + func TestAuthZRequestPluginError(t *testing.T) { +@@ -263,12 +263,7 @@ + + // createTestPlugin creates a new sample authorization plugin + func createTestPlugin(t *testing.T) *authorizationPlugin { +- pwd, err := os.Getwd() +- if err != nil { +- t.Fatal(err) +- } +- +- client, err := plugins.NewClient("unix:///"+path.Join(pwd, pluginAddress), &tlsconfig.Options{InsecureSkipVerify: true}) ++ client, err := plugins.NewClient("unix:///"+path.Join("/", pluginAddress), &tlsconfig.Options{InsecureSkipVerify: true}) + if err != nil { + t.Fatalf("Failed to create client %v", err) + } -- cgit v1.2.3 From 8af4c335e32fbed7556a4cd7f26f93bc66afaace Mon Sep 17 00:00:00 2001 From: Danny Milosavljevic Date: Mon, 31 Dec 2018 00:39:02 +0100 Subject: services: Add docker. * gnu/services/docker.scm: New file. * gnu/local.mk (GNU_SYSTEM_MODULES): Add it. * doc/guix.texi (Miscellaneous Services): Document the service. --- doc/guix.texi | 27 ++++++++++++++ gnu/local.mk | 1 + gnu/services/docker.scm | 94 +++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 122 insertions(+) create mode 100644 gnu/services/docker.scm (limited to 'gnu/local.mk') diff --git a/doc/guix.texi b/doc/guix.texi index 7c6a714830..c0cc8d4169 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -22118,6 +22118,33 @@ The following is an example @code{dicod-service} configuration. %dicod-database:gcide)))) @end example +@cindex Docker +@subsubheading Docker Service + +The @code{(gnu services docker)} module provides the following service. + +@defvr {Scheme Variable} docker-service-type + +This is the type of the service that runs @url{http://www.docker.com,Docker}, +a daemon that can execute application bundles (sometimes referred to as +``containers'') in isolated environments. + +@end defvr + +@deftp {Data Type} docker-configuration +This is the data type representing the configuration of Docker and Containerd. + +@table @asis + +@item @code{package} (default: @code{docker}) +The Docker package to use. + +@item @code{containerd} (default: @var{containerd}) +The Containerd package to use. + +@end table +@end deftp + @node Setuid Programs @subsection Setuid Programs diff --git a/gnu/local.mk b/gnu/local.mk index 25363869dd..7c319b727f 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -483,6 +483,7 @@ GNU_SYSTEM_MODULES = \ %D%/services/desktop.scm \ %D%/services/dict.scm \ %D%/services/dns.scm \ + %D%/services/docker.scm \ %D%/services/authentication.scm \ %D%/services/games.scm \ %D%/services/kerberos.scm \ diff --git a/gnu/services/docker.scm b/gnu/services/docker.scm new file mode 100644 index 0000000000..6d270831b3 --- /dev/null +++ b/gnu/services/docker.scm @@ -0,0 +1,94 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright © 2018 Danny Milosavljevic +;;; +;;; This file is part of GNU Guix. +;;; +;;; GNU Guix is free software; you can redistribute it and/or modify it +;;; under the terms of the GNU General Public License as published by +;;; the Free Software Foundation; either version 3 of the License, or (at +;;; your option) any later version. +;;; +;;; GNU Guix is distributed in the hope that it will be useful, but +;;; WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with GNU Guix. If not, see . + +(define-module (gnu services docker) + #:use-module (gnu services) + #:use-module (gnu services configuration) + #:use-module (gnu services base) + #:use-module (gnu services dbus) + #:use-module (gnu services shepherd) + #:use-module (gnu system shadow) + #:use-module (gnu packages docker) + #:use-module (guix records) + #:use-module (guix gexp) + #:use-module (guix packages) + + #:export (docker-configuration + docker-service-type)) + +(define-configuration docker-configuration + (docker + (package docker) + "Docker daemon package.") + (containerd + (package containerd) + "containerd package.")) + +(define %docker-accounts + (list (user-group (name "docker") (system? #t)))) + +(define (%containerd-activation config) + (let ((state-dir "/var/lib/containerd")) + #~(begin + (use-modules (guix build utils)) + (mkdir-p #$state-dir)))) + +(define (%docker-activation config) + (%containerd-activation config) + (let ((state-dir "/var/lib/docker")) + #~(begin + (use-modules (guix build utils)) + (mkdir-p #$state-dir)))) + +(define (containerd-shepherd-service config) + (let* ((package (docker-configuration-containerd config))) + (shepherd-service + (documentation "containerd daemon.") + (provision '(containerd)) + (start #~(make-forkexec-constructor + (list (string-append #$package "/bin/containerd")))) + (stop #~(make-kill-destructor))))) + +(define (docker-shepherd-service config) + (let* ((docker (docker-configuration-docker config))) + (shepherd-service + (documentation "Docker daemon.") + (provision '(dockerd)) + (requirement '(containerd)) + (start #~(make-forkexec-constructor + (list (string-append #$docker "/bin/dockerd") + "-p" "/var/run/docker.pid") + #:pid-file "/var/run/docker.pid" + #:log-file "/var/log/docker.log")) + (stop #~(make-kill-destructor))))) + +(define docker-service-type + (service-type (name 'docker) + (description "Provide capability to run Docker application +bundles in Docker containers.") + (extensions + (list + (service-extension activation-service-type + %docker-activation) + (service-extension shepherd-root-service-type + (lambda args + (list (apply containerd-shepherd-service args) + (apply docker-shepherd-service args)))) + (service-extension account-service-type + (const %docker-accounts)))) + (default-value (docker-configuration)))) -- cgit v1.2.3 From babfd9447df08a809622238b4830eb046dab2ba6 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Thu, 10 Jan 2019 23:30:43 +0100 Subject: tests: Nitpick on Docker test. This is a followup to 7d8a4eeacc534c8742e0b22d855aa73e5ab66b7f. * gnu/local.mk (GNU_SYSTEM_MODULES): Add gnu/tests/docker.scm. * gnu/tests/docker.scm: Update copyright line. --- gnu/local.mk | 3 ++- gnu/tests/docker.scm | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'gnu/local.mk') diff --git a/gnu/local.mk b/gnu/local.mk index 7c319b727f..306cfa3a62 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -1,5 +1,5 @@ # GNU Guix --- Functional package management for GNU -# Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018 Ludovic Courtès +# Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019 Ludovic Courtès # Copyright © 2013, 2014, 2015, 2016, 2017, 2018 Andreas Enge # Copyright © 2016 Mathieu Lirzin # Copyright © 2013, 2014, 2015, 2016, 2017, 2018 Mark H Weaver @@ -542,6 +542,7 @@ GNU_SYSTEM_MODULES = \ %D%/tests/databases.scm \ %D%/tests/desktop.scm \ %D%/tests/dict.scm \ + %D%/tests/docker.scm \ %D%/tests/monitoring.scm \ %D%/tests/nfs.scm \ %D%/tests/install.scm \ diff --git a/gnu/tests/docker.scm b/gnu/tests/docker.scm index 973a84c558..453ed4893d 100644 --- a/gnu/tests/docker.scm +++ b/gnu/tests/docker.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2017 Christopher Baines +;;; Copyright © 2019 Danny Milosavljevic ;;; ;;; This file is part of GNU Guix. ;;; -- cgit v1.2.3 From 24155bf40db2dfd25c167f41452ea0227a712654 Mon Sep 17 00:00:00 2001 From: Ricardo Wurmus Date: Thu, 10 Jan 2019 14:55:50 +0100 Subject: gnu: Move Java compression packages to new module. * gnu/packages/compression.scm (bitshuffle-for-snappy): Export variable. (java-snappy, java-snappy-1, java-iq80-snappy, java-jbzip2, java-tukaani-xz): Move these variables from here... * gnu/packages/java-compression.scm: ...to this new file. * gnu/local.mk (GNU_SYSTEM_MODULES): Add it. * gnu/packages/java.scm, gnu/packages/bioinformatics.scm: Adjust module references. --- gnu/local.mk | 1 + gnu/packages/bioinformatics.scm | 1 + gnu/packages/compression.scm | 280 +--------------------------------- gnu/packages/java-compression.scm | 308 ++++++++++++++++++++++++++++++++++++++ gnu/packages/java.scm | 1 + 5 files changed, 312 insertions(+), 279 deletions(-) create mode 100644 gnu/packages/java-compression.scm (limited to 'gnu/local.mk') diff --git a/gnu/local.mk b/gnu/local.mk index 306cfa3a62..7eb4366af2 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -241,6 +241,7 @@ GNU_SYSTEM_MODULES = \ %D%/packages/irc.scm \ %D%/packages/iso-codes.scm \ %D%/packages/java.scm \ + %D%/packages/java-compression.scm \ %D%/packages/javascript.scm \ %D%/packages/jemalloc.scm \ %D%/packages/jrnl.scm \ diff --git a/gnu/packages/bioinformatics.scm b/gnu/packages/bioinformatics.scm index 433d322b08..2ecc782324 100644 --- a/gnu/packages/bioinformatics.scm +++ b/gnu/packages/bioinformatics.scm @@ -78,6 +78,7 @@ #:use-module (gnu packages image) #:use-module (gnu packages imagemagick) #:use-module (gnu packages java) + #:use-module (gnu packages java-compression) #:use-module (gnu packages jemalloc) #:use-module (gnu packages dlang) #:use-module (gnu packages linux) diff --git a/gnu/packages/compression.scm b/gnu/packages/compression.scm index b2b4488683..029d11ef21 100644 --- a/gnu/packages/compression.scm +++ b/gnu/packages/compression.scm @@ -45,7 +45,6 @@ #:use-module (guix packages) #:use-module (guix download) #:use-module (guix git-download) - #:use-module (guix build-system ant) #:use-module (guix build-system cmake) #:use-module (guix build-system gnu) #:use-module (guix build-system perl) @@ -59,7 +58,6 @@ #:use-module (gnu packages check) #:use-module (gnu packages curl) #:use-module (gnu packages file) - #:use-module (gnu packages java) #:use-module (gnu packages maths) #:use-module (gnu packages perl) #:use-module (gnu packages perl-check) @@ -1265,7 +1263,7 @@ for most inputs, but the resulting compressed files are anywhere from 20% to 100% bigger.") (license license:asl2.0))) -(define bitshuffle-for-snappy +(define-public bitshuffle-for-snappy (package (inherit bitshuffle) (name "bitshuffle-for-snappy") @@ -1302,245 +1300,6 @@ install: libbitshuffle.so (inputs '()) (native-inputs '()))) -(define-public java-snappy - (package - (name "java-snappy") - (version "1.1.7.2") - (source (origin - (method url-fetch) - (uri (string-append "https://github.com/xerial/snappy-java/archive/" - version ".tar.gz")) - (file-name (string-append name "-" version ".tar.gz")) - (sha256 - (base32 - "1p557vdv006ysgxbpp83krmq0066k46108vyiyka69w8i4i8rbbm")))) - (build-system ant-build-system) - (arguments - `(#:jar-name "snappy.jar" - #:source-dir "src/main/java" - #:phases - (modify-phases %standard-phases - (add-before 'build 'remove-binaries - (lambda _ - (delete-file "lib/org/xerial/snappy/OSInfo.class") - (delete-file-recursively "src/main/resources/org/xerial/snappy/native") - #t)) - (add-before 'build 'build-jni - (lambda _ - ;; Rebuild one of the binaries we removed earlier - (invoke "javac" "src/main/java/org/xerial/snappy/OSInfo.java" - "-d" "lib") - ;; Link to the dynamic bitshuffle and snappy, not the static ones - (substitute* "Makefile.common" - (("-shared") - "-shared -lbitshuffle -lsnappy")) - (substitute* "Makefile" - ;; Don't try to use git, don't download bitshuffle source - ;; and don't build it. - (("\\$\\(SNAPPY_GIT_UNPACKED\\) ") - "") - ((": \\$\\(SNAPPY_GIT_UNPACKED\\)") - ":") - (("\\$\\(BITSHUFFLE_UNPACKED\\) ") - "") - ((": \\$\\(SNAPPY_SOURCE_CONFIGURED\\)") ":") - ;; What we actually want to build - (("SNAPPY_OBJ:=.*") - "SNAPPY_OBJ:=$(addprefix $(SNAPPY_OUT)/, \ - SnappyNative.o BitShuffleNative.o)\n") - ;; Since we removed the directory structure in "native" during - ;; the previous phase, we need to recreate it. - (("NAME\\): \\$\\(SNAPPY_OBJ\\)") - "NAME): $(SNAPPY_OBJ)\n\t@mkdir -p $(@D)")) - ;; Finally we can run the Makefile to build the dynamic library. - ;; Use the -nocmake target to avoid a dependency on cmake, - ;; which in turn requires the "git_unpacked" directory. - (invoke "make" "native-nocmake"))) - ;; Once we have built the shared library, we need to place it in the - ;; "build" directory so it can be added to the jar file. - (add-after 'build-jni 'copy-jni - (lambda _ - (copy-recursively "src/main/resources/org/xerial/snappy/native" - "build/classes/org/xerial/snappy/native") - #t)) - (add-before 'check 'fix-failing - (lambda _ - (with-directory-excursion "src/test/java/org/xerial/snappy" - ;; This package assumes maven build, which puts results in "target". - ;; We put them in "build" instead, so fix that. - (substitute* "SnappyLoaderTest.java" - (("target/classes") "build/classes")) - ;; This requires Hadoop, which is not in Guix yet. - (delete-file "SnappyHadoopCompatibleOutputStreamTest.java")) - #t))))) - (inputs - `(("osgi-framework" ,java-osgi-framework))) - (propagated-inputs - `(("bitshuffle" ,bitshuffle-for-snappy) - ("snappy" ,snappy))) - (native-inputs - `(("junit" ,java-junit) - ("hamcrest" ,java-hamcrest-core) - ("xerial-core" ,java-xerial-core) - ("classworlds" ,java-plexus-classworlds) - ("commons-lang" ,java-commons-lang) - ("commons-io" ,java-commons-io) - ("perl" ,perl))) - (home-page "https://github.com/xerial/snappy-java") - (synopsis "Compression/decompression algorithm in Java") - (description "Snappy-java is a Java port of snappy, a fast C++ -compressor/decompressor.") - (license license:asl2.0))) - -(define-public java-snappy-1 - (package - (inherit java-snappy) - (version "1.0.3-rc3") - (source (origin - (method url-fetch) - (uri (string-append "https://github.com/xerial/snappy-java/archive/" - "snappy-java-" version ".tar.gz")) - (sha256 - (base32 - "08hsxlqidiqck0q57fshwyv3ynyxy18vmhrai9fyc8mz17m7gsa3")))) - (arguments - `(#:jar-name "snappy.jar" - #:source-dir "src/main/java" - #:phases - (modify-phases %standard-phases - (add-before 'build 'remove-binaries - (lambda _ - (delete-file "lib/org/xerial/snappy/OSInfo.class") - (delete-file-recursively "src/main/resources/org/xerial/snappy/native") - #t)) - (add-before 'build 'build-jni - (lambda _ - ;; Rebuild one of the binaries we removed earlier - (invoke "javac" "src/main/java/org/xerial/snappy/OSInfo.java" - "-d" "lib") - ;; Link to the dynamic snappy, not the static ones - (substitute* "Makefile.common" - (("-shared") "-shared -lsnappy")) - (substitute* "Makefile" - ;; Don't download the sources here. - (("\\$\\(SNAPPY_UNPACKED\\) ") "") - ((": \\$\\(SNAPPY_UNPACKED\\) ") ":") - ;; What we actually want to build - (("SNAPPY_OBJ:=.*") - "SNAPPY_OBJ:=$(addprefix $(SNAPPY_OUT)/, SnappyNative.o)\n") - ;; Since we removed the directory structure in "native" during - ;; the previous phase, we need to recreate it. - (("NAME\\): \\$\\(SNAPPY_OBJ\\)") - "NAME): $(SNAPPY_OBJ)\n\t@mkdir -p $(@D)")) - ;; Finally we can run the Makefile to build the dynamic library. - (invoke "make" "native"))) - ;; Once we have built the shared library, we need to place it in the - ;; "build" directory so it can be added to the jar file. - (add-after 'build-jni 'copy-jni - (lambda _ - (copy-recursively "src/main/resources/org/xerial/snappy/native" - "build/classes/org/xerial/snappy/native") - #t)) - (add-before 'check 'fix-tests - (lambda _ - (mkdir-p "src/test/resources/org/xerial/snappy/") - (copy-recursively "src/test/java/org/xerial/snappy/testdata" - "src/test/resources/org/xerial/snappy/testdata") - (install-file "src/test/java/org/xerial/snappy/alice29.txt" - "src/test/resources/org/xerial/snappy/") - #t))))))) - -(define-public java-iq80-snappy - (package - (name "java-iq80-snappy") - (version "0.4") - (source (origin - (method url-fetch) - (uri (string-append "https://github.com/dain/snappy/archive/snappy-" - version ".tar.gz")) - (sha256 - (base32 - "0rb3zhci7w9wzd65lfnk7p3ip0n6gb58a9qpx8n7r0231gahyamf")))) - (build-system ant-build-system) - (arguments - `(#:jar-name "iq80-snappy.jar" - #:source-dir "src/main/java" - #:test-dir "src/test" - #:jdk ,icedtea-8 - #:phases - (modify-phases %standard-phases - (replace 'check - (lambda _ - (define (test class) - (invoke "java" "-cp" (string-append (getenv "CLASSPATH") - ":build/classes" - ":build/test-classes") - "-Dtest.resources.dir=src/test/resources" - "org.testng.TestNG" "-testclass" - class)) - (invoke "ant" "compile-tests") - (test "org.iq80.snappy.SnappyFramedStreamTest") - (test "org.iq80.snappy.SnappyStreamTest") - #t)) - (add-before 'build 'remove-hadoop-dependency - (lambda _ - ;; We don't have hadoop - (delete-file "src/main/java/org/iq80/snappy/HadoopSnappyCodec.java") - (delete-file "src/test/java/org/iq80/snappy/TestHadoopSnappyCodec.java") - #t))))) - (home-page "https://github.com/dain/snappy") - (native-inputs - `(("guava" ,java-guava) - ("java-snappy" ,java-snappy) - ("hamcrest" ,java-hamcrest-core) - ("testng" ,java-testng))) - (synopsis "Java port of the Snappy (de)compressor") - (description - "Iq80-snappy is a port of the Snappy compressor and decompressor rewritten -in pure Java. This compression code produces a byte-for-byte exact copy of the -output created by the original C++ code, and is extremely fast.") - (license license:asl2.0))) - -(define-public java-jbzip2 - (package - (name "java-jbzip2") - (version "0.9.1") - (source (origin - (method url-fetch) - (uri (string-append "https://storage.googleapis.com/" - "google-code-archive-source/v2/" - "code.google.com/jbzip2/" - "source-archive.zip")) - (file-name (string-append name "-" version ".zip")) - (sha256 - (base32 - "0ncmhlqmrfmj96nqf6p77b9ws35lcfsvpfxzwxi2asissc83z1l3")))) - (build-system ant-build-system) - (native-inputs - `(("unzip" ,unzip) - ("java-junit" ,java-junit))) - (arguments - `(#:tests? #f ; no tests - #:jar-name "jbzip2.jar" - #:source-dir "tags/release-0.9.1/src" - #:phases - (modify-phases %standard-phases - (add-after 'unpack 'fix-encoding-problems - (lambda _ - ;; Some of the files we're patching are - ;; ISO-8859-1-encoded, so choose it as the default - ;; encoding so the byte encoding is preserved. - (with-fluids ((%default-port-encoding #f)) - (substitute* "tags/release-0.9.1/src/org/itadaki/bzip2/HuffmanAllocator.java" - (("Milidi.") "Milidiu"))) - #t))))) - (home-page "https://code.google.com/archive/p/jbzip2/") - (synopsis "Java bzip2 compression/decompression library") - (description "Jbzip2 is a Java bzip2 compression/decompression library. -It can be used as a replacement for the Apache @code{CBZip2InputStream} / -@code{CBZip2OutputStream} classes.") - (license license:expat))) - (define-public p7zip (package (name "p7zip") @@ -2099,43 +1858,6 @@ without having to worry how it does so, or use different interfaces for each type by using either Perl modules, or command-line tools on your system.") (license license:perl-license))) -(define-public java-tukaani-xz - (package - (name "java-tukaani-xz") - (version "1.6") - (source (origin - (method url-fetch) - (uri (string-append "https://tukaani.org/xz/xz-java-" version ".zip")) - (sha256 - (base32 - "1z3p1ri1gvl07inxn0agx44ck8n7wrzfmvkz8nbq3njn8r9wba8x")))) - (build-system ant-build-system) - (arguments - `(#:tests? #f; no tests - #:phases - (modify-phases %standard-phases - (add-after 'unpack 'chdir - (lambda _ - ;; Our build system enters the first directory in the archive, but - ;; the package is not contained in a subdirectory - (chdir "..") - #t)) - (replace 'install - (lambda* (#:key outputs #:allow-other-keys) - ;; Do we want to install *Demo.jar? - (install-file "build/jar/xz.jar" - (string-append - (assoc-ref outputs "out") - "/share/java/xz.jar")) - #t))))) - (native-inputs - `(("unzip" ,unzip))) - (home-page "https://tukaani.org") - (synopsis "XZ in Java") - (description "Tukaani-xz is an implementation of xz compression/decompression -algorithms in Java.") - (license license:public-domain))) - (define-public lunzip (package (name "lunzip") diff --git a/gnu/packages/java-compression.scm b/gnu/packages/java-compression.scm new file mode 100644 index 0000000000..8cebfc65a5 --- /dev/null +++ b/gnu/packages/java-compression.scm @@ -0,0 +1,308 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright © 2017, 2019 Ricardo Wurmus +;;; Copyright © 2017, 2018 Julien Lepiller +;;; Copyright © 2018 Marius Bakke +;;; Copyright © 2018 Mark H Weaver +;;; Copyright © 2018 Tobias Geerinckx-Rice +;;; +;;; This file is part of GNU Guix. +;;; +;;; GNU Guix is free software; you can redistribute it and/or modify it +;;; under the terms of the GNU General Public License as published by +;;; the Free Software Foundation; either version 3 of the License, or (at +;;; your option) any later version. +;;; +;;; GNU Guix is distributed in the hope that it will be useful, but +;;; WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with GNU Guix. If not, see . + +(define-module (gnu packages java-compression) + #:use-module ((guix licenses) #:prefix license:) + #:use-module (guix utils) + #:use-module (guix packages) + #:use-module (guix download) + #:use-module (guix build-system ant) + #:use-module (gnu packages) + #:use-module (gnu packages compression) + #:use-module (gnu packages java) + #:use-module (gnu packages perl)) + +(define-public java-snappy + (package + (name "java-snappy") + (version "1.1.7.2") + (source (origin + (method url-fetch) + (uri (string-append "https://github.com/xerial/snappy-java/archive/" + version ".tar.gz")) + (file-name (string-append name "-" version ".tar.gz")) + (sha256 + (base32 + "1p557vdv006ysgxbpp83krmq0066k46108vyiyka69w8i4i8rbbm")))) + (build-system ant-build-system) + (arguments + `(#:jar-name "snappy.jar" + #:source-dir "src/main/java" + #:phases + (modify-phases %standard-phases + (add-before 'build 'remove-binaries + (lambda _ + (delete-file "lib/org/xerial/snappy/OSInfo.class") + (delete-file-recursively "src/main/resources/org/xerial/snappy/native") + #t)) + (add-before 'build 'build-jni + (lambda _ + ;; Rebuild one of the binaries we removed earlier + (invoke "javac" "src/main/java/org/xerial/snappy/OSInfo.java" + "-d" "lib") + ;; Link to the dynamic bitshuffle and snappy, not the static ones + (substitute* "Makefile.common" + (("-shared") + "-shared -lbitshuffle -lsnappy")) + (substitute* "Makefile" + ;; Don't try to use git, don't download bitshuffle source + ;; and don't build it. + (("\\$\\(SNAPPY_GIT_UNPACKED\\) ") + "") + ((": \\$\\(SNAPPY_GIT_UNPACKED\\)") + ":") + (("\\$\\(BITSHUFFLE_UNPACKED\\) ") + "") + ((": \\$\\(SNAPPY_SOURCE_CONFIGURED\\)") ":") + ;; What we actually want to build + (("SNAPPY_OBJ:=.*") + "SNAPPY_OBJ:=$(addprefix $(SNAPPY_OUT)/, \ + SnappyNative.o BitShuffleNative.o)\n") + ;; Since we removed the directory structure in "native" during + ;; the previous phase, we need to recreate it. + (("NAME\\): \\$\\(SNAPPY_OBJ\\)") + "NAME): $(SNAPPY_OBJ)\n\t@mkdir -p $(@D)")) + ;; Finally we can run the Makefile to build the dynamic library. + ;; Use the -nocmake target to avoid a dependency on cmake, + ;; which in turn requires the "git_unpacked" directory. + (invoke "make" "native-nocmake"))) + ;; Once we have built the shared library, we need to place it in the + ;; "build" directory so it can be added to the jar file. + (add-after 'build-jni 'copy-jni + (lambda _ + (copy-recursively "src/main/resources/org/xerial/snappy/native" + "build/classes/org/xerial/snappy/native") + #t)) + (add-before 'check 'fix-failing + (lambda _ + (with-directory-excursion "src/test/java/org/xerial/snappy" + ;; This package assumes maven build, which puts results in "target". + ;; We put them in "build" instead, so fix that. + (substitute* "SnappyLoaderTest.java" + (("target/classes") "build/classes")) + ;; This requires Hadoop, which is not in Guix yet. + (delete-file "SnappyHadoopCompatibleOutputStreamTest.java")) + #t))))) + (inputs + `(("osgi-framework" ,java-osgi-framework))) + (propagated-inputs + `(("bitshuffle" ,bitshuffle-for-snappy) + ("snappy" ,snappy))) + (native-inputs + `(("junit" ,java-junit) + ("hamcrest" ,java-hamcrest-core) + ("xerial-core" ,java-xerial-core) + ("classworlds" ,java-plexus-classworlds) + ("commons-lang" ,java-commons-lang) + ("commons-io" ,java-commons-io) + ("perl" ,perl))) + (home-page "https://github.com/xerial/snappy-java") + (synopsis "Compression/decompression algorithm in Java") + (description "Snappy-java is a Java port of snappy, a fast C++ +compressor/decompressor.") + (license license:asl2.0))) + +(define-public java-snappy-1 + (package + (inherit java-snappy) + (version "1.0.3-rc3") + (source (origin + (method url-fetch) + (uri (string-append "https://github.com/xerial/snappy-java/archive/" + "snappy-java-" version ".tar.gz")) + (sha256 + (base32 + "08hsxlqidiqck0q57fshwyv3ynyxy18vmhrai9fyc8mz17m7gsa3")))) + (arguments + `(#:jar-name "snappy.jar" + #:source-dir "src/main/java" + #:phases + (modify-phases %standard-phases + (add-before 'build 'remove-binaries + (lambda _ + (delete-file "lib/org/xerial/snappy/OSInfo.class") + (delete-file-recursively "src/main/resources/org/xerial/snappy/native") + #t)) + (add-before 'build 'build-jni + (lambda _ + ;; Rebuild one of the binaries we removed earlier + (invoke "javac" "src/main/java/org/xerial/snappy/OSInfo.java" + "-d" "lib") + ;; Link to the dynamic snappy, not the static ones + (substitute* "Makefile.common" + (("-shared") "-shared -lsnappy")) + (substitute* "Makefile" + ;; Don't download the sources here. + (("\\$\\(SNAPPY_UNPACKED\\) ") "") + ((": \\$\\(SNAPPY_UNPACKED\\) ") ":") + ;; What we actually want to build + (("SNAPPY_OBJ:=.*") + "SNAPPY_OBJ:=$(addprefix $(SNAPPY_OUT)/, SnappyNative.o)\n") + ;; Since we removed the directory structure in "native" during + ;; the previous phase, we need to recreate it. + (("NAME\\): \\$\\(SNAPPY_OBJ\\)") + "NAME): $(SNAPPY_OBJ)\n\t@mkdir -p $(@D)")) + ;; Finally we can run the Makefile to build the dynamic library. + (invoke "make" "native"))) + ;; Once we have built the shared library, we need to place it in the + ;; "build" directory so it can be added to the jar file. + (add-after 'build-jni 'copy-jni + (lambda _ + (copy-recursively "src/main/resources/org/xerial/snappy/native" + "build/classes/org/xerial/snappy/native") + #t)) + (add-before 'check 'fix-tests + (lambda _ + (mkdir-p "src/test/resources/org/xerial/snappy/") + (copy-recursively "src/test/java/org/xerial/snappy/testdata" + "src/test/resources/org/xerial/snappy/testdata") + (install-file "src/test/java/org/xerial/snappy/alice29.txt" + "src/test/resources/org/xerial/snappy/") + #t))))))) + +(define-public java-iq80-snappy + (package + (name "java-iq80-snappy") + (version "0.4") + (source (origin + (method url-fetch) + (uri (string-append "https://github.com/dain/snappy/archive/snappy-" + version ".tar.gz")) + (sha256 + (base32 + "0rb3zhci7w9wzd65lfnk7p3ip0n6gb58a9qpx8n7r0231gahyamf")))) + (build-system ant-build-system) + (arguments + `(#:jar-name "iq80-snappy.jar" + #:source-dir "src/main/java" + #:test-dir "src/test" + #:jdk ,icedtea-8 + #:phases + (modify-phases %standard-phases + (replace 'check + (lambda _ + (define (test class) + (invoke "java" "-cp" (string-append (getenv "CLASSPATH") + ":build/classes" + ":build/test-classes") + "-Dtest.resources.dir=src/test/resources" + "org.testng.TestNG" "-testclass" + class)) + (invoke "ant" "compile-tests") + (test "org.iq80.snappy.SnappyFramedStreamTest") + (test "org.iq80.snappy.SnappyStreamTest") + #t)) + (add-before 'build 'remove-hadoop-dependency + (lambda _ + ;; We don't have hadoop + (delete-file "src/main/java/org/iq80/snappy/HadoopSnappyCodec.java") + (delete-file "src/test/java/org/iq80/snappy/TestHadoopSnappyCodec.java") + #t))))) + (home-page "https://github.com/dain/snappy") + (native-inputs + `(("guava" ,java-guava) + ("java-snappy" ,java-snappy) + ("hamcrest" ,java-hamcrest-core) + ("testng" ,java-testng))) + (synopsis "Java port of the Snappy (de)compressor") + (description + "Iq80-snappy is a port of the Snappy compressor and decompressor rewritten +in pure Java. This compression code produces a byte-for-byte exact copy of the +output created by the original C++ code, and is extremely fast.") + (license license:asl2.0))) + +(define-public java-jbzip2 + (package + (name "java-jbzip2") + (version "0.9.1") + (source (origin + (method url-fetch) + (uri (string-append "https://storage.googleapis.com/" + "google-code-archive-source/v2/" + "code.google.com/jbzip2/" + "source-archive.zip")) + (file-name (string-append name "-" version ".zip")) + (sha256 + (base32 + "0ncmhlqmrfmj96nqf6p77b9ws35lcfsvpfxzwxi2asissc83z1l3")))) + (build-system ant-build-system) + (native-inputs + `(("unzip" ,unzip) + ("java-junit" ,java-junit))) + (arguments + `(#:tests? #f ; no tests + #:jar-name "jbzip2.jar" + #:source-dir "tags/release-0.9.1/src" + #:phases + (modify-phases %standard-phases + (add-after 'unpack 'fix-encoding-problems + (lambda _ + ;; Some of the files we're patching are + ;; ISO-8859-1-encoded, so choose it as the default + ;; encoding so the byte encoding is preserved. + (with-fluids ((%default-port-encoding #f)) + (substitute* "tags/release-0.9.1/src/org/itadaki/bzip2/HuffmanAllocator.java" + (("Milidi.") "Milidiu"))) + #t))))) + (home-page "https://code.google.com/archive/p/jbzip2/") + (synopsis "Java bzip2 compression/decompression library") + (description "Jbzip2 is a Java bzip2 compression/decompression library. +It can be used as a replacement for the Apache @code{CBZip2InputStream} / +@code{CBZip2OutputStream} classes.") + (license license:expat))) + +(define-public java-tukaani-xz + (package + (name "java-tukaani-xz") + (version "1.6") + (source (origin + (method url-fetch) + (uri (string-append "https://tukaani.org/xz/xz-java-" version ".zip")) + (sha256 + (base32 + "1z3p1ri1gvl07inxn0agx44ck8n7wrzfmvkz8nbq3njn8r9wba8x")))) + (build-system ant-build-system) + (arguments + `(#:tests? #f; no tests + #:phases + (modify-phases %standard-phases + (add-after 'unpack 'chdir + (lambda _ + ;; Our build system enters the first directory in the archive, but + ;; the package is not contained in a subdirectory + (chdir "..") + #t)) + (replace 'install + (lambda* (#:key outputs #:allow-other-keys) + ;; Do we want to install *Demo.jar? + (install-file "build/jar/xz.jar" + (string-append + (assoc-ref outputs "out") + "/share/java/xz.jar")) + #t))))) + (native-inputs + `(("unzip" ,unzip))) + (home-page "https://tukaani.org") + (synopsis "XZ in Java") + (description "Tukaani-xz is an implementation of xz compression/decompression +algorithms in Java.") + (license license:public-domain))) diff --git a/gnu/packages/java.scm b/gnu/packages/java.scm index c607cbbcc5..163c296278 100644 --- a/gnu/packages/java.scm +++ b/gnu/packages/java.scm @@ -60,6 +60,7 @@ #:use-module (gnu packages guile) #:use-module (gnu packages icu4c) #:use-module (gnu packages image) + #:use-module (gnu packages java-compression) #:use-module (gnu packages libffi) #:use-module (gnu packages linux) ;alsa #:use-module (gnu packages maths) -- cgit v1.2.3