File skelcd.spec of Package skelcd

#
# spec file for package skelcd
#
# Copyright (c) 2024 SUSE LLC.
#
# 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 http://bugs.opensuse.org/
#
%define SLE_RELEASE 16
#
# default replacement variables for README content
%define PRETTY_NAME SUSE Linux Container Collection
%define UNDERLINE ===================================
%define PRODUCT_LINK https://www.suse.com/sles

%define product slcc-dynamic-developer
%define PRODUCT SLCC-DYNAMIC-DEVELOPER

%define dash -

%define container_path usr/share/licenses/product/%{PRODUCT}
%define skelcd1_path usr/share/licenses/product/%{product}

# release is a beta
%define beta 0

%if 0%{?beta} == 1
%define license_dir license.beta
%else
%define license_dir license.final
%endif

%dnl %define skelcd1_path usr/lib/skelcd/CD1

Name:           skelcd%{?dash}%{product}


AutoReqProv:    off
Version:        2024.05.03.1
Release:        0
Summary:        CD skeleton for %{PRODUCT}
License:        GPL-2.0-only
Group:          Metapackages
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
Source:         skelcd-%{version}.tar.xz
# please repo-checker (bsc#1089174)
Provides:       skelcd = %{version}
Conflicts:      otherproviders(skelcd)

%description
Skeleton package for %{PRODUCT}

%package -n skelcd-EULA%{?dash}%{product}
Summary:        EULA for media
Group:          Metapackages

%description -n skelcd-EULA%{?dash}%{product}
Internal package only.


%prep
%setup -n skelcd%{?dash}%{version} -q

%build

%install
#
# copy the product READMEs
pushd READMEs/default
sed -i -e 's/{PRETTY_NAME}/%{PRETTY_NAME} %{SLE_RELEASE}/g' README
sed -i -e 's/{UNDERLINE}/%{UNDERLINE}/g' README
# use @ as delimiter, as the product link conflicts with the standard '/' delimiter
sed -i -e 's@{PRODUCT_LINK}@%{PRODUCT_LINK}@g' README
popd

#
# license tarball generation
mkdir -p $RPM_BUILD_ROOT/%{skelcd1_path}/media.1
pushd %license_dir
# touch all license files to make sure they have the most recent date
# this impacts which license is shown on the CDN to fix bsc#1186047 and bsc#1186812
# else in case beta EULAs have a more recent date than final EULAs they won't
# get replaced
touch *
ls -1 > directory.yast # required for downloading of EULAs from SCC

# bci doesn't have a release package, make EULA available directly
rmdir $RPM_BUILD_ROOT/%{skelcd1_path}/media.1
mv ../BCI/*.txt  $RPM_BUILD_ROOT/%{skelcd1_path}/

popd

#
# skelcd-EULA
%files -n skelcd-EULA-%{product}
%defattr(644,root,root,755)
%dir %{_datadir}/licenses/product
/%{skelcd1_path}

%changelog
openSUSE Build Service is sponsored by