Skip to content

Commit c7288a6

Browse files
authored
Merge pull request #1338 from lwronski/scala-packager-cli_2.13-0.1.28
Scala CLI deb package - Priority and Section flag
2 parents 5f15ada + 19fa509 commit c7288a6

File tree

8 files changed

+45
-10
lines changed

8 files changed

+45
-10
lines changed

.github/scripts/generate-os-packages.sh

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,10 @@ generate_deb() {
4545
--source-app-path "$(launcher)" \
4646
--output "$ARTIFACTS_DIR/scala-cli.deb" \
4747
--description "Scala CLI" \
48-
--maintainer "Scala CLI" \
49-
--launcher-app "scala-cli"
48+
--maintainer "[email protected]" \
49+
--launcher-app "scala-cli" \
50+
--priority "optional" \
51+
--section "devel" \
5052
mv "$ARTIFACTS_DIR/scala-cli.deb" "$ARTIFACTS_DIR/scala-cli-x86_64-pc-linux.deb"
5153
}
5254

@@ -57,7 +59,7 @@ generate_rpm() {
5759
--source-app-path "$(launcher)" \
5860
--output "$ARTIFACTS_DIR/scala-cli-x86_64-pc-linux.rpm" \
5961
--description "Scala CLI" \
60-
--maintainer "Scala CLI" \
62+
--maintainer "[email protected]" \
6163
--license "ASL 2.0" \
6264
--launcher-app "scala-cli"
6365
}
@@ -84,7 +86,7 @@ generate_msi() {
8486
--source-app-path "$(launcher)" \
8587
--output "$ARTIFACTS_DIR/scala-cli-x86_64-pc-win32.msi" \
8688
--product-name "Scala CLI" \
87-
--maintainer "Scala CLI" \
89+
--maintainer "[email protected]" \
8890
--launcher-app "scala-cli" \
8991
--license-path "./LICENSE" \
9092
--exit-dialog "To run Scala CLI, open a Command window, and type scala-cli + Enter. If scala-cli cannot be found, ensure that the Command window was opened after Scala CLI was installed." \

modules/cli-options/src/main/scala/scala/cli/commands/PackagerOptions.scala

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,16 @@ final case class PackagerOptions(
3232
"Architectures that are supported by the repository (default: all)"
3333
)
3434
debArchitecture: String = "all",
35+
@Group("Debian")
36+
@HelpMessage(
37+
"This field represents how important it is that the user have the package installed"
38+
)
39+
priority: Option[String] = None,
40+
@Group("Debian")
41+
@HelpMessage(
42+
"This field specifies an application area into which the package has been classified"
43+
)
44+
section: Option[String] = None,
3545
@Group("MacOS")
3646
@HelpMessage(
3747
"CF Bundle Identifier"

modules/cli/src/main/scala/scala/cli/commands/Package.scala

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,9 @@ object Package extends ScalaCommand[PackageOptions] with BuildCommandHelpers {
403403
architecture = packageOptions.debianOptions.architecture.mandatory(
404404
"--deb-architecture",
405405
"debian"
406-
)
406+
),
407+
priority = packageOptions.debianOptions.priority,
408+
section = packageOptions.debianOptions.section
407409
)
408410

409411
lazy val macOSSettings = MacOSSettings(

modules/cli/src/main/scala/scala/cli/commands/util/PackageOptionsUtil.scala

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,9 @@ object PackageOptionsUtil {
6565
debianOptions = DebianOptions(
6666
conflicts = packager.debianConflicts,
6767
dependencies = packager.debianDependencies,
68-
architecture = Some(packager.debArchitecture)
68+
architecture = Some(packager.debArchitecture),
69+
priority = packager.priority,
70+
section = packager.section
6971
),
7072
redHatOptions = RedHatOptions(
7173
license = packager.license,

modules/integration/src/test/scala/scala/cli/integration/NativePackagerTests.scala

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,9 @@ class NativePackagerTests extends ScalaCliSuite {
116116

117117
testInputs.fromRoot { root =>
118118

119-
val appName = helloWorldFileName.stripSuffix(".scala").toLowerCase()
119+
val appName = helloWorldFileName.stripSuffix(".scala").toLowerCase()
120+
val priority = "optional"
121+
val section = "devel"
120122

121123
val destDir = os.rel / "package"
122124
os.makeDir.all(root / destDir)
@@ -127,7 +129,9 @@ class NativePackagerTests extends ScalaCliSuite {
127129
"--output", destDir / s"$appName.deb",
128130
"--maintainer", "scala-cli-test",
129131
"--description", "scala-cli-test",
130-
"--launcher-app", appName
132+
"--launcher-app", appName,
133+
"--priority", priority,
134+
"--section", section,
131135
)
132136
// format: on
133137
os.proc(cmd).call(
@@ -139,6 +143,11 @@ class NativePackagerTests extends ScalaCliSuite {
139143
val launcher = root / destDir / s"$appName.deb"
140144
expect(os.isFile(launcher))
141145

146+
// check flags
147+
val debInfo = os.proc("dpkg", "--info", launcher).call().out.text().trim
148+
expect(debInfo.contains(s"Priority: $priority"))
149+
expect(debInfo.contains(s"Section: $section"))
150+
142151
if (hasDocker) {
143152
val script =
144153
s"""#!/usr/bin/env bash

modules/options/src/main/scala/scala/build/options/packaging/DebianOptions.scala

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ import scala.build.options.ConfigMonoid
55
final case class DebianOptions(
66
conflicts: List[String] = Nil,
77
dependencies: List[String] = Nil,
8-
architecture: Option[String] = None
8+
architecture: Option[String] = None,
9+
priority: Option[String] = None,
10+
section: Option[String] = None
911
)
1012

1113
object DebianOptions {

project/deps.sc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ object Deps {
6161
def jsoniterScala = "2.17.2"
6262
def scalaMeta = "4.5.13"
6363
def scalaNative = "0.4.7"
64-
def scalaPackager = "0.1.27"
64+
def scalaPackager = "0.1.28"
6565
def signingCli = "0.1.9"
6666
}
6767
// DO NOT hardcode a Scala version in this dependency string

website/docs/reference/cli-options.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1087,6 +1087,14 @@ The list of Debian packages that this package depends on
10871087

10881088
Architectures that are supported by the repository (default: all)
10891089

1090+
#### `--priority`
1091+
1092+
This field represents how important it is that the user have the package installed
1093+
1094+
#### `--section`
1095+
1096+
This field specifies an application area into which the package has been classified
1097+
10901098
#### `--identifier`
10911099

10921100
CF Bundle Identifier

0 commit comments

Comments
 (0)