This repository has been archived on 2023-02-21. You can view files and clone it, but cannot push or open issues or pull requests.
polynum/rpm/centos.spec

122 lines
3.6 KiB
RPMSpec

# preparation :
# $ yum install git
# $ mkdir -p ~/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
# $ echo '%_topdir %(echo $HOME)/rpmbuild' >> ~/.rpmmacros
# $ echo | gzip -c > ~/rpmbuild/SOURCES/polynum-0.0.tar.gz # create a first tar.gz (fake)
# $ cd ~/dev && git clone git://repos.entrouvert.org/polynum.git
# $ ln -s ~/dev/polynum/rpm/centos.spec ~/rpmbuild/SPECS/polynum.spec
# $ rpmbuild -ba ~/rpmbuild/SPECS/polynum.spec
#
# git macros
#
# from http://wiki.mandriva.com/en/Rpmbuild_and_git#First-time_build_for_a_project
%define git_repo polynum
%define git_head master
%define git_repodir %(echo ~/dev/)
%define git_gitdir %{git_repodir}/%{git_repo}/.git
%define git_get_source pushd %{git_repodir}/%{git_repo} ;\
/usr/bin/git archive --format=tar --prefix=%{name}-%{version}/ %{git_head} | \
gzip -c > %{_sourcedir}/%{name}-%{version}.tar.gz ;\
popd
%define git_clone_source if [ -d %{name}-%{version} ] ; then \
cd %{name}-%{version} && git pull origin %{git_head} ; \
else \
git clone %{git_gitdir} %{name}-%{version} && \
cd %{name}-%{version}/ ; \
fi
%define git_submodule git submodule
%define git_prep_submodules %{git_submodule} init --cloned && %{git_submodule} update
# if the git repo has tags
%define git_get_ver %(git --git-dir=%{git_gitdir} describe --tags | sed 's/^v\\?\\(.*\\)-\\([0-9]\\+\\)-g.*$/\\1/;s/-//')
%define git_get_rel %(git --git-dir=%{git_gitdir} describe --tags | grep '\\-g.\\+$' | sed 's/^v\\?\\(.*\\)-\\([0-9]\\+\\)-g.*$/\\2/')
# wtf... we don't want .pyo and .pyc files
%define __os_install_post echo "NO COMPRESS"
#
# real spec starts here
#
# Header Stanza begins here
Summary: Polycopiés numériques
Name: polynum
Version: 0.0
Release: 1
License: AGPLv3+
Group: Applications/Internet
URL: http://dev.entrouvert.org/projects/polynum
Source0: %{name}-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
BuildArch: noarch
# depends
Requires: python26
Requires: python26-virtualenv
Requires: python26-ldap
Requires(post): chkconfig
Requires(preun): chkconfig
# This is for /sbin/service
Requires(preun): initscripts
%description
Polynum (polycopiés numériques) est une application web pour demander
l'impression de polycopiés via l'ENT. Elle propose des options de diffusion
afin de mettre à disposition en ligne les polycopiés pour les étudiants.
%prep
%git_get_source
%setup -q
%build
%install
%{__rm} -rf %{buildroot}
make DESTDIR=%{buildroot} install
%{__mkdir} -p %{buildroot}/%{_sysconfdir}/%{name}
%{__mkdir} -p %{buildroot}/%{_sysconfdir}/default
%{__mkdir} -p %{buildroot}/%{_sysconfdir}/init.d
%{__install} -m 644 debian/polynum.default %{buildroot}/%{_sysconfdir}/default/%{name}
%{__install} -m 755 debian/init.d %{buildroot}/%{_sysconfdir}/init.d/%{name}
%clean
%files
# set perms and ownerships of packaged files
# the - indicates that the current permissions on the files should be used
%defattr(-,root,root)
%doc help local_settings.py.example gunicorn_config.py.example README
%config(noreplace) %{_sysconfdir}/default/%{name}
/opt/polynum/*
/etc/init.d/*
%{_sysconfdir}/%{name}
%post
# This adds the proper /etc/rc*.d links for the script
/sbin/chkconfig --add polynum
%preun
# 'if [ $1 -eq 0 ] ' checks that this is the actual deinstallation of the
# package, as opposed to just removing the old package on upgrade. These
# statements stop the service, and remove the /etc/rc*.d links.
if [ $1 -eq 0 ] ; then
/sbin/service polynum stop # >/dev/null 2>&1
/sbin/chkconfig --del polynum
fi
%changelog
* Tue Jul 24 2012 Thomas NOEL <tnoel@entrouvert.com> 0.0-1
- create spec file