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

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

Re: [rdiff-backup-users] Status of native Windows port?


From: Andrew Ferguson
Subject: Re: [rdiff-backup-users] Status of native Windows port?
Date: Mon, 28 Jul 2008 19:58:29 -0400

Thanks for the instructions Josh.

I have posted a Win32 self-contained executable. Direct link:
http://savannah.nongnu.org/download/rdiff-backup/rdiff-backup-1.2.0-win32.exe

Anyone is welcome to add Josh's script to the wiki. I'll try to put together some consolidated information on the website.



Andrew



On Jul 28, 2008, at 11:50 AM, Josh Nisly wrote:

Attached is the script that I've been using to build rdiff-backup. Just run the script without arguments. It downloads and builds librsync and rdiff-backup in a temp folder, and creates an output folder with rdiff-backup.exe inside. The resulting executable does not need python to be installed.

The script requires that Visual Studio 2003 be installed, since this is what Python itself is built with.

Thanks,
JoshN

Patrick Nagel wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

I read a lot about a native Windows port of rdiff-backup going on. Andrew
Ferguson mentioned it (stating that he thinks it's finished) in the
announcement of version 1.1.17, for example.

Now I have a few questions, regarding this port:
* Is it ready / what are the limitations?
* Are there binaries?

I tried to find the answers through searching the web, but I only found an
outdated Wiki article
(http://wiki.rdiff-backup.org/wiki/index.php/NativeWindowsPort) and an outdated FAQ entry (http://www.nongnu.org/rdiff-backup/FAQ.html#windows )
linking to an outdated Blog entry
(http://katastrophos.net/andre/blog/2005/11/02/rdiff-backup-on-windows/ ).

As far as I can see on this list, a lot of effort has gone into getting rdiff-backup to run on Windows. So I think it would be appropriate to put at least a little effort into making the result available in the form of a ready-to-use executable, or an installer, so that it can actually be used by
anybody (if it's actually usable).

I just think rdiff-backup is a great tool, and it could make Windows hell a
little bit more bearable. :)

Thanks,
Patrick.

- --
Key ID: 0x86E346D4            http://patrick-nagel.net/key.asc
Fingerprint: 7745 E1BE FA8B FBAD 76AB 2BFC C981 E686 86E3 46D4
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkiNatsACgkQyYHmhobjRtRV+QCfeFglOyurwqrIW4bAejyAvFCl
rCYAni1BzvCmZJzqfJossvZJt7atZEzI
=pJEN
-----END PGP SIGNATURE-----


_______________________________________________
rdiff-backup-users mailing list at address@hidden
http://lists.nongnu.org/mailman/listinfo/rdiff-backup-users
Wiki URL: http://rdiff-backup.solutionsfirst.com.au/index.php/RdiffBackupWiki



import glob
import os
import shutil
import sys
import tarfile
import urllib

RDIFF_BACKUP_VERSION = '1.2.0'
RDIFF_BACKUP_NAME = 'rdiff-backup-'+RDIFF_BACKUP_VERSION

RDIFF_BACKUP_URL = 
'http://savannah.nongnu.org/download/rdiff-backup/'+RDIFF_BACKUP_NAME+'.tar.gz'
LIBRSYNC_URL = 
'http://superb-east.dl.sourceforge.net/sourceforge/librsync/librsync-0.9.7.tar.gz'

LIBRSYNC_VCPROJ_TEXT = r"""<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
        ProjectType="Visual C++"
        Version="7.10"
        Name="librsync"
        ProjectGUID="{B7D1448D-017B-4035-86A1-12B5B736101F}"
        RootNamespace="librsync"
        Keyword="Win32Proj">
        <Platforms>
                <Platform
                        Name="Win32"/>
        </Platforms>
        <Configurations>
                <Configuration
                        Name="Release|Win32"
                        OutputDirectory="Release"
                        IntermediateDirectory="Release"
                        ConfigurationType="4"
                        CharacterSet="2">
                        <Tool
                                Name="VCCLCompilerTool"
                                AdditionalIncludeDirectories="popt; .\"
                                PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
                                MinimalRebuild="TRUE"
                                RuntimeLibrary="0"
                                UsePrecompiledHeader="0"
                                WarningLevel="3"
                                Detect64BitPortabilityProblems="FALSE"
                                DebugInformationFormat="3"/>
                        <Tool
                                Name="VCCustomBuildTool"/>
                        <Tool
                                Name="VCLibrarianTool"
                                OutputFile="$(OutDir)/rsync.lib"
                                IgnoreAllDefaultLibraries="TRUE"
                                IgnoreDefaultLibraryNames=""/>
                        <Tool
                                Name="VCMIDLTool"/>
                        <Tool
                                Name="VCPostBuildEventTool"/>
                        <Tool
                                Name="VCPreBuildEventTool"/>
                        <Tool
                                Name="VCPreLinkEventTool"/>
                        <Tool
                                Name="VCResourceCompilerTool"/>
                        <Tool
                                Name="VCWebServiceProxyGeneratorTool"/>
                        <Tool
                                Name="VCXMLDataGeneratorTool"/>
                        <Tool
                                Name="VCManagedWrapperGeneratorTool"/>
                        <Tool
                                Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
                </Configuration>
        </Configurations>
        <References>
        </References>
        <Files>
                <Filter
                        Name="Source Files"
                        Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
                        
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
                        <File
                                RelativePath=".\base64.c">
                        </File>
                        <File
                                RelativePath=".\buf.c">
                        </File>
                        <File
                                RelativePath=".\checksum.c">
                        </File>
                        <File
                                RelativePath=".\command.c">
                        </File>
                        <File
                                RelativePath=".\delta.c">
                        </File>
                        <File
                                RelativePath=".\emit.c">
                        </File>
                        <File
                                RelativePath=".\fileutil.c">
                        </File>
                        <File
                                RelativePath=".\popt\findme.c">
                        </File>
                        <File
                                RelativePath=".\hex.c">
                        </File>
                        <File
                                RelativePath=".\isprefix.c">
                        </File>
                        <File
                                RelativePath=".\job.c">
                        </File>
                        <File
                                RelativePath=".\mdfour.c">
                        </File>
                        <File
                                RelativePath=".\mksum.c">
                        </File>
                        <File
                                RelativePath=".\msg.c">
                        </File>
                        <File
                                RelativePath=".\netint.c">
                        </File>
                        <File
                                RelativePath=".\patch.c">
                        </File>
                        <File
                                RelativePath=".\popt\popt.c">
                        </File>
                        <File
                                RelativePath=".\popt\poptconfig.c">
                        </File>
                        <File
                                RelativePath=".\popt\popthelp.c">
                        </File>
                        <File
                                RelativePath=".\popt\poptparse.c">
                        </File>
                        <File
                                RelativePath=".\prototab.c">
                        </File>
                        <File
                                RelativePath=".\rdiff.c">
                        </File>
                        <File
                                RelativePath=".\readsums.c">
                        </File>
                        <File
                                RelativePath=".\rollsum.c">
                        </File>
                        <File
                                RelativePath=".\scoop.c">
                        </File>
                        <File
                                RelativePath=".\search.c">
                        </File>
                        <File
                                RelativePath=".\snprintf.c">
                        </File>
                        <File
                                RelativePath=".\stats.c">
                        </File>
                        <File
                                RelativePath=".\stream.c">
                        </File>
                        <File
                                RelativePath=".\sumset.c">
                        </File>
                        <File
                                RelativePath=".\trace.c">
                        </File>
                        <File
                                RelativePath=".\tube.c">
                        </File>
                        <File
                                RelativePath=".\util.c">
                        </File>
                        <File
                                RelativePath=".\version.c">
                        </File>
                        <File
                                RelativePath=".\whole.c">
                        </File>
                </Filter>
        </Files>
        <Globals>
        </Globals>
</VisualStudioProject>
"""

LIBRSYNC_SLN_TEXT = r"""Microsoft Visual Studio Solution File, Format Version 8.00 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "librsync", "librsync.vcproj", "{B7D1448D-017B-4035-86A1-12B5B736101F}"
        ProjectSection(ProjectDependencies) = postProject
        EndProjectSection
EndProject
Global
        GlobalSection(SolutionConfiguration) = preSolution
                Debug = Debug
                Release = Release
        EndGlobalSection
        GlobalSection(ProjectConfiguration) = postSolution
                {B7D1448D-017B-4035-86A1-12B5B736101F}.Debug.ActiveCfg = 
Debug|Win32
                {B7D1448D-017B-4035-86A1-12B5B736101F}.Debug.Build.0 = 
Debug|Win32
{B7D1448D-017B-4035-86A1-12B5B736101F}.Release.ActiveCfg = Release| Win32 {B7D1448D-017B-4035-86A1-12B5B736101F}.Release.Build.0 = Release| Win32
        EndGlobalSection
        GlobalSection(ExtensibilityGlobals) = postSolution
        EndGlobalSection
        GlobalSection(ExtensibilityAddIns) = postSolution
        EndGlobalSection
EndGlobal
"""

CONFIG_H_TEXT = """
#define SIZEOF_UNSIGNED_INT 4

#define PACKAGE "librsync"
#define VERSION "0.9.7"
#define RS_CANONICAL_HOST "librsync.sourceforge.net"

#define inline
"""


class BuildError(Exception):
        pass

def copy(src_pattern, dest_dir):
        if '*' in src_pattern:
                files = glob.glob(src_pattern)
        else:
                files = [src_pattern]
        for file in files:
shutil.copyfile(file, os.path.join(dest_dir, os.path.basename(file)))

def unzip(src_file, target_dir):
        print 'Extracting %s...' % src_file
        extension = src_file.rpartition('.')[2]
        tar = tarfile.open(src_file, 'r:'+extension)
        for tarinfo in tar:
dest_path = os.path.join(target_dir, tarinfo.name.replace('/', os.sep))
                if tarinfo.isreg():
                        if not os.path.exists(dest_path):
                                tar.extract(tarinfo, target_dir)
                elif tarinfo.isdir():
                        if not os.path.isdir(dest_path):
                                os.mkdir(dest_path)
                elif tarinfo.issym():
                        pass # We don't care about symlinks
                else:
                        raise ValueError, 'Unhandled .tar.gz file:'+str(tarinfo)
        tar.close()

def verify_env(require_cvs):
        for path in os.environ['PATH'].split(';'):
                if os.path.exists(os.path.join(path, 'devenv.exe')):
                        break
        else:
                raise BuildError, '''This script must be run from \
the Visual Studio 2003 Commandline.'''

        if require_cvs:
                for path in os.environ['PATH'].split(';'):
                        if os.path.exists(os.path.join(path, 'cvs.exe')):
                                break
                else:
                        raise BuildError, '''Cvs.exe (CVSNT) must be in the 
path.'''

def download_file(url, target_dir):
        filename = os.path.basename(url)
        target_name = os.path.join(target_dir, filename)
        if not os.path.exists(target_name):
                print 'Downloading %s...' % url
                urllib.urlretrieve(url, target_name)

        unzip(target_name, target_dir)

def write_text(filepath, text):
        file = open(filepath, 'w')
        file.write(text)
        file.close()

def build_librsync(root_dir):
        # Download package if necessary
        download_file(LIBRSYNC_URL, root_dir)

        # Add in support files and build
        librsync_dir = os.path.join(root_dir, 'librsync-0.9.7')
write_text(os.path.join(librsync_dir, 'librsync.sln'), LIBRSYNC_SLN_TEXT) write_text(os.path.join(librsync_dir, 'librsync.vcproj'), LIBRSYNC_VCPROJ_TEXT)
        write_text(os.path.join(librsync_dir, 'config.h'), CONFIG_H_TEXT)
        
        sln_path = os.path.join(librsync_dir, 'librsync.sln')
        if os.system('devenv %s /build Release' % sln_path):
                raise BuildError, 'Unable to build librsync.'

        # Copy built library to where rdiff-backup's setup.py expects it
        output_dir = os.path.join(librsync_dir, 'lib')
        if not os.path.isdir(output_dir):
                os.mkdir(output_dir)
        lib_path = os.path.join(librsync_dir, 'Release', 'rsync.lib')
        copy(lib_path, output_dir)

        # Copy include files to where rdiff-backup expects them
        include_dir = os.path.join(librsync_dir, 'include')
        if not os.path.isdir(include_dir):
                os.mkdir(include_dir)
        for file in ('librsync.h', 'librsync-config.h'):
                copy(os.path.join(librsync_dir, file), include_dir)

def build_rdiff_backup(use_cvs, rebuild, root_dir, output_dir):
        rdiff_dir = os.path.join(root_dir, 'rdiff-backup')
        librsync_dir = os.path.join(root_dir, 'librsync-0.9.7')

        # Check out rdiff-backup
        if rebuild:
                if os.path.exists(rdiff_dir):
                        shutil.rmtree(rdiff_dir)

        if use_cvs:
                if not os.path.isdir(rdiff_dir):
                        os.chdir(root_dir)
if os.system('cvs -z3 - d:pserver:address@hidden:/sources/rdiff-backup co .'):
                                raise BuildError, 'Unable to check out 
rdiff-backup!'

                        # Patch rdiff-backup
                        os.chdir(rdiff_dir)
                        patch_exe = 'patch.exe'
                        for patch in ():
                                if os.system('%s -N < %s' % (patch_exe, patch)):
                                        raise BuildError, 'Unable to patch 
rdiff-backup!'

                # Make an rdiff-backup dist package
                os.chdir(rdiff_dir)
                if os.system('python dist\\makedist ' + RDIFF_BACKUP_VERSION):
                        raise BuildError, 'Unable to make rdiff-backup dist 
package.'

                # There is now a built version in the rdiff-backup dir.
                # Extract it, build it, and copy the exe to output_dir.
                rdiff_output_name = 'rdiff-backup-'+RDIFF_BACKUP_VERSION
                rdiff_tar = os.path.join(rdiff_dir, rdiff_output_name + 
'.tar.gz')
                unzip(rdiff_tar, rdiff_dir)
        else:
                if not os.path.exists(rdiff_dir):
                        os.mkdir(rdiff_dir)
                download_file(RDIFF_BACKUP_URL, rdiff_dir)
                rdiff_output_name = RDIFF_BACKUP_NAME

        os.chdir(os.path.join(rdiff_dir, rdiff_output_name))

        # Build rdiff-backup
        if os.system('setup.py build --librsync-dir=%s --lflags=%s' % \
                                (librsync_dir, '/NODEFAULTLIB:libcmt.lib')):
                raise BuildError, 'Unable to build rdiff-backup.'
        if os.system('setup.py py2exe --single-file > NUL'):
                raise BuildError, 'Unable to rdiff-backup via py2exe.'

        copy(os.path.join('dist', 'rdiff-backup.exe'), output_dir)

if __name__ == '__main__':
        root_dir = os.path.dirname(__file__)
        target_dir = os.path.join(root_dir, 'temp')
        output_dir = os.path.join(root_dir, 'output')
        rebuild = '--rebuild' in sys.argv[1:]
        use_cvs = '--cvs' in sys.argv[1:]
        for dir in (target_dir, output_dir):
                if not os.path.isdir(dir):
                        os.makedirs(dir)

        verify_env(use_cvs)
        build_librsync(target_dir)
        build_rdiff_backup(use_cvs, rebuild, target_dir, output_dir)

_______________________________________________
rdiff-backup-users mailing list at address@hidden
http://lists.nongnu.org/mailman/listinfo/rdiff-backup-users
Wiki URL: http://rdiff-backup.solutionsfirst.com.au/index.php/RdiffBackupWiki





reply via email to

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