How do I set a RPM package to require Java 8 or higher, whose dependencies can be satisfied by Java 11

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP












0















I'm trying to package an RPM that requires any Java version above Java 8.
The RPM works fine if there's no Java installed, or if JRE/JDK for 8 is installed.
HOWEVER if I install OpenJDK 11, when I install my RPM it will try to install Java 8 again.



How do I get my RPM to detect that there's already a Java 11 installation which should be compatible with my package?
I don't want my package to install Java 8 if I have Java 11 already!



I'm running Red Hat 7.5, but this also reproduces in CentOS7.
I was able to reproduce this with a simple hello world package:



Name: hello-world
Version: 1
Release: 1
Summary: Most simple RPM package
License: FIXME
Requires: jre-headless >= 1.8

%description
%prep
%build
cat > hello-world.sh <<EOF
#!/usr/bin/bash
echo Hello world
EOF

%install
mkdir -p %buildroot/usr/bin/
install -m 755 hello-world.sh %buildroot/usr/bin/hello-world.sh

%files
/usr/bin/hello-world.sh

%changelog


Build with:



rpmdev-setuptree
rpmbuild -ba hello-world.spec


Then install OpenJDK11: sudo yum -y install java-11-openjdk



Finally test my package: rpm -i --test <FILE>.rpm gives:



error: Failed dependencies:
jre-headless >= 1.8 is needed by hello-world-1-1.x86_64


sudo yum localinstall <FILE>.rpm also tries to install Java8.



sudo yum deplist <FILE>.rpm suggests that java-11-openjdk should provide what I need:



Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: ftp.heanet.ie
* extras: ftp.heanet.ie
* updates: ftp.heanet.ie
package: hello-world.x86_64 1-1
dependency: /usr/bin/bash
provider: bash.x86_64 4.2.46-31.el7
dependency: jre-headless >= 1.8
provider: java-11-openjdk-headless.x86_64 1:11.0.ea.28-7.el7
provider: java-11-openjdk-headless.i686 1:11.0.ea.28-7.el7
provider: java-1.8.0-openjdk-headless.x86_64 1:1.8.0.201.b09-2.el7_6
provider: java-1.8.0-openjdk-headless.i686 1:1.8.0.191.b12-1.el7_6
provider: java-1.7.0-openjdk-headless.x86_64 1:1.7.0.211-2.6.17.1.el7_6


(Not sure why Java 7 is a provider of Java 8 either).



I tried setting requires to jre or java but no luck. Also I tried pre-installing java-11-openjdk-headless specifically, but it made no difference.



It seems like boolean dependencies might fix this, but sadly I can't guarantee my end-users have a recent enough version of rpm installed.



I'm not sure what I could be doing wrong?



How do I set a RPM package to require Java 8 or higher, whose dependencies are satisfied by Java 11?










share|improve this question




























    0















    I'm trying to package an RPM that requires any Java version above Java 8.
    The RPM works fine if there's no Java installed, or if JRE/JDK for 8 is installed.
    HOWEVER if I install OpenJDK 11, when I install my RPM it will try to install Java 8 again.



    How do I get my RPM to detect that there's already a Java 11 installation which should be compatible with my package?
    I don't want my package to install Java 8 if I have Java 11 already!



    I'm running Red Hat 7.5, but this also reproduces in CentOS7.
    I was able to reproduce this with a simple hello world package:



    Name: hello-world
    Version: 1
    Release: 1
    Summary: Most simple RPM package
    License: FIXME
    Requires: jre-headless >= 1.8

    %description
    %prep
    %build
    cat > hello-world.sh <<EOF
    #!/usr/bin/bash
    echo Hello world
    EOF

    %install
    mkdir -p %buildroot/usr/bin/
    install -m 755 hello-world.sh %buildroot/usr/bin/hello-world.sh

    %files
    /usr/bin/hello-world.sh

    %changelog


    Build with:



    rpmdev-setuptree
    rpmbuild -ba hello-world.spec


    Then install OpenJDK11: sudo yum -y install java-11-openjdk



    Finally test my package: rpm -i --test <FILE>.rpm gives:



    error: Failed dependencies:
    jre-headless >= 1.8 is needed by hello-world-1-1.x86_64


    sudo yum localinstall <FILE>.rpm also tries to install Java8.



    sudo yum deplist <FILE>.rpm suggests that java-11-openjdk should provide what I need:



    Loaded plugins: fastestmirror
    Loading mirror speeds from cached hostfile
    * base: ftp.heanet.ie
    * extras: ftp.heanet.ie
    * updates: ftp.heanet.ie
    package: hello-world.x86_64 1-1
    dependency: /usr/bin/bash
    provider: bash.x86_64 4.2.46-31.el7
    dependency: jre-headless >= 1.8
    provider: java-11-openjdk-headless.x86_64 1:11.0.ea.28-7.el7
    provider: java-11-openjdk-headless.i686 1:11.0.ea.28-7.el7
    provider: java-1.8.0-openjdk-headless.x86_64 1:1.8.0.201.b09-2.el7_6
    provider: java-1.8.0-openjdk-headless.i686 1:1.8.0.191.b12-1.el7_6
    provider: java-1.7.0-openjdk-headless.x86_64 1:1.7.0.211-2.6.17.1.el7_6


    (Not sure why Java 7 is a provider of Java 8 either).



    I tried setting requires to jre or java but no luck. Also I tried pre-installing java-11-openjdk-headless specifically, but it made no difference.



    It seems like boolean dependencies might fix this, but sadly I can't guarantee my end-users have a recent enough version of rpm installed.



    I'm not sure what I could be doing wrong?



    How do I set a RPM package to require Java 8 or higher, whose dependencies are satisfied by Java 11?










    share|improve this question


























      0












      0








      0








      I'm trying to package an RPM that requires any Java version above Java 8.
      The RPM works fine if there's no Java installed, or if JRE/JDK for 8 is installed.
      HOWEVER if I install OpenJDK 11, when I install my RPM it will try to install Java 8 again.



      How do I get my RPM to detect that there's already a Java 11 installation which should be compatible with my package?
      I don't want my package to install Java 8 if I have Java 11 already!



      I'm running Red Hat 7.5, but this also reproduces in CentOS7.
      I was able to reproduce this with a simple hello world package:



      Name: hello-world
      Version: 1
      Release: 1
      Summary: Most simple RPM package
      License: FIXME
      Requires: jre-headless >= 1.8

      %description
      %prep
      %build
      cat > hello-world.sh <<EOF
      #!/usr/bin/bash
      echo Hello world
      EOF

      %install
      mkdir -p %buildroot/usr/bin/
      install -m 755 hello-world.sh %buildroot/usr/bin/hello-world.sh

      %files
      /usr/bin/hello-world.sh

      %changelog


      Build with:



      rpmdev-setuptree
      rpmbuild -ba hello-world.spec


      Then install OpenJDK11: sudo yum -y install java-11-openjdk



      Finally test my package: rpm -i --test <FILE>.rpm gives:



      error: Failed dependencies:
      jre-headless >= 1.8 is needed by hello-world-1-1.x86_64


      sudo yum localinstall <FILE>.rpm also tries to install Java8.



      sudo yum deplist <FILE>.rpm suggests that java-11-openjdk should provide what I need:



      Loaded plugins: fastestmirror
      Loading mirror speeds from cached hostfile
      * base: ftp.heanet.ie
      * extras: ftp.heanet.ie
      * updates: ftp.heanet.ie
      package: hello-world.x86_64 1-1
      dependency: /usr/bin/bash
      provider: bash.x86_64 4.2.46-31.el7
      dependency: jre-headless >= 1.8
      provider: java-11-openjdk-headless.x86_64 1:11.0.ea.28-7.el7
      provider: java-11-openjdk-headless.i686 1:11.0.ea.28-7.el7
      provider: java-1.8.0-openjdk-headless.x86_64 1:1.8.0.201.b09-2.el7_6
      provider: java-1.8.0-openjdk-headless.i686 1:1.8.0.191.b12-1.el7_6
      provider: java-1.7.0-openjdk-headless.x86_64 1:1.7.0.211-2.6.17.1.el7_6


      (Not sure why Java 7 is a provider of Java 8 either).



      I tried setting requires to jre or java but no luck. Also I tried pre-installing java-11-openjdk-headless specifically, but it made no difference.



      It seems like boolean dependencies might fix this, but sadly I can't guarantee my end-users have a recent enough version of rpm installed.



      I'm not sure what I could be doing wrong?



      How do I set a RPM package to require Java 8 or higher, whose dependencies are satisfied by Java 11?










      share|improve this question
















      I'm trying to package an RPM that requires any Java version above Java 8.
      The RPM works fine if there's no Java installed, or if JRE/JDK for 8 is installed.
      HOWEVER if I install OpenJDK 11, when I install my RPM it will try to install Java 8 again.



      How do I get my RPM to detect that there's already a Java 11 installation which should be compatible with my package?
      I don't want my package to install Java 8 if I have Java 11 already!



      I'm running Red Hat 7.5, but this also reproduces in CentOS7.
      I was able to reproduce this with a simple hello world package:



      Name: hello-world
      Version: 1
      Release: 1
      Summary: Most simple RPM package
      License: FIXME
      Requires: jre-headless >= 1.8

      %description
      %prep
      %build
      cat > hello-world.sh <<EOF
      #!/usr/bin/bash
      echo Hello world
      EOF

      %install
      mkdir -p %buildroot/usr/bin/
      install -m 755 hello-world.sh %buildroot/usr/bin/hello-world.sh

      %files
      /usr/bin/hello-world.sh

      %changelog


      Build with:



      rpmdev-setuptree
      rpmbuild -ba hello-world.spec


      Then install OpenJDK11: sudo yum -y install java-11-openjdk



      Finally test my package: rpm -i --test <FILE>.rpm gives:



      error: Failed dependencies:
      jre-headless >= 1.8 is needed by hello-world-1-1.x86_64


      sudo yum localinstall <FILE>.rpm also tries to install Java8.



      sudo yum deplist <FILE>.rpm suggests that java-11-openjdk should provide what I need:



      Loaded plugins: fastestmirror
      Loading mirror speeds from cached hostfile
      * base: ftp.heanet.ie
      * extras: ftp.heanet.ie
      * updates: ftp.heanet.ie
      package: hello-world.x86_64 1-1
      dependency: /usr/bin/bash
      provider: bash.x86_64 4.2.46-31.el7
      dependency: jre-headless >= 1.8
      provider: java-11-openjdk-headless.x86_64 1:11.0.ea.28-7.el7
      provider: java-11-openjdk-headless.i686 1:11.0.ea.28-7.el7
      provider: java-1.8.0-openjdk-headless.x86_64 1:1.8.0.201.b09-2.el7_6
      provider: java-1.8.0-openjdk-headless.i686 1:1.8.0.191.b12-1.el7_6
      provider: java-1.7.0-openjdk-headless.x86_64 1:1.7.0.211-2.6.17.1.el7_6


      (Not sure why Java 7 is a provider of Java 8 either).



      I tried setting requires to jre or java but no luck. Also I tried pre-installing java-11-openjdk-headless specifically, but it made no difference.



      It seems like boolean dependencies might fix this, but sadly I can't guarantee my end-users have a recent enough version of rpm installed.



      I'm not sure what I could be doing wrong?



      How do I set a RPM package to require Java 8 or higher, whose dependencies are satisfied by Java 11?







      yum rpm java dependencies rpm-spec






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 6 at 13:33







      jenny

















      asked Mar 6 at 13:14









      jennyjenny

      32




      32




















          1 Answer
          1






          active

          oldest

          votes


















          1














          For now, the OpenJDK 11 packages in RHEL 7 and 8 don’t provide java-headless, jre-headless, or any of the unversioned Java packages. (As I understand it, the reason is that OpenJDK 11 isn’t guaranteed to be a replacement for OpenJDK 8 maintaining compatibility in all cases.) This will change when OpenJDK 11 becomes the system JDK; you can try tracking this bug to be notified of changes.



          Unfortunately I don’t think there is a way currently to allow an RPM package to depend on jre-headless and be installable with OpenJDK 11 only, without using boolean dependencies (and RHEL 8, effectively). A typical workaround would be to use a file requirement instead of a package requirement, but java-8-openjdk-headless and java-11-openjdk-headless don’t provide a common file which you can depend upon (and I don’t think file requirements can be versioned).



          Your query suggests that jre-headless is satisfied by the OpenJDK 11 packages, but that’s because the early-access packages erroneously provided the default packages; so



          yum whatprovides jre-headless


          lists OpenJDK 8 and OpenJDK 11 packages, but the latter are no longer installable.






          share|improve this answer

























          • So it might be a problem with the headless? If I set my Requires to java or jre it still fails to recognise the installed java. Maybe I don't understand why deplist or whatprovides think that Java 11 provides the java/jre package?

            – jenny
            Mar 6 at 13:49











          • This affects all the default Java packages. OpenJDK 11 turns up in the query results because of a packaging error in earlier versions of the packages. (See my update for details.)

            – Stephen Kitt
            Mar 6 at 14:09











          Your Answer








          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "106"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f504706%2fhow-do-i-set-a-rpm-package-to-require-java-8-or-higher-whose-dependencies-can-b%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          1














          For now, the OpenJDK 11 packages in RHEL 7 and 8 don’t provide java-headless, jre-headless, or any of the unversioned Java packages. (As I understand it, the reason is that OpenJDK 11 isn’t guaranteed to be a replacement for OpenJDK 8 maintaining compatibility in all cases.) This will change when OpenJDK 11 becomes the system JDK; you can try tracking this bug to be notified of changes.



          Unfortunately I don’t think there is a way currently to allow an RPM package to depend on jre-headless and be installable with OpenJDK 11 only, without using boolean dependencies (and RHEL 8, effectively). A typical workaround would be to use a file requirement instead of a package requirement, but java-8-openjdk-headless and java-11-openjdk-headless don’t provide a common file which you can depend upon (and I don’t think file requirements can be versioned).



          Your query suggests that jre-headless is satisfied by the OpenJDK 11 packages, but that’s because the early-access packages erroneously provided the default packages; so



          yum whatprovides jre-headless


          lists OpenJDK 8 and OpenJDK 11 packages, but the latter are no longer installable.






          share|improve this answer

























          • So it might be a problem with the headless? If I set my Requires to java or jre it still fails to recognise the installed java. Maybe I don't understand why deplist or whatprovides think that Java 11 provides the java/jre package?

            – jenny
            Mar 6 at 13:49











          • This affects all the default Java packages. OpenJDK 11 turns up in the query results because of a packaging error in earlier versions of the packages. (See my update for details.)

            – Stephen Kitt
            Mar 6 at 14:09















          1














          For now, the OpenJDK 11 packages in RHEL 7 and 8 don’t provide java-headless, jre-headless, or any of the unversioned Java packages. (As I understand it, the reason is that OpenJDK 11 isn’t guaranteed to be a replacement for OpenJDK 8 maintaining compatibility in all cases.) This will change when OpenJDK 11 becomes the system JDK; you can try tracking this bug to be notified of changes.



          Unfortunately I don’t think there is a way currently to allow an RPM package to depend on jre-headless and be installable with OpenJDK 11 only, without using boolean dependencies (and RHEL 8, effectively). A typical workaround would be to use a file requirement instead of a package requirement, but java-8-openjdk-headless and java-11-openjdk-headless don’t provide a common file which you can depend upon (and I don’t think file requirements can be versioned).



          Your query suggests that jre-headless is satisfied by the OpenJDK 11 packages, but that’s because the early-access packages erroneously provided the default packages; so



          yum whatprovides jre-headless


          lists OpenJDK 8 and OpenJDK 11 packages, but the latter are no longer installable.






          share|improve this answer

























          • So it might be a problem with the headless? If I set my Requires to java or jre it still fails to recognise the installed java. Maybe I don't understand why deplist or whatprovides think that Java 11 provides the java/jre package?

            – jenny
            Mar 6 at 13:49











          • This affects all the default Java packages. OpenJDK 11 turns up in the query results because of a packaging error in earlier versions of the packages. (See my update for details.)

            – Stephen Kitt
            Mar 6 at 14:09













          1












          1








          1







          For now, the OpenJDK 11 packages in RHEL 7 and 8 don’t provide java-headless, jre-headless, or any of the unversioned Java packages. (As I understand it, the reason is that OpenJDK 11 isn’t guaranteed to be a replacement for OpenJDK 8 maintaining compatibility in all cases.) This will change when OpenJDK 11 becomes the system JDK; you can try tracking this bug to be notified of changes.



          Unfortunately I don’t think there is a way currently to allow an RPM package to depend on jre-headless and be installable with OpenJDK 11 only, without using boolean dependencies (and RHEL 8, effectively). A typical workaround would be to use a file requirement instead of a package requirement, but java-8-openjdk-headless and java-11-openjdk-headless don’t provide a common file which you can depend upon (and I don’t think file requirements can be versioned).



          Your query suggests that jre-headless is satisfied by the OpenJDK 11 packages, but that’s because the early-access packages erroneously provided the default packages; so



          yum whatprovides jre-headless


          lists OpenJDK 8 and OpenJDK 11 packages, but the latter are no longer installable.






          share|improve this answer















          For now, the OpenJDK 11 packages in RHEL 7 and 8 don’t provide java-headless, jre-headless, or any of the unversioned Java packages. (As I understand it, the reason is that OpenJDK 11 isn’t guaranteed to be a replacement for OpenJDK 8 maintaining compatibility in all cases.) This will change when OpenJDK 11 becomes the system JDK; you can try tracking this bug to be notified of changes.



          Unfortunately I don’t think there is a way currently to allow an RPM package to depend on jre-headless and be installable with OpenJDK 11 only, without using boolean dependencies (and RHEL 8, effectively). A typical workaround would be to use a file requirement instead of a package requirement, but java-8-openjdk-headless and java-11-openjdk-headless don’t provide a common file which you can depend upon (and I don’t think file requirements can be versioned).



          Your query suggests that jre-headless is satisfied by the OpenJDK 11 packages, but that’s because the early-access packages erroneously provided the default packages; so



          yum whatprovides jre-headless


          lists OpenJDK 8 and OpenJDK 11 packages, but the latter are no longer installable.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Mar 6 at 14:09

























          answered Mar 6 at 13:33









          Stephen KittStephen Kitt

          179k25407485




          179k25407485












          • So it might be a problem with the headless? If I set my Requires to java or jre it still fails to recognise the installed java. Maybe I don't understand why deplist or whatprovides think that Java 11 provides the java/jre package?

            – jenny
            Mar 6 at 13:49











          • This affects all the default Java packages. OpenJDK 11 turns up in the query results because of a packaging error in earlier versions of the packages. (See my update for details.)

            – Stephen Kitt
            Mar 6 at 14:09

















          • So it might be a problem with the headless? If I set my Requires to java or jre it still fails to recognise the installed java. Maybe I don't understand why deplist or whatprovides think that Java 11 provides the java/jre package?

            – jenny
            Mar 6 at 13:49











          • This affects all the default Java packages. OpenJDK 11 turns up in the query results because of a packaging error in earlier versions of the packages. (See my update for details.)

            – Stephen Kitt
            Mar 6 at 14:09
















          So it might be a problem with the headless? If I set my Requires to java or jre it still fails to recognise the installed java. Maybe I don't understand why deplist or whatprovides think that Java 11 provides the java/jre package?

          – jenny
          Mar 6 at 13:49





          So it might be a problem with the headless? If I set my Requires to java or jre it still fails to recognise the installed java. Maybe I don't understand why deplist or whatprovides think that Java 11 provides the java/jre package?

          – jenny
          Mar 6 at 13:49













          This affects all the default Java packages. OpenJDK 11 turns up in the query results because of a packaging error in earlier versions of the packages. (See my update for details.)

          – Stephen Kitt
          Mar 6 at 14:09





          This affects all the default Java packages. OpenJDK 11 turns up in the query results because of a packaging error in earlier versions of the packages. (See my update for details.)

          – Stephen Kitt
          Mar 6 at 14:09

















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Unix & Linux Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f504706%2fhow-do-i-set-a-rpm-package-to-require-java-8-or-higher-whose-dependencies-can-b%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown






          Popular posts from this blog

          How to check contact read email or not when send email to Individual?

          Bahrain

          Postfix configuration issue with fips on centos 7; mailgun relay