rdiff-backup-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[rdiff-backup-users] Building rdiff-backup on Windows


From: Josh Nisly
Subject: [rdiff-backup-users] Building rdiff-backup on Windows
Date: Mon, 07 Apr 2008 19:34:25 -0500
User-agent: Thunderbird 2.0.0.12 (X11/20080227)

I now have rdiff-backup building and performing local backups and restores. This includes the initial backup, as well as subsequent backups with changed files. I'm working on using Plink to back up to a remote server, but I'd like to start submitting patches for my work so far. I'd really like to get these into the main tree, so if there are any problems with them, please let me know and I'll try to fix them.

The first patch is for rdiff-backup's cmodule.c. Since lstat is not available on Windows, it uses _stati64, which Microsoft's replacement. It also replaces sync with _flushall(), which is documented to accomplish the same thing: http://msdn2.microsoft.com/en-us/library/s9xk9ehd(VS.71).aspx.

The second patch is two simple changes to setup.py to build the main package. It allows building with rsync.lib in the source folder. The second change tells the linker not to link in libcmt.lib.

Could someone with commit access please review these patches?

Thanks,
Josh Nisly
--- setup.py    2008-01-03 09:36:49.000000000 -0600
+++ setup.py    2008-04-02 17:58:36.984375000 -0500
@@ -40,6 +40,9 @@
                        libdir_list = [os.path.join(LIBRSYNC_DIR, 'lib')]
                if '-lrsync' in LIBS:
                        libname = []
+elif os.name == 'nt':
+       incdir_list = ['.']
+       lflags_arg = ['/NODEFAULTLIB:libcmt.lib']
 
 setup(name="rdiff-backup",
          version=version_string,
--- cmodule.c   2008-01-03 09:36:48.000000000 -0600
+++ cmodule.c   2008-04-01 20:08:15.484375000 -0500
@@ -24,7 +24,9 @@
 #include <Python.h>
 #include <sys/types.h>
 #include <sys/stat.h>
+#if !defined(MS_WIN64) && !defined(MS_WIN32)
 #include <unistd.h>
+#endif
 #include <errno.h>
 
 
@@ -46,6 +48,7 @@
 /* This code taken from Python's posixmodule.c */
 #undef STAT
 #if defined(MS_WIN64) || defined(MS_WIN32)
+#  define lstat _stati64
 #      define STAT _stati64
 #      define FSTAT _fstati64
 #      define STRUCT_STAT struct _stati64
@@ -69,6 +72,16 @@
 #define S_ISFIFO(mode)        (((mode) & S_IFMT) == S_IFIFO)
 #endif
 
+#if defined(MS_WIN64) || defined(MS_WIN32)
+#define S_ISSOCK(mode) (0)
+#define S_ISFIFO(mode) (0)
+#define S_ISLNK(mode) (0)
+#define S_ISCHR(mode) (0)
+#define S_ISBLK(mode) (0)
+#define sync _flushall
+#endif
+
 static PyObject *UnknownFileTypeError;
 static PyObject *c_make_file_dict(PyObject *self, PyObject *args);
 static PyObject *long2str(PyObject *self, PyObject *args);

reply via email to

[Prev in Thread] Current Thread [Next in Thread]