OpenPKG CVS Repository http://cvs.openpkg.org/ ____________________________________________________________________________
Server: cvs.openpkg.org Name: Ralf S. Engelschall Root: /v/openpkg/cvs Email: [EMAIL PROTECTED] Module: openpkg-src Date: 31-Jul-2007 15:24:31 Branch: HEAD Handle: 2007073114243100 Added files: openpkg-src/viewmtn rc.viewmtn viewmtn.config.py viewmtn.patch viewmtn.spec Log: new package: viewmtn 0.07 (Monotone DVCS Web Viewer) Summary: Revision Changes Path 1.1 +70 -0 openpkg-src/viewmtn/rc.viewmtn 1.1 +36 -0 openpkg-src/viewmtn/viewmtn.config.py 1.1 +81 -0 openpkg-src/viewmtn/viewmtn.patch 1.1 +147 -0 openpkg-src/viewmtn/viewmtn.spec ____________________________________________________________________________ patch -p0 <<'@@ .' Index: openpkg-src/viewmtn/rc.viewmtn ============================================================================ $ cvs diff -u -r0 -r1.1 rc.viewmtn --- /dev/null 2007-07-31 15:24:08 +0200 +++ rc.viewmtn 2007-07-31 15:24:31 +0200 @@ -0,0 +1,70 @@ [EMAIL PROTECTED]@/bin/openpkg rc +## +## rc.viewmtn -- Run-Commands +## + +%config + viewmtn_enable="$openpkg_rc_def" + viewmtn_bind="127.0.0.1:8080" + viewmtn_graphcache="10000" + viewmtn_log_prolog="true" + viewmtn_log_epilog="true" + viewmtn_log_numfiles="10" + viewmtn_log_minsize="1M" + viewmtn_log_complevel="9" + +%common + viewmtn_pidfile="@l_prefix@/var/viewmtn/viewmtn.pid" + viewmtn_signal () { + [ -f $viewmtn_pidfile ] && kill -$1 `cat $viewmtn_pidfile` + } + +%status -u @l_rusr@ -o + viewmtn_usable="unknown" + viewmtn_active="no" + rcService viewmtn enable yes && \ + viewmtn_signal 0 && viewmtn_active="yes" + echo "viewmtn_enable=\"$viewmtn_enable\"" + echo "viewmtn_usable=\"$viewmtn_usable\"" + echo "viewmtn_active=\"$viewmtn_active\"" + +%start -u @l_rusr@ + rcService viewmtn enable yes || exit 0 + rcService viewmtn active yes && exit 0 + ( cd @l_prefix@/libexec/viewmtn + PATH="@l_prefix@/bin:/bin:/usr/bin:/sbin:/usr/sbin" + export PATH + nohup ./viewmtn.py ${viewmtn_bind} \ + </dev/null >/dev/null 2>&1 & + echo $! >$viewmtn_pidfile + ) >/dev/null 2>&1 + +%stop -u @l_rusr@ + rcService viewmtn enable yes || exit 0 + rcService viewmtn active no && exit 0 + viewmtn_signal TERM + sleep 2 + rm -f $viewmtn_pidfile >/dev/null 2>&1 || true + +%restart -u @l_rusr@ + rcService viewmtn enable yes || exit 0 + rcService viewmtn active no && exit 0 + rc viewmtn stop start + +%daily -u @l_rusr@ + rcService viewmtn enable yes || exit 0 + ( cd @l_prefix@/var/viewmtn/graph || exit $? + days=100 + while [ $days -gt 0 ]; do + kb=`(du -sk | awk '{ print $1; }') 2>/dev/null` + if [ ".$kb" != . ]; then + if [ $kb -lt $viewmtn_graphcache ]; then + break + fi + find . -mtime +$days -print | xargs rm -f 2>/dev/null || true + fi + days=`expr $days - 1` + done + rmdir ./* 2>/dev/null || true + ) || exit $? + @@ . patch -p0 <<'@@ .' Index: openpkg-src/viewmtn/viewmtn.config.py ============================================================================ $ cvs diff -u -r0 -r1.1 viewmtn.config.py --- /dev/null 2007-07-31 15:24:08 +0200 +++ viewmtn.config.py 2007-07-31 15:24:31 +0200 @@ -0,0 +1,36 @@ +## +## viewmtn.config.py -- ViewMTN configuration +## + +import sys + +debug = True + +dynamic_uri_path = 'http://localhost:8080/' +static_uri_path = 'http://localhost:8080/static/' + +highlight_command = '@l_prefix@/bin/highlight' +monotone = '@l_prefix@/bin/mtn' + +dbfile = '@l_prefix@/var/monotone/monotone.db' + +gnome_mimetype_icon_path = '@l_prefix@/share/icon-theme/' +gnome_mimetype_uri = 'icon-theme/' +icon_theme = 'gnome' +icon_size = '16' + +graphopts = { + 'directory' : '@l_prefix@/var/viewmtn/graph/', + 'uri' : 'graph/', + 'dot' : '@l_prefix@/bin/dot', + 'nodeopts' : { + 'fontname' : 'DejaVu Sans', + 'fontsize' : '8', + 'shape' : 'box', + 'height' : '0.3', + 'spline' : 'true', + 'style' : 'filled', + 'fillcolor' : '#dddddd' + } +} + @@ . patch -p0 <<'@@ .' Index: openpkg-src/viewmtn/viewmtn.patch ============================================================================ $ cvs diff -u -r0 -r1.1 viewmtn.patch --- /dev/null 2007-07-31 15:24:08 +0200 +++ viewmtn.patch 2007-07-31 15:24:31 +0200 @@ -0,0 +1,81 @@ +Index: common.py +--- common.py.orig 2007-04-13 14:20:33 +0200 ++++ common.py 2007-07-31 10:46:00 +0200 +@@ -17,6 +17,13 @@ + import traceback + + def parse_timecert(value): ++ # The datetime may contain microseconds which time.strptime cannot ++ # parse. Drop them. This is easy because Monotone keeps timestamps ++ # in ISO 8601 format, so microseconds necessarily start with a ++ # period. ++ index_of_period = value.find ('.') ++ if index_of_period > -1: ++ value = value[0:index_of_period] + return apply(datetime.datetime, time.strptime(value, "%Y-%m-%dT%H:%M:%S")[:6]) + + def set_nonblocking(fd): +Index: templates/index.html +--- templates/index.html.orig 2007-04-13 14:20:34 +0200 ++++ templates/index.html 2007-07-31 10:50:20 +0200 +@@ -3,13 +3,12 @@ + #def body + <p> + Welcome to this <a href="http://grahame.angrygoats.net/viewmtn.shtml">ViewMTN</a> installation. +-The list below shows all branches served within this <a href="http://www.venge.net/monotone">Monotone</a> +-database. ++The list below shows all branches served within this <a href="http://www.monotone.ca/">Monotone</a> database. + </p> + + <p> + Select one of the branches and you will be shown a list of recent changes that have occurred within it. +-If you are looking for a particular revision (for example, a release) the <a href="/tags">list of tags</a> ++If you are looking for a particular revision (for example, a release) the <a href="$dynamic_join('tags')">list of tags</a> + might be useful. + </p> + +Index: templates/revisionfile.html +--- templates/revisionfile.html.orig 2007-04-13 14:20:34 +0200 ++++ templates/revisionfile.html 2007-07-31 10:53:12 +0200 +@@ -7,5 +7,5 @@ + $link($filename).html(override_description="View") | + $link($filename, for_download=True).html(override_description="Download") | + $link($filename, for_changes_rss=True).html(override_description="RSS") +-#filter WebSafe ++#end filter + #end def +Index: templates/revisioninfo.html +--- templates/revisioninfo.html.orig 2007-04-13 14:20:34 +0200 ++++ templates/revisioninfo.html 2007-07-31 10:52:14 +0200 +@@ -48,8 +48,8 @@ + $imagemap + #end filter + <div align="center" style="float: left; margin: 0; margin-bottom: 1em;"> +-<img style=" border-width: 1px; border-color: black; border-style: solid;" usemap="#ancestry" src="$imageuri" alt="Ancestry of $revision" /> +-<br /><small><a href="/help#readinggraph">reading this graph</a></small> ++<img style="border-width: 1px; border-color: black; border-style: solid;" usemap="#ancestry" src="$imageuri" alt="Ancestry of $revision" /> ++<br /><small><a href="$dynamic_join('help#readinggraph')">reading this graph</a></small> + </div> + + #end def +Index: viewmtn.py +--- viewmtn.py.orig 2007-04-13 14:20:35 +0200 ++++ viewmtn.py 2007-07-31 10:47:44 +0200 +@@ -421,7 +421,7 @@ + if last_result != None: + parents = filter(None, parent_func(last_result.revision)) + for parent_rev in parents: +- if parent_rev == None or not selection_func(parent_rev): ++ if parent_rev == None: + continue + heapq.heappush(revq, ComparisonRev(ops, parent_rev)) + +@@ -429,7 +429,7 @@ + last_result = None + while revq: + candidate = heapq.heappop(revq) +- if not (candidate.revision in in_result): ++ if not (candidate.revision in in_result) and selection_func(candidate.revision): + last_result = candidate + break + if last_result == None: @@ . patch -p0 <<'@@ .' Index: openpkg-src/viewmtn/viewmtn.spec ============================================================================ $ cvs diff -u -r0 -r1.1 viewmtn.spec --- /dev/null 2007-07-31 15:24:08 +0200 +++ viewmtn.spec 2007-07-31 15:24:31 +0200 @@ -0,0 +1,147 @@ +## +## viewmtn.spec -- OpenPKG RPM Package Specification +## Copyright (c) 2000-2007 OpenPKG Foundation e.V. <http://openpkg.net/> +## Copyright (c) 2000-2007 Ralf S. Engelschall <http://engelschall.com/> +## +## Permission to use, copy, modify, and distribute this software for +## any purpose with or without fee is hereby granted, provided that +## the above copyright notice and this permission notice appear in all +## copies. +## +## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED +## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR +## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF +## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT +## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +## SUCH DAMAGE. +## + +# package information +Name: viewmtn +Summary: Monotone DVCS Web Viewer +URL: http://grahame.angrygoats.net/moinmoin/ViewMTN +Vendor: Grahame Bowland +Packager: OpenPKG Foundation e.V. +Distribution: OpenPKG Community +Class: EVAL +Group: SCM +License: GPL +Version: 0.07 +Release: 20070731 + +# list of sources +Source0: http://grahame.angrygoats.net/source/viewmtn/viewmtn-%{version}.tgz +Source1: viewmtn.config.py +Source2: rc.viewmtn +Patch0: viewmtn.patch + +# build information +Prefix: %{l_prefix} +BuildRoot: %{l_buildroot} +BuildPreReq: OpenPKG, openpkg >= 20060823 +PreReq: OpenPKG, openpkg >= 20060823 +PreReq: python, python-net, python-www +PreReq: shared-mime-info, icon-theme +PreReq: highlight, graphviz, fonts-free +PreReq: monotone, diffutils +AutoReq: no +AutoReqProv: no + +%description + ViewMTN is a web interface to the Monotone distributed version + control system. + +%track + prog viewmtn = { + version = %{version} + url = http://grahame.angrygoats.net/source/viewmtn/ + regex = viewmtn-(__VER__)\.t(?:gz|ar\.gz) + } + +%prep + %setup -q + %patch -p0 + +%build + # remove files we do not want to install + rm -rf _MTN + rm -f [A-Z]* + + # adjust paths to Python interpreter + %{l_shtool} subst \ + -e 's;#!/usr/bin/env python2.4;#!%{l_prefix}/bin/python;g' \ + viewmtn.py + %{l_shtool} subst \ + -e 's;#!/usr/bin/python;#!%{l_prefix}/bin/python;g' \ + experiments/grapher/grapher.py + %{l_shtool} subst \ + -e 's;/usr/local/share:/usr/share;%{l_prefix}/share/icon-theme:%{l_prefix}/share/mime;g' \ + fdo/xdgbasedir.py + +%install + # create installation hierarchy + rm -rf $RPM_BUILD_ROOT + %{l_shtool} mkdir -f -p -m 755 \ + $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \ + $RPM_BUILD_ROOT%{l_prefix}/etc/viewmtn \ + $RPM_BUILD_ROOT%{l_prefix}/libexec/viewmtn \ + $RPM_BUILD_ROOT%{l_prefix}/var/viewmtn/graph + + # install program files + rm -f config.py.example + find . -name "*.orig" -print | xargs rm -f + cp -rp * $RPM_BUILD_ROOT%{l_prefix}/libexec/viewmtn/ + + # move templates to final location + mv $RPM_BUILD_ROOT%{l_prefix}/libexec/viewmtn/templates \ + $RPM_BUILD_ROOT%{l_prefix}/etc/viewmtn/templates + ln -s ../../etc/viewmtn/templates \ + $RPM_BUILD_ROOT%{l_prefix}/libexec/viewmtn/templates + + # install default configuration + %{l_shtool} install -c -m 644 %{l_value -s -a} \ + %{SOURCE viewmtn.config.py} $RPM_BUILD_ROOT%{l_prefix}/etc/viewmtn/ + ln -s ../../etc/viewmtn/viewmtn.config.py \ + $RPM_BUILD_ROOT%{l_prefix}/libexec/viewmtn/config.py + + # make sure the graphs can be generated + ln -s ../../var/viewmtn/graph \ + $RPM_BUILD_ROOT%{l_prefix}/libexec/viewmtn/graph + + # install run-command script + %{l_shtool} install -c -m 755 %{l_value -s -a} \ + %{SOURCE rc.viewmtn} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/ + + # determine installation files + %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \ + %{l_files_std} \ + '%config %{l_prefix}/etc/viewmtn/*' \ + '%config %{l_prefix}/etc/viewmtn/templates/*' \ + '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/viewmtn/*' \ + '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/viewmtn' + +%files -f files + +%clean + rm -rf $RPM_BUILD_ROOT + +%post + # after upgrade, restart service + [ $1 -eq 2 ] || exit 0 + eval `%{l_rc} viewmtn status 2>/dev/null` + [ ".$viewmtn_active" = .yes ] && %{l_rc} viewmtn restart + exit 0 + +%preun + # before erase, stop service and remove log files + [ $1 -eq 0 ] || exit 0 + %{l_rc} viewmtn stop 2>/dev/null + rm -f $RPM_INSTALL_PREFIX/var/viewmtn/viewmtn.log* >/dev/null 2>&1 || true + exit 0 + @@ . ______________________________________________________________________ OpenPKG http://openpkg.org CVS Repository Commit List openpkg-cvs@openpkg.org