Delete old conflicting links in pretrans for headless, javadoc and javadoc-zip

- Delete old conflicting links in pretrans for headless, javadoc and javadoc-zip
- Related: RHEL-68848
This commit is contained in:
Thomas Fitzsimmons 2024-11-29 13:00:38 -05:00
parent 02fa1f2d05
commit 0d40b6cf94

View File

@ -2167,6 +2167,25 @@ done
%post
%{post_script %{nil}}
# Allow upgrades from packages that have /usr/lib/jvm/java-21-openjdk
# as an alternatives symlink, without running into the known RPM
# limitation when changing to a directory a symlink to a directory.
# See also javadoc and javadoc-zip subpackages for
# /usr/share/javadoc/java-21-openjdk, which was a symlink before.
# /etc/java/java-21-openjdk is OK because it was always a directory.
# Reference:
# https://docs.fedoraproject.org/en-US/packaging-guidelines/Directory_Replacement/
%define lua_delete_old_link() %{expand:
path = "%{1}"
st = posix.stat(path)
if st and st.type == "link" then
os.remove(path)
end
}
%pretrans headless -p <lua>
%{lua_delete_old_link -- %{_jvmdir}/%{sdkdir -- %{?1}}}
%post headless
%{post_headless %{nil}}
@ -2191,12 +2210,20 @@ done
%posttrans devel
%{posttrans_devel %{nil}}
%pretrans javadoc -p <lua>
%{lua_delete_old_link -- %{_jvmdir}/%{sdkdir -- %{?1}}}
%{lua_delete_old_link -- %{_javadocdir}/%{uniquejavadocdir -- %{?1}}}
%post javadoc
%{alternatives_javadoc_install %{nil}}
%preun javadoc
%{preun_javadoc %{nil}}
%pretrans javadoc-zip -p <lua>
%{lua_delete_old_link -- %{_jvmdir}/%{sdkdir -- %{?1}}}
%{lua_delete_old_link -- %{_javadocdir}/%{uniquejavadocdir -- %{?1}}}
%post javadoc-zip
%{alternatives_javadoczip_install %{nil}}
@ -2380,6 +2407,7 @@ done
- Take ownership of versioned jvmdir in javadoc, javadoc-zip subpackages
- Make headless own /usr/share/doc/java-21-openjdk
- Make javadoc-zip own /usr/share/javadoc/java-21-openjdk
- Delete old conflicting links in pretrans for headless, javadoc and javadoc-zip
- Resolves: RHEL-71920
- Resolves: RHEL-71954
- Resolves: RHEL-69321