summaryrefslogtreecommitdiffstats
path: root/misc
diff options
context:
space:
mode:
authorChris St. Pierre <chris.a.st.pierre@gmail.com>2013-10-28 09:22:16 -0400
committerChris St. Pierre <chris.a.st.pierre@gmail.com>2013-10-28 09:22:16 -0400
commitcde36fc9d16b7e8722d1baf7648970baca6fbdda (patch)
tree9499b545a6878aa8c1096d7c7faea82e95d8138c /misc
parent0f02b2c5eb52cebd918953b9f10689c5c9577d1d (diff)
downloadbcfg2-cde36fc9d16b7e8722d1baf7648970baca6fbdda.tar.gz
bcfg2-cde36fc9d16b7e8722d1baf7648970baca6fbdda.tar.bz2
bcfg2-cde36fc9d16b7e8722d1baf7648970baca6fbdda.zip
specfile: backported merge w/ Fedora specfile to 1.3
Diffstat (limited to 'misc')
-rw-r--r--misc/bcfg2.spec658
1 files changed, 478 insertions, 180 deletions
diff --git a/misc/bcfg2.spec b/misc/bcfg2.spec
index 66c0c8de1..9cf91d16a 100644
--- a/misc/bcfg2.spec
+++ b/misc/bcfg2.spec
@@ -1,13 +1,31 @@
-%global __python python
-%{!?py_ver: %global py_ver %(%{__python} -c 'import sys;print(sys.version[0:3])')}
-%global pythonversion %{py_ver}
-%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
+# Fedora 13+ and EL6 contain these macros already; only needed for EL5
+%if 0%{?rhel} && 0%{?rhel} <= 5
+%global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")
+%define python_version %(%{__python} -c 'import sys;print(sys.version[0:3])')
+%endif
+
+# openSUSE macro translation
+%if 0%{?suse_version}
+%global python_version %{py_ver}
%{!?_initrddir: %global _initrddir %{_sysconfdir}/rc.d/init.d}
+# openSUSE < 11.2
+%if %{suse_version} < 1120
+%global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")
+%endif
+%endif
+
+# For -pre or -rc releases, remove the initial <hash><percent>
+# characters from the appropriate line below.
+#
+# Don't forget to change the Release: tag below to something like 0.1
+#%%global _rc 1
+#%%global _pre 2
+%global _pre_rc %{?_pre:.pre%{_pre}}%{?_rc:.rc%{_rc}}
Name: bcfg2
Version: 1.3.2
-Release: 1
-Summary: Configuration management system
+Release: 2%{?_pre_rc}%{?dist}
+Summary: A configuration management system
%if 0%{?suse_version}
# http://en.opensuse.org/openSUSE:Package_group_guidelines
@@ -18,11 +36,55 @@ Group: Applications/System
License: BSD
URL: http://bcfg2.org
Source0: ftp://ftp.mcs.anl.gov/pub/bcfg/%{name}-%{version}.tar.gz
+# Used in %%check
+Source1: http://www.w3.org/2001/XMLSchema.xsd
+%if %{?rhel}%{!?rhel:10} <= 5 || 0%{?suse_version}
+# EL5 and OpenSUSE require the BuildRoot tag
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
+%endif
BuildArch: noarch
+BuildRequires: python
BuildRequires: python-devel
BuildRequires: python-lxml
+BuildRequires: python-boto
+%if 0%{?suse_version}
+BuildRequires: python-M2Crypto
+BuildRequires: python-Genshi
+BuildRequires: python-gamin
+BuildRequires: python-pyinotify
+BuildRequires: python-python-daemon
+BuildRequires: python-CherryPy >= 3
+%else # ! suse_version
+BuildRequires: python-daemon
+BuildRequires: python-inotify
+%if "%{_vendor}" == "redhat" && 0%{!?rhel:1} && 0%{!?fedora:1}
+# by default, el5 doesn't have the %%rhel macro, provided by this
+# package; EPEL build servers install buildsys-macros by default, but
+# explicitly requiring this may help builds in other environments
+BuildRequires: buildsys-macros
+%else # vendor != redhat || rhel defined
+%if 0%{?rhel} && 0%{?rhel} < 6
+BuildRequires: python-ssl
+%else # rhel > 5
+# EL5 lacks python-mock, so test suite is disabled
+BuildRequires: python-sqlalchemy
+BuildRequires: python-nose
+BuildRequires: mock
+BuildRequires: m2crypto
+BuildRequires: Django
+BuildRequires: PyYAML
+BuildRequires: python-genshi
+BuildRequires: python-cheetah
+BuildRequires: pylibacl
+BuildRequires: libselinux-python
+BuildRequires: python-pep8
+BuildRequires: python-cherrypy >= 3
+BuildRequires: python-mock
+BuildRequires: pylint
+%endif # rhel > 5
+%endif # vendor != redhat || rhel defined
+%endif # ! suse_version
%if 0%{?mandriva_version}
# mandriva seems to behave differently than other distros and needs
@@ -40,23 +102,42 @@ BuildRequires: libsane1
# a different package name in EPEL.
%if "%{_vendor}" == "redhat" && 0%{?rhel} <= 6 && 0%{?fedora} == 0
BuildRequires: python-sphinx10
-# the python-sphinx10 package doesn't set sys.path correctly, so we
-# have to do it for them
+# python-sphinx10 doesn't set sys.path correctly; do it for them
%global pythonpath %(find %{python_sitelib} -name Sphinx*.egg)
%else
BuildRequires: python-sphinx >= 1.0
%endif
+BuildRequires: python-docutils
-%if 0%{?rhel_version}
-# the debian init script needs redhat-lsb.
-# iff we switch to the redhat one, this might not be needed anymore.
-Requires: redhat-lsb
+%if 0%{?fedora} >= 16
+BuildRequires: systemd-units
%endif
+
+Requires: python-lxml
+Requires: m2crypto
+%if 0%{?rhel} && 0%{?rhel} < 6
+Requires: python-ssl
+%endif
+Requires: pylibacl
+Requires: libselinux-python
+
+%if 0%{?fedora} >= 16
+Requires(post): systemd-units
+Requires(preun): systemd-units
+Requires(postun): systemd-units
+%else
+Requires(post): /sbin/chkconfig
+Requires(preun): /sbin/chkconfig
+Requires(preun): /sbin/service
+Requires(postun): /sbin/service
+%endif
+
%if "%{_vendor}" != "redhat"
# fedora and rhel (and possibly other distros) do not know this tag.
Recommends: cron
%endif
+
%description
Bcfg2 helps system administrators produce a consistent, reproducible,
and verifiable description of their environment, and offers
@@ -86,17 +167,13 @@ deployment strategies.
This package includes the Bcfg2 client software.
%package server
-Version: 1.3.2
Summary: Bcfg2 Server
%if 0%{?suse_version}
Group: System/Management
%else
-Group: System Tools
-%endif
-Requires: bcfg2 = %{version}
-%if "%{py_ver}" < "2.6"
-Requires: python-ssl
+Group: System Environment/Daemons
%endif
+Requires: bcfg2 = %{version}-%{release}
Requires: python-lxml >= 1.2.1
%if 0%{?suse_version}
Requires: python-pyinotify
@@ -107,7 +184,26 @@ Requires: python-daemon
%endif
Requires: /usr/sbin/sendmail
Requires: /usr/bin/openssl
+Requires: python-genshi
+Requires: python-cheetah
+Requires: graphviz
Requires: python-nose
+Requires: PyYAML
+
+%if %{_vendor} == redhat
+%if 0%{?fedora} >= 16
+Requires(post): systemd-units
+Requires(preun): systemd-units
+Requires(postun): systemd-units
+Requires(post): systemd-sysv
+%else
+Requires(post): /sbin/chkconfig
+Requires(preun): /sbin/chkconfig
+Requires(preun): /sbin/service
+Requires(postun): /sbin/service
+%endif
+%endif
+
%description server
Bcfg2 helps system administrators produce a consistent, reproducible,
@@ -138,15 +234,14 @@ deployment strategies.
This package includes the Bcfg2 server software.
%package server-cherrypy
-Version: 1.3.2
Summary: Bcfg2 Server - CherryPy backend
%if 0%{?suse_version}
Group: System/Management
%else
-Group: System Tools
+Group: System Environment/Daemons
%endif
-Requires: bcfg2 = %{version}
-Requires: bcfg2-server = %{version}
+Requires: bcfg2 = %{version}-%{release}
+Requires: bcfg2-server = %{version}-%{release}
# cherrypy 3.3 actually doesn't exist yet, but 3.2 has bugs that
# prevent it from working:
@@ -181,36 +276,67 @@ deployment strategies.
This package includes the Bcfg2 CherryPy server backend.
-%package doc
-Summary: Configuration management system documentation
+%package web
+Summary: Bcfg2 Web Reporting Interface
+
%if 0%{?suse_version}
-Group: Documentation/HTML
+Group: System/Management
+Requires: python-django >= 1.2
+Requires: python-django-south >= 0.7
%else
-Group: Documentation
+Group: System Tools
+Requires: Django >= 1.2
+Requires: Django-south >= 0.7
+Requires: bcfg2-server
%endif
-BuildRequires: python-boto
-%if 0%{?suse_version}
-BuildRequires: python-M2Crypto
-BuildRequires: python-Genshi
-BuildRequires: python-gamin
-BuildRequires: python-pyinotify
-BuildRequires: python-python-daemon
-BuildRequires: python-CherryPy >= 3
+Requires: httpd
+%if "%{_vendor}" == "redhat"
+Requires: mod_wsgi
+%global apache_conf %{_sysconfdir}/httpd
%else
-BuildRequires: m2crypto
-BuildRequires: python-genshi
-BuildRequires: gamin-python
-BuildRequires: python-inotify
-BuildRequires: python-daemon
+Requires: apache2-mod_wsgi
+%global apache_conf %{_sysconfdir}/apache2
%endif
-%if "%{_vendor}" == "redhat" && 0%{?rhel} < 6 && 0%{?fedora} == 0
-BuildRequires: python-ssl
+
+%description web
+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.
+
+This package includes the Bcfg2 reports web frontend.
+
+
+%package doc
+Summary: Documentation for Bcfg2
+%if 0%{?suse_version}
+Group: Documentation/HTML
%else
-BuildRequires: python-cherrypy >= 3
-BuildRequires: python-mock
+Group: Documentation
%endif
+
%description doc
Bcfg2 helps system administrators produce a consistent, reproducible,
and verifiable description of their environment, and offers
@@ -239,26 +365,13 @@ deployment strategies.
This package includes the Bcfg2 documentation.
-%package web
-Version: 1.3.2
-Summary: Bcfg2 Web Reporting Interface
-%if 0%{?suse_version}
-Group: System/Management
-Requires: httpd,python-django >= 1.2,python-django-south >= 0.7
-%else
-Group: System Tools
-Requires: httpd,Django >= 1.2,Django-south >= 0.7
-%endif
-Requires: bcfg2-server
-%if "%{_vendor}" == "redhat"
-Requires: mod_wsgi
-%global apache_conf %{_sysconfdir}/httpd
-%else
-Requires: apache2-mod_wsgi
-%global apache_conf %{_sysconfdir}/apache2
-%endif
-%description web
+%package examples
+Summary: Examples for Bcfg2
+Group: Documentation
+
+
+%description examples
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
@@ -284,199 +397,384 @@ systems are constantly changing; if required in your environment,
Bcfg2 can enable the construction of complex change management and
deployment strategies.
-This package includes the Bcfg2 reports web frontend.
+This package includes the examples files for Bcfg2.
+
%prep
-%setup -q -n %{name}-%{version}
+%setup -q -n %{name}-%{version}%{?_pre_rc}
-%build
-%{__python}%{pythonversion} setup.py build
+# The pylint and pep8 unit tests fail on RH-derivative distros
+%if "%{_vendor}" == "redhat"
+mv testsuite/Testsrc/test_code_checks.py \
+ testsuite/Testsrc/test_code_checks.py.disable_unit_tests
+awk '
+ BEGIN {line=0}
+ /class Test(Pylint|PEP8)/ {line=FNR+1}
+ FNR==line {sub("True","False")}
+ {print $0}
+ ' testsuite/Testsrc/test_code_checks.py.disable_unit_tests \
+ > testsuite/Testsrc/test_code_checks.py
+%endif
+
+# Fixup some paths
+%{__perl} -pi -e 's@/etc/default@%{_sysconfdir}/sysconfig@g' tools/bcfg2-cron
-%{?pythonpath: export PYTHONPATH="%{pythonpath}"}
-%{__python}%{pythonversion} setup.py build_sphinx
+%{__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
+
+# Get rid of extraneous shebangs
+for f in `find src/lib -name \*.py`
+do
+ sed -i -e '/^#!/,1d' $f
+done
sed -i "s/apache2/httpd/g" misc/apache/bcfg2.conf
+
+%build
+%{__python} setup.py build
+%{?pythonpath: PYTHONPATH="%{pythonpath}"} \
+ %{__python} setup.py build_sphinx
+
+
%install
+%if 0%{?rhel} == 5 || 0%{?suse_version}
+# EL5 and OpenSUSE require the buildroot to be cleaned manually
rm -rf %{buildroot}
-%{__python}%{pythonversion} setup.py install --root=%{buildroot} --record=INSTALLED_FILES --prefix=/usr
-%{__install} -d %{buildroot}%{_bindir}
-%{__install} -d %{buildroot}%{_sbindir}
-%{__install} -d %{buildroot}%{_initrddir}
-%{__install} -d %{buildroot}%{_sysconfdir}/default
-%{__install} -d %{buildroot}%{_sysconfdir}/cron.daily
-%{__install} -d %{buildroot}%{_sysconfdir}/cron.hourly
-%{__install} -d %{buildroot}%{_prefix}/lib/bcfg2
-mkdir -p %{buildroot}%{_defaultdocdir}/bcfg2-doc-%{version}
-mkdir -p %{buildroot}%{_defaultdocdir}/bcfg2-server-%{version}
+%endif
+
+%{__python} setup.py install -O1 --skip-build --root=%{buildroot} --prefix=/usr
+install -d %{buildroot}%{_bindir}
+install -d %{buildroot}%{_sbindir}
+install -d %{buildroot}%{_initrddir}
+install -d %{buildroot}%{_sysconfdir}/cron.daily
+install -d %{buildroot}%{_sysconfdir}/cron.hourly
+install -d %{buildroot}%{_sysconfdir}/sysconfig
+install -d %{buildroot}%{_libexecdir}
+install -d %{buildroot}%{_localstatedir}/cache/%{name}
+install -d %{buildroot}%{_localstatedir}/lib/%{name}
%if 0%{?suse_version}
-%{__install} -d %{buildroot}/var/adm/fillup-templates
-%endif
-
-%{__mv} %{buildroot}%{_bindir}/bcfg2* %{buildroot}%{_sbindir}
-%{__install} -m 755 debian/bcfg2.init %{buildroot}%{_initrddir}/bcfg2
-%{__install} -m 755 debian/bcfg2-server.init %{buildroot}%{_initrddir}/bcfg2-server
-%{__install} -m 755 debian/bcfg2-server.bcfg2-report-collector.init %{buildroot}%{_initrddir}/bcfg2-report-collector
-%{__install} -m 755 debian/bcfg2.default %{buildroot}%{_sysconfdir}/default/bcfg2
-%{__install} -m 755 debian/bcfg2-server.default %{buildroot}%{_sysconfdir}/default/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}%{_prefix}/lib/bcfg2/bcfg2-cron
+install -d %{buildroot}/var/adm/fillup-templates
+%endif
+
+mv %{buildroot}%{_bindir}/bcfg2* %{buildroot}%{_sbindir}
+
+%if 0%{?fedora} < 16
+# Install SysV init scripts for everyone but new Fedoras
+install -m 755 redhat/scripts/bcfg2.init \
+ %{buildroot}%{_initrddir}/bcfg2
+install -m 755 redhat/scripts/bcfg2-server.init \
+ %{buildroot}%{_initrddir}/bcfg2-server
+install -m 755 redhat/scripts/bcfg2-report-collector.init \
+ %{buildroot}%{_initrddir}/bcfg2-report-collector
+%endif
+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
+install -m 644 debian/bcfg2-server.default \
+ %{buildroot}%{_sysconfdir}/sysconfig/bcfg2-server
%if 0%{?suse_version}
-%{__install} -m 755 debian/bcfg2.default %{buildroot}/var/adm/fillup-templates/sysconfig.bcfg2
-%{__install} -m 755 debian/bcfg2-server.default %{buildroot}/var/adm/fillup-templates/sysconfig.bcfg2-server
+install -m 755 debian/bcfg2.default \
+ %{buildroot}/var/adm/fillup-templates/sysconfig.bcfg2
+install -m 755 debian/bcfg2-server.default \
+ %{buildroot}/var/adm/fillup-templates/sysconfig.bcfg2-server
ln -s %{_initrddir}/bcfg2 %{buildroot}%{_sbindir}/rcbcfg2
ln -s %{_initrddir}/bcfg2-server %{buildroot}%{_sbindir}/rcbcfg2-server
%endif
-cp -r tools/* %{buildroot}%{_defaultdocdir}/bcfg2-server-%{version}
-cp -r build/sphinx/html/* %{buildroot}%{_defaultdocdir}/bcfg2-doc-%{version}
+touch %{buildroot}%{_sysconfdir}/%{name}.{cert,conf,key}
-%{__install} -d %{buildroot}%{apache_conf}/conf.d
-%{__install} -m 644 misc/apache/bcfg2.conf %{buildroot}%{apache_conf}/conf.d/wsgi_bcfg2.conf
+# systemd
+install -d %{buildroot}%{_unitdir}
+install -p -m 644 redhat/systemd/%{name}.service \
+ %{buildroot}%{_unitdir}/%{name}.service
+install -p -m 644 redhat/systemd/%{name}-server.service \
+ %{buildroot}%{_unitdir}/%{name}-server.service
-%{__mkdir_p} %{buildroot}%{_localstatedir}/cache/%{name}
-%{__mkdir_p} %{buildroot}%{_localstatedir}/lib/%{name}
+# Webserver
+install -d %{buildroot}%{apache_conf}/conf.d
+install -p -m 644 misc/apache/bcfg2.conf \
+ %{buildroot}%{apache_conf}/conf.d/wsgi_bcfg2.conf
-# mandriva and RHEL 5 cannot handle %ghost without the file existing,
+# mandriva cannot handle %ghost without the file existing,
# so let's touch a bunch of empty config files
-touch %{buildroot}%{_sysconfdir}/bcfg2.conf \
- %{buildroot}%{_sysconfdir}/bcfg2-web.conf
+touch %{buildroot}%{_sysconfdir}/bcfg2.conf
+%if 0%{?rhel} == 5
+# Required for EL5
%clean
-[ "%{buildroot}" != "/" ] && %{__rm} -rf %{buildroot} || exit 2
+rm -rf %{buildroot}
+%endif
+
+
+%if 0%{?rhel} != 5
+# EL5 lacks python-mock, so test suite is disabled
+%check
+# Downloads not allowed in koji; fix .xsd urls to point to local files
+sed -i "s@schema_url = .*\$@schema_url = 'file://`pwd`/`basename %{SOURCE1}`'@" \
+ testsuite/Testschema/test_schema.py
+sed "s@http://www.w3.org/2001/xml.xsd@file://$(pwd)/schemas/xml.xsd@" \
+ %{SOURCE1} > `basename %{SOURCE1}`
+%{__python} setup.py test
+%endif
+
+
+%post
+%if 0%{?fedora} >= 18
+ %systemd_post bcfg2.service
+%else
+ if [ $1 -eq 1 ] ; then
+ # Initial installation
+ %if 0%{?suse_version}
+ %fillup_and_insserv -f bcfg2
+ %else %if 0%{?fedora} >= 16
+ /bin/systemctl daemon-reload >/dev/null 2>&1 || :
+ %else
+ /sbin/chkconfig --add bcfg2
+ %endif %endif
+ fi
+%endif
+
+%post server
+%if 0%{?fedora} >= 18
+ %systemd_post bcfg2-server.service
+%else
+ if [ $1 -eq 1 ] ; then
+ # Initial installation
+ %if 0%{?suse_version}
+ %fillup_and_insserv -f bcfg2-server
+ %else %if 0%{?fedora} >= 16
+ /bin/systemctl daemon-reload >/dev/null 2>&1 || :
+ %else
+ /sbin/chkconfig --add bcfg2-server
+ %endif %endif
+ fi
+%endif
+
+%preun
+%if 0%{?fedora} >= 18
+ %systemd_preun bcfg2.service
+%else
+ if [ $1 -eq 0 ]; then
+ # Package removal, not upgrade
+ %if 0%{?suse_version}
+ %stop_on_removal bcfg2
+ %else %if 0%{?fedora} >= 16
+ /bin/systemctl --no-reload disable bcfg2.service > /dev/null 2>&1 || :
+ /bin/systemctl stop bcfg2.service > /dev/null 2>&1 || :
+ %else
+ /sbin/service bcfg2 stop &>/dev/null || :
+ /sbin/chkconfig --del bcfg2
+ %endif %endif
+ fi
+%endif
+
+%preun server
+%if 0%{?fedora} >= 18
+ %systemd_preun bcfg2-server.service
+%else
+ if [ $1 -eq 0 ]; then
+ # Package removal, not upgrade
+ %if 0%{?suse_version}
+ %stop_on_removal bcfg2-server
+ %stop_on_removal bcfg2-report-collector
+ %else %if 0%{?fedora} >= 16
+ /bin/systemctl --no-reload disable bcfg2-server.service > /dev/null 2>&1 || :
+ /bin/systemctl stop bcfg2-server.service > /dev/null 2>&1 || :
+ %else
+ /sbin/service bcfg2-server stop &>/dev/null || :
+ /sbin/chkconfig --del bcfg2-server
+ %endif %endif
+ fi
+%endif
+
+%postun
+%if 0%{?fedora} >= 18
+ %systemd_postun bcfg2.service
+%else
+ %if 0%{?fedora} >= 16
+ /bin/systemctl daemon-reload >/dev/null 2>&1 || :
+ %endif
+ if [ $1 -ge 1 ] ; then
+ # Package upgrade, not uninstall
+ %if 0%{?suse_version}
+ %insserv_cleanup
+ %else %if 0%{?fedora} >= 16
+ /bin/systemctl try-restart bcfg2.service >/dev/null 2>&1 || :
+ %else
+ /sbin/service bcfg2 condrestart &>/dev/null || :
+ %endif %endif
+ fi
+%endif
+
+%postun server
+%if 0%{?fedora} >= 18
+ %systemd_postun bcfg2-server.service
+%else
+ %if 0%{?fedora} >= 16
+ /bin/systemctl daemon-reload >/dev/null 2>&1 || :
+ %endif
+ if [ $1 -ge 1 ] ; then
+ # Package upgrade, not uninstall
+ %if 0%{?fedora} >= 16
+ /bin/systemctl try-restart bcfg2-server.service >/dev/null 2>&1 || :
+ %else
+ /sbin/service bcfg2-server condrestart &>/dev/null || :
+ %endif
+ fi
+ %if 0%{?suse_version}
+ if [ $1 -eq 0 ]; then
+ # clean up on removal.
+ %insserv_cleanup
+ fi
+ %endif
+%endif
+
+%if 0%{?fedora} || 0%{?rhel}
+%triggerun -- bcfg2 < 1.2.1-1
+/usr/bin/systemd-sysv-convert --save bcfg2 >/dev/null 2>&1 || :
+/bin/systemctl --no-reload enable bcfg2.service >/dev/null 2>&1 || :
+/sbin/chkconfig --del bcfg2 >/dev/null 2>&1 || :
+/bin/systemctl try-restart bcfg2.service >/dev/null 2>&1 || :
+
+%triggerun server -- bcfg2-server < 1.2.1-1
+/usr/bin/systemd-sysv-convert --save bcfg2-server >/dev/null 2>&1 || :
+/bin/systemctl --no-reload enable bcfg2-server.service >/dev/null 2>&1 || :
+/sbin/chkconfig --del bcfg2-server >/dev/null 2>&1 || :
+/bin/systemctl try-restart bcfg2-server.service >/dev/null 2>&1 || :
+%endif
+
%files
+%if 0%{?rhel} == 5 || 0%{?suse_version}
+# Required for EL5 and OpenSUSE
%defattr(-,root,root,-)
+%endif
+%doc COPYRIGHT LICENSE README
+%{_mandir}/man1/bcfg2.1*
+%{_mandir}/man5/bcfg2.conf.5*
+%ghost %attr(600,root,root) %config(noreplace,missingok) %{_sysconfdir}/bcfg2.cert
+%ghost %attr(0600,root,root) %config(noreplace,missingok) %{_sysconfdir}/bcfg2.conf
+%if 0%{?fedora} >= 16
+ %config(noreplace) %{_unitdir}/%{name}.service
+%else
+ %{_initrddir}/bcfg2
+%endif
+%if 0%{?fedora} || 0%{?rhel}
+%config(noreplace) %{_sysconfdir}/sysconfig/bcfg2
+%else
+%config(noreplace) %{_sysconfdir}/default/bcfg2
+%endif
+%{_sysconfdir}/cron.daily/bcfg2
+%{_sysconfdir}/cron.hourly/bcfg2
%{_sbindir}/bcfg2
+%{_libexecdir}/bcfg2-cron
+%dir %{_localstatedir}/cache/%{name}
+%{python_sitelib}/Bcfg2*.egg-info
%dir %{python_sitelib}/Bcfg2
-%{python_sitelib}/Bcfg2/Compat.py*
%{python_sitelib}/Bcfg2/__init__.py*
+%{python_sitelib}/Bcfg2/Client
+%{python_sitelib}/Bcfg2/Compat.py*
%{python_sitelib}/Bcfg2/Logger.py*
%{python_sitelib}/Bcfg2/Options.py*
%{python_sitelib}/Bcfg2/Proxy.py*
%{python_sitelib}/Bcfg2/Utils.py*
%{python_sitelib}/Bcfg2/version.py*
-%{python_sitelib}/Bcfg2/Client
-%{_mandir}/man1/bcfg2.1*
-%{_mandir}/man5/bcfg2.conf.5*
-%{_initrddir}/bcfg2
-%config(noreplace) %{_sysconfdir}/default/bcfg2
-%{_sysconfdir}/cron.hourly/bcfg2
-%{_sysconfdir}/cron.daily/bcfg2
-%{_prefix}/lib/bcfg2/bcfg2-cron
-%{_localstatedir}/cache/%{name}
-%{_localstatedir}/lib/%{name}
%if 0%{?suse_version}
%{_sbindir}/rcbcfg2
%config(noreplace) /var/adm/fillup-templates/sysconfig.bcfg2
%endif
-%ghost %config(noreplace,missingok) %attr(0600,root,root) %{_sysconfdir}/bcfg2.conf
%files server
+%if 0%{?rhel} == 5 || 0%{?suse_version}
%defattr(-,root,root,-)
-%{_initrddir}/bcfg2-server
-%{_initrddir}/bcfg2-report-collector
-%dir %{python_sitelib}/Bcfg2
+%endif
+%ghost %attr(600,root,root) %config(noreplace) %{_sysconfdir}/bcfg2.key
+%if 0%{?fedora} >= 16
+ %config(noreplace) %{_unitdir}/%{name}-server.service
+%else
+ %{_initrddir}/bcfg2-server
+ %{_initrddir}/bcfg2-report-collector
+%endif
+%config(noreplace) %{_sysconfdir}/sysconfig/bcfg2-server
+%{_sbindir}/bcfg2-*
+%dir %{_localstatedir}/lib/%{name}
%{python_sitelib}/Bcfg2/Cache.py*
%{python_sitelib}/Bcfg2/Encryption.py*
%{python_sitelib}/Bcfg2/SSLServer.py*
%{python_sitelib}/Bcfg2/Statistics.py*
-%{python_sitelib}/Bcfg2/manage.py*
%{python_sitelib}/Bcfg2/settings.py*
%{python_sitelib}/Bcfg2/Server
%{python_sitelib}/Bcfg2/Reporting
+%{python_sitelib}/Bcfg2/manage.py*
%exclude %{python_sitelib}/Bcfg2/Server/CherryPyCore.py
-%{python_sitelib}/*egg-info
-
%dir %{_datadir}/bcfg2
-%{_datadir}/bcfg2/Hostbase
%{_datadir}/bcfg2/schemas
%{_datadir}/bcfg2/xsl-transforms
-%config(noreplace) %{_sysconfdir}/default/bcfg2-server
-%{_sbindir}/bcfg2-admin
-%{_sbindir}/bcfg2-build-reports
-%{_sbindir}/bcfg2-crypt
-%{_sbindir}/bcfg2-info
-%{_sbindir}/bcfg2-lint
-%{_sbindir}/bcfg2-repo-validate
-%{_sbindir}/bcfg2-reports
-%{_sbindir}/bcfg2-report-collector
-%{_sbindir}/bcfg2-server
-%{_sbindir}/bcfg2-yum-helper
-%{_sbindir}/bcfg2-test
+%{_datadir}/bcfg2/Hostbase
%if 0%{?suse_version}
%{_sbindir}/rcbcfg2-server
%config(noreplace) /var/adm/fillup-templates/sysconfig.bcfg2-server
%endif
%{_mandir}/man5/bcfg2-lint.conf.5*
-%{_mandir}/man8/*.8*
-%dir %{_prefix}/lib/bcfg2
-%ghost %config(noreplace,missingok) %attr(0600,root,root) %{_sysconfdir}/bcfg2.conf
+%{_mandir}/man8/bcfg2*.8*
-%doc %{_defaultdocdir}/bcfg2-server-%{version}
+%doc tools/*
%files server-cherrypy
+%if 0%{?rhel} == 5 || 0%{?suse_version}
%defattr(-,root,root,-)
+%endif
%{python_sitelib}/Bcfg2/Server/CherryPyCore.py
-%files doc
-%defattr(-,root,root,-)
-%doc %{_defaultdocdir}/bcfg2-doc-%{version}
-
%files web
+%if 0%{?rhel} == 5 || 0%{?suse_version}
%defattr(-,root,root,-)
+%endif
%{_datadir}/bcfg2/reports.wsgi
%{_datadir}/bcfg2/site_media
-%dir %{apache_conf}
-%dir %{apache_conf}/conf.d
%config(noreplace) %{apache_conf}/conf.d/wsgi_bcfg2.conf
-%ghost %config(noreplace,missingok) %attr(0640,root,apache) %{_sysconfdir}/bcfg2-web.conf
-
-%post server
-# enable daemon on first install only (not on update).
-if [ $1 -eq 1 ]; then
-%if 0%{?suse_version}
- %fillup_and_insserv -f bcfg2-server
-%else
- /sbin/chkconfig --add bcfg2-server
-%endif
-fi
-
-%preun
-%if 0%{?suse_version}
-# stop on removal (not on update).
-if [ $1 -eq 0 ]; then
- %stop_on_removal bcfg2
-fi
-%endif
-%preun server
-%if 0%{?suse_version}
-if [ $1 -eq 0 ]; then
- %stop_on_removal bcfg2-server
- %stop_on_removal bcfg2-report-collector
-fi
+%files doc
+%if 0%{?rhel} == 5 || 0%{?suse_version}
+%defattr(-,root,root,-)
%endif
+%doc build/sphinx/html/*
-%postun
-%if 0%{?suse_version}
-if [ $1 -eq 0 ]; then
- %insserv_cleanup
-fi
+%files examples
+%if 0%{?rhel} == 5 || 0%{?suse_version}
+%defattr(-,root,root,-)
%endif
+%doc examples/*
-%postun server
-%if 0%{?suse_version}
-if [ $1 -eq 0 ]; then
- # clean up on removal.
- %insserv_cleanup
-fi
-%endif
%changelog
+* Sun Aug 04 2013 John Morris <john@zultron.com> - 1.3.2-2
+- Reconcile divergences with Fedora specfile, as requested by upstream
+ (equally large changes made in Fedora version to reconcile with
+ this file)
+- Python macro cleanups
+- Accommodations for OpenSUSE
+- Macros for pre and rc releases
+- %%check section
+- Move BRs to top of file
+- Rearrange lines to match Fedora
+- Group: tag tweaks
+- Startup/shutdown changes
+- Separate examples package
+- Remove %%{__install} macros; RH has backed away from those
+- Add fedora systemd units, both f16 and f18 variants :P
+ - Changes to %%post* scripts
+- Rearrange %%files sections
+
* Mon Jul 01 2013 Sol Jerome <sol.jerome@gmail.com> 1.3.2-1
- New upstream release