[darwinbuild-changes] [850] trunk

source_changes at macosforge.org source_changes at macosforge.org
Thu Jul 1 16:52:24 PDT 2010


Revision: 850
          http://trac.macosforge.org/projects/darwinbuild/changeset/850
Author:   wsiegrist at apple.com
Date:     2010-07-01 16:52:24 -0700 (Thu, 01 Jul 2010)
Log Message:
-----------
Merge PR-8116613

Modified Paths:
--------------
    trunk/darwinup/Archive.cpp
    trunk/darwinup/Utils.cpp

Property Changed:
----------------
    trunk/


Property changes on: trunk
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/PR-4841388:399-419
/branches/PR-6358021:442-443
/branches/PR-6392966:423-427
/branches/PR-6398060:433-434
/branches/PR-6493844:460-461
/branches/PR-6497694:466-468,471
/branches/PR-6634286:632-650
/branches/PR-6688645:479-490
/branches/PR-6722857:495-499
/branches/PR-6729491:655-664
/branches/PR-6973110:804-813
/branches/PR-7250612:635-650
/branches/PR-7341154:682-694
/branches/PR-7431723:660-664
/branches/PR-7461534:650-664
/branches/PR-7482850:670-671
/branches/PR-7489777:676-731
/branches/PR-7529688:692-694
/branches/PR-7593824:739-772
/branches/PR-7598640:703-731
/branches/PR-7748469:777-785
/branches/PR-7765119:790-791
/branches/PR-7798586:796-799
/branches/PR-7872907:830-840
/branches/PR-7935095:819-821
   + /branches/PR-4841388:399-419
/branches/PR-6358021:442-443
/branches/PR-6392966:423-427
/branches/PR-6398060:433-434
/branches/PR-6493844:460-461
/branches/PR-6497694:466-468,471
/branches/PR-6634286:632-650
/branches/PR-6688645:479-490
/branches/PR-6722857:495-499
/branches/PR-6729491:655-664
/branches/PR-6973110:804-813
/branches/PR-7250612:635-650
/branches/PR-7341154:682-694
/branches/PR-7431723:660-664
/branches/PR-7461534:650-664
/branches/PR-7482850:670-671
/branches/PR-7489777:676-731
/branches/PR-7529688:692-694
/branches/PR-7593824:739-772
/branches/PR-7598640:703-731
/branches/PR-7748469:777-785
/branches/PR-7765119:790-791
/branches/PR-7798586:796-799
/branches/PR-7872907:830-840
/branches/PR-7935095:819-821
/branches/PR-8116613:849

Modified: trunk/darwinup/Archive.cpp
===================================================================
--- trunk/darwinup/Archive.cpp	2010-06-28 22:35:07 UTC (rev 849)
+++ trunk/darwinup/Archive.cpp	2010-07-01 23:52:24 UTC (rev 850)
@@ -280,23 +280,14 @@
 			fprintf(stderr, "Error: could not fetch remote URL: %s \n", path);
 			return NULL;
 		}
-	} else if (is_userhost_path(path)) {
-		char* cleanpath;
-		// join with / to ensure all single slashes and a single trailing slash
-		int res = join_path(&cleanpath, path, "/");
-		assert(res==0);
-		size_t pathlen = strlen(cleanpath);
-		// remove trailing slash so rsync behavior is predictable
-		cleanpath[pathlen - 1] = '\0';
-	
-		IF_DEBUG("fetching userhost path from: %s to: %s \n", cleanpath, tmppath);
-		actpath = fetch_userhost(cleanpath, tmppath);
+	} else if (is_userhost_path(path)) {		
+		IF_DEBUG("fetching userhost path from: %s to: %s \n", path, tmppath);
+		actpath = fetch_userhost(path, tmppath);
 		IF_DEBUG("fetched %s \n", actpath);
 		if (!actpath) {
 			fprintf(stderr, "Error: could not fetch remote file from: %s \n", path);
 			return NULL;
 		}
-		free(cleanpath);
 	} else {
 		actpath = (char *)path;
 	}

Modified: trunk/darwinup/Utils.cpp
===================================================================
--- trunk/darwinup/Utils.cpp	2010-06-28 22:35:07 UTC (rev 849)
+++ trunk/darwinup/Utils.cpp	2010-07-01 23:52:24 UTC (rev 850)
@@ -257,30 +257,35 @@
 
 char* fetch_userhost(const char* srcpath, const char* dstpath) {
 	extern uint32_t verbosity;
+	int res = 0;
 
-	char* localfile;
-	int res = join_path(&localfile, dstpath, basename((char*)srcpath));
-	if (!localfile) return NULL;
+	// clean up srcpath by adding trailing slash
+	char* cleansrc;
+	res = join_path(&cleansrc, srcpath, "/");
+	if (res != 0) return NULL;
+
+	// make sure dstpath ends in basename of cleansrc for consistent rsync behavior
+	char* cleandst;
+	char* srccopy = strdup(cleansrc); // basename might modify input, so make a copy
+	res = join_path(&cleandst, dstpath, basename(srccopy));
+	if (res != 0) return NULL;
+
+	IF_DEBUG("rsync -a --delete %s %s %s \n", 
+			 (verbosity ? "-v" : "-q"), cleansrc, cleandst);
 	
-	// make sure dstpath has a trailing slash
-	char* cleanpath;
-	res = join_path(&cleanpath, dstpath, "/");
-	if (!cleanpath) return NULL;
-		
-	IF_DEBUG("rsync %s %s %s \n", (verbosity ? "-v" : "-q"), srcpath, cleanpath);
-	
 	const char* args[] = {
 		"/usr/bin/rsync",
 		(verbosity ? "-v" : "-q"),
 		"-a", "--delete",
-		srcpath,
-		cleanpath,
+		cleansrc,
+		cleandst,
 		NULL
 	};
 
-	free(cleanpath);
 	if (res == 0) res = exec_with_args(args);
-	if (res == 0) return localfile;
+	free(srccopy);
+	free(cleansrc);
+	if (res == 0) return cleandst;
 	return NULL;	
 }
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/darwinbuild-changes/attachments/20100701/a13a55d3/attachment.html>


More information about the darwinbuild-changes mailing list