Build package for both python2 and python3

OBS-URL: https://build.opensuse.org/package/show/Virtualization:Appliances:Builder/python-kiwi?expand=0&rev=4
This commit is contained in:
Marcus Schaefer 2017-03-10 16:13:20 +00:00 committed by Git OBS Bridge
parent 77a33debaa
commit 1580733b90
4 changed files with 174 additions and 86 deletions

View File

@ -38,5 +38,5 @@ addFilter("W: no-manual-page-for-binary kiwicompat");
# kiwi master package can't be noarch if sub packages are arch specific
addFilter("W: no-binary");
# multipython builds does not deal well with fdupes
addFilter("E: files-duplicated-waste");
# don't think we need a postin for update alternatives
addFilter("W: ghost-files-without-postin");

View File

@ -3,9 +3,7 @@ Thu Mar 9 17:21:54 CET 2017 - ms@suse.com
- Setup package for multipython build
There is an initiative at SUSE to combine the python2
and python3 package builds into a single spec in order
to provide packages for both versions of python
Build package for both python2 and python3
-------------------------------------------------------------------
Wed Mar 8 17:24:18 CET 2017 - ms@suse.com

View File

@ -16,76 +16,9 @@
#
# https://github.com/SUSE/kiwi/issues
#
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
Name: python-kiwi
Version: 9.3.2
Provides: kiwi-schema = 6.5
Release: 0
Url: https://github.com/SUSE/kiwi
Summary: KIWI - Appliance Builder Next Generation
License: GPL-3.0+
Group: Development/Languages/Python
Source: %{name}.tar.gz
Source1: %{name}-boot-packages
Source2: %{name}-rpmlintrc
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: %{python_module base}
BuildRequires: %{python_module setuptools}
BuildRequires: python-rpm-macros
BuildRequires: fdupes
BuildRequires: update-alternatives
BuildRequires: shadow
Provides: kiwi-image:tbz
Provides: kiwi-image:docker
Provides: kiwi-image:iso
Provides: kiwi-image:vmx
Provides: kiwi-image:pxe
Provides: kiwi-image:oem
Requires: update-alternatives
Requires: python-docopt
Requires: python-setuptools
Requires: python-lxml
Requires: python-xattr
Requires: python-six
Requires: python-future
Requires(post): update-alternatives
Requires(postun): update-alternatives
# tools used by kiwi
%if 0%{?suse_version}
Requires: zypper
Requires: squashfs
Provides: kiwi-packagemanager:zypper
%endif
%if 0%{?rhel_version} || 0%{?centos_version}
Requires: yum
Requires: squashfs-tools
Provides: kiwi-packagemanager:yum
%endif
Requires: genisoimage
Requires: kiwi-tools
Requires: rsync
Requires: tar >= 1.2.7
Requires: gptfdisk
Requires: qemu-tools
Requires: dosfstools
Requires: e2fsprogs
Requires: lvm2
Requires: parted
Requires: multipath-tools
Requires: grub2
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
%{?!python2_sitelib:%define python2_sitelib %python_sitelib}
# translate version id to distribution
# name as it is used in kiwi
# 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
@ -119,13 +52,150 @@ Requires: s390-tools
%define distro rhel-07.0
%endif
%python_subpackages
Name: python-kiwi
Version: 9.3.2
Provides: kiwi-schema = 6.5
Release: 0
Url: https://github.com/SUSE/kiwi
Summary: KIWI - Appliance Builder Next Generation
License: GPL-3.0+
Group: Development/Languages/Python
Source: %{name}.tar.gz
Source1: %{name}-boot-packages
Source2: %{name}-rpmlintrc
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: python3-devel
BuildRequires: python3-setuptools
BuildRequires: python-devel
BuildRequires: python-setuptools
BuildRequires: fdupes
BuildRequires: update-alternatives
BuildRequires: shadow
%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.
# python2-kiwi
%package -n python2-kiwi
Summary: KIWI - Appliance Builder Next Generation
Group: Development/Languages/Python
Provides: kiwi-image:tbz
Provides: kiwi-image:docker
Provides: kiwi-image:iso
Provides: kiwi-image:vmx
Provides: kiwi-image:pxe
Provides: kiwi-image:oem
Requires: update-alternatives
Requires: python-docopt
Requires: python-setuptools
Requires: python-lxml
Requires: python-xattr
Requires: python-six
Requires: python-future
Requires(post): update-alternatives
Requires(postun): update-alternatives
# tools used by kiwi
%if 0%{?suse_version}
Requires: zypper
Requires: squashfs
Provides: kiwi-packagemanager:zypper
%endif
%if 0%{?rhel_version} || 0%{?centos_version}
Requires: yum
Requires: squashfs-tools
Provides: kiwi-packagemanager:yum
%endif
Requires: genisoimage
Requires: kiwi-tools
Requires: kiwi-man-pages
Requires: rsync
Requires: tar >= 1.2.7
Requires: gptfdisk
Requires: qemu-tools
Requires: dosfstools
Requires: e2fsprogs
Requires: lvm2
Requires: parted
Requires: multipath-tools
Requires: grub2
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
%description -n python2-kiwi
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.
# python3-kiwi
%package -n python3-kiwi
Summary: KIWI - Appliance Builder Next Generation
Group: Development/Languages/Python
Provides: kiwi-image:tbz
Provides: kiwi-image:docker
Provides: kiwi-image:iso
Provides: kiwi-image:vmx
Provides: kiwi-image:pxe
Provides: kiwi-image:oem
Requires: update-alternatives
Requires: python3-docopt
Requires: python3-setuptools
Requires: python3-lxml
Requires: python3-xattr
Requires: python3-six
Requires: python3-future
Requires(post): update-alternatives
Requires(postun): update-alternatives
# tools used by kiwi
%if 0%{?suse_version}
Requires: zypper
Requires: squashfs
Provides: kiwi-packagemanager:zypper
%endif
%if 0%{?rhel_version} || 0%{?centos_version}
Requires: yum
Requires: squashfs-tools
Provides: kiwi-packagemanager:yum
%endif
Requires: genisoimage
Requires: kiwi-tools
Requires: kiwi-man-pages
Requires: rsync
Requires: tar >= 1.2.7
Requires: gptfdisk
Requires: qemu-tools
Requires: dosfstools
Requires: e2fsprogs
Requires: lvm2
Requires: parted
Requires: multipath-tools
Requires: grub2
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
%description -n python3-kiwi
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 -n kiwi-tools
Summary: KIWI - Collection of Boot Helper Tools
License: GPL-3.0+
@ -163,7 +233,7 @@ Provides: kiwi-filesystem:squashfs
Requires: btrfsprogs
Requires: e2fsprogs
Requires: xfsprogs
Requires: python-kiwi = %{version}
Requires: python3-kiwi = %{version}
Requires: %(echo `cat %{S:1}|grep %{_target_cpu}:%{distro}:|cut -f3- -d:`)
License: GPL-3.0+
Group: System/Management
@ -187,10 +257,18 @@ Provides manual pages to describe the kiwi commands
%setup -q -n kiwi-%{version}
%build
%python_build --cflags="${RPM_OPT_FLAGS}"
# Build Python 2 version
python2 setup.py build --cflags="${RPM_OPT_FLAGS}"
# Build Python 3 version
python3 setup.py build --cflags="${RPM_OPT_FLAGS}"
%install
%python_install
# Install Python 2 version
python2 setup.py install --prefix=%{_prefix} --root=%{buildroot}
# Install Python 3 version
python3 setup.py install --prefix=%{_prefix} --root=%{buildroot}
# init alternatives setup
mkdir -p %{buildroot}%{_sysconfdir}/alternatives
@ -213,7 +291,8 @@ done
%endif
%fdupes %{buildroot}/srv/tftpboot
%fdupes %{buildroot}/%{python_sitelib}/kiwi/boot
%fdupes %{buildroot}/%{python3_sitelib}/kiwi/boot
%fdupes %{buildroot}/%{python2_sitelib}/kiwi/boot
%post
%{_sbindir}/update-alternatives \
@ -240,16 +319,27 @@ if ! /usr/bin/getent passwd tftp >/dev/null; then
fi
%endif
%files %python_files
%files -n python2-kiwi
%defattr(-,root,root,-)
%{_bindir}/kiwi-ng-%{py_ver}
%{_bindir}/kiwicompat-%{py_ver}
%{_bindir}/kiwi-ng-2*
%{_bindir}/kiwicompat-2*
%ghost %{_bindir}/kiwi
%ghost %{_bindir}/kiwicompat
%ghost %_sysconfdir/alternatives/kiwi
%ghost %_sysconfdir/alternatives/kiwicompat
%{python_sitelib}/*
%config %_sysconfdir/bash_completion.d/kiwi-ng-%{py_ver}.sh
%{python2_sitelib}/*
%config %_sysconfdir/bash_completion.d/kiwi-ng-2*.sh
%files -n python3-kiwi
%defattr(-,root,root,-)
%{_bindir}/kiwi-ng-3*
%{_bindir}/kiwicompat-3*
%ghost %{_bindir}/kiwi
%ghost %{_bindir}/kiwicompat
%ghost %_sysconfdir/alternatives/kiwi
%ghost %_sysconfdir/alternatives/kiwicompat
%{python3_sitelib}/*
%config %_sysconfdir/bash_completion.d/kiwi-ng-3*.sh
%files -n kiwi-man-pages
%defattr(-, root, root)

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:b04812a71c32f7d7d870f27d488bcf3e02c74fc5a3f6fb9a90062157297071c2
size 2933953
oid sha256:6c49bd1db1c79c01969e92039a1398201d22600969efe8ee3fd0969b90d2d026
size 2949691