From 896241a09f8eb1c724d64f17d9ac2539fce375ed Mon Sep 17 00:00:00 2001 From: Narayan Desai Date: Thu, 22 May 2008 19:16:46 +0000 Subject: Improved RPM packaging from Robin Bowes (Resolves Ticket #553) git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@4623 ce84e21b-d406-0410-9b95-82705330c041 --- redhat/Makefile | 138 +++++++++++++++++++++++++++++ redhat/PACKAGE | 1 + redhat/RELEASE | 1 + redhat/VERSION | 1 + redhat/bcfg2.spec | 257 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 398 insertions(+) create mode 100644 redhat/Makefile create mode 100644 redhat/PACKAGE create mode 100644 redhat/RELEASE create mode 100644 redhat/VERSION create mode 100644 redhat/bcfg2.spec (limited to 'redhat') diff --git a/redhat/Makefile b/redhat/Makefile new file mode 100644 index 000000000..8e23f1e56 --- /dev/null +++ b/redhat/Makefile @@ -0,0 +1,138 @@ +# -- generic Makefile for building RPM-based packages out of source +# code control systems (git, cvs, svn) +# +# $Id: Makefile 46 2007-10-24 09:14:12Z robin $ + +SCM_TYPE := svn +SCM_PATH := ../ +#CVSROOT := $(shell cat 2>/dev/null src/CVS/Root) +SVN_PATH := $(shell svn info ${SCM_PATH} 2>/dev/null | awk '/^URL:/{print $$2}') +SVN_REV := $(shell svn info ${SVN_PATH} 2>/dev/null | awk '/^Last Changed Rev:/{print $$4}') + +PACKAGE := $(shell cat PACKAGE) +VERSION := $(shell cat VERSION) +RELEASE := $(shell cat RELEASE)r${SVN_REV} +BASE_VER := ${VERSION}-${RELEASE} +CURRENT_PACKAGE := $(PACKAGE)-$(BASE_VER) +TARBALL := $(CURRENT_PACKAGE).tar + +DIRNAME := $(shell echo $${PWD}) +DIRBASE := $(shell basename $${PWD}) + + +.SUFFIXES: +.PHONY: clean mrclean distclean prepclean all default +.PHONY: rpm rpmdist buildrpm buildrpmdist +.PHONY: buildtarball buildtargz +.PHONY: builddir distdir prepbuildtarball +.PHONY: cvs-export git-export svn-export test-export +.PHONY: cvs-clean git-clean svn-clean test-clean + +default: rpmdist + +# -- the "rpmdist" target will build out of the SCM, but will +# use the user's default build settings (which in many cases +# is exposed as an RPM repository) +# +#rpmdist: buildrpmdist distclean +rpmdist: buildrpmdist + +buildrpmdist: buildtargz + @rpmbuild \ + --define "_package ${PACKAGE}" \ + --define "_version ${VERSION}" \ + --define "_release ${RELEASE}" \ + -ta ./build/$(TARBALL).gz + +# -- the "rpm" target will build out of the SCM, but will leave +# the resulting package in the relative ./build/ directory +# +rpm: buildrpm $(SCM_TYPE)-clean + +buildrpm: buildtargz + @rpmbuild \ + --define "_rpmdir ./build/" \ + --define "_sourcedir ./build/" \ + --define "_srcrpmdir ./build/" \ + --define "_package ${PACKAGE}" \ + --define "_version ${VERSION}" \ + --define "_release ${RELEASE}" \ + -ta ./build/$(TARBALL).gz + +buildtarball: prepbuildtarball + @tar \ + --create \ + --directory ./build/ \ + --file ./build/$(TARBALL) \ + ${CURRENT_PACKAGE} + +buildtargz: buildtarball + @gzip -c < ./build/$(TARBALL) > ./build/$(TARBALL).gz + +prepbuildtarball: $(SCM_TYPE)-export + cp ${PACKAGE}.spec ./build/${CURRENT_PACKAGE} \ + && echo cp files/* ./build/ + +test-clean: + @cd .. \ + && rm "$(CURRENT_PACKAGE)" + +test-export: builddir + @cd .. \ + && ln -snvf $(DIRBASE) $(CURRENT_PACKAGE) \ + && tar \ + --create \ + --dereference \ + --to-stdout \ + --exclude "*.git*" \ + --exclude "*.svn*" \ + --exclude "*/CVS/*" \ + --exclude "$(CURRENT_PACKAGE)/build/*" \ + $(CURRENT_PACKAGE) \ + | tar \ + --extract \ + --directory $(CURRENT_PACKAGE)/build/ \ + --file - + +git-export: builddir prepclean + @git-tar-tree HEAD $(PACKAGE)-$(VERSION) \ + | tar \ + --extract \ + --directory ./build/ \ + --file - + +git-clean: + @: + +cvs-export: builddir prepclean + @cd ./build/ \ + && echo CURRENT_PACKAGE: ${CURRENT_PACKAGE} \ + && echo CVSROOT: ${CVSROOT} \ + && CVSROOT=${CVSROOT} cvs export -r HEAD -d$(CURRENT_PACKAGE) ${PACKAGE} + +cvs-clean: + @: + +svn-export: builddir prepclean + @cd ./build/ \ + && svn export $(SVN_PATH) $(CURRENT_PACKAGE) + +svn-clean: + @: + +builddir: + @mkdir -p ./build + +distdir: + @mkdir -p ./dist + +prepclean: + @rm -rf ./build/$(CURRENT_PACKAGE)* + +clean: + @rm -rf ./build/* ./dist/* 2>/dev/null || : + +mrclean: clean + +distclean: clean $(SCM_TYPE)-clean + @rmdir ./build/ ./dist/ 2>/dev/null || : diff --git a/redhat/PACKAGE b/redhat/PACKAGE new file mode 100644 index 000000000..5b418ae6b --- /dev/null +++ b/redhat/PACKAGE @@ -0,0 +1 @@ +bcfg2 diff --git a/redhat/RELEASE b/redhat/RELEASE new file mode 100644 index 000000000..49d59571f --- /dev/null +++ b/redhat/RELEASE @@ -0,0 +1 @@ +0.1 diff --git a/redhat/VERSION b/redhat/VERSION new file mode 100644 index 000000000..85b7c695b --- /dev/null +++ b/redhat/VERSION @@ -0,0 +1 @@ +0.9.6 diff --git a/redhat/bcfg2.spec b/redhat/bcfg2.spec new file mode 100644 index 000000000..d2ab7be2a --- /dev/null +++ b/redhat/bcfg2.spec @@ -0,0 +1,257 @@ +Name: %{_package} +Version: %{_version} +Release: %{_release} + +%define __python python +%{!?py_ver: %define py_ver %(python -c 'import sys;print(sys.version[0:3])')} +%define pythonversion %{py_ver} +%{!?python_sitelib: %define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")} +%{!?_initrddir: %define _initrddir %{_sysconfdir}/rc.d/init.d} + +# Most rpm-based distributions include the lxml package a 'python-lxml', +# but some distributions and some people who roll their own lxml packages +# call it just 'lxml'. We'll try to catch both. +%define dfl_lxml python-lxml +%define alt_lxml lxml +%define lxmldep %(rpm -q %{alt_lxml} 2>&1 > /dev/null && echo %{alt_lxml} || echo %{dfl_lxml}) + +Summary: Configuration management system +Group: Applications/System +License: BSD +URL: http://trac.mcs.anl.gov/projects/bcfg2 +Source0: %{name}-%{version}-%{release}.tar.gz +BuildRoot: %{_builddir}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) + +BuildArch: noarch + +%if 0%{?fedora} >= 8 +BuildRequires: python-setuptools-devel +%else +BuildRequires: python-setuptools +%endif + +Requires: %{lxmldep} >= 0.9 +Requires(post): /sbin/chkconfig +Requires(preun): /sbin/chkconfig +Requires(preun): /sbin/service +Requires(postun): /sbin/service + + +%description +Bcfg2 helps system administrators produce a consistent, reproducible, +and verifiable description of their environment, and offers +visualization and reporting tools to aid in day-to-day administrative +tasks. It is the fifth generation of configuration management tools +developed in the Mathematics and Computer Science Division of Argonne +National Laboratory. + +It is based on an operational model in which the specification can be +used to validate and optionally change the state of clients, but in a +feature unique to bcfg2 the client's response to the specification can +also be used to assess the completeness of the specification. Using +this feature, bcfg2 provides an objective measure of how good a job an +administrator has done in specifying the configuration of client +systems. Bcfg2 is therefore built to help administrators construct an +accurate, comprehensive specification. + +Bcfg2 has been designed from the ground up to support gentle +reconciliation between the specification and current client states. It +is designed to gracefully cope with manual system modifications. + +Finally, due to the rapid pace of updates on modern networks, client +systems are constantly changing; if required in your environment, +Bcfg2 can enable the construction of complex change management and +deployment strategies. + +%package server +Summary: Configuration management server +Group: System Environment/Daemons +Requires: bcfg2 = %{version}-%{release} +Requires: /usr/sbin/sendmail +Requires: /usr/bin/openssl +Requires: gamin-python +Requires: redhat-lsb +Requires: python-genshi +Requires: python-cheetah +Requires(post): /sbin/chkconfig +Requires(preun): /sbin/chkconfig +Requires(preun): /sbin/service +Requires(postun): /sbin/service + +%description server +Configuration management server + +%prep +%setup -q -n %{name}-%{version}-%{release} + +# fixup some paths +%{__perl} -pi -e 's@/etc/default@%{_sysconfdir}/sysconfig@g' debian/buildsys/common/bcfg2.init +%{__perl} -pi -e 's@/etc/default@%{_sysconfdir}/sysconfig@g' tools/bcfg2-cron + +%{__perl} -pi -e 's@/usr/lib/bcfg2@%{_libexecdir}@g' debian/bcfg2.cron.daily +%{__perl} -pi -e 's@/usr/lib/bcfg2@%{_libexecdir}@g' debian/bcfg2.cron.hourly + +# don't start servers by default +%{__perl} -pi -e 's@chkconfig: (\d+)@chkconfig: -@' debian/buildsys/common/bcfg2.init +%{__perl} -pi -e 's@chkconfig: (\d+)@chkconfig: -@' debian/buildsys/common/bcfg2-server.init + +# get rid of extraneous shebangs +for f in `find src/lib -name \*.py` +do + %{__sed} -i -e '/^#!/,1d' $f +done + +%build +%{__python} -c 'import setuptools; execfile("setup.py")' build + + +%install +rm -rf %{buildroot} +%{__python} -c 'import setuptools; execfile("setup.py")' install --skip-build --root %{buildroot} + +mkdir -p %{buildroot}%{_sbindir} +mkdir -p %{buildroot}%{_initrddir} +mkdir -p %{buildroot}%{_sysconfdir}/cron.daily +mkdir -p %{buildroot}%{_sysconfdir}/cron.hourly +mkdir -p %{buildroot}%{_sysconfdir}/sysconfig +mkdir -p %{buildroot}%{_libexecdir} +mkdir -p %{buildroot}%{_var}/lib/bcfg2 +mkdir -p %{buildroot}%{_var}/cache/bcfg2 + +mv %{buildroot}%{_bindir}/bcfg2* %{buildroot}%{_sbindir} + +install -m 755 debian/buildsys/common/bcfg2.init %{buildroot}%{_initrddir}/bcfg2 +install -m 755 debian/buildsys/common/bcfg2-server.init %{buildroot}%{_initrddir}/bcfg2-server +install -m 755 debian/bcfg2.cron.daily %{buildroot}%{_sysconfdir}/cron.daily/bcfg2 +install -m 755 debian/bcfg2.cron.hourly %{buildroot}%{_sysconfdir}/cron.hourly/bcfg2 +install -m 755 tools/bcfg2-cron %{buildroot}%{_libexecdir}/bcfg2-cron + +install -m 644 debian/bcfg2.default %{buildroot}%{_sysconfdir}/sysconfig/bcfg2 + +touch %{buildroot}%{_sysconfdir}/bcfg2.conf +touch %{buildroot}%{_sysconfdir}/bcfg2.key + +%clean +rm -rf %{buildroot} + +%post +/sbin/chkconfig --add bcfg2 + +%preun +if [ $1 = 0 ]; then + /sbin/service bcfg2 stop >/dev/null 2>&1 || : + /sbin/chkconfig --del bcfg2 +fi + +%postun +if [ "$1" -ge "1" ]; then + /sbin/service bcfg2 condrestart >/dev/null 2>&1 || : +fi + +%post server +/sbin/chkconfig --add bcfg2-server + +%preun server +if [ $1 = 0 ]; then + /sbin/service bcfg2-server stop >/dev/null 2>&1 || : + /sbin/chkconfig --del bcfg2-server +fi + +%postun server +if [ "$1" -ge "1" ]; then + /sbin/service bcfg2-server condrestart >/dev/null 2>&1 || : +fi + +%files +%defattr(-,root,root,-) +%doc AUTHORS examples COPYRIGHT README + +%ghost %attr(600,root,root) %config(noreplace) %{_sysconfdir}/bcfg2.conf + +%config(noreplace) %{_sysconfdir}/sysconfig/bcfg2 +%{_sysconfdir}/cron.daily/bcfg2 +%{_sysconfdir}/cron.hourly/bcfg2 + +%{_initrddir}/bcfg2 + +%{python_sitelib}/Bcfg2*.egg-info +%dir %{python_sitelib}/Bcfg2 +%{python_sitelib}/Bcfg2/__init__.* +%{python_sitelib}/Bcfg2/Client +%{python_sitelib}/Bcfg2/Component.* +%{python_sitelib}/Bcfg2/Daemon.* +%{python_sitelib}/Bcfg2/Logging.* +%{python_sitelib}/Bcfg2/Options.* +%{python_sitelib}/Bcfg2/Proxy.* +%{python_sitelib}/Bcfg2/tlslite + +%{_sbindir}/bcfg2 +%{_mandir}/man1/bcfg2.1* +%{_mandir}/man5/bcfg2.conf.5* + +%{_libexecdir}/bcfg2-cron + +%dir %{_var}/cache/bcfg2 + + +%files server +%defattr(-,root,root,-) + +%ghost %attr(600,root,root) %config(noreplace) %{_sysconfdir}/bcfg2.key + +%{_initrddir}/bcfg2-server + +%{python_sitelib}/Bcfg2/Server + +%{_datadir}/bcfg2 + +%{_sbindir}/bcfg2-admin +%{_sbindir}/bcfg2-build-reports +%{_sbindir}/bcfg2-info +%{_sbindir}/bcfg2-ping-sweep +%{_sbindir}/bcfg2-repo-validate +%{_sbindir}/bcfg2-remote +%{_sbindir}/bcfg2-server + +%{_mandir}/man8/bcfg2-admin.8* +%{_mandir}/man8/bcfg2-build-reports.8* +%{_mandir}/man8/bcfg2-info.8* +%{_mandir}/man8/bcfg2-repo-validate.8* +%{_mandir}/man8/bcfg2-remote.8* +%{_mandir}/man8/bcfg2-server.8* + +%dir %{_var}/lib/bcfg2 + +%changelog +* Thu May 08 2008 Robin Bowes 0.9.6-0.1 +- Revised spec file to build directly from svn checkout using Makefile +- copied lots of stuff from the "official" spec file + +* Fri Feb 2 2007 Mike Brady 0.9.1 +- Removed use of _libdir due to Red Hat x86_64 issue. + +* Fri Dec 22 2006 Jeffrey C. Ollie - 0.8.7.1-5 +- Server needs client library files too so put them in main package + +* Wed Dec 20 2006 Jeffrey C. Ollie - 0.8.7.1-4 +- Yes, actually we need to require openssl + +* Wed Dec 20 2006 Jeffrey C. Ollie - 0.8.7.1-3 +- Don't generate SSL cert in post script, it only needs to be done on + the server and is handled by the bcfg2-admin tool. +- Move the /etc/bcfg2.key file to the server package +- Don't install a sample copy of the config file, just ghost it +- Require gamin-python for the server package +- Don't require openssl +- Make the client a separate package so you don't have to have the + client if you don't want it + +* Wed Dec 20 2006 Jeffrey C. Ollie - 0.8.7.1-2 +- Add more documentation + +* Mon Dec 18 2006 Jeffrey C. Ollie - 0.8.7.1-1 +- First version for Fedora Extras + +* Fri Sep 15 2006 Narayan Desai - 0.8.4-1 +- Initial log + -- cgit v1.2.3-1-g7c22