File illuusio-repos.spec of Package illuusio-repos
#
# spec file for package illuusio-repos
#
# Copyright (c) 2025 SUSE LLC
# Copyright (c) 2022 Neal Gompa <ngompa13@gmail.com>
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%global debug_package %{nil}
Name: illuusio-repos
Version: 1.0.0
Release: 0
Summary: Illuusio package repositories
License: MIT
Group: System/Management
URL: https://build.opensuse.org/project/show/home:illuusio
Source0: illuusio-leap-repoindex.xml
Source1: illuusio.service
#boo#1203715
BuildRequires: -post-build-checks
BuildArch: noarch
Requires: zypper
# Ensure we install matching packages on given distribution
# illuusio-release has suggest on particular theme based on distribution
Conflicts: illuusio-repos
%description
Definitions for illuusio repository management via zypp-services
%package leap
Summary: Illuusio repository definitions
Requires: illuusio-repos
Conflicts: illuusio-repos-leap
Conflicts: illuusio-repos-slowroll
Conflicts: illuusio-repos-tumbleweed
%description leap
Definitions for illuusio repository management via zypp-services
%{_datadir}/zypp/local/service/illuusio/repo/illuusio-leap-repoindex.xml
%package slowroll
Summary: Illuusio repository definitions
Requires: illuusio-repos
Conflicts: illuusio-repos-leap
Conflicts: illuusio-repos-slowroll
Conflicts: illuusio-repos-tumbleweed
%description slowroll
Definitions for illuusio repository management via zypp-services
%{_datadir}/zypp/local/service/illuusio/repo/illuusio-slowroll-repoindex.xml
%package tumbleweed
Summary: Illuusio repository definitions
Requires: illuusio-repos
Conflicts: illuusio-repos-leap
Conflicts: illuusio-repos-slowroll
Conflicts: illuusio-repos-tumbleweed
%description tumbleweed
Definitions for illuusio repository management via zypp-services
%{_datadir}/zypp/local/service/illuusio/repo/illuusio-tumbleweed-repoindex.xml
%prep
# Nothing to prep
%build
# Nothing to build
sed -e "s/\"leap\"/\"openSUSE_Tumbleweed\"/" -e "s/\"\${releasever}\"/\"openSUSE_Tumbleweed\"/" %{SOURCE0} > %{_sourcedir}/illuusio-tumbleweed-repoindex.xml
sed -e "s/\"leap\"/\"openSUSE_Slowroll\"/" -e "s/\"\${releasever}\"/\"openSUSE_Slowroll\"/" %{SOURCE0} > %{_sourcedir}/illuusio-slowroll-repoindex.xml
%install
mkdir -p %{buildroot}%{_datadir}/zypp/local/service/illuusio/repo
mkdir -p %{buildroot}%{_sysconfdir}/zypp/vars.d/
install %{_sourcedir}/illuusio-tumbleweed-repoindex.xml -pm 0644 %{buildroot}%{_datadir}/zypp/local/service/illuusio/repo
install %{_sourcedir}/illuusio-slowroll-repoindex.xml -pm 0644 %{buildroot}%{_datadir}/zypp/local/service/illuusio/repo
install %{_sourcedir}/illuusio-leap-repoindex.xml -pm 0644 %{buildroot}%{_datadir}/zypp/local/service/illuusio/repo
%post
# Disable all non-zypp-service managed repos with default filenames
for repo_file in \
home-illuusio.repo \
home-illuusio-golang.repo \
home-illuusio-nodejs-packages.repo \
home-illuusio-nodejs_packages.repo \
home-illuusio-perl.repo \
home-illuusio-php-next.repo \
home-illuusio-php_next.repo \
home-illuusio-python-3.11.repo \
home_illuusio.repo \
home_illuusio_golang.repo \
home_illuusio_nodejs-packages.repo \
home_illuusio_nodejs_packages.repo \
home_illuusio_perl.repo \
home_illuusio_php-next.repo \
home_illuusio_php_next.repo \
home_illuusio_python_3.11.repo \
home:illuusio.repo \
home:illuusio:golang.repo \
home:illuusio:nodejs-packages.repo \
home:illuusio:perl.repo \
home:illuusio:php-next.repo \
home:illuusio:python:3.11.repo; do
if [ -f %{_sysconfdir}/zypp/repos.d/$repo_file ]; then
echo "Content of $repo_file will be newly managed by zypp-services."
echo "Storing old copy as %{_sysconfdir}/zypp/repos.d/$repo_file.rpmsave"
mv %{_sysconfdir}/zypp/repos.d/$repo_file %{_sysconfdir}/zypp/repos.d/$repo_file.rpmsave
fi
done
# Needs to be called after postun of old package or we might endup with
# No service and no repos as there is a symlink and service removal in postun of old pkg
%posttrans tumbleweed
ln -sf %{_datadir}/zypp/local/service/illuusio/repo/illuusio-tumbleweed-repoindex.xml %{_datadir}/zypp/local/service/illuusio/repo/repoindex.xml
ZYPP_READONLY_HACK=1 zypper addservice %{_datadir}/zypp/local/service/illuusio illuusio
ZYPP_READONLY_HACK=1 zypper refresh-services || :
%posttrans slowroll
ln -sf %{_datadir}/zypp/local/service/illuusio/repo/illuusio-slowroll-repoindex.xml %{_datadir}/zypp/local/service/illuusio/repo/repoindex.xml
ZYPP_READONLY_HACK=1 zypper addservice %{_datadir}/zypp/local/service/illuusio illuusio
ZYPP_READONLY_HACK=1 zypper refresh-services || :
%posttrans leap
ln -sf %{_datadir}/zypp/local/service/illuusio/repo/illuusio-leap-repoindex.xml %{_datadir}/zypp/local/service/illuusio/repo/repoindex.xml
ZYPP_READONLY_HACK=1 zypper addservice %{_datadir}/zypp/local/service/illuusio illuusio
ZYPP_READONLY_HACK=1 zypper refresh-services || :
%postun
if [ "$1" = 0 ] ; then
# We hereby declare that running this will not influence existing transaction
ZYPP_READONLY_HACK=1 zypper removeservice illuusio
if [ -L "%{_datadir}/zypp/local/service/illuusio/repo/repoindex.xml" ] ; then
rm -f %{_datadir}/zypp/local/service/illuusio/repo/repoindex.xml
fi
fi
%files
%dir %{_sysconfdir}/zypp
%dir %{_datadir}/zypp
%dir %{_datadir}/zypp/local/
%dir %{_datadir}/zypp/local/service
%dir %{_datadir}/zypp/local/service/illuusio
%dir %{_datadir}/zypp/local/service/illuusio/repo
%ghost %attr(0644,root,root) %{_datadir}/zypp/local/service/illuusio/repo/repoindex.xml
%ghost %attr(0644,root,root) %{_sysconfdir}/zypp/services.d/illuusio.service
%files tumbleweed
%{_datadir}/zypp/local/service/illuusio/repo/illuusio-tumbleweed-repoindex.xml
%files slowroll
%{_datadir}/zypp/local/service/illuusio/repo/illuusio-slowroll-repoindex.xml
%files leap
%{_datadir}/zypp/local/service/illuusio/repo/illuusio-leap-repoindex.xml
%changelog