From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ricardo Wurmus Subject: [PATCH 2/3] gnu: icedtea-6: Use modify-phases syntax. Date: Mon, 18 Jul 2016 13:59:40 +0200 Message-ID: <20160718115941.17707-3-ricardo.wurmus@mdc-berlin.de> References: <20160718115941.17707-1-ricardo.wurmus@mdc-berlin.de> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:35846) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bP7Ec-0000db-Pd for guix-devel@gnu.org; Mon, 18 Jul 2016 08:01:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bP7EV-00044c-4W for guix-devel@gnu.org; Mon, 18 Jul 2016 08:01:17 -0400 Received: from sinope02.bbbm.mdc-berlin.de ([141.80.25.24]:47742) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bP7EU-000449-MF for guix-devel@gnu.org; Mon, 18 Jul 2016 08:01:11 -0400 In-Reply-To: <20160718115941.17707-1-ricardo.wurmus@mdc-berlin.de> List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: guix-devel@gnu.org From: Ricardo Wurmus * gnu/packages/java.scm (icedtea-6)[arguments]: Use modify-phases syntax. --- gnu/packages/java.scm | 431 ++++++++++++++++++++++++-------------------------- 1 file changed, 211 insertions(+), 220 deletions(-) diff --git a/gnu/packages/java.scm b/gnu/packages/java.scm index 753fb77..faa6e5b 100644 --- a/gnu/packages/java.scm +++ b/gnu/packages/java.scm @@ -281,111 +281,108 @@ build process and its dependencies, whereas Make uses Makefile format.") ,(string-append "--with-jdk-home=" jdk) ,(string-append "--with-java=" jdk "/bin/java"))) #:phases - (alist-replace - 'unpack - (lambda* (#:key source inputs #:allow-other-keys) - (and (zero? (system* "tar" "xvf" source)) - (begin - (chdir (string-append "icedtea6-" ,version)) - (mkdir "openjdk.src") - (with-directory-excursion "openjdk.src" - (copy-file (assoc-ref inputs "openjdk6-src") - "openjdk6-src.tar.xz") - (zero? (system* "tar" "xvf" "openjdk6-src.tar.xz")))))) - (alist-cons-after - 'unpack 'patch-patches - (lambda _ - ;; shebang in patches so that they apply cleanly - (substitute* '("patches/jtreg-jrunscript.patch" - "patches/hotspot/hs23/drop_unlicensed_test.patch") - (("#!/bin/sh") (string-append "#!" (which "sh")))) + (modify-phases %standard-phases + (replace 'unpack + (lambda* (#:key source inputs #:allow-other-keys) + (and (zero? (system* "tar" "xvf" source)) + (begin + (chdir (string-append "icedtea6-" ,version)) + (mkdir "openjdk.src") + (with-directory-excursion "openjdk.src" + (copy-file (assoc-ref inputs "openjdk6-src") + "openjdk6-src.tar.xz") + (zero? (system* "tar" "xvf" "openjdk6-src.tar.xz"))))))) + (add-after 'unpack 'patch-patches + (lambda _ + ;; shebang in patches so that they apply cleanly + (substitute* '("patches/jtreg-jrunscript.patch" + "patches/hotspot/hs23/drop_unlicensed_test.patch") + (("#!/bin/sh") (string-append "#!" (which "sh")))) - ;; fix path to alsa header in patch - (substitute* "patches/openjdk/6799141-split_out_versions.patch" - (("ALSA_INCLUDE=/usr/include/alsa/version.h") - (string-append "ALSA_INCLUDE=" - (assoc-ref %build-inputs "alsa-lib") - "/include/alsa/version.h")))) - (alist-cons-after - 'unpack 'patch-paths - (lambda _ - ;; buildtree.make generates shell scripts, so we need to replace - ;; the generated shebang - (substitute* '("openjdk.src/hotspot/make/linux/makefiles/buildtree.make") - (("/bin/sh") (which "bash"))) + ;; fix path to alsa header in patch + (substitute* "patches/openjdk/6799141-split_out_versions.patch" + (("ALSA_INCLUDE=/usr/include/alsa/version.h") + (string-append "ALSA_INCLUDE=" + (assoc-ref %build-inputs "alsa-lib") + "/include/alsa/version.h"))))) + (add-after 'unpack 'patch-paths + (lambda _ + ;; buildtree.make generates shell scripts, so we need to replace + ;; the generated shebang + (substitute* '("openjdk.src/hotspot/make/linux/makefiles/buildtree.make") + (("/bin/sh") (which "bash"))) - (let ((corebin (string-append - (assoc-ref %build-inputs "coreutils") "/bin/")) - (binbin (string-append - (assoc-ref %build-inputs "binutils") "/bin/")) - (grepbin (string-append - (assoc-ref %build-inputs "grep") "/bin/"))) - (substitute* '("openjdk.src/jdk/make/common/shared/Defs-linux.gmk" - "openjdk.src/corba/make/common/shared/Defs-linux.gmk") - (("UNIXCOMMAND_PATH = /bin/") - (string-append "UNIXCOMMAND_PATH = " corebin)) - (("USRBIN_PATH = /usr/bin/") - (string-append "USRBIN_PATH = " corebin)) - (("DEVTOOLS_PATH *= */usr/bin/") - (string-append "DEVTOOLS_PATH = " corebin)) - (("COMPILER_PATH *= */usr/bin/") - (string-append "COMPILER_PATH = " - (assoc-ref %build-inputs "gcc") "/bin/")) - (("DEF_OBJCOPY *=.*objcopy") - (string-append "DEF_OBJCOPY = " (which "objcopy")))) + (let ((corebin (string-append + (assoc-ref %build-inputs "coreutils") "/bin/")) + (binbin (string-append + (assoc-ref %build-inputs "binutils") "/bin/")) + (grepbin (string-append + (assoc-ref %build-inputs "grep") "/bin/"))) + (substitute* '("openjdk.src/jdk/make/common/shared/Defs-linux.gmk" + "openjdk.src/corba/make/common/shared/Defs-linux.gmk") + (("UNIXCOMMAND_PATH = /bin/") + (string-append "UNIXCOMMAND_PATH = " corebin)) + (("USRBIN_PATH = /usr/bin/") + (string-append "USRBIN_PATH = " corebin)) + (("DEVTOOLS_PATH *= */usr/bin/") + (string-append "DEVTOOLS_PATH = " corebin)) + (("COMPILER_PATH *= */usr/bin/") + (string-append "COMPILER_PATH = " + (assoc-ref %build-inputs "gcc") "/bin/")) + (("DEF_OBJCOPY *=.*objcopy") + (string-append "DEF_OBJCOPY = " (which "objcopy")))) - ;; fix hard-coded utility paths - (substitute* '("openjdk.src/jdk/make/common/shared/Defs-utils.gmk" - "openjdk.src/corba/make/common/shared/Defs-utils.gmk") - (("ECHO *=.*echo") - (string-append "ECHO = " (which "echo"))) - (("^GREP *=.*grep") - (string-append "GREP = " (which "grep"))) - (("EGREP *=.*egrep") - (string-append "EGREP = " (which "egrep"))) - (("CPIO *=.*cpio") - (string-append "CPIO = " (which "cpio"))) - (("READELF *=.*readelf") - (string-append "READELF = " (which "readelf"))) - (("^ *AR *=.*ar") - (string-append "AR = " (which "ar"))) - (("^ *TAR *=.*tar") - (string-append "TAR = " (which "tar"))) - (("AS *=.*as") - (string-append "AS = " (which "as"))) - (("LD *=.*ld") - (string-append "LD = " (which "ld"))) - (("STRIP *=.*strip") - (string-append "STRIP = " (which "strip"))) - (("NM *=.*nm") - (string-append "NM = " (which "nm"))) - (("^SH *=.*sh") - (string-append "SH = " (which "bash"))) - (("^FIND *=.*find") - (string-append "FIND = " (which "find"))) - (("LDD *=.*ldd") - (string-append "LDD = " (which "ldd"))) - (("NAWK *=.*(n|g)awk") - (string-append "NAWK = " (which "gawk"))) - (("XARGS *=.*xargs") - (string-append "XARGS = " (which "xargs"))) - (("UNZIP *=.*unzip") - (string-append "UNZIP = " (which "unzip"))) - (("ZIPEXE *=.*zip") - (string-append "ZIPEXE = " (which "zip"))) - (("SED *=.*sed") - (string-append "SED = " (which "sed")))) + ;; fix hard-coded utility paths + (substitute* '("openjdk.src/jdk/make/common/shared/Defs-utils.gmk" + "openjdk.src/corba/make/common/shared/Defs-utils.gmk") + (("ECHO *=.*echo") + (string-append "ECHO = " (which "echo"))) + (("^GREP *=.*grep") + (string-append "GREP = " (which "grep"))) + (("EGREP *=.*egrep") + (string-append "EGREP = " (which "egrep"))) + (("CPIO *=.*cpio") + (string-append "CPIO = " (which "cpio"))) + (("READELF *=.*readelf") + (string-append "READELF = " (which "readelf"))) + (("^ *AR *=.*ar") + (string-append "AR = " (which "ar"))) + (("^ *TAR *=.*tar") + (string-append "TAR = " (which "tar"))) + (("AS *=.*as") + (string-append "AS = " (which "as"))) + (("LD *=.*ld") + (string-append "LD = " (which "ld"))) + (("STRIP *=.*strip") + (string-append "STRIP = " (which "strip"))) + (("NM *=.*nm") + (string-append "NM = " (which "nm"))) + (("^SH *=.*sh") + (string-append "SH = " (which "bash"))) + (("^FIND *=.*find") + (string-append "FIND = " (which "find"))) + (("LDD *=.*ldd") + (string-append "LDD = " (which "ldd"))) + (("NAWK *=.*(n|g)awk") + (string-append "NAWK = " (which "gawk"))) + (("XARGS *=.*xargs") + (string-append "XARGS = " (which "xargs"))) + (("UNZIP *=.*unzip") + (string-append "UNZIP = " (which "unzip"))) + (("ZIPEXE *=.*zip") + (string-append "ZIPEXE = " (which "zip"))) + (("SED *=.*sed") + (string-append "SED = " (which "sed")))) - ;; Some of these timestamps cause problems as they are more than - ;; 10 years ago, failing the build process. - (substitute* - "openjdk.src/jdk/src/share/classes/java/util/CurrencyData.properties" - (("AZ=AZM;2005-12-31-20-00-00;AZN") "AZ=AZN") - (("MZ=MZM;2006-06-30-22-00-00;MZN") "MZ=MZN") - (("RO=ROL;2005-06-30-21-00-00;RON") "RO=RON") - (("TR=TRL;2004-12-31-22-00-00;TRY") "TR=TRY")))) - (alist-cons-before - 'configure 'set-additional-paths + ;; Some of these timestamps cause problems as they are more than + ;; 10 years ago, failing the build process. + (substitute* + "openjdk.src/jdk/src/share/classes/java/util/CurrencyData.properties" + (("AZ=AZM;2005-12-31-20-00-00;AZN") "AZ=AZN") + (("MZ=MZM;2006-06-30-22-00-00;MZN") "MZ=MZN") + (("RO=ROL;2005-06-30-21-00-00;RON") "RO=RON") + (("TR=TRL;2004-12-31-22-00-00;TRY") "TR=TRY"))))) + (add-before 'configure 'set-additional-paths (lambda* (#:key inputs #:allow-other-keys) (let* ((gcjdir (assoc-ref %build-inputs "gcj")) (gcjlib (string-append gcjdir "/lib")) @@ -412,125 +409,119 @@ build process and its dependencies, whereas Make uses Makefile format.") "/include")) (setenv "ALT_FREETYPE_LIB_PATH" (string-append (assoc-ref %build-inputs "freetype") - "/lib")))) - (alist-cons-before - 'check 'fix-test-framework - (lambda _ - ;; Fix PATH in test environment - (substitute* "src/jtreg/com/sun/javatest/regtest/Main.java" - (("PATH=/bin:/usr/bin") - (string-append "PATH=" (getenv "PATH")))) - (substitute* "src/jtreg/com/sun/javatest/util/SysEnv.java" - (("/usr/bin/env") (which "env"))) - #t) - (alist-cons-before - 'check 'fix-hotspot-tests - (lambda _ - (with-directory-excursion "openjdk.src/hotspot/test/" - (substitute* "jprt.config" - (("PATH=\"\\$\\{path4sdk\\}\"") - (string-append "PATH=" (getenv "PATH"))) - (("make=/usr/bin/make") - (string-append "make=" (which "make")))) - (substitute* '("runtime/6626217/Test6626217.sh" - "runtime/7110720/Test7110720.sh") - (("/bin/rm") (which "rm")) - (("/bin/cp") (which "cp")) - (("/bin/mv") (which "mv")))) - #t) - (alist-cons-before - 'check 'fix-jdk-tests - (lambda _ - (with-directory-excursion "openjdk.src/jdk/test/" - (substitute* "com/sun/jdi/JdbReadTwiceTest.sh" - (("/bin/pwd") (which "pwd"))) - (substitute* "com/sun/jdi/ShellScaffold.sh" - (("/bin/kill") (which "kill"))) - (substitute* "start-Xvfb.sh" - ;;(("/usr/bin/X11/Xvfb") (which "Xvfb")) - (("/usr/bin/nohup") (which "nohup"))) - (substitute* "javax/security/auth/Subject/doAs/Test.sh" - (("/bin/rm") (which "rm"))) - (substitute* "tools/launcher/MultipleJRE.sh" - (("echo \"#!/bin/sh\"") - (string-append "echo \"#!" (which "rm") "\"")) - (("/usr/bin/zip") (which "zip"))) - (substitute* "com/sun/jdi/OnThrowTest.java" - (("#!/bin/sh") (string-append "#!" (which "sh")))) - (substitute* "java/lang/management/OperatingSystemMXBean/GetSystemLoadAverage.java" - (("/usr/bin/uptime") (which "uptime"))) - (substitute* "java/lang/ProcessBuilder/Basic.java" - (("/usr/bin/env") (which "env")) - (("/bin/false") (which "false")) - (("/bin/true") (which "true")) - (("/bin/cp") (which "cp")) - (("/bin/sh") (which "sh"))) - (substitute* "java/lang/ProcessBuilder/FeelingLucky.java" - (("/bin/sh") (which "sh"))) - (substitute* "java/lang/ProcessBuilder/Zombies.java" - (("/usr/bin/perl") (which "perl")) - (("/bin/ps") (which "ps")) - (("/bin/true") (which "true"))) - (substitute* "java/lang/Runtime/exec/ConcurrentRead.java" - (("/usr/bin/tee") (which "tee"))) - (substitute* "java/lang/Runtime/exec/ExecWithDir.java" - (("/bin/true") (which "true"))) - (substitute* "java/lang/Runtime/exec/ExecWithInput.java" - (("/bin/cat") (which "cat"))) - (substitute* "java/lang/Runtime/exec/ExitValue.java" - (("/bin/sh") (which "sh")) - (("/bin/true") (which "true")) - (("/bin/kill") (which "kill"))) - (substitute* "java/lang/Runtime/exec/LotsOfDestroys.java" - (("/usr/bin/echo") (which "echo"))) - (substitute* "java/lang/Runtime/exec/LotsOfOutput.java" - (("/usr/bin/cat") (which "cat"))) - (substitute* "java/lang/Runtime/exec/SleepyCat.java" - (("/bin/cat") (which "cat")) - (("/bin/sleep") (which "sleep")) - (("/bin/sh") (which "sh"))) - (substitute* "java/lang/Runtime/exec/StreamsSurviveDestroy.java" - (("/bin/cat") (which "cat"))) - (substitute* "java/rmi/activation/CommandEnvironment/SetChildEnv.java" - (("/bin/chmod") (which "chmod"))) - (substitute* "java/util/zip/ZipFile/Assortment.java" - (("/bin/sh") (which "sh")))) - #t) - (alist-replace - 'check - (lambda _ - ;; The "make check-*" targets always return zero, so we need to - ;; check for errors in the associated log files to determine - ;; whether any tests have failed. - (use-modules (ice-9 rdelim)) - (let* ((error-pattern (make-regexp "^(Error|FAILED):.*")) - (checker (lambda (port) - (let loop () - (let ((line (read-line port))) - (cond - ((eof-object? line) #t) - ((regexp-exec error-pattern line) #f) - (else (loop))))))) - (run-test (lambda (test) - (system* "make" test) - (call-with-input-file - (string-append "test/" test ".log") - checker)))) - (or #t ; skip tests - (and (run-test "check-hotspot") - (run-test "check-langtools") - (run-test "check-jdk"))))) - (alist-replace - 'install - (lambda* (#:key outputs #:allow-other-keys) - (let ((doc (string-append (assoc-ref outputs "doc") - "/share/doc/icedtea")) - (jre (assoc-ref outputs "out")) - (jdk (assoc-ref outputs "jdk"))) - (copy-recursively "openjdk.build/docs" doc) - (copy-recursively "openjdk.build/j2re-image" jre) - (copy-recursively "openjdk.build/j2sdk-image" jdk))) - %standard-phases))))))))))) + "/lib"))))) + (add-before 'check 'fix-test-framework + (lambda _ + ;; Fix PATH in test environment + (substitute* "src/jtreg/com/sun/javatest/regtest/Main.java" + (("PATH=/bin:/usr/bin") + (string-append "PATH=" (getenv "PATH")))) + (substitute* "src/jtreg/com/sun/javatest/util/SysEnv.java" + (("/usr/bin/env") (which "env"))) + #t)) + (add-before 'check 'fix-hotspot-tests + (lambda _ + (with-directory-excursion "openjdk.src/hotspot/test/" + (substitute* "jprt.config" + (("PATH=\"\\$\\{path4sdk\\}\"") + (string-append "PATH=" (getenv "PATH"))) + (("make=/usr/bin/make") + (string-append "make=" (which "make")))) + (substitute* '("runtime/6626217/Test6626217.sh" + "runtime/7110720/Test7110720.sh") + (("/bin/rm") (which "rm")) + (("/bin/cp") (which "cp")) + (("/bin/mv") (which "mv")))) + #t)) + (add-before 'check 'fix-jdk-tests + (lambda _ + (with-directory-excursion "openjdk.src/jdk/test/" + (substitute* "com/sun/jdi/JdbReadTwiceTest.sh" + (("/bin/pwd") (which "pwd"))) + (substitute* "com/sun/jdi/ShellScaffold.sh" + (("/bin/kill") (which "kill"))) + (substitute* "start-Xvfb.sh" + ;;(("/usr/bin/X11/Xvfb") (which "Xvfb")) + (("/usr/bin/nohup") (which "nohup"))) + (substitute* "javax/security/auth/Subject/doAs/Test.sh" + (("/bin/rm") (which "rm"))) + (substitute* "tools/launcher/MultipleJRE.sh" + (("echo \"#!/bin/sh\"") + (string-append "echo \"#!" (which "rm") "\"")) + (("/usr/bin/zip") (which "zip"))) + (substitute* "com/sun/jdi/OnThrowTest.java" + (("#!/bin/sh") (string-append "#!" (which "sh")))) + (substitute* "java/lang/management/OperatingSystemMXBean/GetSystemLoadAverage.java" + (("/usr/bin/uptime") (which "uptime"))) + (substitute* "java/lang/ProcessBuilder/Basic.java" + (("/usr/bin/env") (which "env")) + (("/bin/false") (which "false")) + (("/bin/true") (which "true")) + (("/bin/cp") (which "cp")) + (("/bin/sh") (which "sh"))) + (substitute* "java/lang/ProcessBuilder/FeelingLucky.java" + (("/bin/sh") (which "sh"))) + (substitute* "java/lang/ProcessBuilder/Zombies.java" + (("/usr/bin/perl") (which "perl")) + (("/bin/ps") (which "ps")) + (("/bin/true") (which "true"))) + (substitute* "java/lang/Runtime/exec/ConcurrentRead.java" + (("/usr/bin/tee") (which "tee"))) + (substitute* "java/lang/Runtime/exec/ExecWithDir.java" + (("/bin/true") (which "true"))) + (substitute* "java/lang/Runtime/exec/ExecWithInput.java" + (("/bin/cat") (which "cat"))) + (substitute* "java/lang/Runtime/exec/ExitValue.java" + (("/bin/sh") (which "sh")) + (("/bin/true") (which "true")) + (("/bin/kill") (which "kill"))) + (substitute* "java/lang/Runtime/exec/LotsOfDestroys.java" + (("/usr/bin/echo") (which "echo"))) + (substitute* "java/lang/Runtime/exec/LotsOfOutput.java" + (("/usr/bin/cat") (which "cat"))) + (substitute* "java/lang/Runtime/exec/SleepyCat.java" + (("/bin/cat") (which "cat")) + (("/bin/sleep") (which "sleep")) + (("/bin/sh") (which "sh"))) + (substitute* "java/lang/Runtime/exec/StreamsSurviveDestroy.java" + (("/bin/cat") (which "cat"))) + (substitute* "java/rmi/activation/CommandEnvironment/SetChildEnv.java" + (("/bin/chmod") (which "chmod"))) + (substitute* "java/util/zip/ZipFile/Assortment.java" + (("/bin/sh") (which "sh")))) + #t)) + (replace 'check + (lambda _ + ;; The "make check-*" targets always return zero, so we need to + ;; check for errors in the associated log files to determine + ;; whether any tests have failed. + (use-modules (ice-9 rdelim)) + (let* ((error-pattern (make-regexp "^(Error|FAILED):.*")) + (checker (lambda (port) + (let loop () + (let ((line (read-line port))) + (cond + ((eof-object? line) #t) + ((regexp-exec error-pattern line) #f) + (else (loop))))))) + (run-test (lambda (test) + (system* "make" test) + (call-with-input-file + (string-append "test/" test ".log") + checker)))) + (or #t ; skip tests + (and (run-test "check-hotspot") + (run-test "check-langtools") + (run-test "check-jdk")))))) + (replace 'install + (lambda* (#:key outputs #:allow-other-keys) + (let ((doc (string-append (assoc-ref outputs "doc") + "/share/doc/icedtea")) + (jre (assoc-ref outputs "out")) + (jdk (assoc-ref outputs "jdk"))) + (copy-recursively "openjdk.build/docs" doc) + (copy-recursively "openjdk.build/j2re-image" jre) + (copy-recursively "openjdk.build/j2sdk-image" jdk))))))) (native-inputs `(("ant" ,ant) ("alsa-lib" ,alsa-lib) -- 2.9.0