[darwinbuild-changes] [635] branches/PR-7250612/darwinup/Depot.cpp

source_changes at macosforge.org source_changes at macosforge.org
Wed Nov 11 10:25:38 PST 2009


Revision: 635
          http://trac.macosforge.org/projects/darwinbuild/changeset/635
Author:   wsiegrist at apple.com
Date:     2009-11-11 10:25:38 -0800 (Wed, 11 Nov 2009)
Log Message:
-----------
Always use copyfile to backup files so there is no chance of the host system needing a file we temporarily moved out of the way.

Modified Paths:
--------------
    branches/PR-7250612/darwinup/Depot.cpp

Modified: branches/PR-7250612/darwinup/Depot.cpp
===================================================================
--- branches/PR-7250612/darwinup/Depot.cpp	2009-11-11 18:13:31 UTC (rev 634)
+++ branches/PR-7250612/darwinup/Depot.cpp	2009-11-11 18:25:38 UTC (rev 635)
@@ -467,36 +467,9 @@
 		++context->files_modified;
 
 		// XXX: res = file->backup()
+		IF_DEBUG("[backup] copyfile(%s, %s)\n", path, dstpath);
+		res = copyfile(path, dstpath, NULL, COPYFILE_ALL);
 
-		// copy files used by gnutar and libarchive instead of moving them
-		//  since we use tar during the archive process
-		size_t i = 0;
-		bool docopy = false;
-		const char* tarfiles[] = {"/usr/bin/tar",
-					  "/usr/bin/gnutar",
-					  "/usr/bin/bsdtar",
-					  "/usr/lib/dyld",
-					  "/usr/lib/libarchive",
-					  "/usr/lib/libbz2",
-					  "/usr/lib/libz",
-					  "/usr/lib/libSystem",
-					  "/usr/lib/libiconv",
-					  "/usr/lib/libgcc_s"};
-		size_t numfiles = sizeof(tarfiles)/sizeof(*tarfiles);
-		for (i = 0; i < numfiles; i++) {
-		        if (strncmp(tarfiles[i], relpath, strlen(tarfiles[i])) == 0) {
-			        docopy = true;
-				break;
-			}
-		}
-		if (docopy) {
-		        IF_DEBUG("[backup] copyfile(%s, %s)\n", path, dstpath);
-			res = copyfile(path, dstpath, NULL, COPYFILE_ALL);
-		} else {
-		        IF_DEBUG("[backup] rename(%s, %s)\n", path, dstpath);
-			res = rename(path, dstpath);
-		}
-
 		if (res != 0) fprintf(stderr, "%s:%d: backup failed: %s: %s (%d)\n", __FILE__, __LINE__, dstpath, strerror(errno), errno);
 		free(path);
 		free(dstpath);
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/darwinbuild-changes/attachments/20091111/e1b55039/attachment-0001.html>


More information about the darwinbuild-changes mailing list