Skip to content

Commit 3f8f152

Browse files
committed
[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 scala/scala-dev#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.
1 parent eeefb5c commit 3f8f152

File tree

5 files changed

+18
-31
lines changed

5 files changed

+18
-31
lines changed

build.sbt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@ Docs.settings
2323

2424
ScalaDist.platformSettings
2525

26-
enablePlugins(UniversalPlugin, RpmPlugin, JDebPackaging, WindowsPlugin)
27-
2826
// resolvers += "local" at "file:///e:/.m2/repository"
2927
// resolvers += Resolver.mavenLocal
3028
// to test, run e.g., stage, or windows:packageBin, show s3-upload::mappings

project/Docs.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ object Docs {
1616
import ScalaDist._
1717

1818
def settings: Seq[Setting[_]] = Seq(
19-
packageName in UniversalDocs := s"scala-docs-${version.value}",
19+
name in UniversalDocs := s"scala-docs-${version.value}",
2020
// libraryDependencies += scalaDistDep(version.value, "javadoc"), // seems not to be necessary
2121
// need updateClassifiers to get javadoc jars
2222
mappings in UniversalDocs ++= createMappingsWith(updateClassifiers.value.toSeq, universalDocsMappings)

project/ScalaDist.scala

Lines changed: 13 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ import sbt._
22
import sbt.Keys._
33

44
import com.typesafe.sbt.SbtNativePackager._
5-
import com.typesafe.sbt.packager.MappingsHelper._
6-
import com.typesafe.sbt.packager.universal.UniversalPlugin.autoImport.useNativeZip
75
import com.typesafe.sbt.packager.Keys._
86

97
import com.typesafe.sbt.S3Plugin.S3.upload
@@ -40,18 +38,11 @@ object ScalaDist {
4038
mappings in upload += uploadMapping(packageZipTarball in UniversalDocs).value,
4139
mappings in upload += uploadMapping(packageXzTarball in UniversalDocs).value,
4240
mappings in upload += uploadMapping(packageBin in Rpm).value,
43-
// Debian needs special handling because the value sbt-native-packager
44-
// gives us for `packageBin in Debian` (coming from the archiveFilename
45-
// method) includes the debian version and arch information,
46-
// which we historically have not included. I don't see a way to
47-
// override the filename on disk, so we re-map at upload time
48-
mappings in upload += Def.task {
49-
(packageBin in Debian).value ->
50-
s"scala/${version.value}/${(name in Debian).value}-${version.value}.deb"
51-
}.value
41+
mappings in upload += uploadMapping(packageBin in Debian).value
5242
)
5343

5444
def settings: Seq[Setting[_]] =
45+
packagerSettings ++
5546
useNativeZip ++ // use native zip to preserve +x permission on scripts
5647
Seq(
5748
name := "scala",
@@ -65,13 +56,7 @@ object ScalaDist {
6556

6657
// create lib directory by resolving scala-dist's dependencies
6758
// to populate the rest of the distribution, explode scala-dist artifact itself
68-
mappings in Universal ++= createMappingsWith(update.value.toSeq, universalMappings),
69-
70-
// work around regression in sbt-native-packager 1.0.5 where
71-
// these tasks invoke `tar` without any flags at all
72-
universalArchiveOptions in (UniversalDocs, packageZipTarball) := Seq("--force-local", "-pcvf"),
73-
universalArchiveOptions in (UniversalDocs, packageXzTarball ) := Seq("--force-local", "-pcvf")
74-
59+
mappings in Universal ++= createMappingsWith(update.value.toSeq, universalMappings)
7560
)
7661

7762
// private lazy val onWindows = System.getProperty("os.name").toLowerCase(Locale.ENGLISH).contains("windows")
@@ -89,16 +74,19 @@ object ScalaDist {
8974
case "scala-dist" =>
9075
val tmpdir = IO.createTemporaryDirectory
9176
IO.unzip(file, tmpdir)
77+
// IO.listFiles(tmpdir) does not recurse, use ** with glob "*" to find all files
78+
(PathFinder(IO.listFiles(tmpdir)) ** "*").get flatMap { file =>
79+
val relative = IO.relativize(tmpdir, file).get // .get is safe because we just unzipped under tmpdir
80+
81+
// files are stored in repository with platform-appropriate line endings
82+
// if (onWindows && (relative endsWith ".bat")) toDosInPlace(file)
9283

93-
// create mappings from the unzip scala-dist zip
94-
contentOf(tmpdir) filter {
95-
case (file, dest) => !(dest.endsWith("MANIFEST.MF") || dest.endsWith("META-INF"))
96-
} map {
9784
// make unix scripts executable (heuristically...)
98-
case (file, dest) if (dest startsWith "bin/") && !(dest endsWith ".bat") =>
85+
if ((relative startsWith "bin/") && !(file.getName endsWith ".bat"))
9986
file.setExecutable(true, true)
100-
file -> dest
101-
case mapping => mapping
87+
88+
if (relative startsWith "META-INF") Seq()
89+
else Seq(file -> relative)
10290
}
10391

10492
// core jars: use simple name for backwards compat

project/Unix.scala

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import sbt.Keys._
44
import com.typesafe.sbt.SbtNativePackager._
55
import com.typesafe.sbt.packager.Keys._
66
import com.typesafe.sbt.packager.linux.{LinuxPackageMapping => pkgMap, LinuxSymlink}
7-
import com.typesafe.sbt.packager.linux.LinuxPlugin.autoImport.packageMapping
87

98
/** Create debian & rpm packages.
109
*
@@ -92,7 +91,9 @@ object Unix {
9291

9392
linuxPackageMappings in Debian += (packageMapping(
9493
(sourceDirectory.value / "debian" / "changelog") -> "/usr/share/doc/scala/changelog.gz"
95-
).withUser("root").withGroup("root").withPerms("0644").gzipped).asDocs()
94+
).withUser("root").withGroup("root").withPerms("0644").gzipped).asDocs(),
9695

96+
// Hack so we use regular version, rather than debian version.
97+
target in Debian := target.value / s"${(name in Debian).value}-${version.value}"
9798
)
9899
}

project/plugins.sbt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
scalacOptions ++= Seq("-deprecation", "-feature", "-Xlint")
22

3-
addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.0.6")
3+
addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "0.6.4")
44

55
addSbtPlugin("com.typesafe.sbt" % "sbt-s3" % "0.8")
66

0 commit comments

Comments
 (0)