Blob Blame Raw
# Default to Python 2 being removed for Fedora 29+
%if 0%{?fedora} < 29
%bcond_without python2
%else
%bcond_with python2
%endif

# Enable Python dependency generation
%{?python_enable_dependency_generator}

# Disable mangling shebangs for dracut module files as it breaks initramfs
%global __brp_mangle_shebangs_exclude_from ^%{_prefix}/lib/dracut/modules.d/.*$

%global desc \
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.


Name:           kiwi
Version:        9.17.38
Release:        1%{?dist}
URL:            http://suse.github.io/kiwi/
Summary:        Flexible operating system image builder
License:        GPLv3+
# We must use the version uploaded to pypi, as it contains all the required files.
Source0:        https://files.pythonhosted.org/packages/source/k/%{name}/%{name}-%{version}.tar.gz

# Fedora-specific patches
## Use python-pyxattr instead of python-xattr
## TODO: Get python-xattr into Fedora
Patch1000:      kiwi-9.12.8-use-pyxattr.patch
## Use buildah instead of umoci by default for OCI image builds
## TODO: Consider getting umoci into Fedora?
Patch1001:      kiwi-9.17.34-use-buildah.patch

BuildRequires:  bash-completion
BuildRequires:  dracut
BuildRequires:  fdupes
BuildRequires:  gcc
BuildRequires:  make
%if %{with python2}
BuildRequires:  python2-devel
BuildRequires:  python2-setuptools
%endif
BuildRequires:  python3-devel
BuildRequires:  python3-setuptools
BuildRequires:  shadow-utils

# doc build requirements
BuildRequires:  python3dist(docopt) >= 0.6.2
BuildRequires:  python3dist(future)
BuildRequires:  python3dist(lxml)
BuildRequires:  python3dist(pyxattr)
BuildRequires:  python3dist(pyyaml)
BuildRequires:  python3dist(requests)
BuildRequires:  python3dist(six)

%description %{desc}


%package systemdeps
Summary:        Common system dependencies for KIWI
Provides:       kiwi-image:docker
Provides:       kiwi-image:iso
Provides:       kiwi-image:oem
Provides:       kiwi-image:pxe
Provides:       kiwi-image:tbz
Provides:       kiwi-image:vmx
# tools used by kiwi
# For building Fedora, RHEL/CentOS, and Mageia based images
Requires:       dnf
Provides:       kiwi-packagemanager:dnf
Provides:       kiwi-packagemanager:yum
%if 0%{?fedora}
# For building (open)SUSE based images
Requires:       zypper
Provides:       kiwi-packagemanager:zypper
%endif
# Common tool dependencies
Requires:       device-mapper-multipath
Requires:       dosfstools
Requires:       e2fsprogs
Requires:       xorriso
Requires:       gdisk
Requires:       grub2
Requires:       %{name}-tools = %{version}-%{release}
Requires:       lvm2
Requires:       mtools
Requires:       parted
Requires:       qemu-img
Requires:       rsync
Requires:       squashfs-tools
%ifarch %{ix86} x86_64
# Pull in syslinux when it's x86
%if 0%{?fedora} || 0%{?rhel} >= 8
Requires:       syslinux-nonlinux
%endif
Requires:       syslinux
%endif
Requires:       tar >= 1.2.7
%if 0%{?fedora} || 0%{?rhel} >= 8
# For building Debian/Ubuntu based images
Recommends:     debootstrap
Recommends:     jing
%endif
%ifnarch ppc64 %{ix86}
# buildah isn't available on ppc64 or x86_32
Requires:       buildah
%endif
%ifarch %{arm} aarch64
Requires:       uboot-tools
%endif
%ifarch x86_64
Requires:       grub2-efi
%endif
%ifarch s390 s390x
Requires:       s390utils
%endif
%if ! %{with python2}
Obsoletes:      python2-%{name} < %{version}-%{release}
%endif

%description systemdeps
This metapackage installs the necessary system dependencies
to run KIWI.

%if %{with python2}
%package -n python2-%{name}
Summary:        KIWI - Python 2 implementation
Requires:       %{name}-systemdeps = %{version}-%{release}
Requires:       python2-setuptools
# Conflict with flumotion that was pre kiwi-gtk package rename
Conflicts:      flumotion < 0.11.0.1-9
BuildArch:      noarch
%{?python_provide:%python_provide python2-%{name}}

%description -n python2-%{name}
Python 2 library of 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.
%endif

%package -n python3-%{name}
Summary:        KIWI - Python 3 implementation
Requires:       kiwi-systemdeps = %{version}-%{release}
Requires:       python3-setuptools
BuildArch:      noarch
%{?python_provide:%python_provide python3-%{name}}

%description -n python3-%{name}
Python 3 library of 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 tools
Summary:        KIWI - Collection of Boot Helper Tools

%description 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 pxeboot
Summary:        KIWI - PXE boot structure
Requires:       syslinux
Requires:       tftp-server

%description pxeboot
This package contains the basic PXE directory structure which is
needed to serve kiwi built images via PXE.
%endif

%package -n dracut-kiwi-lib
Summary:        KIWI - Dracut kiwi Library
Requires:       bc
Requires:       btrfs-progs
Requires:       coreutils
Requires:       cryptsetup
Requires:       curl
Requires:       device-mapper
Requires:       dialog
Requires:       dracut
Requires:       e2fsprogs
Requires:       gdisk
Requires:       grep
Requires:       lvm2
Requires:       mdadm
Requires:       parted
Requires:       pv
Requires:       util-linux
Requires:       xfsprogs
Requires:       xz
BuildArch:      noarch

%description -n dracut-kiwi-lib
This package contains a collection of methods to provide a library
for tasks done in other kiwi dracut modules

%package -n dracut-kiwi-oem-repart
Summary:        KIWI - Dracut module for oem(repart) image type
Requires:       dracut-kiwi-lib = %{version}-%{release}
BuildArch:      noarch

%description -n dracut-kiwi-oem-repart
This package contains the kiwi-repart dracut module which is
used to repartition the oem disk image to the current disk
geometry according to the setup in the kiwi image configuration

%package -n dracut-kiwi-oem-dump
Summary:        KIWI - Dracut module for oem(install) image type
Requires:       dracut-kiwi-lib = %{version}-%{release}
Requires:       device-mapper-multipath
Requires:       gawk
Requires:       kexec-tools
BuildArch:      noarch

%description -n dracut-kiwi-oem-dump
This package contains the kiwi-dump dracut module which is
used to install an oem image onto a target disk. It implements
a simple installer which allows for user selected target disk
or unattended installation to target. The source of the image
to install could be either from media(CD/DVD/USB) or from
remote

%package -n dracut-kiwi-live
Summary:        KIWI - Dracut module for iso(live) image type
Requires:       device-mapper
Requires:       dialog
Requires:       dracut
Requires:       e2fsprogs
Requires:       xorriso
Requires:       util-linux
Requires:       xfsprogs
Requires:       parted
BuildArch:      noarch

%description -n dracut-kiwi-live
This package contains the kiwi-live dracut module which is used
for booting iso(live) images built with KIWI

%package -n dracut-kiwi-overlay
Summary:        KIWI - Dracut module for vmx(+overlay) image type
Requires:       dracut
Requires:       util-linux
BuildArch:      noarch

%description -n dracut-kiwi-overlay
This package contains the kiwi-overlay dracut module which is used
for booting vmx images built with KIWI and configured to use an
overlay root filesystem

%package cli
Summary:        Flexible operating system appliance image builder
Provides:       kiwi-schema = 7.1
# So we can reference it by the source package name while permitting this to be noarch
Provides:       %{name} = %{version}-%{release}
Requires:       python3-%{name} = %{version}-%{release}
Requires:       bash-completion
BuildArch:      noarch

%description cli %{desc}


%prep
%autosetup -p1

# Drop shebang for kiwi/xml_parse.py, as we don't intend to use it as an independent script
sed -e "s|#!/usr/bin/env python||" -i kiwi/xml_parse.py

%build
# Because there are some compiled stuff
%set_build_flags

%if %{with python2}
%py2_build
%endif
%py3_build

%install
%if %{with python2}
%py2_install
%endif
%py3_install

# Install dracut modules (yes, the slash is needed!)
make buildroot=%{buildroot}/ install_dracut

# Move the bash completion file to right place
mkdir -p %{buildroot}%{_datadir}/bash-completion/completions
mv %{buildroot}%{_sysconfdir}/bash_completion.d/kiwi-ng.sh %{buildroot}%{_datadir}/bash-completion/completions/kiwi-ng

# Erase redundant bash completion file
rm -rf %{buildroot}%{_sysconfdir}/bash_completion.d

# Get rid of unnecessary doc files
rm -rf %{buildroot}%{_docdir}/packages

# Create symlinks for correct binaries
ln -sr %{buildroot}%{_bindir}/kiwi-ng %{buildroot}%{_bindir}/kiwi
ln -sr %{buildroot}%{_bindir}/kiwi-ng-3 %{buildroot}%{_bindir}/kiwi-ng
ln -sr %{buildroot}%{_bindir}/kiwicompat-3 %{buildroot}%{_bindir}/kiwicompat

# kiwi pxeboot directory structure to be packed in kiwi-pxeboot
%ifarch %{ix86} x86_64
for i in KIWI pxelinux.cfg image upload boot; do \
    mkdir -p %{buildroot}%{_sharedstatedir}/tftpboot/$i ;\
done
%fdupes %{buildroot}%{_sharedstatedir}/tftpboot
%endif

%if %{with python2}
%files -n python2-%{name}
%license LICENSE
%{_bindir}/kiwi-ng-2*
%{_bindir}/kiwicompat-2*
%{python2_sitelib}/kiwi*/
%endif

%files -n python3-%{name}
%license LICENSE
%{_bindir}/kiwi-ng-3*
%{_bindir}/kiwicompat-3*
%{python3_sitelib}/kiwi*/

%files tools
%license LICENSE
%{_bindir}/dcounter
%{_bindir}/isconsole
%{_bindir}/kversion
%{_bindir}/utimer

%files cli
%{_bindir}/kiwi
%{_bindir}/kiwi-ng
%{_bindir}/kiwicompat
%{_datadir}/bash-completion/completions/kiwi-ng
%{_mandir}/man8/kiwi*

%ifarch %{ix86} x86_64
%files pxeboot
%license LICENSE
%{_sharedstatedir}/tftpboot/*
%endif

%files -n dracut-kiwi-lib
%license LICENSE
%{_prefix}/lib/dracut/modules.d/99kiwi-lib/

%files -n dracut-kiwi-oem-repart
%license LICENSE
%{_prefix}/lib/dracut/modules.d/90kiwi-repart/

%files -n dracut-kiwi-oem-dump
%license LICENSE
%{_prefix}/lib/dracut/modules.d/90kiwi-dump

%files -n dracut-kiwi-live
%license LICENSE
%{_prefix}/lib/dracut/modules.d/90kiwi-live/

%files -n dracut-kiwi-overlay
%license LICENSE
%{_prefix}/lib/dracut/modules.d/90kiwi-overlay/

%files systemdeps
# Empty metapackage

%changelog
* Mon Apr 22 2019 Neal Gompa <ngompa13@gmail.com> - 9.17.38-1
- Upgrade to 9.17.38 (RH#1698619)

* Sun Mar 31 2019 Neal Gompa <ngompa13@gmail.com> - 9.17.34-2
- Do not require buildah on x86_32 and ppc64

* Sun Mar 31 2019 Neal Gompa <ngompa13@gmail.com> - 9.17.34-1
- Upgrade to 9.17.34 (RH#1688338)
- Patch to use buildah by default instead of umoci for OCI image builds

* Sun Mar 10 2019 Neal Gompa <ngompa13@gmail.com> - 9.17.27-1
- Upgrade to 9.17.27 (RH#1680084)

* Sun Feb 17 2019 Neal Gompa <ngompa13@gmail.com> - 9.17.19-1
- Upgrade to 9.17.19

* Fri Feb 01 2019 Fedora Release Engineering <releng@fedoraproject.org> - 9.16.12-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild

* Sun Aug 26 2018 Neal Gompa <ngompa13@gmail.com> - 9.16.12-1
- Upgrade to 9.16.12 (RH#1591056)

* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 9.16.0-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild

* Tue Jun 19 2018 Miro HronĨok <mhroncok@redhat.com> - 9.16.0-2
- Rebuilt for Python 3.7

* Wed Jun 06 2018 Neal Gompa <ngompa13@gmail.com> - 9.16.0-1
- Upgrade to 9.16.0 (RH#1578808)
- Drop Python 2 subpackage for F29+

* Wed May 09 2018 Neal Gompa <ngompa13@gmail.com> - 9.15.1-1
- Upgrade to 9.15.1 (RH#1570222)

* Thu Apr 12 2018 Neal Gompa <ngompa13@gmail.com> - 9.14.2-1
- Upgrade to 9.14.2 (RH#1565110)

* Sat Mar 24 2018 Neal Gompa <ngompa13@gmail.com> - 9.14.0-1
- Upgrade to 9.14.0 (RH#1560120)

* Sat Mar 17 2018 Neal Gompa <ngompa13@gmail.com> - 9.13.7-2
- Add Conflicts for flumotion < 0.11.0.1-9 on python2-kiwi

* Sat Mar 17 2018 Neal Gompa <ngompa13@gmail.com> - 9.13.7-1
- Initial import into Fedora (RH#1483339)

* Fri Mar 16 2018 Neal Gompa <ngompa13@gmail.com> - 9.13.7-0.4
- Drop useless python shebang in a source file
- Swap python BRs for python2 ones

* Fri Mar 16 2018 Neal Gompa <ngompa13@gmail.com> - 9.13.7-0.3
- Fix invocations of python_provide macro to work with noarch subpackages
- Add BuildRequires for kiwi-tools

* Fri Mar 16 2018 Neal Gompa <ngompa13@gmail.com> - 9.13.7-0.2
- More small cleanups
- Reorder Req/Prov declarations

* Fri Mar 16 2018 Neal Gompa <ngompa13@gmail.com> - 9.13.7-0.1
- Update to 9.13.7
- Cleanups to packaging per review
- Adapt kiwi-pxeboot to match how tftp-server is packaged

* Sun Feb 25 2018 Neal Gompa <ngompa13@gmail.com> - 9.13.0-0.3
- Rename source package from python-kiwi to kiwi
- Rename kiwi subpackage to kiwi-cli
- Merge kiwi-man-pages into kiwi-cli

* Wed Feb 21 2018 Neal Gompa <ngompa13@gmail.com> - 9.13.0-0.2
- Update proposed change based on PR changes

* Tue Feb 20 2018 Neal Gompa <ngompa13@gmail.com> - 9.13.0-0.1
- Update to 9.13.0
- Add proposed change to fix yum vs yum-deprecated lookup in chroot

* Mon Feb 12 2018 Neal Gompa <ngompa13@gmail.com> - 9.12.8-0.4
- Switch to autosetup to actually apply patch

* Mon Feb 12 2018 Neal Gompa <ngompa13@gmail.com> - 9.12.8-0.3
- Patch to use pyxattr in setuptools data

* Fri Feb 09 2018 Neal Gompa <ngompa13@gmail.com> - 9.12.8-0.2
- Fix broken dependency on pyxattr

* Thu Feb 08 2018 Neal Gompa <ngompa13@gmail.com> - 9.12.8-0.1
- Update to 9.12.8

* Mon Jan 15 2018 Neal Gompa <ngompa13@gmail.com> - 9.11.30-0.1
- Update to 9.11.30

* Thu Dec 21 2017 Neal Gompa <ngompa13@gmail.com> - 9.11.19-0.1
- Update to 9.11.19

* Wed Sep 06 2017 Neal Gompa <ngompa13@gmail.com> - 9.10.7-0.1
- Update to 9.10.7

* Wed Aug 23 2017 Neal Gompa <ngompa13@gmail.com> - 9.10.6-0.1
- Update to 9.10.6
- Address review feedback

* Sun Aug 20 2017 Neal Gompa <ngompa13@gmail.com> - 9.10.4-0.1
- Initial packaging