Skip to content
Snippets Groups Projects
Commit 0395f413 authored by Thomas Woerner's avatar Thomas Woerner
Browse files

New script utils/build-srpm.sh to build SRPM

This script gets version and release from git describe --tags. It uses
utils/ansible-freeipa.spec.in and the variables to generate
ansible-freeipa.spec in the top folder.

An archive not including the spec file is created to generate the SRPM from.
parent 33db6537
No related branches found
No related tags found
No related merge requests found
# Turn off automatic python byte compilation because these are Ansible
# roles and the files are transferred to the node and compiled there with
# the python version used in the node
%define __brp_python_bytecompile %{nil}
Summary: Roles and playbooks to deploy FreeIPA servers, replicas and clients
Name: ansible-freeipa
Version: @@VERSION@@
Release: @@RELEASE@@%{?dist}
URL: https://github.com/freeipa/ansible-freeipa
License: GPLv3+
Source: %{name}-%{version}-@@RELEASE@@.tar.bz2
BuildArch: noarch
%description
ansible-freeipa provides Ansible roles and playbooks to install and uninstall
FreeIPA servers, replicas and clients. Also modules for group, host, topology
and user management.
Note: The ansible playbooks and roles require a configured ansible environment
where the ansible nodes are reachable and are properly set up to have an IP
address and a working package manager.
%package tests
Summary: ansible-freeipa tests
Requires: %{name}
%description tests
%prep
%setup -q -n ansible-freeipa-%{version}-@@RELEASE@@
# Do not create backup files with patches
# Fix python modules and module utils:
# - Remove shebang
# - Remove execute flag
for i in roles/ipa*/library/*.py roles/ipa*/module_utils/*.py plugins/*/*.py; do
sed -i '1{/\/usr\/bin\/python*/d;}' $i
chmod a-x $i
done
# Add execute flag to py3test.py scripts
chmod a+x roles/ipa*/files/py3test.py
%build
%install
install -m 755 -d %{buildroot}%{_datadir}/ansible/roles/
cp -rp roles/ipaserver %{buildroot}%{_datadir}/ansible/roles/
cp -rp roles/ipaserver/README.md README-server.md
cp -rp roles/ipareplica %{buildroot}%{_datadir}/ansible/roles/
cp -rp roles/ipareplica/README.md README-replica.md
cp -rp roles/ipaclient %{buildroot}%{_datadir}/ansible/roles/
cp -rp roles/ipaclient/README.md README-client.md
install -m 755 -d %{buildroot}%{_datadir}/ansible/plugins/
cp -rp plugins/* %{buildroot}%{_datadir}/ansible/plugins/
install -m 755 -d %{buildroot}%{_datadir}/ansible-freeipa/tests
cp -rp tests %{buildroot}%{_datadir}/ansible-freeipa/
%files
%license COPYING
%{_datadir}/ansible/roles/ipaserver
%{_datadir}/ansible/roles/ipareplica
%{_datadir}/ansible/roles/ipaclient
%{_datadir}/ansible/plugins/module_utils
%{_datadir}/ansible/plugins/modules
%doc README*.md
%doc playbooks
%files tests
%{_datadir}/ansible-freeipa
%changelog
* @@DATE@@ Thomas Woerner <twoerner@redhat.com> - @@VERSION@@-@@RELEASE@@
- GIT version @@VERSION@@-@@RELEASE@@
#!/bin/bash
git_version=$(git describe --tags | sed -e "s/^v//")
version=${git_version%%-*}
release=${git_version#*-}
release=${release//-/_}
date=$(date "+%a %b %e %Y")
topdir=$(dirname $0)
sed -e "s/@@VERSION@@/$version/g" -e "s/@@RELEASE@@/$release/g" -e "s/@@DATE@@/$date/g" $topdir/ansible-freeipa.spec.in > ansible-freeipa.spec
git archive --format=tar --prefix=ansible-freeipa-${version}-${release}/ 'HEAD' | bzip2 -c > ansible-freeipa-${version}-${release}.tar.bz2
rpmbuild --define "_sourcedir $PWD" -bs ansible-freeipa.spec
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment