Commit 778721f2 authored by bescoto's avatar bescoto

Merged fixes from 0.13 for --calculate-average, mac os x, and python 2.3


git-svn-id: http://svn.savannah.nongnu.org/svn/rdiff-backup@372 2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109
parent 7aa26914
New in v0.12.3 (2003/08/??)
---------------------------
Patch by Jeffrey Marshall fixes socket/fifo recognition on Mac OS X
(which apparently has buggy macros).
Patch by Jeffrey Marshall fixes --calculate-average mode, which seems
to have broken recently.
rdiff-backup should now work with python 2.3.
New in v0.12.2 (2003/07/24)
---------------------------
......
......@@ -24,7 +24,7 @@ import getopt, sys, re, os
from log import Log, LoggerError, ErrorLog
import Globals, Time, SetConnections, selection, robust, rpath, \
manage, backup, connection, restore, FilenameMapping, \
Security, Hardlink, regress, C
Security, Hardlink, regress, C, statistics
action = None
......@@ -518,8 +518,9 @@ def ListIncrements(rp):
def CalculateAverage(rps):
"""Print out the average of the given statistics files"""
statobjs = map(lambda rp: StatsObj().read_stats_from_rp(rp), rps)
average_stats = StatsObj().set_to_average(statobjs)
statobjs = map(lambda rp: statistics.StatsObj().read_stats_from_rp(rp),
rps)
average_stats = statistics.StatsObj().set_to_average(statobjs)
print average_stats.get_stats_logstring(
"Average of %d stat files" % len(rps))
......
......@@ -49,7 +49,7 @@ def Mirror_and_increment(src_rpath, dest_rpath, inc_rpath):
class SourceStruct:
"""Hold info used on source side when backing up"""
source_select = None # will be set to source Select iterator
_source_select = None # will be set to source Select iterator
def set_source_select(cls, rpath, tuplelist, *filelists):
"""Initialize select object using tuplelist
......@@ -58,7 +58,7 @@ class SourceStruct:
connection. Otherwise we will get an error because a list
containing files can't be pickled.
Also, cls.source_select needs to be cached so get_diffs below
Also, cls._source_select needs to be cached so get_diffs below
can retrieve the necessary rps.
"""
......@@ -66,15 +66,15 @@ class SourceStruct:
sel.ParseArgs(tuplelist, filelists)
sel.set_iter()
cache_size = Globals.pipeline_max_length * 3 # to and from+leeway
cls.source_select = rorpiter.CacheIndexable(sel, cache_size)
cls._source_select = rorpiter.CacheIndexable(sel, cache_size)
def get_source_select(cls):
"""Return source select iterator, set by set_source_select"""
return cls.source_select
return cls._source_select
def get_diffs(cls, dest_sigiter):
"""Return diffs of any files with signature in dest_sigiter"""
source_rps = cls.source_select
source_rps = cls._source_select
error_handler = robust.get_error_handler("ListError")
def attach_snapshot(diff_rorp, src_rp):
"""Attach file of snapshot to diff_rorp, w/ error checking"""
......
......@@ -35,13 +35,23 @@
#define PY_LONG_LONG LONG_LONG
#endif
/* The following section is by Jeffrey A. Marshall and compensates for
* a bug in Mac OS X's S_ISFIFO and S_ISSOCK macros.
*/
#ifdef __APPLE__
/* S_ISFIFO/S_ISSOCK macros from <sys/stat.h> on mac osx are bogus */
#undef S_ISSOCK /* their definition of a socket includes fifos */
#undef S_ISFIFO /* their definition of a fifo includes sockets */
#define S_ISSOCK(mode) (((mode) & S_IFMT) == S_IFSOCK)
#define S_ISFIFO(mode) (((mode) & S_IFMT) == S_IFIFO)
#endif
static PyObject *UnknownFileTypeError;
static PyObject *c_make_file_dict(PyObject *self, PyObject *args);
static PyObject *long2str(PyObject *self, PyObject *args);
static PyObject *str2long(PyObject *self, PyObject *args);
static PyObject *my_sync(PyObject *self, PyObject *args);
/* Turn a stat structure into a python dictionary. The preprocessor
stuff taken from Python's posixmodule.c */
static PyObject *c_make_file_dict(self, args)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment