From 626af0525b7cae58bc7051c5dd627a89ce1b1ad5 Mon Sep 17 00:00:00 2001 From: Mark Wright Date: Tue, 14 Jan 2020 23:13:15 +1100 Subject: dev-lang/scala: Bump to 2.12.10 Thanks to toralf for reporting bug #623824, fixed with EAPI=7. Thanks to Till Schafer for reporting bug #662184, fixed with: use doc && einstalldocs Thanks to Gentookh for reporting, fixed by only calling check-reqs functions if ! use binary Closes: https://bugs.gentoo.org/show_bug.cgi?id=623824 Closes: https://bugs.gentoo.org/show_bug.cgi?id=662184 Closes: https://bugs.gentoo.org/show_bug.cgi?id=617586 Package-Manager: Portage-2.3.84, Repoman-2.3.20 Signed-off-by: Mark Wright --- dev-lang/scala/Manifest | 4 + dev-lang/scala/files/scala-2.12.10-no-git.patch | 37 +++++ dev-lang/scala/scala-2.12.10.ebuild | 198 ++++++++++++++++++++++++ 3 files changed, 239 insertions(+) create mode 100644 dev-lang/scala/files/scala-2.12.10-no-git.patch create mode 100644 dev-lang/scala/scala-2.12.10.ebuild (limited to 'dev-lang/scala') diff --git a/dev-lang/scala/Manifest b/dev-lang/scala/Manifest index 1bf33c711620..3c7a3439e3cc 100644 --- a/dev-lang/scala/Manifest +++ b/dev-lang/scala/Manifest @@ -1,3 +1,7 @@ +DIST scala-2.12.10-gentoo-binary.tar.xz 79479656 BLAKE2B 2d75552ba960a1f1cda5f678f1ba6ca01d5a41b813c098ceacdea93f8a3ea3f7c45d18a94f7be891f22d01fc9fc9a14b0c077723056e859ade327f973c545572 SHA512 f9eee5667bd31e1d90da2a95ffde9f894bef557dcebd6db9e882baed9b9ba6a9d290cdb34688307467578fdc8e20993911d64bd5d442e0a7198e4889edb80a2b +DIST scala-2.12.10-ivy2-deps.tar.xz 76800392 BLAKE2B 4290f8f3a2f0122620e5c459e23fece319168c1c7807c93ec731b99d89ec2ffb19591c3e01d2827e984f46214895dac7c68456f92241afb165a0cb6088ac33d6 SHA512 71870332e8488de99d0e8dc11c8afe009152b83feef1912c91c7ca6201de67c96b9760ee039ce0449d5893da0c2086e5c9f7819ad8008e899ab49508a1de1e99 +DIST scala-2.12.10-sbt-deps.tar.xz 34944260 BLAKE2B a42a320340f180c60ae2f5e908eb5fabd3cd4d4e9218c724ec74a79f288b4145445de7ccf91cc2dea3ab1bb128beffbbaeedfb1ed4e44f9c0ad66b16fba4741b SHA512 08bb9eea27ac3603bf4772d29235bf076bf7bb5433fc13d2faf85d7362b4a80176651457851c4eefb41a0169ce1204e634f44e22e5d6ac83777c11c90d9a8aae +DIST scala-2.12.10.tar.gz 6725873 BLAKE2B 5534baed3c51d8234b67cec79d8f6859bde403e79e557a0d50019d834c9f448398b507ad90aca522437f870a2f4cbdf56a2b7c5bee67a95c1e96b237bebcefc6 SHA512 30079ee83e89c189e84e94068f261aafe1fd7fe0cb4177e2802ac85372c4c2272c5af2b57424ab90e5236cbaca2f30936635f8f3bb4bfb2c748483e9c52ae96e DIST scala-2.12.4-annotations.jar 2242 BLAKE2B 0c731c25eaa407bdfb51d749f688062a33bd7f2815e8303ba5c56532027350f58d5ab364f2428547c2a99e2032ba0d0d20d4d50cc27dc5c42946e7842111547d SHA512 3ceee0b1361b9e0911c1ff060ad108a1d93f7ea3e82ef946401cd5f895cb06016ac0ecdfd095f99b11cfb28c4cef7705c1b564c7af644c5f19b45c14a413c4dd DIST scala-2.12.4-ant-contrib.jar 224277 BLAKE2B f43bfe3da05decbcf4ec9d2f48bface141907abfbe5b17532e970dbb660e0e1ffae9807c12da38cd6dc8e57c2605c6ec86ad11a99331e73edd3e4418656ab27e SHA512 5ec325a55bb213226c86faf8a99951839319e9579956ae58e2ccfe84f62d2742542998f98eed3f0dc8f8f94635d6dff1fe02e3c0f5289df1f09027ae2b9bee83 DIST scala-2.12.4-ant-dotnet-1.0.jar 57795 BLAKE2B 1f04f20739a231816a6d9c81ac0ba23f155ebdb467f466640b18ba2b4f125a6171bcf420c42f71fcfa2c13293a5241e200d0d908bd460ca3ae0342b13747aaad SHA512 72afc387cf9dbeb99e627ca7f35f919f627bbf3f072eb46036120695fb70311490593c255c2a2e79b684adb8f213d8ab591d4ceda5d5f2e6b6906a6977b38867 diff --git a/dev-lang/scala/files/scala-2.12.10-no-git.patch b/dev-lang/scala/files/scala-2.12.10-no-git.patch new file mode 100644 index 000000000000..017cb983b59b --- /dev/null +++ b/dev-lang/scala/files/scala-2.12.10-no-git.patch @@ -0,0 +1,37 @@ +--- scala-2.12.10-orig/project/VersionUtil.scala 2019-09-05 01:01:59.000000000 +1000 ++++ scala-2.12.10/project/VersionUtil.scala 2019-09-12 11:00:05.525154568 +1000 +@@ -2,7 +2,7 @@ + + import sbt.{stringToProcess => _, _} + import Keys._ +-import java.util.{Date, Locale, Properties, TimeZone} ++import java.util.{Calendar, Date, Locale, Properties, TimeZone} + import java.io.{File, FileInputStream} + import java.text.SimpleDateFormat + +@@ -65,18 +65,13 @@ + val log = sLog.value + val (dateObj, sha) = { + try { +- // Use JGit to get the commit date and SHA +- import org.eclipse.jgit.storage.file.FileRepositoryBuilder +- import org.eclipse.jgit.revwalk.RevWalk +- val db = new FileRepositoryBuilder().findGitDir.build +- val head = db.resolve("HEAD") +- if (head eq null) { +- log.info("No git HEAD commit found -- Using current date and 'unknown' SHA") +- (new Date, "unknown") +- } else { +- val commit = new RevWalk(db).parseCommit(head) +- (new Date(commit.getCommitTime.toLong * 1000L), commit.getName.substring(0, 7)) +- } ++ val commit = "61701c22900f14676fa181500722b64330eb2605" ++ val cal = Calendar.getInstance(); ++ cal.set(Calendar.YEAR, 2019); ++ cal.set(Calendar.MONTH, Calendar.SEPTEMBER); ++ cal.set(Calendar.DAY_OF_MONTH, 5); ++ val date = cal.getTime(); ++ (date, commit.substring(0, 7)) + } catch { + case ex: Exception => + log.error("Could not determine commit date + SHA: " + ex) diff --git a/dev-lang/scala/scala-2.12.10.ebuild b/dev-lang/scala/scala-2.12.10.ebuild new file mode 100644 index 000000000000..0ae8d3064386 --- /dev/null +++ b/dev-lang/scala/scala-2.12.10.ebuild @@ -0,0 +1,198 @@ +# Copyright 1999-2020 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI="7" + +JAVA_PKG_IUSE="doc source" + +inherit eutils check-reqs java-pkg-2 + +SV="$(ver_cut 1-2)" +SBTV="0.13.18" + +# Note: to bump scala, some things to try are: +# 1. remove the https://dev.gentoo.org/~gienah/snapshots/${P}-ivy2-deps.tar.gz +# and https://dev.gentoo.org/~gienah/snapshots/${P}-sbt-deps.tar.gz from +# SRC_URI +# 2. try emerge scala, with network-sandbox disabled: +# FEATURES="noclean -network-sandbox" emerge dev-lang/scala +# Check if it downloads more stuff in src_compile to +# ${WORKDIR}/.ivy2 or ${WORKDIR}/.sbt or /root/.ivy2 or /root/.sbt +# 3. tar up all the .ivy2 and .sbt junk into ${P}-ivy2-deps.tar.xz and +# ${P}-sbt-deps.tar.xz and add them to SRC_URI, in ${WORKDIR}: +# XZ_OPT=-9 tar --owner=portage --group=portage \ +# -cJf /usr/portage/distfiles/${P}-ivy2-deps.tar.xz .ivy2/cache +# XZ_OPT=-9 tar --owner=portage --group=portage \ +# -cJf /usr/portage/distfiles/${P}-sbt-deps.tar.xz .sbt +# 4. Add these tar files to SRC_URI (undo step 1). +# 5. Try emerging it again, with network-sandbox, and create the bianry +# tar archive: +# FEATURES="noclean network-sandbox -test" USE="doc source" emerge dev-lang/scala +# cd $WORDKIR +# XZ_OPT=-9 tar --owner=portage --group=portage \ +# -cJf /usr/portage/distfiles/${P}-gentoo-binary.tar.xz .ivy2/local \ +# ${P}/build/pack/bin ${P}/build/quick/classes/scala-dist/man/man1 \ +# ${P}/src/library ${P}/src/library-aux ${P}/src/reflect ${P}/doc/README \ +# ${P}/build/scaladoc + +DESCRIPTION="The Scala Programming Language" +HOMEPAGE="http://www.scala-lang.org/" +SRC_URI=" + !binary? ( + https://github.com/scala/scala/archive/v${PV}.tar.gz -> ${P}.tar.gz + https://dev.gentoo.org/~gienah/snapshots/${P}-ivy2-deps.tar.xz + https://dev.gentoo.org/~gienah/snapshots/${P}-sbt-deps.tar.xz + ) + binary? ( + https://dev.gentoo.org/~gienah/files/dist/${P}-gentoo-binary.tar.xz + )" +LICENSE="BSD" +SLOT="${SV}/${PV}" +KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux ~x86-macos" + +IUSE="binary emacs" + +COMMON_DEP="dev-java/ant-core:0 + dev-java/jline:2" + +DEPEND="${COMMON_DEP} + !binary? ( + >=virtual/jdk-1.8:* + >=dev-java/sbt-${SBTV}:0 + media-gfx/graphviz + ) + binary? ( + >=virtual/jdk-1.8:* + ) + app-arch/xz-utils:0" + +RDEPEND="${COMMON_DEP} + >=virtual/jre-1.8:* + app-eselect/eselect-scala + !dev-lang/scala-bin:0" + +PDEPEND="emacs? ( app-emacs/scala-mode:0 )" + +CHECKREQS_MEMORY="1536M" + +pkg_setup() { + java-pkg-2_pkg_setup + + if ! use binary; then + debug-print "Checking for sufficient physical RAM" + + ewarn "This package can fail to build with memory allocation errors in some cases." + ewarn "If you are unable to build from sources, please try USE=binary" + ewarn "for this package. See bug #181390 for more information." + + check-reqs_pkg_setup + fi +} + +pkg_pretend() { + if ! use binary; then + check-reqs_pkg_pretend + fi +} + +src_unpack() { + # Unpack tar files only. + for f in ${A} ; do + [[ ${f} == *".tar."* ]] && unpack ${f} + done +} + +src_prepare() { + java-pkg_getjars ant-core,jline-2,sbt + + if ! use binary; then + local a + for a in "${JURI[@]}" + do + echo "${a}" + local g="${a/* -> /}" + echo "${g}" + local j="${a/ -> */}" + echo "${j}" + cp -p "${DISTDIR}/${g}" "${S}/${j#${BURI}/*/}" || die + done + + # gentoo patch (by gienah) to stop it calling git log in the build + eapply "${FILESDIR}/${PN}-2.12.10-no-git.patch" + + local SBT_PVR="$(java-config --query=PVR --package=sbt)" + sed -e "s@sbt.version=${SBTV}@sbt.version=${SBT_PVR}@" \ + -i "${S}/project/build.properties" \ + || die "Could not set sbt.version=${SBT_PVR} in project/build.properties" + + cat <<- EOF > "${S}/sbt" + #!/bin/bash + gjl_package=sbt + gjl_jar="sbt-launch.jar" + gjl_java_args="-Dsbt.version=${SBT_PVR} -Xms512M -Xmx1536M -Xss1M -XX:+CMSClassUnloadingEnabled -Duser.home="${WORKDIR}"" + source /usr/share/java-config-2/launcher/launcher.bash + EOF + chmod u+x "${S}/sbt" || die + + sed -e 's@-Xmx1024M@-Xmx1536M@' \ + -i "${S}/build.sbt" \ + || die "Could not change increase memory size in ${S}/build.sbt" + fi + + default +} + +src_compile() { + if ! use binary; then + export PATH="${EROOT}usr/share/scala-${SV}/bin:${WORKDIR}/${L_P}:${PATH}" + export LANG="en_US.UTF-8" + einfo "=== scala compile ..." + "${S}"/sbt -Dsbt.log.noformat=true compile || die "sbt compile failed" + einfo "=== sbt publishLocal with jdk $(java-pkg_get-vm-version) ..." + "${S}"/sbt -Dsbt.log.noformat=true publishLocal \ + || die "sbt publishLocal failed" + else + einfo "Skipping compilation, USE=binary is set." + fi +} + +src_test() { + if ! use binary; then + "${S}"/sbt -Dsbt.log.noformat=true test || die "sbt test failed" + else + einfo "Skipping tests, USE=binary is set." + fi +} + +src_install() { + pushd build/pack || die + local SCALADIR="/usr/share/${PN}-${SV}" + exeinto "${SCALADIR}/bin" + doexe $(find bin/ -type f ! -iname '*.bat') + dodir /usr/bin + for b in $(find bin/ -type f ! -iname '*.bat'); do + local _name=$(basename "${b}") + dosym "${SCALADIR}/bin/${_name}" "/usr/bin/${_name}-${SV}" + done + popd || die + java-pkg_dojar $(find "${WORKDIR}"/.ivy2/local -name \*.jar -print) + + pushd build/quick/classes/scala-dist/man/man1 || die + for i in *.1; do + newman "${i}" "${i/./-${SV}.}" + done + popd || die + + #sources are .scala so no use for java-pkg_dosrc + pushd src || die + if use source; then + dodir "${SCALADIR}/src" + insinto "${SCALADIR}/src" + doins -r library library-aux reflect + fi + popd || die + + local DOCS=( "doc/README" ) + local HTML_DOCS=( "build/scaladoc" ) + use doc && einstalldocs +} -- cgit v1.2.3-65-gdbad