From 757444ac04da260e864f0968444b747b02cb0bd64c70a21b0875fbf0a2e774d4 Mon Sep 17 00:00:00 2001 From: Fridrich Strba Date: Fri, 22 Oct 2021 05:21:47 +0000 Subject: [PATCH 1/2] Accepting request 926674 from home:schubi2 - Use libalternatives instead of update-alternatives. From the last try: "Given the discussion on the openSUSE Factory list concerning the libalternatives, and given the failing on leap, rejecting" Currently we have already switched about 40 packages to libalternatives. We need it for the next MicroOS release. We do not use libalternatives for previous Leap versions like 15.3. Only the latest factory is for interest. We have already created new RPM Macros, updated old ones and have adapted rpmlint. So it would be nice, if we can have this packages too. ;-) OBS-URL: https://build.opensuse.org/request/show/926674 OBS-URL: https://build.opensuse.org/package/show/Java:packages/maven?expand=0&rev=25 --- maven.changes | 5 +++++ maven.spec | 55 ++++++++++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 57 insertions(+), 3 deletions(-) diff --git a/maven.changes b/maven.changes index 7206eaf..9f72b46 100644 --- a/maven.changes +++ b/maven.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Tue Sep 14 14:44:11 UTC 2021 - Stefan Schubert + +- Use libalternatives instead of update-alternatives. + ------------------------------------------------------------------- Tue May 11 09:57:12 UTC 2021 - Fridrich Strba diff --git a/maven.spec b/maven.spec index 95582bc..f6fffaf 100644 --- a/maven.spec +++ b/maven.spec @@ -20,6 +20,13 @@ %global homedir %{_datadir}/%{name}%{?maven_version_suffix} %global confdir %{_sysconfdir}/%{name}%{?maven_version_suffix} %bcond_with logback + +%if 0%{?suse_version} > 1500 +%bcond_without libalternatives +%else +%bcond_with libalternatives +%endif + Name: maven Version: 3.8.1 Release: 0 @@ -99,6 +106,12 @@ Requires(postun):aaa_base %if %{with logback} BuildRequires: mvn(ch.qos.logback:logback-classic) %endif +%if %{with libalternatives} +Requires: alts +%else +Requires(post): update-alternatives +Requires(postun):update-alternatives +%endif %description Maven is a software project management and comprehension tool. Based on the @@ -357,9 +370,28 @@ ln -sf %{confdir}/settings.xml %{buildroot}%{homedir}/conf/settings.xml mv %{buildroot}%{homedir}/conf/logging %{buildroot}%{confdir}/ ln -sf %{confdir}/logging %{buildroot}%{homedir}/conf -# Ghosts for alternatives install -d -m 755 %{buildroot}%{_bindir}/ install -d -m 755 %{buildroot}%{_mandir}/man1/ + +%if %{with libalternatives} +ln -sf %{_bindir}/alts %{buildroot}%{_bindir}/mvn +mkdir -p %{buildroot}%{_datadir}/libalternatives/mvn +cat > %{buildroot}%{_datadir}/libalternatives/mvn/%{?maven_alternatives_priority}1.conf < %{buildroot}%{_datadir}/libalternatives/mvnDebug/%{?maven_alternatives_priority}1.conf < 0 ] && [ -f %{_sbindir}/update-alternatives ] ; then + update-alternatives --remove mvn %{homedir}/bin/mvn +fi +%endif %files lib -f .mfiles %doc README.md @@ -385,12 +424,22 @@ fi %config(noreplace) %{confdir}/logging/simplelogger.properties %files +%{_datadir}/bash-completion +%if ! 0%{with libalternatives} %ghost %{_bindir}/mvn %ghost %{_bindir}/mvnDebug -%{_datadir}/bash-completion %ghost %{_mandir}/man1/mvn.1.gz %ghost %{_mandir}/man1/mvnDebug.1.gz - +%else +%dir %{_datadir}/libalternatives +%dir %{_datadir}/libalternatives/mvn +%dir %{_datadir}/libalternatives/mvnDebug +%{_datadir}/libalternatives/mvn/%{?maven_alternatives_priority}1.conf +%{_datadir}/libalternatives/mvnDebug/%{?maven_alternatives_priority}1.conf +%{_bindir}/mvn +%{_bindir}/mvnDebug +%{_mandir}/man1/mvn.1.gz +%endif %files javadoc -f .mfiles-javadoc %license LICENSE NOTICE From 45633ac62c4c3e185fa6c86d453f34b1803cd5fc34ecef60fabe831d72e28998 Mon Sep 17 00:00:00 2001 From: Fridrich Strba Date: Fri, 22 Oct 2021 07:12:46 +0000 Subject: [PATCH 2/2] OBS-URL: https://build.opensuse.org/package/show/Java:packages/maven?expand=0&rev=26 --- maven.spec | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/maven.spec b/maven.spec index f6fffaf..ccee50b 100644 --- a/maven.spec +++ b/maven.spec @@ -19,14 +19,12 @@ %global bundled_slf4j_version 1.7.25 %global homedir %{_datadir}/%{name}%{?maven_version_suffix} %global confdir %{_sysconfdir}/%{name}%{?maven_version_suffix} -%bcond_with logback - %if 0%{?suse_version} > 1500 %bcond_without libalternatives %else %bcond_with libalternatives %endif - +%bcond_with logback Name: maven Version: 3.8.1 Release: 0 @@ -107,7 +105,7 @@ Requires(postun):aaa_base BuildRequires: mvn(ch.qos.logback:logback-classic) %endif %if %{with libalternatives} -Requires: alts +BuildRequires: alts %else Requires(post): update-alternatives Requires(postun):update-alternatives @@ -406,6 +404,7 @@ if [ $1 -eq 0 ]; then update-alternatives --remove mvn %{homedir}/bin/mvn fi %else + %pre # removing old update-alternatives entries if [ "$1" > 0 ] && [ -f %{_sbindir}/update-alternatives ] ; then @@ -438,8 +437,9 @@ fi %{_datadir}/libalternatives/mvnDebug/%{?maven_alternatives_priority}1.conf %{_bindir}/mvn %{_bindir}/mvnDebug -%{_mandir}/man1/mvn.1.gz +%{_mandir}/man1/mvn.1%{?ext_man} %endif + %files javadoc -f .mfiles-javadoc %license LICENSE NOTICE