[bitten] Initial package import from SRPM

Tim Niemueller timn at fedoraproject.org
Mon Feb 21 20:57:21 UTC 2011


commit 9f1e9b28ed2334999519caf34ec2af1dd5fcc006
Author: Tim Niemueller <niemueller at kbsg.rwth-aachen.de>
Date:   Mon Feb 21 21:33:55 2011 +0100

    Initial package import from SRPM

 .gitignore                   |    1 +
 Bitten-0.6dev-r777-git.patch |  103 +++++++++++++++++++
 bitten-slave.conf            |   12 +++
 bitten-slave.init            |  108 ++++++++++++++++++++
 bitten-slave.logrotate       |   10 ++
 bitten-slave.sysconf         |   24 +++++
 bitten.spec                  |  225 ++++++++++++++++++++++++++++++++++++++++++
 sources                      |    1 +
 8 files changed, 484 insertions(+), 0 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index e69de29..2111fdb 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1 @@
+/Bitten-0.6b3.tar.gz
diff --git a/Bitten-0.6dev-r777-git.patch b/Bitten-0.6dev-r777-git.patch
new file mode 100644
index 0000000..60c240f
--- /dev/null
+++ b/Bitten-0.6dev-r777-git.patch
@@ -0,0 +1,103 @@
+diff -urN Bitten-0.6dev-r777/bitten/build/gittools.py Bitten-0.6dev-r777.git/bitten/build/gittools.py
+--- Bitten-0.6dev-r777/bitten/build/gittools.py	1970-01-01 01:00:00.000000000 +0100
++++ Bitten-0.6dev-r777.git/bitten/build/gittools.py	2009-10-24 17:03:02.000000000 +0200
+@@ -0,0 +1,77 @@
++# -*- coding: utf-8 -*-
++# Copyright (C) Tim Niemueller [www.niemueller.de]
++# Copyright (C) 2007 Edgewall Software
++# based on hgtools.py
++#
++# This software is licensed as described in the file COPYING, which
++# you should have received as part of this distribution. The terms
++# are also available at http://bitten.edgewall.org/wiki/License.
++
++"""Recipe commands for git."""
++
++import logging
++
++log = logging.getLogger('bitten.build.gittools')
++
++__docformat__ = 'restructuredtext en'
++
++def clone(ctxt, url, dir_='.'):
++    """pull and update the local working copy from the git repository.
++    
++    :param ctxt: the build context
++    :type ctxt: `Context`
++    :param url: the url of the repository to clone
++    :param dir\_: the name of a local subdirectory containing the working copy
++    """
++    args = ['clone', url, dir_]
++
++    from bitten.build import shtools
++    returncode = shtools.execute(ctxt, file_='git', args=args)
++    if returncode != 0:
++        ctxt.error('git clone failed (%s)' % returncode)
++
++def pull(ctxt, revision, remote='origin', dir_='.'):
++    """pull and update the local working copy from the git repository.
++    
++    :param ctxt: the build context
++    :type ctxt: `Context`
++    :param remote: the remote repository to pull from
++    :param dir\_: the name of a local subdirectory containing the working copy
++    """
++    args = ['pull', '-u', remote, revision]
++
++    from bitten.build import shtools
++    returncode = shtools.execute(ctxt, file_='git', dir_=dir_, args=args)
++    if returncode != 0:
++        ctxt.error('git pull failed (%s)' % returncode)
++
++def checkout(ctxt, branch, dir_='.'):
++    """checkout specific branch
++    
++    :param ctxt: the build context
++    :type ctxt: `Context`
++    :param branch: branch to checkout
++    :param dir\_: the name of a local subdirectory containing the working copy
++    """
++    args = ['checkout', branch]
++
++    from bitten.build import shtools
++    returncode = shtools.execute(ctxt, file_='git', dir_=dir_, args=args)
++    if returncode != 0:
++        ctxt.error('git branch failed (%s)' % returncode)
++
++def reset(ctxt, revision, dir_='.'):
++    """reset git tree to given revision/commit
++    
++    :param ctxt: the build context
++    :type ctxt: `Context`
++    :param revision: the revision/commit to reset to
++    :param dir\_: the name of a local subdirectory containing the working copy
++    """
++    args = ['reset', '--hard', revision]
++
++    from bitten.build import shtools
++    returncode = shtools.execute(ctxt, file_='git', dir_=dir_, args=args)
++    if returncode != 0:
++        ctxt.error('git reset failed (%s)' % returncode)
++
+diff -urN Bitten-0.6dev-r777/setup.py Bitten-0.6dev-r777.git/setup.py
+--- Bitten-0.6dev-r777/setup.py	2009-10-16 14:15:34.000000000 +0200
++++ Bitten-0.6dev-r777.git/setup.py	2009-10-24 17:05:22.000000000 +0200
+@@ -55,6 +55,10 @@
+         'svn#export = bitten.build.svntools:export',
+         'svn#update = bitten.build.svntools:update',
+         'hg#pull = bitten.build.hgtools:pull',
++        'git#clone = bitten.build.gittools:clone',
++        'git#pull = bitten.build.gittools:pull',
++        'git#reset = bitten.build.gittools:reset',
++        'git#checkout = bitten.build.gittools:checkout',
+         'xml#transform = bitten.build.xmltools:transform'
+     ]
+ recipe_commands = [NS_old + tool for tool in tools] \
+@@ -133,6 +137,7 @@
+                   "bitten.build.pythontools",
+                   "bitten.build.shtools",
+                   "bitten.build.svntools",
++                  "bitten.build.gittools",
+                   "bitten.build.xmltools",
+                   "bitten.recipe",
+                   "bitten.slave",
diff --git a/bitten-slave.conf b/bitten-slave.conf
new file mode 100644
index 0000000..182ce23
--- /dev/null
+++ b/bitten-slave.conf
@@ -0,0 +1,12 @@
+;[authentication]
+; user/pass for login to Trac
+;username = <user>
+;password = <pass>
+
+[os]
+name = @DISTRO@
+version = @DISTRO_VERSION@
+
+;[package:some-package]
+;version = 2.0
+
diff --git a/bitten-slave.init b/bitten-slave.init
new file mode 100644
index 0000000..08ae214
--- /dev/null
+++ b/bitten-slave.init
@@ -0,0 +1,108 @@
+#!/bin/bash
+#
+# bitten        Continuous integration build slave
+#
+# Author:       Tim Niemueller <tim at niemueller.de>
+#
+# chkconfig:	- 97 03
+#
+# description:  This is a daemon which periodically checks for new \
+#               builds at the bitten master and if available executes \
+#               these builds.
+# processname:  bitten-slave
+# config: /etc/bitten-slave.conf
+# pidfile: /var/run/bitten-slave.pid
+#
+
+### BEGIN INIT INFO
+# Provides: bitten-slave
+# Required-Start: $syslog $local_fs
+# Required-Stop: $syslog $local_fs
+# Default-Stop: 0 1 6
+# Short-Description: Bitten build slave
+# Description: Daemon which executes build as provided by bitten master.
+### END INIT INFO
+
+
+# source function library
+. /etc/rc.d/init.d/functions
+
+# Source sysconfig file
+. /etc/sysconfig/bitten-slave
+
+RETVAL=0
+
+if [ -z "$BITTEN_SLAVE_URLS" ]; then
+	echo -n "Configure Bitten URLs in /etc/sysconfig/bitten-slave"
+	failure 1
+	echo
+	exit 1
+fi
+
+ARGS="-f /etc/bitten-slave.conf --work-dir=$BITTEN_SLAVE_WORKDIR $BITTEN_SLAVE_ARGS $BITTEN_SLAVE_URLS"
+if [ -n "$BITTEN_SLAVE_USER" ]; then
+	DAEMON_ARGS="--user $BITTEN_SLAVE_USER"
+fi
+#echo ARGS: $ARGS
+#echo DAEMON_ARGS: $DAEMON_ARGS
+
+start() {
+        if [ -e /var/lock/subsys/bitten-slave ]; then
+                if [ -n "$(pidofproc bitten-slave)" ]; then
+                        echo "Bitten slave is already running"
+                        return
+                fi
+        fi
+	echo -n $"Starting bitten slave: "
+	if [ ! -d $BITTEN_SLAVE_WORKDIR ]; then
+		mkdir -p $BITTEN_SLAVE_WORKDIR
+		if [ -n "$BITTEN_SLAVE_USER" ]; then
+			chown -R $BITTEN_SLAVE_USER $BITTEN_SLAVE_WORKDIR
+		fi
+	fi
+	if [ ! -f $BITTEN_SLAVE_LOG ]; then
+		touch $BITTEN_SLAVE_LOG
+	fi
+	chown $BITTEN_SLAVE_USER $BITTEN_SLAVE_LOG
+	daemon $DAEMON_ARGS "bitten-slave $ARGS >>$BITTEN_SLAVE_LOG 2>&1 &"
+	RETVAL=$?
+	echo
+	[ $RETVAL -eq 0 ] && touch /var/lock/subsys/bitten-slave
+}
+
+stop() {
+	echo -n $"Stopping bitten-slave: "
+	killproc bitten-slave
+	echo
+	[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/bitten-slave
+}
+
+restart() {
+	stop
+	start
+}
+
+case "$1" in
+  start)
+	start
+	;;
+  stop) 
+	stop
+	;;
+  restart|force-reload|reload)
+	restart
+	;;
+  condrestart|try-restart)
+	[ -f /var/lock/subsys/bitten-slave ] && restart
+	;;
+  status)
+	status bitten-slave
+	RETVAL=$?
+	;;
+  *)
+	echo $"Usage: $0 {start|stop|status|restart|reload|force-reload|condrestart}"
+	exit 1
+esac
+
+exit $RETVAL
+
diff --git a/bitten-slave.logrotate b/bitten-slave.logrotate
new file mode 100644
index 0000000..cc684bb
--- /dev/null
+++ b/bitten-slave.logrotate
@@ -0,0 +1,10 @@
+# Bitten slave config file
+/var/log/bitten-slave.log {
+	notifempty
+	missingok
+	postrotate
+		/sbin/service bitten-slave condrestart 2>/dev/null >/dev/null || :
+	endscript
+	create 644 bitten-slave bitten-slave
+	size 2M
+}
diff --git a/bitten-slave.sysconf b/bitten-slave.sysconf
new file mode 100644
index 0000000..b22c7d9
--- /dev/null
+++ b/bitten-slave.sysconf
@@ -0,0 +1,24 @@
+#
+# Bitten parameter configuration
+#
+
+# URLs to Trac with bitten master
+BITTEN_SLAVE_URLS=
+
+# Arguments:
+# Implicitly set in init script:
+# -f /etc/bitten-slave.conf --build-dir=/var/lib/bitten-slave
+# Additionally useful:
+# --form-auth  login using AccountManager HTML form instead of
+#              HTTP authentication for all urls
+BITTEN_SLAVE_ARGS=--form-auth
+
+# Which user should bitten-slave run as?
+BITTEN_SLAVE_USER=bitten-slave
+
+# Build dir
+BITTEN_SLAVE_WORKDIR=/var/lib/bitten-slave
+
+# Log file
+BITTEN_SLAVE_LOG=/var/log/bitten-slave.log
+
diff --git a/bitten.spec b/bitten.spec
new file mode 100644
index 0000000..b698d12
--- /dev/null
+++ b/bitten.spec
@@ -0,0 +1,225 @@
+# sitelib for noarch packages, sitearch for others (remove the unneeded one)
+%{!?python_sitelib: %define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
+
+%define username        bitten-slave
+%define homedir         %_var/lib/%username
+%if 0%{?fedora}
+%define distro          Fedora
+%define distrover       %{fedora}
+%else
+%define distro          RHEL
+# {rhel} not defined!?
+%if 0%{?rhel}
+%define distrover       %{rhel}
+%else
+%define distrover       5
+%endif
+%endif
+
+#define svnrev 777
+
+Name:           bitten
+Version:        0.6b3
+Release:        0.2%{?dist}
+Summary:        A continuous integration plugin for Trac
+Group:          Development/Tools
+License:        BSD
+URL:            http://bitten.edgewall.org
+# For SVN revisions:
+# Source comes from SVN right now: svn co -r {svnrev} http://svn.edgewall.org/repos/bitten/trunk bitten; \
+#                                  cd bitten; \
+#                                  python setup.py sdist --formats gztar
+# Source is now in the dist subdirectory.
+Source0:        http://ftp.edgewall.com/pub/bitten/Bitten-%{version}.tar.gz
+Source1:        bitten-slave.conf
+Source2:        bitten-slave.init
+Source3:        bitten-slave.sysconf
+Source4:        bitten-slave.logrotate
+Patch0:         Bitten-0.6dev-r777-git.patch
+BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
+BuildArch:      noarch
+
+Requires:       python-setuptools
+BuildRequires:  python-devel
+BuildRequires:  python-setuptools
+
+
+%description
+Bitten is a Python-based framework for collecting various software metrics via
+continuous integration. It builds on Trac to provide an integrated web-based
+user interface.
+
+%package master
+Summary:        A continuous integration plugin for Trac
+Group:          Development/Tools
+Requires:       trac >= 0.11
+Requires:       bitten-common
+
+%description master
+Bitten is a Python-based framework for collecting various software metrics via
+continuous integration. It builds on Trac to provide an integrated web-based
+user interface.
+
+This package includes the Bitten master. It integrates into Trac and will
+supply Bitten slaves with build orders.
+
+
+%package common
+Summary:        Common files for Bitten master and slave
+Group:          Development/Libraries
+
+%description common
+This package contains files common to the Bitten build master and slave.
+
+
+%package slave
+Summary:          Bitten build slave
+Group:            Development/Tools
+Requires:         bitten-common
+Requires(pre):    %{_sbindir}/useradd
+
+
+%description slave
+Bitten build slave.
+
+
+%prep
+#  -n Bitten-{version}dev-r{svnrev}
+%setup -q -n Bitten-%{version}
+%patch0 -p1 -b .git
+
+%build
+%{__python} setup.py build
+
+
+%install
+rm -rf $RPM_BUILD_ROOT
+# skip-build doesn't work on el4
+%{__python} setup.py install -O1 --root $RPM_BUILD_ROOT
+# replaced by open alternative via patch 2
+rm -rf $RPM_BUILD_ROOT%{python_sitelib}/bitten/htdocs/chart*
+mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}
+mkdir -p $RPM_BUILD_ROOT%{_initrddir}
+mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig
+mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d
+mkdir -p $RPM_BUILD_ROOT%{_var}/lib/bitten-slave
+sed -e 's/@DISTRO@/%{distro}/g' -e 's/@DISTRO_VERSION@/%{distrover}/g'  %{SOURCE1} > $RPM_BUILD_ROOT%{_sysconfdir}/bitten-slave.conf
+cp -p %{SOURCE2} $RPM_BUILD_ROOT%{_initrddir}/bitten-slave
+cp -p %{SOURCE3} $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/bitten-slave
+cp -p %{SOURCE4} $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/bitten-slave
+
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%post slave
+if [ "$1" = "1" ]; then
+  /sbin/chkconfig --add bitten-slave
+fi
+
+%pre slave
+id '%username' >/dev/null 2>&1 || %{_sbindir}/useradd -r -d %homedir -m -s /sbin/nologin -c 'Bitten Slave' %username || :
+
+%preun slave
+if [ "$1" = "0" ]; then
+  /sbin/chkconfig --del bitten-slave
+fi
+
+%postun slave
+if [ "$1" = "0" ]; then
+  # {_sbindir}/userdel -r username
+  echo "Please remember to remove the user %{username} if no longer required."
+fi
+
+%files common
+%defattr(-,root,root,-)
+%dir %{python_sitelib}/bitten/
+%doc COPYING README.txt ChangeLog doc/*.txt
+# For noarch packages: sitelib
+%{python_sitelib}/bitten/__init__.py*
+%{python_sitelib}/bitten/build/api.py*
+%{python_sitelib}/bitten/build/config.py*
+%{python_sitelib}/bitten/build/__init__.py*
+%{python_sitelib}/bitten/recipe.py*
+%{python_sitelib}/bitten/util/
+%{python_sitelib}/Bitten*/
+
+%files master
+%defattr(-,root,root,-)
+# For noarch packages: sitelib
+%{python_sitelib}/bitten/admin.py*
+%{python_sitelib}/bitten/api.py*
+%{python_sitelib}/bitten/htdocs/
+%{python_sitelib}/bitten/main.py*
+%{python_sitelib}/bitten/master.py*
+%{python_sitelib}/bitten/model.py*
+%{python_sitelib}/bitten/notify.py*
+%{python_sitelib}/bitten/queue.py*
+%{python_sitelib}/bitten/report/
+%{python_sitelib}/bitten/templates/
+%{python_sitelib}/bitten/upgrades.py*
+%{python_sitelib}/bitten/web_ui.py*
+
+%files slave
+%defattr(-,root,root,-)
+# For noarch packages: sitelib
+%config(noreplace) %attr(640,%username,%username) %{_sysconfdir}/bitten-slave.conf
+%config(noreplace) %{_sysconfdir}/sysconfig/bitten-slave
+%config(noreplace) %{_sysconfdir}/logrotate.d/bitten-slave
+%{_bindir}/bitten-slave
+%{python_sitelib}/bitten/slave.py*
+%{python_sitelib}/bitten/build/*tools.py*
+%attr(0755,root,root) %{_initrddir}/bitten-slave
+%dir %attr(-,%username,%username) %{_var}/lib/bitten-slave
+
+%changelog
+* Sat Feb 19 2011 Tim Niemueller <timn at fedoraproject.org> 0.6b3-0.2
+- Instead of removing the user on deinstall, simply print reminder
+
+* Sun Jan 23 2011 Tim Niemueller <timn at fedoraproject.org> 0.6b3-0.1
+- Update to 0.6b3
+- Drop typo and charts patches (applied)
+
+* Tue Oct 27 2009 Tim Niemueller <timn at fedoraproject.org> 0.6-0.3.svn777
+- Replace closed source charting library with open alternative
+
+* Sat Oct 24 2009 Tim Niemueller <timn at fedoraproject.org> 0.6-0.2.svn777
+- Added new git patch (rewritten and tested)
+- Added patch for small but annoying typo
+
+* Wed Oct 14 2009 Tim Niemueller <timn at fedoraproject.org> 0.6-0.1.svn777
+- Upgrade to latest 0.6 version from svn
+- Added patch for git support
+
+* Mon Jul 13 2009 Tim Niemueller <timn at fedoraproject.org> 0.6svn519-0.6
+- Rebuild for F-11
+- Add patch for Python 2.6
+
+* Tue Jan 29 2008 Tim Niemueller <timn at fedoraprojdect.org> 0.6svn519-0.5
+- Release is now 0.5 to allow seemless upgrade for final 0.6
+- Updated config file to not have the homedir as builddir, in some situations
+  the homedir should survive, for example to be able to have a .subversion
+  dir for auth credentials or a .ccache
+
+* Sat Jan 26 2008 Tim Niemueller <timn at fedoraprojdect.org> 0.6svn519-4
+- Added ignore-rmtree-error patch
+- Rename master package to bitten-master
+- Added init script
+- Added config files
+- Create custom user for bitten-slave
+- Added bitten-slave builddir
+- Added logrotate config
+
+* Mon Jan 14 2008 Tim Niemueller <timn at fedoraprojdect.org> 0.6svn519-3
+- Added config generalization patch
+- Fixes to form-login patch to make it work, support for storing
+  credentials in config file
+- Provide example config file
+
+* Tue Jan 08 2008 Tim Niemueller <timn at fedoraprojdect.org> 0.6svn519-2
+- Moved some files from slave to common
+- Added form-login patch from #219
+
+* Mon Jan 07 2008 Tim Niemueller <timn at fedoraprojdect.org> 0.6svn519-1
+- Initial revision based on trac-git-plugin spec file
+
diff --git a/sources b/sources
index e69de29..6abfad8 100644
--- a/sources
+++ b/sources
@@ -0,0 +1 @@
+89c1201bea6ca2ee61e7ac4dde617197  Bitten-0.6b3.tar.gz


More information about the scm-commits mailing list