#149 Add javaver- and origin-specific javadoc(zip) links
Closed 2 years ago by ferdnyc. Opened 2 years ago by ferdnyc.
Unknown source javadoc-alts  into  rawhide

file modified
+42 -7
@@ -363,7 +363,7 @@

  %global top_level_dir_name   %{origin}

  %global top_level_dir_name_backup %{top_level_dir_name}-backup

  %global buildver        1

- %global rpmrelease      5

+ %global rpmrelease      6

  #%%global tagsuffix     %%{nil}

  # Priority must be 8 digits in total; up to openjdk 1.8, we were using 18..... so when we moved to 11, we had to add another digit

  %if %is_system_jdk
@@ -762,10 +762,19 @@

  if [ "%{?1}" == %{debug_suffix} ]; then

    let PRIORITY=PRIORITY-1

  fi

+   for X in %{origin} %{javaver} ; do

+     key=javadocdir_"$X"

+     alternatives --install %{_javadocdir}/java-"$X" $key %{_javadocdir}/%{uniquejavadocdir -- %{?1}}/api $PRIORITY --family %{family_noarch}

+     %{set_if_needed_alternatives $key %{family_noarch}}

+   done

+ 

+   key=javadocdir_%{javaver}_%{origin}

+   alternatives --install %{_javadocdir}/java-%{javaver}-%{origin} $key %{_javadocdir}/%{uniquejavadocdir -- %{?1}}/api $PRIORITY --family %{family_noarch}

+   %{set_if_needed_alternatives  $key %{family_noarch}}

  

- key=javadocdir

- alternatives --install %{_javadocdir}/java $key %{_javadocdir}/%{uniquejavadocdir -- %{?1}}/api $PRIORITY  --family %{family_noarch}

- %{set_if_needed_alternatives  $key %{family_noarch}}

+   key=javadocdir

+   alternatives --install %{_javadocdir}/java $key %{_javadocdir}/%{uniquejavadocdir -- %{?1}}/api $PRIORITY --family %{family_noarch}

+   %{set_if_needed_alternatives  $key %{family_noarch}}

  exit 0

  }

  
@@ -775,6 +784,9 @@

  fi

    post_state=$1 # from postun, https://docs.fedoraproject.org/en-US/packaging-guidelines/Scriptlets/#_syntax

    %{save_and_remove_alternatives  javadocdir  %{_javadocdir}/%{uniquejavadocdir -- %{?1}}/api $post_state %{family_noarch}}

+   %{save_and_remove_alternatives  javadocdir_%{origin} %{_javadocdir}/%{uniquejavadocdir -- %{?1}}/api $post_state %{family_noarch}}

+   %{save_and_remove_alternatives  javadocdir_%{javaver} %{_javadocdir}/%{uniquejavadocdir -- %{?1}}/api $post_state %{family_noarch}}

+   %{save_and_remove_alternatives  javadocdir_%{javaver}_%{origin} %{_javadocdir}/%{uniquejavadocdir -- %{?1}}/api $post_state %{family_noarch}}

  exit 0

  }

  
@@ -786,9 +798,20 @@

  if [ "%{?1}" == %{debug_suffix} ]; then

    let PRIORITY=PRIORITY-1

  fi

- key=javadoczip

- alternatives --install %{_javadocdir}/java-zip $key %{_javadocdir}/%{uniquejavadocdir -- %{?1}}.zip $PRIORITY  --family %{family_noarch}

- %{set_if_needed_alternatives  $key %{family_noarch}}

+   for X in %{origin} %{javaver} ; do

+     key=javadoczip_"$X"

+     alternatives --install %{_javadocdir}/java-"$X".zip $key %{_javadocdir}/%{uniquejavadocdir -- %{?1}}.zip $PRIORITY --family %{family_noarch}

+     %{set_if_needed_alternatives $key %{family_noarch}}

+   done

+ 

+   key=javadoczip_%{javaver}_%{origin}

+   alternatives --install %{_javadocdir}/java-%{javaver}-%{origin}.zip $key %{_javadocdir}/%{uniquejavadocdir -- %{?1}}.zip $PRIORITY --family %{family_noarch}

+   %{set_if_needed_alternatives  $key %{family_noarch}}

+ 

+   # Weird legacy filename for backwards-compatibility

+   key=javadoczip

+   alternatives --install %{_javadocdir}/java-zip $key %{_javadocdir}/%{uniquejavadocdir -- %{?1}}.zip $PRIORITY  --family %{family_noarch}

+   %{set_if_needed_alternatives  $key %{family_noarch}}

  exit 0

  }

  
@@ -798,6 +821,9 @@

    fi

    post_state=$1 # from postun, https://docs.fedoraproject.org/en-US/packaging-guidelines/Scriptlets/#_syntax

    %{save_and_remove_alternatives  javadoczip  %{_javadocdir}/%{uniquejavadocdir -- %{?1}}.zip $post_state %{family_noarch}}

+   %{save_and_remove_alternatives  javadoczip_%{origin}  %{_javadocdir}/%{uniquejavadocdir -- %{?1}}.zip $post_state %{family_noarch}}

+   %{save_and_remove_alternatives  javadoczip_%{javaver}  %{_javadocdir}/%{uniquejavadocdir -- %{?1}}.zip $post_state %{family_noarch}}

+   %{save_and_remove_alternatives  javadoczip_%{javaver}_%{origin}  %{_javadocdir}/%{uniquejavadocdir -- %{?1}}.zip $post_state %{family_noarch}}

  exit 0

  }

  
@@ -1078,6 +1104,9 @@

  %if %is_system_jdk

  %if %{is_release_build -- %{?1}}

  %ghost %{_javadocdir}/java

+ %ghost %{_javadocdir}/java-%{origin}

+ %ghost %{_javadocdir}/java-%{javaver}

+ %ghost %{_javadocdir}/java-%{javaver}-%{origin}

  %endif

  %endif

  }
@@ -1088,6 +1117,9 @@

  %if %is_system_jdk

  %if %{is_release_build -- %{?1}}

  %ghost %{_javadocdir}/java-zip

+ %ghost %{_javadocdir}/java-%{origin}.zip

+ %ghost %{_javadocdir}/java-%{javaver}.zip

+ %ghost %{_javadocdir}/java-%{javaver}-%{origin}.zip

  %endif

  %endif

  }
@@ -2611,6 +2643,9 @@

  %endif

  

  %changelog

+ * Fri Mar 11 2022 FeRD (Frank Dana) <ferdnyc@gmail.com.> - 1:11.0.14.1.1-6

+ - Add javaver- and origin-specific javadoc and javadoczip alternatives.

+ 

  * Thu Feb 17 2022 Andrew Hughes <gnu.andrew@redhat.com> - 1:11.0.14.1.1-5

  - Sync cleanups from release branch.

  

This PR (one of three being submitted to the java-{1.8.0,11,17}-openjdk packages) adds javaver- and origin-specific alternatives to the javadoc and javadoc-zip subpackages, in the style of the same links created for e.g. java_sdk.

So, where the alternatives system also has, in addition to java_sdk, links like java_sdk_11, java_sdk_openjdk, and java_sdk_17_openjdk, similar links will be created in /usr/share/javadoc/.

These additional links are useful because, for example, the Java IDE provided by Intellij IDEA has the ability to define documentation paths on a per-SDK basis. Pointing it at e.g. /usr/share/javadoc/java-11 for the JDK 11 documentation ensures that configuration will not be broken whenever the java-11-openjdk-javadoc package is updated.

With this PR applied, the following alternatives will be created for each javadoc package installed:

  • javadocdir which defines /usr/share/javadoc/java (existing)
  • javadocdir_%{javaver} which defines /usr/share/javadoc/java-%{javaver}
  • javadocdir_%{origin} which defines /usr/share/javadoc/java-%{origin}
  • javadocdir_%{javaver}_%{origin} which defines /usr/share/javadoc/java-%{javaver}-%{origin}

For each javadoc-zip subpackage installed,

  • javadoczip which defines /usr/share/javadoc/java-zip (existing)
  • javadoczip_%{javaver} which defines /usr/share/javadoc/java-%{javaver}.zip
  • javadoczip_%{origin} which defines /usr/share/javadoc/java-%{origin}.zip
  • javadoczip_%{javaver}_%{origin} which defines /usr/share/javadoc/java-%{javaver}-%{origin}.zip

Note the change in "public" link name for the javadoczip links — the current/existing javadoczip defines a link /usr/share/javadoc/java-zip, which in turn indirectly points to a .zip file in that same directory. Linking to a .zip file from a name without a .zip extension makes the link difficult to use.

I couldn't (easily) change that for the existing link without potentially disrupting users, but for the new alternatives I chose to use a link name ending in .zip so that it indicates the type of resource being provided. For example, /usr/share/javadoc/java-1.8.0.zip and /usr/share/javadoc/java-11-openjdk.zip will point (respectively) to /etc/alternatives/javadoczip_1.8.0 and /etc/alternatives/javadoczip_11_openjdk, which in turn will be linked to the corresponding .zip files from the java-1.8.0-openjdk-javadoc-zip and java-11-openjdk-javadoc-zip packages.

I mockbuilt my changes to java-1.8.0-openjdk locally and everything came out as expected; test installs and removals both succeeded without issue. Since these changes (save the versioning/changelog) were applied to each .spec file from the same set of patches, that should hopefully be representative of all three PRs.

Build failed. More information on how to proceed and troubleshoot errors available at https://fedoraproject.org/wiki/Zuul-based-ci

Hello!

Once it is in java-lates-openjd, it should flow down to 17, 11 and 8 on its own. Tahx a lot!

Pull-Request has been closed by ferdnyc

2 years ago
Metadata