Update RPM spec and make targets. (#27712)

This commit is contained in:
Matt Clay 2017-08-03 12:35:37 -07:00 committed by GitHub
parent 96784160b1
commit b54d00f2de
2 changed files with 26 additions and 12 deletions

View file

@ -93,6 +93,10 @@ RPMRELEASE = $(RELEASE)
ifneq ($(OFFICIAL),yes) ifneq ($(OFFICIAL),yes)
RPMRELEASE = 100.git$(DATE)$(GITINFO) RPMRELEASE = 100.git$(DATE)$(GITINFO)
endif endif
ifeq ($(PUBLISH),nightly)
# https://fedoraproject.org/wiki/Packaging:Versioning#Snapshots
RPMRELEASE = $(RELEASE).$(DATE)git.$(GIT_HASH)
endif
RPMNVR = "$(NAME)-$(VERSION)-$(RPMRELEASE)$(RPMDIST)" RPMNVR = "$(NAME)-$(VERSION)-$(RPMRELEASE)$(RPMDIST)"
# MOCK build parameters # MOCK build parameters
@ -201,17 +205,17 @@ sdist_upload: clean docs
rpmcommon: sdist rpmcommon: sdist
@mkdir -p rpm-build @mkdir -p rpm-build
@cp dist/*.gz rpm-build/ @cp dist/*.gz rpm-build/
@sed -e 's#^Version:.*#Version: $(VERSION)#' -e 's#^Release:.*#Release: $(RPMRELEASE)%{?dist}#' $(RPMSPEC) >rpm-build/$(NAME).spec @sed -e 's#^Version:.*#Version: $(VERSION)#' -e 's#^Release:.*#Release: $(RPMRELEASE)%{?dist}$(REPOTAG)#' $(RPMSPEC) >rpm-build/$(NAME).spec
mock-srpm: /etc/mock/$(MOCK_CFG).cfg rpmcommon mock-srpm: /etc/mock/$(MOCK_CFG).cfg rpmcommon
$(MOCK_BIN) -r $(MOCK_CFG) --resultdir rpm-build/ --buildsrpm --spec rpm-build/$(NAME).spec --sources rpm-build/ $(MOCK_BIN) -r $(MOCK_CFG) $(MOCK_ARGS) --resultdir rpm-build/ --buildsrpm --spec rpm-build/$(NAME).spec --sources rpm-build/
@echo "#############################################" @echo "#############################################"
@echo "Ansible SRPM is built:" @echo "Ansible SRPM is built:"
@echo rpm-build/*.src.rpm @echo rpm-build/*.src.rpm
@echo "#############################################" @echo "#############################################"
mock-rpm: /etc/mock/$(MOCK_CFG).cfg mock-srpm mock-rpm: /etc/mock/$(MOCK_CFG).cfg mock-srpm
$(MOCK_BIN) -r $(MOCK_CFG) --resultdir rpm-build/ --rebuild rpm-build/$(NAME)-*.src.rpm $(MOCK_BIN) -r $(MOCK_CFG) $(MOCK_ARGS) --resultdir rpm-build/ --rebuild rpm-build/$(NAME)-*.src.rpm
@echo "#############################################" @echo "#############################################"
@echo "Ansible RPM is built:" @echo "Ansible RPM is built:"
@echo rpm-build/*.noarch.rpm @echo rpm-build/*.noarch.rpm

View file

@ -10,11 +10,11 @@ Version: %{ansible_version}
Release: 1%{?dist} Release: 1%{?dist}
Url: https://www.ansible.com Url: https://www.ansible.com
Summary: SSH-based application deployment, configuration management, and IT orchestration platform Summary: SSH-based application deployment, configuration management, and IT orchestration platform
License: GPLv3 License: GPLv3+
Group: Development/Libraries Group: Development/Libraries
Source: http://releases.ansible.com/ansible/%{name}-%{version}.tar.gz Source: http://releases.ansible.com/ansible/%{name}-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")} %{!?python_sitelib: %global python_sitelib %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
BuildArch: noarch BuildArch: noarch
@ -33,7 +33,12 @@ Requires: python26-six
# RHEL == 6 # RHEL == 6
%if 0%{?rhel} == 6 %if 0%{?rhel} == 6
Requires: python-crypto2.6 Requires: python-crypto
%endif
# RHEL >=7
%if 0%{?rhel} >= 7
Requires: python2-cryptography
%endif %endif
# RHEL > 5 # RHEL > 5
@ -43,8 +48,6 @@ BuildRequires: python-setuptools
Requires: PyYAML Requires: PyYAML
Requires: python-paramiko Requires: python-paramiko
Requires: python-jinja2 Requires: python-jinja2
Requires: python-keyczar
Requires: python-httplib2
Requires: python-setuptools Requires: python-setuptools
Requires: python-six Requires: python-six
%endif %endif
@ -89,10 +92,16 @@ are transferred to managed machines automatically.
%setup -q %setup -q
%build %build
%{__python} setup.py build %{__python2} setup.py build
%install %install
%{__python} setup.py install -O1 --prefix=%{_prefix} --root=%{buildroot} %{__python2} setup.py install --root=%{buildroot}
for i in %{buildroot}/%{_bindir}/{ansible,ansible-console,ansible-doc,ansible-galaxy,ansible-playbook,ansible-pull,ansible-vault}; do
mv $i $i-%{python2_version}
ln -s %{_bindir}/$(basename $i)-%{python2_version} $i
ln -s %{_bindir}/$(basename $i)-%{python2_version} $i-2
done
# Amazon Linux doesn't install to dist-packages but python_sitelib expands to # Amazon Linux doesn't install to dist-packages but python_sitelib expands to
# that location and the python interpreter expects things to be there. # that location and the python interpreter expects things to be there.
@ -105,6 +114,7 @@ if expr x'%{python_sitelib}' : 'x.*dist-packages/\?' ; then
fi fi
mkdir -p %{buildroot}/etc/ansible/ mkdir -p %{buildroot}/etc/ansible/
mkdir -p %{buildroot}/etc/ansible/roles/
cp examples/hosts %{buildroot}/etc/ansible/ cp examples/hosts %{buildroot}/etc/ansible/
cp examples/ansible.cfg %{buildroot}/etc/ansible/ cp examples/ansible.cfg %{buildroot}/etc/ansible/
mkdir -p %{buildroot}/%{_mandir}/man1/ mkdir -p %{buildroot}/%{_mandir}/man1/
@ -120,7 +130,7 @@ rm -rf %{buildroot}
%{_bindir}/ansible* %{_bindir}/ansible*
%dir %{_datadir}/ansible %dir %{_datadir}/ansible
%config(noreplace) %{_sysconfdir}/ansible %config(noreplace) %{_sysconfdir}/ansible
%doc README.md PKG-INFO COPYING %doc README.md PKG-INFO COPYING CHANGELOG.md
%doc %{_mandir}/man1/ansible* %doc %{_mandir}/man1/ansible*
%changelog %changelog