From 3f8f152f913dd9c3f9fea08af1118b85cace494f Mon Sep 17 00:00:00 2001 From: Seth Tisue Date: Thu, 3 Mar 2016 12:26:35 +0100 Subject: [PATCH] [nomerge] downgrade sbt-native-packager to 0.6.4 this restores the 2.11.7 status quo for the 2.11.8 release. the upgrade turned out to be way too problematic. even after multiple PRs addressing regressions, new ones continue to turn up; see https://github.com/scala/scala-dev/issues/92 for details on the latest regressions. for past history (including details on regressions), see these PRs in this repo: #159, #157, #156, #155, #154, #142, plus issue so what's next after this? - we could maybe still consider upgrading for 2.11.9, but someone would need to thoroughly QA it on all platforms and assure us there are no regressions - or we could restrict the upgrade to 2.12.x and hope for partially crowdsourced QA so that regressions would be caught during the milestone and release candidate phases. I lean towards leaving 2.11.x frozen at 0.6.4, at least unless the upgrade brings concrete benefits to end users (no one has listed any, to my knowledge). if this is mainly just dogfooding, then 2.12.x is a better context for that. --- build.sbt | 2 -- project/Docs.scala | 2 +- project/ScalaDist.scala | 38 +++++++++++++------------------------- project/Unix.scala | 5 +++-- project/plugins.sbt | 2 +- 5 files changed, 18 insertions(+), 31 deletions(-) diff --git a/build.sbt b/build.sbt index 151db83a9..c2709de61 100644 --- a/build.sbt +++ b/build.sbt @@ -23,8 +23,6 @@ Docs.settings ScalaDist.platformSettings -enablePlugins(UniversalPlugin, RpmPlugin, JDebPackaging, WindowsPlugin) - // resolvers += "local" at "file:///e:/.m2/repository" // resolvers += Resolver.mavenLocal // to test, run e.g., stage, or windows:packageBin, show s3-upload::mappings diff --git a/project/Docs.scala b/project/Docs.scala index ac8b99911..4b07d2163 100644 --- a/project/Docs.scala +++ b/project/Docs.scala @@ -16,7 +16,7 @@ object Docs { import ScalaDist._ def settings: Seq[Setting[_]] = Seq( - packageName in UniversalDocs := s"scala-docs-${version.value}", + name in UniversalDocs := s"scala-docs-${version.value}", // libraryDependencies += scalaDistDep(version.value, "javadoc"), // seems not to be necessary // need updateClassifiers to get javadoc jars mappings in UniversalDocs ++= createMappingsWith(updateClassifiers.value.toSeq, universalDocsMappings) diff --git a/project/ScalaDist.scala b/project/ScalaDist.scala index 51fc5acfc..da0e75f0d 100644 --- a/project/ScalaDist.scala +++ b/project/ScalaDist.scala @@ -2,8 +2,6 @@ import sbt._ import sbt.Keys._ import com.typesafe.sbt.SbtNativePackager._ -import com.typesafe.sbt.packager.MappingsHelper._ -import com.typesafe.sbt.packager.universal.UniversalPlugin.autoImport.useNativeZip import com.typesafe.sbt.packager.Keys._ import com.typesafe.sbt.S3Plugin.S3.upload @@ -40,18 +38,11 @@ object ScalaDist { mappings in upload += uploadMapping(packageZipTarball in UniversalDocs).value, mappings in upload += uploadMapping(packageXzTarball in UniversalDocs).value, mappings in upload += uploadMapping(packageBin in Rpm).value, - // Debian needs special handling because the value sbt-native-packager - // gives us for `packageBin in Debian` (coming from the archiveFilename - // method) includes the debian version and arch information, - // which we historically have not included. I don't see a way to - // override the filename on disk, so we re-map at upload time - mappings in upload += Def.task { - (packageBin in Debian).value -> - s"scala/${version.value}/${(name in Debian).value}-${version.value}.deb" - }.value + mappings in upload += uploadMapping(packageBin in Debian).value ) def settings: Seq[Setting[_]] = + packagerSettings ++ useNativeZip ++ // use native zip to preserve +x permission on scripts Seq( name := "scala", @@ -65,13 +56,7 @@ object ScalaDist { // create lib directory by resolving scala-dist's dependencies // to populate the rest of the distribution, explode scala-dist artifact itself - mappings in Universal ++= createMappingsWith(update.value.toSeq, universalMappings), - - // work around regression in sbt-native-packager 1.0.5 where - // these tasks invoke `tar` without any flags at all - universalArchiveOptions in (UniversalDocs, packageZipTarball) := Seq("--force-local", "-pcvf"), - universalArchiveOptions in (UniversalDocs, packageXzTarball ) := Seq("--force-local", "-pcvf") - + mappings in Universal ++= createMappingsWith(update.value.toSeq, universalMappings) ) // private lazy val onWindows = System.getProperty("os.name").toLowerCase(Locale.ENGLISH).contains("windows") @@ -89,16 +74,19 @@ object ScalaDist { case "scala-dist" => val tmpdir = IO.createTemporaryDirectory IO.unzip(file, tmpdir) + // IO.listFiles(tmpdir) does not recurse, use ** with glob "*" to find all files + (PathFinder(IO.listFiles(tmpdir)) ** "*").get flatMap { file => + val relative = IO.relativize(tmpdir, file).get // .get is safe because we just unzipped under tmpdir + + // files are stored in repository with platform-appropriate line endings + // if (onWindows && (relative endsWith ".bat")) toDosInPlace(file) - // create mappings from the unzip scala-dist zip - contentOf(tmpdir) filter { - case (file, dest) => !(dest.endsWith("MANIFEST.MF") || dest.endsWith("META-INF")) - } map { // make unix scripts executable (heuristically...) - case (file, dest) if (dest startsWith "bin/") && !(dest endsWith ".bat") => + if ((relative startsWith "bin/") && !(file.getName endsWith ".bat")) file.setExecutable(true, true) - file -> dest - case mapping => mapping + + if (relative startsWith "META-INF") Seq() + else Seq(file -> relative) } // core jars: use simple name for backwards compat diff --git a/project/Unix.scala b/project/Unix.scala index a65baecee..87d2b95f9 100644 --- a/project/Unix.scala +++ b/project/Unix.scala @@ -4,7 +4,6 @@ import sbt.Keys._ import com.typesafe.sbt.SbtNativePackager._ import com.typesafe.sbt.packager.Keys._ import com.typesafe.sbt.packager.linux.{LinuxPackageMapping => pkgMap, LinuxSymlink} -import com.typesafe.sbt.packager.linux.LinuxPlugin.autoImport.packageMapping /** Create debian & rpm packages. * @@ -92,7 +91,9 @@ object Unix { linuxPackageMappings in Debian += (packageMapping( (sourceDirectory.value / "debian" / "changelog") -> "/usr/share/doc/scala/changelog.gz" - ).withUser("root").withGroup("root").withPerms("0644").gzipped).asDocs() + ).withUser("root").withGroup("root").withPerms("0644").gzipped).asDocs(), + // Hack so we use regular version, rather than debian version. + target in Debian := target.value / s"${(name in Debian).value}-${version.value}" ) } diff --git a/project/plugins.sbt b/project/plugins.sbt index ec8543a63..bc54fc4c2 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,6 +1,6 @@ scalacOptions ++= Seq("-deprecation", "-feature", "-Xlint") -addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.0.6") +addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "0.6.4") addSbtPlugin("com.typesafe.sbt" % "sbt-s3" % "0.8")