summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris+github@qwirx.com>2006-08-30 08:53:55 +0000
committerChris Wilson <chris+github@qwirx.com>2006-08-30 08:53:55 +0000
commit535ab4aec14fd9ac2753762beb28d01114753a82 (patch)
treee5149fd53277192a927bbc1e37b8926b55259538
parent6c3dabe68da278f71b7c2c2b1da1858033504fce (diff)
* infrastructure/BoxPlatform.pm.in
* win32.bat * bin/bbackupd/BackupClientDirectoryRecord.cpp - Merged back changes from trunk
-rw-r--r--bin/bbackupd/BackupClientDirectoryRecord.cpp45
-rw-r--r--infrastructure/BoxPlatform.pm.in32
-rw-r--r--win32.bat17
3 files changed, 47 insertions, 47 deletions
diff --git a/bin/bbackupd/BackupClientDirectoryRecord.cpp b/bin/bbackupd/BackupClientDirectoryRecord.cpp
index 37bd3fea..946f2bb8 100644
--- a/bin/bbackupd/BackupClientDirectoryRecord.cpp
+++ b/bin/bbackupd/BackupClientDirectoryRecord.cpp
@@ -97,6 +97,33 @@ void BackupClientDirectoryRecord::DeleteSubDirectories()
// --------------------------------------------------------------------------
//
// Function
+// Name: MakeFullPath(const std::string& rDir, const std::string& rFile)
+// Purpose: Combine directory and file name
+// Created: 2006/08/10
+//
+// --------------------------------------------------------------------------
+static std::string MakeFullPath(const std::string& rDir,
+ const std::string& rFile)
+{
+ std::string result;
+
+ if (rDir.size() > 0 &&
+ rDir[rDir.size()-1] == DIRECTORY_SEPARATOR_ASCHAR)
+ {
+ result = rDir + rFile;
+ }
+ else
+ {
+ result = rDir + DIRECTORY_SEPARATOR + rFile;
+ }
+
+ return result;
+}
+
+
+// --------------------------------------------------------------------------
+//
+// Function
// Name: BackupClientDirectoryRecord::SyncDirectory(BackupClientDirectoryRecord::SyncParams &, int64_t, const std::string &, bool)
// Purpose: Syncronise, recusively, a local directory with the server.
// Created: 2003/10/08
@@ -207,8 +234,7 @@ void BackupClientDirectoryRecord::SyncDirectory(BackupClientDirectoryRecord::Syn
}
// Stat file to get info
- filename = rLocalPath + DIRECTORY_SEPARATOR +
- en->d_name;
+ filename = MakeFullPath(rLocalPath, en->d_name);
if(::lstat(filename.c_str(), &st) != 0)
{
@@ -512,7 +538,7 @@ bool BackupClientDirectoryRecord::UpdateItems(BackupClientDirectoryRecord::SyncP
f != rFiles.end(); ++f)
{
// Filename of this file
- std::string filename(rLocalPath + DIRECTORY_SEPARATOR + *f);
+ std::string filename(MakeFullPath(rLocalPath, *f));
// Get relevant info about file
box_time_t modTime = 0;
@@ -859,7 +885,7 @@ bool BackupClientDirectoryRecord::UpdateItems(BackupClientDirectoryRecord::SyncP
d != rDirs.end(); ++d)
{
// Get the local filename
- std::string dirname(rLocalPath + DIRECTORY_SEPARATOR + *d);
+ std::string dirname(MakeFullPath(rLocalPath, *d));
// See if it's in the listing (if we have one)
BackupStoreFilenameClear storeFilename(*d);
@@ -1063,10 +1089,13 @@ bool BackupClientDirectoryRecord::UpdateItems(BackupClientDirectoryRecord::SyncP
BackupClientDirectoryRecord *rec = e->second;
mSubDirectories.erase(e);
delete rec;
- TRACE2("Deleted directory record for "
- "%s" DIRECTORY_SEPARATOR "%s\n",
- rLocalPath.c_str(),
- dirname.GetClearFilename().c_str());
+
+ std::string name = MakeFullPath(
+ rLocalPath,
+ dirname.GetClearFilename());
+
+ TRACE1("Deleted directory record for "
+ "%s\n", name.c_str());
}
}
}
diff --git a/infrastructure/BoxPlatform.pm.in b/infrastructure/BoxPlatform.pm.in
index 81629414..828516e2 100644
--- a/infrastructure/BoxPlatform.pm.in
+++ b/infrastructure/BoxPlatform.pm.in
@@ -1,7 +1,7 @@
package BoxPlatform;
use Exporter;
@ISA = qw/Exporter/;
-@EXPORT = qw/$build_os $target_os $make_command $bsd_make $platform_define $platform_cpu $gcc_v3 $product_version $product_name $install_into_dir $sub_make_options $platform_compile_line_extra $platform_link_line_extra $platform_lib_files $platform_exe_ext $target_windows update_if_changed/;
+@EXPORT = qw/$build_os $target_os $make_command $bsd_make $platform_define $platform_cpu $gcc_v3 $product_version $product_name $install_into_dir $sub_make_options $platform_compile_line_extra $platform_link_line_extra $platform_lib_files $platform_exe_ext $target_windows/;
BEGIN
{
@@ -24,7 +24,6 @@ BEGIN
# Cygwin Builds usually something like CYGWIN_NT-5.0, CYGWIN_NT-5.1
# Box Backup tried on Win2000,XP only :)
-
$build_os = 'CYGWIN' if $build_os =~ m/CYGWIN/;
$make_command = ($build_os eq 'Darwin') ? 'bsdmake' : ($build_os eq 'SunOS') ? 'gmake' : 'make';
@@ -107,34 +106,5 @@ sub make_flag
return $_[0].'=1';
}
-sub update_if_changed ($)
-{
- my ($file) = @_;
- die "$file.new: not found" unless -r "$file.new";
-
- if (-r $file)
- {
- die "$file.new: not found" unless -r "$file.new";
- if (system("diff --brief $file $file.new") == 0)
- {
- unlink "$file.new";
- return;
- }
- }
-
- if (system("cp $file.new $file") != 0)
- {
- die "failed to copy $file.new to $file";
- }
-
- if (system("diff --brief $file $file.new") != 0)
- {
- die "$file and $file.new are still different";
- }
-
- unlink "$file.new";
- return;
-}
-
1;
diff --git a/win32.bat b/win32.bat
index e4a39359..81a97944 100644
--- a/win32.bat
+++ b/win32.bat
@@ -5,26 +5,27 @@ echo using Cygwin and Perl
copy .\infrastructure\BoxPlatform.pm.in .\infrastructure\BoxPlatform.pm
-cd .\bin\bbackupquery\ & perl ./../../bin/bbackupquery/makedocumentation.pl
+cd .\bin\bbackupquery\ & perl ./../../bin/bbackupquery/makedocumentation.pl.in
cd ..\..\
-cd .\lib\backupclient & perl ./../../lib/common/makeexception.pl BackupStoreException.txt
-perl ./../../lib/server/makeprotocol.pl Client ./../../bin/bbstored/backupprotocol.txt
+cd .\lib\backupclient & perl ./../../lib/common/makeexception.pl.in BackupStoreException.txt & perl ./../../lib/server/makeprotocol.pl.in Client ./../../bin/bbstored/backupprotocol.txt
cd ..\..\
-cd .\lib\compress & perl ./../../lib/common/makeexception.pl CompressException.txt
+cd .\lib\compress & perl ./../../lib/common/makeexception.pl.in CompressException.txt
cd ..\..\
-cd .\lib\common & perl ./../../lib/common/makeexception.pl CommonException.txt & perl ./../../lib/common/makeexception.pl ConversionException.txt
+cd .\lib\common & perl ./../../lib/common/makeexception.pl.in CommonException.txt & perl ./../../lib/common/makeexception.pl.in ConversionException.txt
cd ..\..\
-cd .\lib\crypto & perl ./../../lib/common/makeexception.pl CipherException.txt
+cd .\lib\crypto & perl ./../../lib/common/makeexception.pl.in CipherException.txt
cd ..\..\
echo server parts - which appears as though some of the clients rely on
-cd .\lib\server & perl ./../../lib/common/makeexception.pl ServerException.txt & perl ./../../lib/common/makeexception.pl ConnectionException.txt
+cd .\lib\server & perl ./../../lib/common/makeexception.pl.in ServerException.txt & perl ./../../lib/common/makeexception.pl.in ConnectionException.txt
cd ..\..\
-perl -i.orig -pe 's/@PERL@/perl/' ./test/bbackupd/testfiles/bbackupd.conf
+copy lib\win32\config.h.win32 lib\common\BoxConfig.h
+
+perl -pe 's/@PERL@/perl/' ./test/bbackupd/testfiles/bbackupd.conf.in > .\test\bbackupd\testfiles\bbackupd.conf