Repository: bazelbuild/bazel
Issue: Debian package should only suggest JDK instead of depending on it
Labels: type: feature request
P2
area-EngProd
team-OSS

Right now the published Debian / Ubuntu package declares a (hard) dependency to a Java SDK. But the bazel version included in the `deb` file is already a standalone one that comes with a bundled Java runtime.

Would you accept a PR which downgrades the `Depends` to a `Suggests`? The [Debian Policy](https://www.debian.org/doc/debian-policy/ch-relationships.html) describes `Suggests` as:

> This is used to declare that one package may be more useful with one or more others. Using this field tells the packaging system and the user that the listed packages are related to this one and can perhaps enhance its usefulness, but that installing this one without them is perfectly reasonable.

Thanks,
Gregor

Issue comments:
I think such PR will be welcome - any objections @philwo ?
That would be great, yes. Thanks!

Pull request review comments:

Patch that resolved the issue:
diff --git a/scripts/packages/debian/BUILD b/scripts/packages/debian/BUILD
index b809983fab3b15..a54e43cad39027 100644
--- a/scripts/packages/debian/BUILD
+++ b/scripts/packages/debian/BUILD
@@ -9,12 +9,12 @@ load("//tools/build_defs/pkg:pkg.bzl", "pkg_tar", "pkg_deb")
 pkg_tar(
     name = "bazel-bin",
     srcs = [
-        "//scripts/packages:without-jdk/bazel",
-        "//scripts/packages:without-jdk/bazel-real",
+        "//scripts/packages:with-jdk/bazel",
+        "//scripts/packages:with-jdk/bazel-real",
     ],
     mode = "0755",
     package_dir = "/usr/bin",
-    strip_prefix = "/scripts/packages/without-jdk",
+    strip_prefix = "/scripts/packages/with-jdk",
 )
 
 pkg_tar(
@@ -77,7 +77,6 @@ pkg_deb(
     data = ":debian-data",
     depends = [
         # Keep in sync with Depends section in ./control
-        "google-jdk | java8-sdk-headless | java8-jdk | java8-sdk | oracle-java8-installer",
         "g++",
         "zlib1g-dev",
         "bash-completion",
@@ -88,6 +87,10 @@ pkg_deb(
     homepage = "http://bazel.build",
     maintainer = "The Bazel Authors <bazel-dev@googlegroups.com>",
     package = "bazel",
+    suggests = [
+        # Keep in sync with Suggests section in ./control
+        "google-jdk | java8-sdk-headless | java8-jdk | java8-sdk | oracle-java8-installer",
+    ],
     version_file = ":version.txt",
     visibility = ["//scripts/packages:__pkg__"],
 )
diff --git a/scripts/packages/debian/control b/scripts/packages/debian/control
index 851decdfb1e493..19e2b03efaa67f 100644
--- a/scripts/packages/debian/control
+++ b/scripts/packages/debian/control
@@ -10,7 +10,8 @@ Section: contrib/devel
 Priority: optional
 Architecture: amd64
 # Keep in sync with :bazel-debian in ./BUILD
-Depends: google-jdk | java8-sdk-headless | java8-jdk | java8-sdk | oracle-java8-installer, g++, zlib1g-dev, bash-completion, unzip, python
+Depends: g++, zlib1g-dev, bash-completion, unzip, python
+Suggests: google-jdk | java8-sdk-headless | java8-jdk | java8-sdk | oracle-java8-installer
 Description: Bazel is a tool that automates software builds and tests.
  Supported build tasks include running compilers and linkers to produce
  executable programs and libraries, and assembling deployable packages


Test patch: