diff --git a/.cvsignore b/.cvsignore deleted file mode 100644 index 064b2ba..0000000 --- a/.cvsignore +++ /dev/null @@ -1 +0,0 @@ -monotone-0.30.tar.gz diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..61594c7 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +monotone-0.42.tar.gz diff --git a/Makefile b/Makefile deleted file mode 100644 index 659e999..0000000 --- a/Makefile +++ /dev/null @@ -1,21 +0,0 @@ -# Makefile for source rpm: monotone -# $Id$ -NAME := monotone -SPECFILE = $(firstword $(wildcard *.spec)) - -define find-makefile-common -for d in common ../common ../../common ; do if [ -f $$d/Makefile.common ] ; then if [ -f $$d/CVS/Root -a -w $$/Makefile.common ] ; then cd $$d ; cvs -Q update ; fi ; echo "$$d/Makefile.common" ; break ; fi ; done -endef - -MAKEFILE_COMMON := $(shell $(find-makefile-common)) - -ifeq ($(MAKEFILE_COMMON),) -# attept a checkout -define checkout-makefile-common -test -f CVS/Root && { cvs -Q -d $$(cat CVS/Root) checkout common && echo "common/Makefile.common" ; } || { echo "ERROR: I can't figure out how to checkout the 'common' module." ; exit -1 ; } >&2 -endef - -MAKEFILE_COMMON := $(shell $(checkout-makefile-common)) -endif - -include $(MAKEFILE_COMMON) diff --git a/README.monotone-server b/README.monotone-server index d5d2299..a2640d3 100644 --- a/README.monotone-server +++ b/README.monotone-server @@ -10,7 +10,7 @@ server instances from people using monotone.) The /etc/monotone directory serves as ~/.monotone for the server. This directory and its contents are not writable by the "monotone" user ID under -which the network server runs. The database lives in /var/db/monotone, +which the network server runs. The database lives in /var/lib/monotone, which the "monotone" user ID must write to. The init.d script will generate a private key for the server to use, if diff --git a/monotone-0.42-gcc44.patch b/monotone-0.42-gcc44.patch new file mode 100644 index 0000000..6e46048 --- /dev/null +++ b/monotone-0.42-gcc44.patch @@ -0,0 +1,90 @@ +diff -up monotone-0.42/key_store.cc.orig monotone-0.42/key_store.cc +--- monotone-0.42/key_store.cc.orig 2008-12-14 00:02:12.000000000 +0100 ++++ monotone-0.42/key_store.cc 2009-02-07 17:23:27.000000000 +0100 +@@ -460,30 +460,30 @@ key_store::cache_decrypted_key(const rsa + + void + key_store::create_key_pair(database & db, +- rsa_keypair_id const & id, ++ rsa_keypair_id const & ident, + utf8 const * maybe_passphrase, + id * maybe_pubhash, + id * maybe_privhash) + { + conditional_transaction_guard guard(db); + +- bool exists = key_pair_exists(id); ++ bool exists = key_pair_exists(ident); + if (db.database_specified()) + { + guard.acquire(); +- exists = exists || db.public_key_exists(id); ++ exists = exists || db.public_key_exists(ident); + } +- N(!exists, F("key '%s' already exists") % id); ++ N(!exists, F("key '%s' already exists") % ident); + + utf8 prompted_passphrase; + if (!maybe_passphrase) + { +- get_passphrase(prompted_passphrase, id, true, true); ++ get_passphrase(prompted_passphrase, ident, true, true); + maybe_passphrase = &prompted_passphrase; + } + + // okay, now we can create the key +- P(F("generating key-pair '%s'") % id); ++ P(F("generating key-pair '%s'") % ident); + RSA_PrivateKey priv(*s->rng, static_cast(constants::keylen)); + + // serialize and maybe encrypt the private key +@@ -514,20 +514,20 @@ key_store::create_key_pair(database & db + % kp.priv().size()); + + // and save it. +- P(F("storing key-pair '%s' in %s/") % id % get_key_dir()); +- put_key_pair(id, kp); ++ P(F("storing key-pair '%s' in %s/") % ident % get_key_dir()); ++ put_key_pair(ident, kp); + + if (db.database_specified()) + { +- P(F("storing public key '%s' in %s") % id % db.get_filename()); +- db.put_key(id, kp.pub); ++ P(F("storing public key '%s' in %s") % ident % db.get_filename()); ++ db.put_key(ident, kp.pub); + guard.commit(); + } + + if (maybe_pubhash) +- key_hash_code(id, kp.pub, *maybe_pubhash); ++ key_hash_code(ident, kp.pub, *maybe_pubhash); + if (maybe_privhash) +- key_hash_code(id, kp.priv, *maybe_privhash); ++ key_hash_code(ident, kp.priv, *maybe_privhash); + } + + void +diff -up monotone-0.42/key_store.hh.orig monotone-0.42/key_store.hh +--- monotone-0.42/key_store.hh.orig 2008-10-03 15:30:21.000000000 +0200 ++++ monotone-0.42/key_store.hh 2009-02-07 17:21:54.000000000 +0100 +@@ -64,7 +64,7 @@ public: + + void cache_decrypted_key(rsa_keypair_id const & id); + +- void create_key_pair(database & db, rsa_keypair_id const & id, ++ void create_key_pair(database & db, rsa_keypair_id const & ident, + utf8 const * maybe_passphrase = NULL, + id * maybe_pubhash = NULL, + id * maybe_privhash = NULL); +diff -up monotone-0.42/sanity.hh.orig monotone-0.42/sanity.hh +--- monotone-0.42/sanity.hh.orig 2008-11-23 22:32:49.000000000 +0100 ++++ monotone-0.42/sanity.hh 2009-02-07 17:21:42.000000000 +0100 +@@ -12,6 +12,7 @@ + + #include + #include ++#include + + #include "boost/current_function.hpp" + diff --git a/monotone-0.42-netsync.patch b/monotone-0.42-netsync.patch new file mode 100644 index 0000000..49ebdb7 --- /dev/null +++ b/monotone-0.42-netsync.patch @@ -0,0 +1,101 @@ +diff -up monotone-0.42/netsync.cc.orig monotone-0.42/netsync.cc +--- monotone-0.42/netsync.cc.orig 2009-02-04 13:53:00.000000000 +0100 ++++ monotone-0.42/netsync.cc 2009-02-04 13:53:49.000000000 +0100 +@@ -353,7 +353,7 @@ unsigned int reactable::count = 0; + + class session_base : public reactable + { +- bool read_some(); ++ void read_some(bool & failed, bool & eof); + bool write_some(); + void mark_recent_io() + { +@@ -468,10 +468,12 @@ session_base::which_events() + return ret; + } + +-bool +-session_base::read_some() ++void ++session_base::read_some(bool & failed, bool & eof) + { + I(inbuf.size() < constants::netcmd_maxsz); ++ eof = false; ++ failed = false; + char tmp[constants::bufsz]; + Netxx::signed_size_type count = str->read(tmp, sizeof(tmp)); + if (count > 0) +@@ -479,17 +481,38 @@ session_base::read_some() + L(FL("read %d bytes from fd %d (peer %s)") + % count % str->get_socketfd() % peer_id); + if (encountered_error) +- { +- L(FL("in error unwind mode, so throwing them into the bit bucket")); +- return true; +- } ++ L(FL("in error unwind mode, so throwing them into the bit bucket")); ++ + inbuf.append(tmp,count); + mark_recent_io(); + note_bytes_in(count); +- return true; ++ } ++ else if (count == 0) ++ { ++ // Returning 0 bytes after select() marks the file descriptor as ++ // ready for reading signifies EOF. ++ ++ switch (protocol_state) ++ { ++ case working_state: ++ P(F("peer %s IO terminated connection in working state (error)") ++ % peer_id); ++ break; ++ ++ case shutdown_state: ++ P(F("peer %s IO terminated connection in shutdown state " ++ "(possibly client misreported error)") ++ % peer_id); ++ break; ++ ++ case confirmed_state: ++ break; ++ } ++ ++ eof = true; + } + else +- return false; ++ failed = true; + } + + bool +@@ -531,11 +554,14 @@ bool + session_base::do_io(Netxx::Probe::ready_type what) + { + bool ok = true; ++ bool eof = false; + try + { + if (what & Netxx::Probe::ready_read) + { +- if (!read_some()) ++ bool failed; ++ read_some(failed, eof); ++ if (failed) + ok = false; + } + if (what & Netxx::Probe::ready_write) +@@ -578,7 +604,11 @@ session_base::do_io(Netxx::Probe::ready_ + % peer_id); + ok = false; + } +- return ok; ++ ++ // Return false in case we reached EOF, so as to prevent further calls ++ // to select()s on this stream, as recommended by the select_tut man ++ // page. ++ return ok && !eof; + } + + //////////////////////////////////////////////////////////////////////// diff --git a/monotone-0.42-netsync2.patch b/monotone-0.42-netsync2.patch new file mode 100644 index 0000000..7dbeaa0 --- /dev/null +++ b/monotone-0.42-netsync2.patch @@ -0,0 +1,12 @@ +diff -up monotone-0.42/netsync.cc.orig monotone-0.42/netsync.cc +--- monotone-0.42/netsync.cc.orig 2008-12-14 00:02:12.000000000 +0100 ++++ monotone-0.42/netsync.cc 2009-02-27 19:19:37.000000000 +0100 +@@ -374,7 +374,7 @@ protected: + } + bool output_overfull() const + { +- return outbuf.size() > constants::bufsz * 10; ++ return outbuf_size > constants::bufsz * 10; + } + public: + string peer_id; diff --git a/monotone.init b/monotone.init index b367162..967ab15 100644 --- a/monotone.init +++ b/monotone.init @@ -8,6 +8,20 @@ # pidfile: /var/run/monotone/monotone-server.pid # config: /etc/sysconfig/monotone # config: /etc/monotone/monotonerc +# +### BEGIN INIT INFO +# Provides: monotone +# Required-Start: $local_fs $network $named $time +# Required-Stop: $local_fs $network +# Short-Description: start and stop Monotone netsync protocol server +# Description: Monotone is a free, distributed version control system. +# It provides fully disconnected operation, manages complete +# tree versions, keeps its state in a local transactional +# database, supports overlapping branches and extensible +# metadata, exchanges work over plain network protocols, +# performs history-sensitive merging, and delegates trust +# functions to client-side RSA certificates. +### END INIT INFO # Source function library. . /etc/rc.d/init.d/functions @@ -29,6 +43,8 @@ MTSERVER=/usr/sbin/monotone-server MONOTONE_PIDFILE=/var/run/monotone/monotone-server.pid MONOTONE_LOGFILE=${MONOTONE_LOGFILE:-/var/log/monotone.log} MONOTONE_OLDDB=/var/db/monotone/server.db +MONOTONE_OLDDBFILE=/var/db/monotone/server.mtn +MONOTONE_OLDPPFILE=/var/db/monotone/passphrase.lua random_passphrase() { @@ -39,11 +55,34 @@ random_passphrase() umask 077 +check_db_version() +{ + db_version=`runuser -s /bin/bash - ${MONOTONE_USER:-monotone} \ + -c "LC_ALL=C \ + $MT $MONOTONE_RCOPTS $MONOTONE_DBOPTS \ + db version"` || exit 2 + set -- $db_version + [ "$5" == "(usable)" ] + return $? +} + # See how we were called. case "$1" in start) + if [ -e $MONOTONE_OLDDBFILE -a ! -e $MONOTONE_DBFILE ]; then + echo -n $"Moving" "$MONOTONE_OLDDBFILE" $"to" "$MONOTONE_DBFILE" + if mv "$MONOTONE_OLDDBFILE" "$MONOTONE_DBFILE"; then + failure + echo + exit + else + success + echo + fi + rmdir 2> /dev/null /var/db/monotone + fi if [ -e $MONOTONE_DBFILE ]; then - $0 migrate + check_db_version || $0 migrate elif [ -e $MONOTONE_OLDDB ]; then echo -n $"Pre-0.26 monotone database must be migrated by hand: " failure @@ -84,11 +123,11 @@ case "$1" in [ $RETVAL = 0 ] && rm -f /var/lock/subsys/monotone echo ;; - restart) + restart|force-reload) $0 stop $0 start ;; - condrestart) + condrestart|try-restart) [ -e /var/lock/subsys/monotone ] && $0 restart ;; status) @@ -97,10 +136,10 @@ case "$1" in ;; init) echo -n $"Initializing database" "${MONOTONE_DBFILE}: " - { [ -d /var/db/monotone ] || + { [ -d /var/lib/monotone ] || /usr/bin/install -o ${MONOTONE_USER:-monotone} \ -g ${MONOTONE_GROUP:-monotone} \ - -m 0770 -d /var/db/monotone; } && + -m 0770 -d /var/lib/monotone; } && runuser -s /bin/bash - ${MONOTONE_USER:-monotone} -c "umask 007; \ $MT $MONOTONE_RCOPTS $MONOTONE_DBOPTS db init" && success $"database initialization" || @@ -109,8 +148,14 @@ case "$1" in echo ;; genkey) - MONOTONE_KEYID=${2:-${MONOTONE_KEYID:-`/bin/hostname -f`}} - MONOTONE_PPFILE=${MONOTONE_PPFILE:-/var/db/monotone/passphrase.lua} + MONOTONE_KEYID=${2:-${MONOTONE_KEYID:-monotone@`/bin/hostname -f`}} + MONOTONE_PPFILE=${MONOTONE_PPFILE:-/etc/monotone/passphrase.lua} + if [ -s "$MONOTONE_PPFILE" -a -s "$MONOTONE_KEYDIR/$MONOTONE_KEYID" ] + then + echo >&2 "$0:" $"Server key already installed" + echo >&2 "$0:" $"To lose old key remove file" "$MONOTONE_PPFILE" + exit 1 + fi echo -n $"Generating RSA key for server $MONOTONE_KEYID" tmp=/tmp/mtserver$$ if @@ -120,6 +165,7 @@ case "$1" in genkey $MONOTONE_KEYID > /dev/null 2>&1) && /bin/chgrp ${MONOTONE_GROUP:-monotone} \ "$MONOTONE_KEYDIR/$MONOTONE_KEYID" && + /bin/chmod 0640 "$MONOTONE_KEYDIR/$MONOTONE_KEYID" && cat > $tmp < /dev/null 2>&1 || : + /sbin/install-info %{_infodir}/monotone.info %{_infodir}/dir > /dev/null 2>&1 || : fi -%postun +%preun if [ $1 -eq 0 ] then - /sbin/install-info --delete %{_infodir}/monotone.info %{_infodir}/dir > /dev/null 2>&1 || : + /sbin/install-info --delete %{_infodir}/monotone.info %{_infodir}/dir > /dev/null 2>&1 || : fi %files -f %{name}.lang @@ -123,47 +157,135 @@ fi %doc monotone.html %{_bindir}/mtn +%{_bindir}/mtnopt %{_infodir}/monotone.info* -%{_mandir}/man1/mtn.1* %{_datadir}/emacs/site-lisp/monotone*.el* +%{_sysconfdir}/bash_completion.d +%files -n perl-Monotone +%defattr(-,root,root,-) +%{perl_vendorlib}/Monotone.pm %files server -%doc README.monotone-server %defattr(-,root,root,-) +%doc README.monotone-server %{_sbindir}/monotone-server -%{_sysconfdir}/init.d/monotone +%{_sysconfdir}/rc.d/init.d/monotone %dir %attr(0755,monotone,monotone) %{_localstatedir}/run/monotone -%config %{_sysconfdir}/sysconfig/monotone +%config(noreplace) %{_sysconfdir}/sysconfig/monotone %dir %attr(0755,root,monotone) %{_sysconfdir}/monotone %dir %attr(0750,root,monotone) %{_sysconfdir}/monotone/private-keys %attr(0640,root,monotone) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) %{_sysconfdir}/monotone/monotonerc %attr(0440,root,monotone) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) %{_sysconfdir}/monotone/passphrase.lua %attr(0640,root,monotone) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) %{_sysconfdir}/monotone/read-permissions %attr(0640,root,monotone) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) %{_sysconfdir}/monotone/write-permissions -%dir %attr(0770,monotone,monotone) %{_localstatedir}/db/monotone -%attr(0660,monotone,monotone) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) %{_localstatedir}/db/monotone/server.mtn +%dir %attr(0770,monotone,monotone) %{_localstatedir}/lib/monotone +%attr(0660,monotone,monotone) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) %{_localstatedir}/lib/monotone/server.mtn %pre server -# Add the "monotone" user -/usr/sbin/useradd -c "Monotone Netsync Server" \ - -s /sbin/nologin -r -d %{_localstatedir}/db/monotone monotone 2> /dev/null || : +# Add "monotone" user per http://fedoraproject.org/wiki/Packaging/UsersAndGroups +getent group monotone > /dev/null || groupadd -r monotone +getent passwd monotone > /dev/null || +useradd -r -g monotone -r -d %{_localstatedir}/lib/monotone -s /sbin/nologin \ + -c "Monotone Netsync Server" monotone +exit 0 %post server # Register the monotone service /sbin/chkconfig --add monotone -# Restart the running server, which will update its db format when needed. -/sbin/service monotone condrestart - %preun server if [ $1 = 0 ]; then - /sbin/service monotone stop > /dev/null 2>&1 - /sbin/chkconfig --del monotone + /sbin/service monotone stop > /dev/null 2>&1 + /sbin/chkconfig --del monotone +fi + +%postun +if [ $1 -gt 1 ]; then + # Restart the running server: updates its db format when needed. + /sbin/service monotone condrestart > /dev/null 2>&1 || : fi %changelog +* Fri Feb 27 2009 Thomas Moschny - 0.42-5 +- Add one more netsync related patch from trunk. + +* Wed Feb 25 2009 Fedora Release Engineering - 0.42-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild + +* Mon Feb 9 2009 Thomas Moschny - 0.42-3 +- Disable %%{_smp_mflags} in the testsuite, causes strange errors. +- Fix two issues with gcc44. +- Add patch from upstream fixing netsync printing an error message of + the form "peer [...] IO failed in confirmed state (success)". + +* Fri Jan 2 2009 Thomas Moschny - 0.42-2 +- Pack Monotone.pm (in a subpackage). (#450267) + +* Fri Jan 2 2009 Thomas Moschny - 0.42-1 +- Updated for 0.42 release. + +* Fri Sep 12 2008 Thomas Moschny - 0.41-1 +- Updated for 0.41 release. +- Added mtnopt helper. + +* Mon Aug 11 2008 Tom "spot" Callaway - 0.40-2 +- fix license tag + +* Mon Apr 14 2008 Roland McGrath - 0.40-1 +- Updated for 0.40 release. +- Tweaked trivia for packaging guidelines nits. + +* Mon Feb 25 2008 Roland McGrath - 0.39-1 +- Updated for 0.39 release. + +* Sat Dec 22 2007 Roland McGrath - 0.38-2 +- Fix monotone-server user creation. (#426607) +- Moved monotone-server database to /var/lib. (#426608) +- Use monotone@ in server key name. (#426609) + +* Fri Dec 21 2007 Roland McGrath - 0.38-1 +- Updated for 0.38 release. + +* Sat Oct 27 2007 Roland McGrath - 0.37-3 +- Updated for 0.37 release. +- Prevent destroying old passphrase file with 'service monotone genkey'. +- Put LSB standard comments in monotone.init for monotone-server subpackage. + +* Tue Aug 28 2007 Roland McGrath - 0.36-2 +- Clean up %%pre script per packaging guidelines. +- Disable ppc and ppc64 builds temporarily since make check fails. (#259161) + +* Fri Aug 3 2007 Roland McGrath - 0.36-1 +- Updated for 0.36 release. + +* Fri Jul 06 2007 Florian La Roche - 0.35-4 +- add more requires + +* Wed May 16 2007 Roland McGrath - 0.35-3 +- Fix locale dependency in monotone-server init script. (#213893) + +* Wed May 9 2007 Roland McGrath - 0.35-2 +- Updated for 0.35 release. +- Avoid unnecessary "db migrate" in monotone-server init script. (#213893) + +* Wed Apr 4 2007 Roland McGrath - 0.34-1 +- Updated for 0.34 release. + +* Thu Mar 1 2007 Roland McGrath - 0.33-1 +- Updated for 0.33 release. +- Install monotone.bash_completion file. + +* Wed Feb 28 2007 Roland McGrath - 0.32-1 +- Updated for 0.32 release. + +* Thu Dec 21 2006 Kevin Fenzi - 0.31-2 +- Bump and rebuild to fix upgrade path + +* Sat Nov 11 2006 Roland McGrath - 0.31-1 +- Updated for 0.31 release. + * Tue Oct 10 2006 Roland McGrath - 0.30-1 - Updated for 0.30 release. - Fix service script to work around buggy init.d/functions. (#198761) diff --git a/monotone.sysconfig b/monotone.sysconfig index a0a5c23..a61496a 100644 --- a/monotone.sysconfig +++ b/monotone.sysconfig @@ -1,10 +1,10 @@ MONOTONE_CONFDIR=/etc/monotone MONOTONE_KEYDIR=/etc/monotone/private-keys -MONOTONE_DBFILE=/var/db/monotone/server.mtn +MONOTONE_DBFILE=/var/lib/monotone/server.mtn MONOTONE_PPFILE=/etc/monotone/passphrase.lua MONOTONE_RCOPTS="--confdir=$MONOTONE_CONFDIR" MONOTONE_DBOPTS="--db=$MONOTONE_DBFILE --keydir=$MONOTONE_KEYDIR" MONOTONE_PPOPTS="--rcfile=$MONOTONE_PPFILE" -MONOTONE_SERVE_OPTS="'*'" +MONOTONE_SERVE_OPTS="" diff --git a/sources b/sources index 88f2945..ec72068 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -94a1f8369162f7a7df8596b365a1d846 monotone-0.30.tar.gz +c8e916d674b6608369d9f447700a8830 monotone-0.42.tar.gz