kiwi-el8/package/python3-kiwi-spec-template
Marcus Schäfer 31630ff735
Fixed cut and paste error in spec template
correct the project Url
2016-02-18 10:09:34 +01:00

235 lines
6.9 KiB
Plaintext

#
# spec file for package kiwi
#
# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
#
# 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://github.com/SUSE/kiwi/issues
#
Name: python3-kiwi
Version: %%VERSION
Release: 0
Url: https://github.com/SUSE/kiwi
Summary: KIWI - Appliance Builder Next Generation
License: GPL-2.0+
Group: Development/Languages/Python
Source: python3-kiwi.tar.bz2
Source1: python3-kiwi-boot-packages
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: python3-devel
BuildRequires: python3-setuptools
BuildRequires: fdupes
BuildRequires: update-alternatives
Requires: update-alternatives
Requires: python3-docopt
Requires: python3-setuptools
Requires: python3-lxml
# tools used by kiwi
Requires: kiwi-tools
Requires: rsync
Requires: tar
Requires: gptfdisk
Requires: qemu-tools
Requires: dosfstools
Requires: genisoimage
Requires: e2fsprogs
Requires: lvm2
Requires: parted
Requires: multipath-tools
Requires: squashfs
Requires: grub2
Requires: syslinux
Requires: mtools
%ifarch %arm aarch64
Requires: u-boot-tools
%endif
%ifarch x86_64
Requires: grub2-x86_64-efi
%endif
%ifarch s390 s390x
Requires: s390-tools
%endif
# translate version id to distribution
# name as it is used in kiwi
%if 0%{?suse_version}
%define distro %(echo `export VER=%{suse_version}; echo "suse-${VER:0:2}.${VER:2:1}"`)
# redefine for the SLES case if no sles_version exists
# SLE12:
%if 0%{?suse_version} == 1315 && !0%{?is_opensuse}
%define distro suse-SLES12
%endif
# Leap 42.1:
%if 0%{?suse_version} == 1315 && 0%{?is_opensuse}
%define distro suse-leap42.1
%endif
# Tumbleweed:
# Current Tumbleweed version, moving target
%if 0%{?suse_version} == 1330
%define distro suse-tumbleweed
%endif
%endif
# SLES with sles_version macro
%if 0%{?sles_version}
%define distro suse-SLES%{sles_version}
%endif
# RHEL // CentOS
# use the rhel templates for CentOS, too
%if 0%{?rhel_version} == 700 || 0%{?centos_version} == 700
%define distro rhel-07.0
%endif
%description
The KIWI Image System provides an operating system image builder
for Linux supported hardware platforms as well as for virtualization
and cloud systems like Xen, KVM, VMware, EC2 and more.
%package -n kiwi-tools
Summary: KIWI - Collection of Boot Helper Tools
License: GPL-2.0+
Group: System/Management
%description -n kiwi-tools
This package contains a small set of helper tools used for the
kiwi created initial ramdisk which is used to control the very
first boot of an appliance. The tools are not meant to be used
outside of the scope of kiwi appliance building.
%ifarch %ix86 x86_64
%package -n kiwi-pxeboot
Summary: KIWI - PXE boot structure
Requires: syslinux
License: GPL-2.0+
Group: System/Management
BuildArch: noarch
%description -n kiwi-pxeboot
This package contains the basic PXE directory structure which is
needed to serve kiwi built images via PXE.
%endif
%package -n kiwi-boot-requires
Summary: KIWI - buildservice package requirements for boot images
Provides: kiwi-boot:isoboot
Provides: kiwi-boot:vmxboot
Provides: kiwi-boot:netboot
Provides: kiwi-boot:oemboot
Requires: %(echo `cat %{S:1}|grep %{_target_cpu}:%{distro}:|cut -f3- -d:`)
License: GPL-2.0+
Group: System/Management
%description -n kiwi-boot-requires
Meta package for the buildservice to pull in all required packages in
order to have them in the buildservice created repositories to allow
kiwi to build the boot image. This package must never be published
nor installed by anybody else except for the buildservice, it is part
of the kiwi - buildservice integration exclusively
%prep
%setup -q -n kiwi-%{version}
%build
test -e /.buildenv && . /.buildenv
make buildroot=%{buildroot} CFLAGS="${RPM_OPT_FLAGS}" tools
python3 setup.build.py build
%install
mkdir -p %{buildroot}%{_sysconfdir}/alternatives
mkdir -p %{buildroot}%_sysconfdir/bash_completion.d
install -m 644 completion/kiwi.sh \
%{buildroot}%_sysconfdir/bash_completion.d/kiwi-next-generation.sh
touch %{buildroot}%{_sysconfdir}/alternatives/kiwi.sh
ln -s %{_sysconfdir}/alternatives/kiwi.sh \
%{buildroot}%_sysconfdir/bash_completion.d/kiwi.sh
make buildroot=%{buildroot} install_tools
make buildroot=%{buildroot} install_man
python3 setup.build.py install --prefix=%{_prefix} --root=%{buildroot}
touch %{buildroot}%{_sysconfdir}/alternatives/kiwi
ln -s %{_sysconfdir}/alternatives/kiwi \
%{buildroot}%_bindir/kiwi
%ifarch %ix86 x86_64
for i in KIWI pxelinux.cfg image upload boot; do \
mkdir -p %{buildroot}/srv/tftpboot/$i ;\
done
%endif
%fdupes %{buildroot}/srv/tftpboot
%fdupes %{buildroot}/%{python3_sitelib}/kiwi
%post
%{_sbindir}/update-alternatives \
--install %_sysconfdir/bash_completion.d/kiwi.sh kiwi.sh \
%_sysconfdir/bash_completion.d/kiwi-next-generation.sh 10
%{_sbindir}/update-alternatives \
--install %_bindir/kiwi kiwi %_bindir/kiwi-py3 10
%preun
%{_sbindir}/update-alternatives --remove kiwi.sh \
%_sysconfdir/bash_completion.d/kiwi.sh
%{_sbindir}/update-alternatives --remove kiwi %_bindir/kiwi
%ifarch %ix86 x86_64
%pre -n kiwi-pxeboot
#============================================================
# create user and group tftp if they does not exist
if ! /usr/bin/getent group tftp >/dev/null; then
%{_sbindir}/groupadd -r tftp 2>/dev/null || :
fi
if ! /usr/bin/getent passwd tftp >/dev/null; then
%{_sbindir}/useradd -c "TFTP account" -d /srv/tftpboot -G tftp -g tftp \
-r -s /bin/false tftp 2>/dev/null || :
fi
%endif
%files
%defattr(-,root,root,-)
%{_bindir}/kiwi-py3
%{_bindir}/kiwi
%ghost %_sysconfdir/alternatives/kiwi
%{_bindir}/kiwicompat
%{python3_sitelib}/*
%config %_sysconfdir/bash_completion.d/kiwi-next-generation.sh
%ghost %_sysconfdir/bash_completion.d/kiwi.sh
%ghost %_sysconfdir/alternatives/kiwi.sh
%doc %{_mandir}/man2/*
%files -n kiwi-tools
%defattr(-, root, root)
%exclude %{_bindir}/kiwi
%exclude %{_bindir}/kiwi-py3
%exclude %{_bindir}/kiwicompat
%{_bindir}/*
%ifarch %ix86 x86_64
%files -n kiwi-pxeboot
%defattr(-, root, root)
%dir %attr(0750,tftp,tftp) /srv/tftpboot
%dir /srv/tftpboot/KIWI
%dir /srv/tftpboot/pxelinux.cfg
%dir /srv/tftpboot/image
%dir /srv/tftpboot/upload
%dir /srv/tftpboot/boot
%endif
%files -n kiwi-boot-requires
%defattr(-, root, root)
%changelog