%global name_upstream swidGenerator %if 0%{?fedora} || 0%{?rhel} > 7 %global python %{__python3} %global python_sitelib %{python3_sitelib} %global python_prefix python3 %else # RHEL 7 %global python %{__python} %global python_prefix python %endif %global commit 0d0941d261925cc01638e88df748c0f2c4395131 %global shortcommit %(c=%{commit}; echo ${c:0:7}) Name: swid_generator Version: 1.0.3 Release: 3.git%{shortcommit}%{?dist} Summary: SWID Tags generator Group: System Environment/Base License: MIT URL: https://github.com/strongswan/%{name_upstream} Source0: https://github.com/strongswan/%{name_upstream}/archive/v%{version}.tar.gz#/%{name_upstream}-%{version}.tar.gz # The upstream repository contains tests/ subdirectory with huge docker # rpm. Since we do not run tests in build time, bloating the .src.rpm # can be avoided with # gunzip swidGenerator-1.0.3.tar.gz # tar --delete -vf swidGenerator-1.0.3.tar swidGenerator-1.0.3/tests # gzip swidGenerator-1.0.3.tar Patch1: %{url}/compare/v%{version}...%{commit}.diff#/%{name}-%{version}-%{commit}.patch # Tweak the retrieved patch, remove all diffs that deal with tests/ directory. BuildArch: noarch Requires: %{python_prefix}-%{name}-libs = %{version}-%{release} BuildRequires: %{python_prefix}-devel BuildRequires: %{python_prefix}-setuptools # for building man page BuildRequires: python-sphinx %description A small application which generates SWID Tags from Linux package managers like dpkg, rpm or pacman. %package -n %{python_prefix}-%{name}-libs Summary: Python library for %{name} %description -n %{python_prefix}-%{name}-libs Python library to generate SWID Tags from Linux package managers like dpkg, rpm or pacman. %prep %setup -q -n %{name_upstream}-%{version} %patch1 -p1 %build CFLAGS="$RPM_OPT_FLAGS" %{python} setup.py build cd docs make man cd .. %install CFLAGS="$RPM_OPT_FLAGS" %{python} setup.py install --skip-build --root $RPM_BUILD_ROOT mkdir -p $RPM_BUILD_ROOT/%{_mandir}/man1/ install -m 644 -p docs/_build/man/%{name}.1 $RPM_BUILD_ROOT/%{_mandir}/man1/ %files %{_bindir}/%{name} %doc %{_mandir}/man1/* %doc README.rst %files -n %{python_prefix}-swid_generator-libs %{python_sitelib}/%{name} %{python_sitelib}/%{name}-%{version}-*.egg-info %changelog * Thu Aug 16 2018 Jan Pazdziora - 1.0.3-3 - Patch to current master (0d0941d261925cc01638e88df748c0f2c4395131). * Tue May 22 2018 Jan Pazdziora - 1.0.3-2 - Rebase to 1.0.3. * Sun Sep 14 2014 Šimon Lukašík - 0.3.0-1 - First attempt to package swid_generator to rpm