From 78c6b922fb4ff8b00b16c3b56c260b7f2dfa58e13038ed26da0db38aec0e4a1d Mon Sep 17 00:00:00 2001 From: Soc Virnyl Estela Date: Thu, 21 Jul 2022 05:53:41 +0000 Subject: [PATCH] - use alternatives instead OBS-URL: https://build.opensuse.org/package/show/science/juliaup?expand=0&rev=21 --- juliaup.changes | 5 ++++ juliaup.spec | 79 ++++++++++++++++++++++++++++++++++++++++++++----- 2 files changed, 76 insertions(+), 8 deletions(-) diff --git a/juliaup.changes b/juliaup.changes index ad9571b..282b7e9 100644 --- a/juliaup.changes +++ b/juliaup.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Thu Jul 21 05:53:04 UTC 2022 - Soc Virnyl Estela + +- use alternatives instead + ------------------------------------------------------------------- Tue Jul 19 15:31:47 UTC 2022 - socvirnyl.estela@gmail.com diff --git a/juliaup.spec b/juliaup.spec index 3d522ce..05daf58 100644 --- a/juliaup.spec +++ b/juliaup.spec @@ -16,10 +16,55 @@ # +%global oldest_supported_julia_version 0.7.0 + # Based on the latest stable release in the https://julialang.org/ website # Juliaup follows the versions too in the following permalink: # https://github.com/JuliaLang/juliaup/blob/c1efc01e1b4af2e19b5a0b063d9de1ab58097886/build.rs#L21-L69 -%global latest_julia_stable 1.7.3 +%define provides_julia_versioned() \ +Provides: %{1}0.7.0%{?2:-%{2}} \ +Provides: %{1}1.0.0%{?2:-%{2}} \ +Provides: %{1}1.0.1%{?2:-%{2}} \ +Provides: %{1}1.0.2%{?2:-%{2}} \ +Provides: %{1}1.0.3%{?2:-%{2}} \ +Provides: %{1}1.0.4%{?2:-%{2}} \ +Provides: %{1}1.0.5%{?2:-%{2}} \ +Provides: %{1}1.1.0%{?2:-%{2}} \ +Provides: %{1}1.1.1%{?2:-%{2}} \ +Provides: %{1}1.2.0%{?2:-%{2}} \ +Provides: %{1}1.3.0%{?2:-%{2}} \ +Provides: %{1}1.3.1%{?2:-%{2}} \ +Provides: %{1}1.4.0%{?2:-%{2}} \ +Provides: %{1}1.4.1%{?2:-%{2}} \ +Provides: %{1}1.4.2%{?2:-%{2}} \ +Provides: %{1}1.5.0%{?2:-%{2}} \ +Provides: %{1}1.5.1%{?2:-%{2}} \ +Provides: %{1}1.5.2%{?2:-%{2}} \ +Provides: %{1}1.5.3%{?2:-%{2}} \ +Provides: %{1}1.5.4%{?2:-%{2}} \ +Provides: %{1}1.6.0%{?2:-%{2}} \ +Provides: %{1}1.6.1%{?2:-%{2}} \ +Provides: %{1}1.6.2%{?2:-%{2}} \ +Provides: %{1}1.6.3%{?2:-%{2}} \ +Provides: %{1}1.6.4%{?2:-%{2}} \ +Provides: %{1}1.6.5%{?2:-%{2}} \ +Provides: %{1}1.6.6%{?2:-%{2}} \ +Provides: %{1}1.7.0-beta%{?2:-%{2}} \ +Provides: %{1}1.7.0-beta%{?2:-%{2}} \ +Provides: %{1}1.7.0-beta%{?2:-%{2}} \ +Provides: %{1}1.7.0-beta%{?2:-%{2}} \ +Provides: %{1}1.7.0-rc1%{?2:-%{2}} \ +Provides: %{1}1.7.0%{?2:-%{2}} \ +Provides: %{1}1.7.0-rc2%{?2:-%{2}} \ +Provides: %{1}1.7.0-rc3%{?2:-%{2}} \ +Provides: %{1}1.7.1%{?2:-%{2}} \ +Provides: %{1}1.7.2%{?2:-%{2}} \ +Provides: %{1}1.7.3%{?2:-%{2}} \ +Provides: %{1}1.8.0-beta%{?2:-%{2}} \ +Provides: %{1}1.8.0-beta%{?2:-%{2}} \ +Provides: %{1}1.8.0-rc1%{?2:-%{2}} \ +Provides: %{1}1.8.0-rc3%{?2:-%{2}} + Name: juliaup Version: 1.6.8 Release: 0 @@ -31,12 +76,10 @@ Source0: %{name}-%{version}.tar.gz Source1: vendor.tar.gz Source2: cargo_config BuildRequires: cargo-packaging - -# This package actually conflicts with an existing -# Julia package in the science repository -Conflicts: julia -Obsoletes: julia < %{latest_julia_stable} -Provides: julia = %{latest_julia_stable}-%{release} +Obsoletes: julia < %{oldest_supported_julia_version} +%provides_julia_versioned julia +Requires(post): update-alternatives +Requires(postun):update-alternatives %description A cross-platform installer for the Julia programming language. @@ -56,7 +99,26 @@ cp %{SOURCE2} .cargo/config %install %{cargo_install} -ln -sv "%{_bindir}/julialauncher" "%{buildroot}/%{_bindir}/julia" +mkdir -p %{buildroot}%{_sysconfdir}/alternatives +ln -sf %{_sysconfdir}/alternatives/julia %{buildroot}%{_bindir}/julia + +%post +update-alternatives --install \ + %{_bindir}/julia julia %{_bindir}/julia 15 + +%post -n juliaup +update-alternatives --install \ + %{_bindir}/julia julia %{_bindir}/julialauncher 20 + +%postun +if [ ! -f %{_bindir}/julia ] ; then + update-alternatives --remove julia %{_bindir}/julia +fi + +%postun -n juliaup +if [ ! -f %{_bindir}/julialauncher ] ; then + update-alternatives --remove julia %{_bindir}/julialauncher +fi %files %license LICENSE @@ -65,5 +127,6 @@ ln -sv "%{_bindir}/julialauncher" "%{buildroot}/%{_bindir}/julia" %{_bindir}/juliainstaller %{_bindir}/julialauncher %{_bindir}/juliaup +%ghost %_sysconfdir/alternatives/julia %changelog