File skelcd.spec of Package skelcd.24320
#
# spec file for package skelcd
#
# Copyright (c) 2021 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 flavor @BUILD_FLAVOR@
%define SLE_RELEASE 15 SP3
#
# default replacement variables for README content
%define PRETTY_NAME SUSE Linux Enterprise Server
%define UNDERLINE ===================================
%define PRODUCT_LINK https://www.suse.com/sles
#
# default documentation
# only used for sles and sle-hpc
%define BOOKS admin deployment installquick storage
# don't build skelcd
%if "%{flavor}" != ""
%define dash -
%else
%define PRODUCT_PATH_REL_NOTES %{nil}
%define PRODUCT %{nil}
%define product %{nil}
ExclusiveArch: %{nil}
%endif
#
# define the product specific options
%if "%{flavor}" == "ha"
%define PRETTY_NAME SUSE Linux Enterprise High Availability Extension
%define UNDERLINE ========================================================
%define PRODUCT_LINK https://www.suse.com/products/highavailability/
%define PRODUCT_PATH_REL_NOTES SUSE_Linux_Enterprise_High_Availability_Extension_15
%define PRODUCT sle-ha
%define product ha
%endif
%if "%{flavor}" == "leanos"
%define product leanos
%endif
%if "%{flavor}" == "rt"
%define PRODUCT_PATH_REL_NOTES SLE_RT_15
%define product rt
ExclusiveArch: x86_64
%endif
%if "%{flavor}" == "sap-apl"
%define PRODUCT SLES_SAP
%define product sap-apl
%endif
%if "%{flavor}" == "sle_hpc"
%define PRETTY_NAME SUSE Linux Enterprise for High Performance Computing
%define UNDERLINE ===========================================================
%define PRODUCT_LINK https://www.suse.com/sles-hpc
%define PRODUCT_PATH_REL_NOTES SLE_HPC_15
%define PRODUCT SLE_HPC
%define product sle_hpc
%endif
%if "%{flavor}" == "sle_lp"
# PRODUCT_PATH_REL_NOTES is not (yet) defined as we do not ship separate release notes for SLE-LP
%define PRODUCT SLE_LP
%define product sle_lp
%endif
%if "%{flavor}" == "sle_rt"
%define PRODUCT_PATH_REL_NOTES SLE_RT_15
%define PRODUCT SLE_RT
%define product sle_rt
ExclusiveArch: x86_64
%endif
%if "%{flavor}" == "sle-we"
%define PRETTY_NAME SUSE Linux Enterprise Workstation Extension
%define UNDERLINE ==================================================
%define PRODUCT_LINK https://www.suse.com/sled
%define PRODUCT_PATH_REL_NOTES SUSE_Linux_Enterprise_Desktop_15
%define PRODUCT sle-we
%define product sle-we
ExclusiveArch: %ix86 x86_64 aarch64
%endif
%if "%{flavor}" == "sled"
%define PRETTY_NAME SUSE Linux Enterprise Desktop
%define UNDERLINE ====================================
%define PRODUCT_LINK https://www.suse.com/sled
%define BOOKS installquick
%define PRODUCT_PATH_REL_NOTES SUSE_Linux_Enterprise_Desktop_15
%define PRODUCT SLED
%define product sled
ExclusiveArch: %ix86 x86_64
%endif
%if "%{flavor}" == "sles"
%define PRODUCT_PATH_REL_NOTES SUSE_Linux_Enterprise_Server_15
%define PRODUCT SLES
%define product sles
%endif
%if "%{flavor}" == "suse-manager-proxy"
%define PRODUCT_PATH_REL_NOTES SUSE_Manager_Proxy
%define PRODUCT SUSE-Manager-Proxy
%define product suse-manager-proxy
ExcludeArch: aarch64
%endif
%if "%{flavor}" == "suse-manager-retail-branch-server"
%define PRODUCT_PATH_REL_NOTES SUSE_Manager_Proxy
%define PRODUCT SUSE-Manager-Retail-Branch-Server
%define product suse-manager-retail-branch-server
ExcludeArch: aarch64
%endif
%if "%{flavor}" == "suse-manager-server"
%define PRODUCT_PATH_REL_NOTES SUSE_Manager_Server
%define PRODUCT SUSE-Manager-Server
%define product suse-manager-server
ExcludeArch: aarch64
%endif
# release is a beta
%define beta 0
%if 0%{?beta} == 1
%define license_dir license.beta
%else
%define license_dir license.final
%endif
# SLE15 uses different paths
%if 0%{?suse_version} > 1320
%define skelcd1_path usr/lib/skelcd/CD1
%else
%define skelcd1_path CD1
%endif
%if "%{flavor}" == "bci"
%define PRODUCT BCI
%define product bci
%define skelcd1_path usr/share/licenses/product/BCI
%endif
Name: skelcd%{?dash}%{product}
#
# define flavor specific BuildRequires
#
# packages that share the same BuildRequires as sles
%if ("%{product}" == "sle_hpc" || "%{product}" == "sled" || "%{product}" == "sles")
BuildRequires: release-notes%{?dash}%{product}
BuildRequires: suse-build-key
%endif
#
# packages that differ in BuildRequires to sles
%if ("%{product}" == "ha" || "%{product}" == "sle_rt")
BuildRequires: release-notes%{?dash}%{product}
BuildRequires: suse-build-key
Conflicts: skelcd-SUSE_Linux skelcd skelcd-SUSE_Linux-Addon skelcd-ISSLE-Addon
BuildRequires: libxml2
BuildRequires: yast2-installation >= 2.17.44
BuildRequires: yast2-installation-control
%endif
%if "%{product}" == "rt"
BuildRequires: release-notes-sle_rt
BuildRequires: suse-build-key
Conflicts: skelcd-SUSE_Linux skelcd skelcd-SUSE_Linux-Addon skelcd-ISSLE-Addon
BuildRequires: libxml2
BuildRequires: yast2-installation >= 2.17.44
BuildRequires: yast2-installation-control
%endif
%if "%{product}" == "leanos"
# We put the RN for the base products on the installer media
BuildRequires: release-notes-sles
BuildRequires: release-notes-sled
BuildRequires: release-notes-sles-for-sap
BuildRequires: release-notes-sle_hpc
BuildRequires: sle_quickstarts
BuildRequires: suse-build-key
BuildRequires: w3m
%endif
%if "%{product}" == "sap-apl"
BuildRequires: suse-build-key
%endif
%if "%{product}" == "sle-we"
BuildRequires: release-notes-sled
BuildRequires: suse-build-key
%endif
%if ("%{product}" == "suse-manager-proxy" || "%{product}" == "suse-manager-retail-branch-server")
BuildRequires: release-notes-susemanager-proxy
BuildRequires: suse-build-key
BuildRequires: w3m
%endif
%if "%{product}" == "suse-manager-server"
BuildRequires: release-notes-susemanager
BuildRequires: suse-build-key
BuildRequires: w3m
%endif
AutoReqProv: off
Version: 2021.05.14
Release: 0
Summary: CD skeleton for %{PRODUCT}
License: GPL-2.0-only
Group: Metapackages
BuildRoot: %{_tmppath}/%{name}-%{version}-build
Source: skelcd-%{version}.tar.xz
Source1: BCI-eula.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.
%if "%{product}" == "sles"
%package -n skelcd-EULA%{?dash}%{PRODUCT}_BCL
Summary: EULA for media
Group: Metapackages
%description -n skelcd-EULA%{?dash}%{PRODUCT}_BCL
Internal package only.
%endif
%prep
%setup -n skelcd%{?dash}%{version} -a 1 -q
%build
%install
#
# for sle_lp and bci, we don't copy the SUSE build keys
%if ("%{product}" != "sle_lp" && "%{product}" != "bci")
mkdir -p $RPM_BUILD_ROOT/%{skelcd1_path}/boot
cp COPYRIGHT/* $RPM_BUILD_ROOT/%{skelcd1_path}/
cp /usr/lib/rpm/gnupg/keys/* $RPM_BUILD_ROOT/%{skelcd1_path}/
%endif
#
# copy the product READMEs
# SUSE Manager and Real Time have their own README
%if ("%{product}" != "suse-manager-proxy" && "%{product}" != "suse-manager-retail-branch-server" && "%{product}" != "suse-manager-server" && "%{product}" != "rt" && "%{product}" != "sle_rt")
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
%else
%if ("%{product}" == "suse-manager-proxy" || "%{product}" == "suse-manager-retail-branch-server" || "%{product}" == "suse-manager-server")
pushd READMEs/suse-manager
%else
pushd READMEs/realtime
%endif
%endif
# Live Patching & BCI doesn't have a README
%if ("%{product}" != "sle_lp" && "%{product}" != "bci")
for i in README \
%if %{?beta} == 1
README.BETA \
%endif
; do
cp -pv $i $RPM_BUILD_ROOT/%{skelcd1_path}/$i
done
%endif
popd
#
# license tarball generation
mkdir -p $RPM_BUILD_ROOT/%{skelcd1_path}/media.1
pushd %license_dir
ls -1 > directory.yast # required for downloading of EULAs from SCC
# leanos doesn't use a product string for the tarball
%if "%{product}" == "leanos"
tar cvzf license.tar.gz --owner=root --group=root *txt directory.yast
cp license.tar.gz $RPM_BUILD_ROOT/%{skelcd1_path}/
%endif
# rt has a different product string matching sle_rt
%if "%{product}" == "rt"
tar cvzf license-sle-rt.tar.gz --owner=root --group=root *txt directory.yast
cp license-sle-rt.tar.gz $RPM_BUILD_ROOT/%{skelcd1_path}/
%endif
# bci doesn't have a release package, make EULA available directly
%if "%{product}" == "bci"
rmdir $RPM_BUILD_ROOT/%{skelcd1_path}/media.1
mv ../BCI/*.txt $RPM_BUILD_ROOT/%{skelcd1_path}/
%endif
# all other flavors
%if ("%{product}" != "leanos" && "%{product}" != "rt" && "%{product}" != "bci")
tar cvzf license-%{PRODUCT}.tar.gz --owner=root --group=root *txt directory.yast
cp license-%{PRODUCT}.tar.gz $RPM_BUILD_ROOT/%{skelcd1_path}/
%endif
popd
#
# workaround for BCL -> only required in sles flavor
# Checked with Ciaran - since BCL does not introduce own code, SLES EULA will be fine
%if "%{product}" == "sles"
cp %license_dir/license-%{PRODUCT}.tar.gz $RPM_BUILD_ROOT/%{skelcd1_path}/license-%{PRODUCT}_BCL.tar.gz
%endif
#
# Install PDF documentation
# sled, sles, sle_hpc and leanos
%if "%{product}" != "bci"
mkdir -p $RPM_BUILD_ROOT/%{skelcd1_path}/docu/
%if ("%{product}" == "sles" || "%{product}" == "sle_hpc" || "%{product}" == "sled")
for i in ar cs de en es fr hu it ja ko pl pt_BR ru zh_CN zh_TW ; do
test -f "/usr/share/doc/manual/%{product}-installquick_$i-pdf/*.pdf" || continue;
mkdir -p $RPM_BUILD_ROOT/%{skelcd1_path}/docu/$i
for book in BOOKS; do
pdf="/usr/share/doc/manual/%{product}-${book}_$i-pdf/*.pdf"
test -f $pdf && \
cp -av $pdf $RPM_BUILD_ROOT/%{skelcd1_path}/docu/$i/${book}.pdf
done
# remove empty directories
rmdir $RPM_BUILD_ROOT/%{skelcd1_path}/docu/$i ||:
done
%endif
%if "%{product}" == "leanos"
cp -vp /usr/share/doc/manual/quickstarts/*.pdf $RPM_BUILD_ROOT/%{skelcd1_path}/docu/
%endif
%endif
#
# Install release notes as HTML pages
# for sap-apl and sle_lp these are not copied
%if ("%{product}" != "sap-apl" && "%{product}" != "sle_lp" && "%{product}" != "bci" )
# leanos is including all release notes
%if "%{product}" != "leanos"
cp -vp /usr/share/doc/release-notes/%{PRODUCT_PATH_REL_NOTES}/RELEASE-NOTES.en.* \
$RPM_BUILD_ROOT/%{skelcd1_path}/docu/
%else
pushd /usr/share/doc/release-notes/
for j in `ls`; do
pushd $j
for i in RELEASE-NOTES.en.*; do
cp -vp ${i} $RPM_BUILD_ROOT/%{skelcd1_path}/docu/${i/NOTES/NOTES_${j}}
done;
popd
done
popd
pushd $RPM_BUILD_ROOT/%{skelcd1_path}/docu/
for i in *.en.html; do
w3m -dump $i > ${i/html/txt}
done;
popd
%endif
# different handling for SUSE Manager
%if ("%{product}" == "suse-manager-proxy" || "%{product}" == "suse-manager-retail-branch-server" || "%{product}" == "suse-manager-server" )
w3m -dump $RPM_BUILD_ROOT/%{skelcd1_path}/docu/RELEASE-NOTES.en.html > $RPM_BUILD_ROOT/%{skelcd1_path}/docu/RELEASE-NOTES.en.txt
%endif
%endif
#
# Create .treeinfo for virt-manager in leanos flavor
%if "%{product}" == "leanos"
cat << EOF > $RPM_BUILD_ROOT/%{skelcd1_path}/.treeinfo
[header]
version = 1.0
[general]
arch = %{_arch}
family = SUSE Linux Enterprise
name = SUSE Linux Enterprise
version = %{SLE_RELEASE}
%ifarch x86_64
platforms = x86_64,xen
%else
platforms = %{_arch}
%endif
[release]
name = SUSE Linux Enterprise
short = sle
version = %{SLE_RELEASE}
[images-%{_arch}]
%ifnarch x86_64
kernel = boot/%{_arch}/linux
initrd = boot/%{_arch}/initrd
%else
kernel = boot/%{_arch}/loader/linux
initrd = boot/%{_arch}/loader/initrd
[images-xen]
kernel = boot/x86_64/loader/linux
initrd = boot/x86_64/loader/initrd
%endif
EOF
%endif
#
# Add control file for ha to ha, rt and sle_rt, bnc#713674
# this enables the cloning of yast2-cluster configuration
%if ("%{product}" == "ha" || "%{product}" == "rt" || "%{product}" == "sle_rt")
mkdir -p $RPM_BUILD_ROOT/%{skelcd1_path}
# Verify syntax
xmllint -noout -relaxng /usr/share/YaST2/control/control.rng installation.xml
cp installation.xml $RPM_BUILD_ROOT/%{skelcd1_path}/
%endif
%clean
rm -rf $RPM_BUILD_ROOT
%if "%{product}" != "bci"
%files
#
# skelcd
%defattr(644,root,root,755)
%if "%{product}" == "sles"
%exclude /%{skelcd1_path}/license-*.tar.gz
%endif
# rt has a different product string matching sle_rt
%if "%{product}" == "rt"
%exclude /usr/lib/skelcd/CD1/license-sle-rt.tar.gz
%endif
# leanos doesn't have a product string
%if "%{product}" == "leanos"
%exclude /%{skelcd1_path}/license.tar.gz
%endif
# all other products
%if ("%{product}" != "rt" && "%{product}" != "sles" && "%{product}" != "leanos")
%exclude /%{skelcd1_path}/license-%{PRODUCT}.tar.gz
%endif
%dir /usr/lib/skelcd/
/%{skelcd1_path}
%endif
#
# skelcd-EULA
%if ("%{product}" != "rt" && "%{product}" != "leanos")
%files -n skelcd-EULA-%{product}
%defattr(644,root,root,755)
/%{skelcd1_path}/license-%{PRODUCT}.tar.gz
%endif
# rt has a different product string matching sle_rt
%if "%{product}" == "rt"
%files -n skelcd-EULA-rt
%defattr(644,root,root,755)
/usr/lib/skelcd/CD1/license-sle-rt.tar.gz
%endif
# leanos doesn't have a product string
%if "%{product}" == "leanos"
%files -n skelcd-EULA-%{product}
%defattr(644,root,root,755)
/%{skelcd1_path}/license.tar.gz
%endif
#
# only required in sles flavor, which takes care of BCL
%if "%{product}" == "sles"
%files -n skelcd-EULA-%{PRODUCT}_BCL
%defattr(644,root,root,755)
/%{skelcd1_path}/license-%{PRODUCT}_BCL.tar.gz
%endif
# bci doesn't have a release package
%if "%{product}" == "bci"
%files -n skelcd-EULA-%{product}
%defattr(644,root,root,755)
%dir %{_datadir}/licenses/product
/%{skelcd1_path}
%endif
%changelog