Ticket #553: bcfg2_rpmbuild.2.diff

File bcfg2_rpmbuild.2.diff, 12.7 KB (added by [email protected]…, 15 years ago)

Revised diff. This one doesn't delete the misc/ directory and also significantly revises the .spec file, borrowing heavily from the "official" Redhat .spec file

  • redhat/RELEASE

     
     10.1 
  • redhat/VERSION

     
     10.9.6 
  • redhat/PACKAGE

     
     1bcfg2 
  • redhat/bcfg2.spec

     
     1Name:           %{_package} 
     2Version:        %{_version} 
     3Release:        %{_release} 
     4 
     5%define __python python 
     6%{!?py_ver: %define py_ver %(python -c 'import sys;print(sys.version[0:3])')} 
     7%define pythonversion %{py_ver} 
     8%{!?python_sitelib: %define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")} 
     9%{!?_initrddir: %define _initrddir %{_sysconfdir}/rc.d/init.d} 
     10 
     11# Most rpm-based distributions include the lxml package a 'python-lxml', 
     12# but some distributions and some people who roll their own lxml packages 
     13# call it just 'lxml'. We'll try to catch both. 
     14%define dfl_lxml python-lxml 
     15%define alt_lxml lxml 
     16%define lxmldep %(rpm -q %{alt_lxml} 2>&1 > /dev/null && echo %{alt_lxml} || echo %{dfl_lxml}) 
     17 
     18Summary:          Configuration management system 
     19Group:            Applications/System 
     20License:          BSD 
     21URL:              http://trac.mcs.anl.gov/projects/bcfg2 
     22Source0:          %{name}-%{version}-%{release}.tar.gz 
     23BuildRoot:        %{_builddir}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) 
     24 
     25BuildArch:        noarch 
     26 
     27%if 0%{?fedora} >= 8 
     28BuildRequires: python-setuptools-devel 
     29%else 
     30BuildRequires: python-setuptools 
     31%endif 
     32 
     33Requires:         %{lxmldep} >= 0.9 
     34Requires(post):   /sbin/chkconfig 
     35Requires(preun):  /sbin/chkconfig 
     36Requires(preun):  /sbin/service 
     37Requires(postun): /sbin/service 
     38 
     39 
     40%description 
     41Bcfg2 helps system administrators produce a consistent, reproducible, 
     42and verifiable description of their environment, and offers 
     43visualization and reporting tools to aid in day-to-day administrative 
     44tasks. It is the fifth generation of configuration management tools 
     45developed in the Mathematics and Computer Science Division of Argonne 
     46National Laboratory. 
     47 
     48It is based on an operational model in which the specification can be 
     49used to validate and optionally change the state of clients, but in a 
     50feature unique to bcfg2 the client's response to the specification can 
     51also be used to assess the completeness of the specification. Using 
     52this feature, bcfg2 provides an objective measure of how good a job an 
     53administrator has done in specifying the configuration of client 
     54systems. Bcfg2 is therefore built to help administrators construct an 
     55accurate, comprehensive specification. 
     56 
     57Bcfg2 has been designed from the ground up to support gentle 
     58reconciliation between the specification and current client states. It 
     59is designed to gracefully cope with manual system modifications. 
     60 
     61Finally, due to the rapid pace of updates on modern networks, client 
     62systems are constantly changing; if required in your environment, 
     63Bcfg2 can enable the construction of complex change management and 
     64deployment strategies. 
     65 
     66%package server 
     67Summary:          Configuration management server 
     68Group:            System Environment/Daemons 
     69Requires:         bcfg2 = %{version}-%{release} 
     70Requires:         /usr/sbin/sendmail 
     71Requires:         /usr/bin/openssl 
     72Requires:         gamin-python 
     73Requires:         redhat-lsb 
     74Requires:         python-genshi 
     75Requires:         python-cheetah 
     76Requires(post):   /sbin/chkconfig 
     77Requires(preun):  /sbin/chkconfig 
     78Requires(preun):  /sbin/service 
     79Requires(postun): /sbin/service 
     80 
     81%description server 
     82Configuration management server 
     83 
     84%prep 
     85%setup -q -n %{name}-%{version}-%{release} 
     86 
     87# fixup some paths 
     88%{__perl} -pi -e '[email protected]/etc/[email protected]%{_sysconfdir}/[email protected]' debian/buildsys/common/bcfg2.init 
     89%{__perl} -pi -e '[email protected]/etc/[email protected]%{_sysconfdir}/[email protected]' tools/bcfg2-cron 
     90 
     91%{__perl} -pi -e '[email protected]/usr/lib/[email protected]%{_libexecdir}@g' debian/bcfg2.cron.daily 
     92%{__perl} -pi -e '[email protected]/usr/lib/[email protected]%{_libexecdir}@g' debian/bcfg2.cron.hourly 
     93 
     94# don't start servers by default 
     95%{__perl} -pi -e '[email protected]: (\d+)@chkconfig: [email protected]' debian/buildsys/common/bcfg2.init 
     96%{__perl} -pi -e '[email protected]: (\d+)@chkconfig: [email protected]' debian/buildsys/common/bcfg2-server.init 
     97 
     98# get rid of extraneous shebangs 
     99for f in `find src/lib -name \*.py` 
     100do 
     101        %{__sed} -i -e '/^#!/,1d' $f 
     102done 
     103 
     104%build 
     105%{__python} -c 'import setuptools; execfile("setup.py")' build 
     106 
     107 
     108%install 
     109rm -rf %{buildroot} 
     110%{__python} -c 'import setuptools; execfile("setup.py")' install --skip-build --root %{buildroot} 
     111 
     112mkdir -p %{buildroot}%{_sbindir} 
     113mkdir -p %{buildroot}%{_initrddir} 
     114mkdir -p %{buildroot}%{_sysconfdir}/cron.daily 
     115mkdir -p %{buildroot}%{_sysconfdir}/cron.hourly 
     116mkdir -p %{buildroot}%{_sysconfdir}/sysconfig 
     117mkdir -p %{buildroot}%{_libexecdir} 
     118mkdir -p %{buildroot}%{_var}/lib/bcfg2 
     119mkdir -p %{buildroot}%{_var}/cache/bcfg2 
     120 
     121mv %{buildroot}%{_bindir}/bcfg2* %{buildroot}%{_sbindir} 
     122 
     123install -m 755 debian/buildsys/common/bcfg2.init %{buildroot}%{_initrddir}/bcfg2 
     124install -m 755 debian/buildsys/common/bcfg2-server.init %{buildroot}%{_initrddir}/bcfg2-server 
     125install -m 755 debian/bcfg2.cron.daily %{buildroot}%{_sysconfdir}/cron.daily/bcfg2 
     126install -m 755 debian/bcfg2.cron.hourly %{buildroot}%{_sysconfdir}/cron.hourly/bcfg2 
     127install -m 755 tools/bcfg2-cron %{buildroot}%{_libexecdir}/bcfg2-cron 
     128 
     129install -m 644 debian/bcfg2.default %{buildroot}%{_sysconfdir}/sysconfig/bcfg2 
     130 
     131touch %{buildroot}%{_sysconfdir}/bcfg2.conf 
     132touch %{buildroot}%{_sysconfdir}/bcfg2.key 
     133 
     134%clean 
     135rm -rf %{buildroot} 
     136 
     137%post 
     138/sbin/chkconfig --add bcfg2 
     139 
     140%preun 
     141if [ $1 = 0 ]; then 
     142        /sbin/service bcfg2 stop >/dev/null 2>&1 || : 
     143        /sbin/chkconfig --del bcfg2 
     144fi 
     145 
     146%postun 
     147if [ "$1" -ge "1" ]; then 
     148        /sbin/service bcfg2 condrestart >/dev/null 2>&1 || : 
     149fi 
     150 
     151%post server 
     152/sbin/chkconfig --add bcfg2-server 
     153 
     154%preun server 
     155if [ $1 = 0 ]; then 
     156        /sbin/service bcfg2-server stop >/dev/null 2>&1 || : 
     157        /sbin/chkconfig --del bcfg2-server 
     158fi 
     159 
     160%postun server 
     161if [ "$1" -ge "1" ]; then 
     162        /sbin/service bcfg2-server condrestart >/dev/null 2>&1 || : 
     163fi 
     164 
     165%files 
     166%defattr(-,root,root,-) 
     167%doc AUTHORS examples COPYRIGHT README 
     168 
     169%ghost %attr(600,root,root) %config(noreplace) %{_sysconfdir}/bcfg2.conf 
     170 
     171%config(noreplace) %{_sysconfdir}/sysconfig/bcfg2 
     172%{_sysconfdir}/cron.daily/bcfg2 
     173%{_sysconfdir}/cron.hourly/bcfg2 
     174 
     175%{_initrddir}/bcfg2 
     176 
     177%{python_sitelib}/Bcfg2*.egg-info 
     178%dir %{python_sitelib}/Bcfg2 
     179%{python_sitelib}/Bcfg2/__init__.* 
     180%{python_sitelib}/Bcfg2/Client 
     181%{python_sitelib}/Bcfg2/Component.* 
     182%{python_sitelib}/Bcfg2/Daemon.* 
     183%{python_sitelib}/Bcfg2/Logging.* 
     184%{python_sitelib}/Bcfg2/Options.* 
     185%{python_sitelib}/Bcfg2/Proxy.* 
     186%{python_sitelib}/Bcfg2/tlslite 
     187 
     188%{_sbindir}/bcfg2 
     189%{_mandir}/man1/bcfg2.1* 
     190%{_mandir}/man5/bcfg2.conf.5* 
     191 
     192%{_libexecdir}/bcfg2-cron 
     193 
     194%dir %{_var}/cache/bcfg2 
     195 
     196 
     197%files server 
     198%defattr(-,root,root,-) 
     199 
     200%ghost %attr(600,root,root) %config(noreplace) %{_sysconfdir}/bcfg2.key 
     201 
     202%{_initrddir}/bcfg2-server 
     203 
     204%{python_sitelib}/Bcfg2/Server 
     205 
     206%{_datadir}/bcfg2 
     207 
     208%{_sbindir}/bcfg2-admin 
     209%{_sbindir}/bcfg2-build-reports 
     210%{_sbindir}/bcfg2-info 
     211%{_sbindir}/bcfg2-ping-sweep 
     212%{_sbindir}/bcfg2-repo-validate 
     213%{_sbindir}/bcfg2-remote 
     214%{_sbindir}/bcfg2-server 
     215 
     216%{_mandir}/man8/bcfg2-admin.8* 
     217%{_mandir}/man8/bcfg2-build-reports.8* 
     218%{_mandir}/man8/bcfg2-info.8* 
     219%{_mandir}/man8/bcfg2-repo-validate.8* 
     220%{_mandir}/man8/bcfg2-remote.8* 
     221%{_mandir}/man8/bcfg2-server.8* 
     222 
     223%dir %{_var}/lib/bcfg2 
     224 
     225%changelog 
     226* Thu May 08 2008 Robin Bowes <[email protected]> 0.9.6-0.1 
     227- Revised spec file to build directly from svn checkout using Makefile 
     228- copied lots of stuff from the "official" spec file 
     229 
     230* Fri Feb 2 2007 Mike Brady <[email protected]> 0.9.1 
     231- Removed use of _libdir due to Red Hat x86_64 issue. 
     232 
     233* Fri Dec 22 2006 Jeffrey C. Ollie <[email protected]> - 0.8.7.1-5 
     234- Server needs client library files too so put them in main package 
     235 
     236* Wed Dec 20 2006 Jeffrey C. Ollie <[email protected]> - 0.8.7.1-4 
     237- Yes, actually we need to require openssl 
     238 
     239* Wed Dec 20 2006 Jeffrey C. Ollie <[email protected]> - 0.8.7.1-3 
     240- Don't generate SSL cert in post script, it only needs to be done on 
     241  the server and is handled by the bcfg2-admin tool. 
     242- Move the /etc/bcfg2.key file to the server package 
     243- Don't install a sample copy of the config file, just ghost it 
     244- Require gamin-python for the server package 
     245- Don't require openssl 
     246- Make the client a separate package so you don't have to have the 
     247  client if you don't want it 
     248 
     249* Wed Dec 20 2006 Jeffrey C. Ollie <[email protected]> - 0.8.7.1-2 
     250- Add more documentation 
     251 
     252* Mon Dec 18 2006 Jeffrey C. Ollie <[email protected]> - 0.8.7.1-1 
     253- First version for Fedora Extras 
     254 
     255* Fri Sep 15 2006 Narayan Desai <[email protected]> - 0.8.4-1 
     256- Initial log 
     257 
  • redhat/Makefile

     
     1# -- generic Makefile for building RPM-based packages out of source 
     2#    code control systems (git, cvs, svn) 
     3# 
     4# $Id: Makefile 46 2007-10-24 09:14:12Z robin $ 
     5 
     6SCM_TYPE := svn 
     7SCM_PATH := ../ 
     8#CVSROOT := $(shell cat 2>/dev/null src/CVS/Root) 
     9SVN_PATH := $(shell svn info ${SCM_PATH} 2>/dev/null | awk '/^URL:/{print $$2}') 
     10SVN_REV := $(shell svn info ${SVN_PATH} 2>/dev/null | awk '/^Last Changed Rev:/{print $$4}') 
     11 
     12PACKAGE := $(shell cat PACKAGE) 
     13VERSION := $(shell cat VERSION) 
     14RELEASE := $(shell cat RELEASE)r${SVN_REV} 
     15BASE_VER := ${VERSION}-${RELEASE} 
     16CURRENT_PACKAGE := $(PACKAGE)-$(BASE_VER) 
     17TARBALL := $(CURRENT_PACKAGE).tar 
     18 
     19DIRNAME := $(shell echo $${PWD}) 
     20DIRBASE := $(shell basename $${PWD}) 
     21 
     22 
     23.SUFFIXES: 
     24.PHONY: clean mrclean distclean prepclean all default 
     25.PHONY: rpm rpmdist buildrpm buildrpmdist 
     26.PHONY: buildtarball buildtargz 
     27.PHONY: builddir distdir prepbuildtarball 
     28.PHONY: cvs-export git-export svn-export test-export 
     29.PHONY: cvs-clean git-clean svn-clean test-clean 
     30 
     31default: rpmdist 
     32 
     33# -- the "rpmdist" target will build out of the SCM, but will 
     34#    use the user's default build settings (which in many cases 
     35#    is exposed as an RPM repository) 
     36# 
     37#rpmdist: buildrpmdist distclean 
     38rpmdist: buildrpmdist 
     39 
     40buildrpmdist: buildtargz 
     41        @rpmbuild \ 
     42          --define "_package ${PACKAGE}" \ 
     43          --define "_version ${VERSION}" \ 
     44          --define "_release ${RELEASE}" \ 
     45          -ta ./build/$(TARBALL).gz 
     46 
     47# -- the "rpm" target will build out of the SCM, but will leave 
     48#    the resulting package in the relative ./build/ directory 
     49# 
     50rpm: buildrpm $(SCM_TYPE)-clean 
     51 
     52buildrpm: buildtargz 
     53        @rpmbuild \ 
     54          --define "_rpmdir ./build/" \ 
     55          --define "_sourcedir ./build/" \ 
     56          --define "_srcrpmdir ./build/" \ 
     57          --define "_package ${PACKAGE}" \ 
     58          --define "_version ${VERSION}" \ 
     59          --define "_release ${RELEASE}" \ 
     60          -ta ./build/$(TARBALL).gz 
     61 
     62buildtarball: prepbuildtarball 
     63        @tar \ 
     64          --create \ 
     65          --directory ./build/ \ 
     66          --file      ./build/$(TARBALL) \ 
     67          ${CURRENT_PACKAGE} 
     68 
     69buildtargz: buildtarball 
     70        @gzip -c < ./build/$(TARBALL) > ./build/$(TARBALL).gz 
     71 
     72prepbuildtarball: $(SCM_TYPE)-export 
     73        cp ${PACKAGE}.spec ./build/${CURRENT_PACKAGE} \ 
     74          && echo cp files/* ./build/ 
     75 
     76test-clean: 
     77        @cd .. \ 
     78          && rm "$(CURRENT_PACKAGE)" 
     79 
     80test-export: builddir 
     81        @cd .. \ 
     82          && ln -snvf $(DIRBASE) $(CURRENT_PACKAGE) \ 
     83          && tar \ 
     84            --create \ 
     85            --dereference \ 
     86            --to-stdout \ 
     87            --exclude "*.git*" \ 
     88            --exclude "*.svn*" \ 
     89            --exclude "*/CVS/*" \ 
     90            --exclude "$(CURRENT_PACKAGE)/build/*" \ 
     91              $(CURRENT_PACKAGE) \ 
     92          | tar \ 
     93            --extract \ 
     94            --directory $(CURRENT_PACKAGE)/build/ \ 
     95            --file - 
     96 
     97git-export: builddir prepclean 
     98        @git-tar-tree HEAD $(PACKAGE)-$(VERSION) \ 
     99          | tar \ 
     100            --extract \ 
     101            --directory ./build/ \ 
     102            --file - 
     103 
     104git-clean: 
     105        @: 
     106 
     107cvs-export: builddir prepclean 
     108        @cd ./build/ \ 
     109          && echo CURRENT_PACKAGE: ${CURRENT_PACKAGE} \ 
     110          && echo CVSROOT: ${CVSROOT} \ 
     111          && CVSROOT=${CVSROOT} cvs export -r HEAD -d$(CURRENT_PACKAGE) ${PACKAGE} 
     112 
     113cvs-clean: 
     114        @: 
     115 
     116svn-export: builddir prepclean 
     117        @cd ./build/ \ 
     118          && svn export $(SVN_PATH) $(CURRENT_PACKAGE) 
     119 
     120svn-clean: 
     121        @: 
     122 
     123builddir: 
     124        @mkdir -p ./build 
     125 
     126distdir: 
     127        @mkdir -p ./dist 
     128 
     129prepclean: 
     130        @rm -rf ./build/$(CURRENT_PACKAGE)* 
     131 
     132clean: 
     133        @rm -rf ./build/* ./dist/* 2>/dev/null || : 
     134 
     135mrclean: clean 
     136 
     137distclean: clean $(SCM_TYPE)-clean 
     138        @rmdir ./build/ ./dist/ 2>/dev/null || :