%undefine __brp_mangle_shebangs %global _build_id_links none # Macros %define file_permissions_user root %define file_permissions_group root %define venv_cmd virtualenv --always-copy --python=python2.7 %define venv_name linchpin %define venv_install_dir /opt/%{venv_name} %define venv_dir %{buildroot}/%{venv_install_dir} %define venv_bin %{venv_dir}/bin %define venv_python %{venv_bin}/python %define venv_pip %{venv_python} %{venv_bin}/pip install %define __prelink_undo_cmd %{nil} # Globals %global __os_install_post %(echo '%{__os_install_post}' | sed -e 's!/usr/lib[^[:space:]]*/brp-python-bytecompile[[:space:]].*$!!g') # Tags Name: linchpin Version: 1.9.2 Release: 2%{?dist} BuildRoot: %(mktemp -ud %{_tmppath}/%{_builddir}/linchpin-1.9.2-%{version}-%{release}-XXXXXX) Requires: git, beaker-client Summary: Ansible based multicloud orchestrator Group: Application/System License: GPLv3+ Url: https://linchpin.readthedocs.io Source0: https://github.com/CentOS-PaaS-SIG/linchpin/archive/v1.9.2.tar.gz AutoReq: No AutoProv: No %{?fc30:Requires: python2-lxml, python2-libvirt} %{?fc31:Requires: python2-lxml, python2-libvirt, python2-libs} %{?rhel7:Requires: python-lxml, libvirt-python} BuildRequires: python2-pip, python2-devel, gcc # Blocks %files %defattr(-,%{file_permissions_user},%{file_permissions_group},-) /usr/bin/linchpin /%{venv_install_dir} %clean rm -rf %{buildroot} %install cp %{_builddir}/linchpin.sh %{_builddir}/linchpin-1.9.2/linchpin.sh export PATH=$PATH:~/.local/bin mkdir -p "%{buildroot}/%(dirname usr/bin/linchpin)" cp -R %{_builddir}/linchpin-1.9.2/linchpin.sh %{buildroot}/usr/bin/linchpin %{venv_cmd} %{venv_dir} cd %{_builddir}/linchpin-1.9.2/ %{venv_pip} -r requirements.txt cd - cd %{_builddir}/linchpin-1.9.2/ %{venv_pip} -r /dev/null 'ansible<2.9.0' cd - cd %{_builddir}/linchpin-1.9.2/ %{venv_python} setup.py install cd - # RECORD files are used by wheels for checksum. They contain path names which # match the buildroot and must be removed or the package will fail to build. find %{buildroot} -name "RECORD" -exec rm -rf {} \; # Change the virtualenv path to the target installation direcotry. venvctrl-relocate --source=%{venv_dir} --destination=/%{venv_install_dir} find %{buildroot} -name "*.pyc" -exec rm -rf {} \; find %{buildroot} -type f -print0 | xargs -0 sed -i "s|${RPM_BUILD_ROOT}||g" unlink %{buildroot}/opt/linchpin/lib64 || true ln -s /opt/linchpin/lib %{buildroot}/opt/linchpin/lib64 || true %post ln -s /opt/linchpin/bin/linchpin /usr/bin/linchpin chown -R %{file_permissions_user}:%{file_permissions_group} /usr/bin/linchpin %prep %setup -q touch %{_builddir}/linchpin.sh chmod +x %{_builddir}/linchpin.sh cat << EOF > %{_builddir}/linchpin.sh #!/bin/bash PATH="\$PATH:/opt/linchpin/bin" PYTHONPATH="/opt/linchpin/lib64/python2.7/site-packages:/usr/lib/python2.7/site-packages:/usr/lib64/python2.7/site-packages" /opt/linchpin/bin/linchpin \$@ EOF pip2 install --user rpmvenv virtualenv==16.1.0 rm -rf %{buildroot}/* mkdir -p %{buildroot}/%{venv_install_dir} %description linchpin is an Ansible-based tool to stand up and tear down resources in various cloud environments