Ticket #12629: macports-remotetime.patch
File macports-remotetime.patch, 3.6 KB (added by afb@…, 17 years ago) |
---|
-
configure.ac
79 79 AC_HEADER_SYS_WAIT 80 80 AC_HEADER_STAT 81 81 AC_CHECK_HEADERS([limits.h paths.h sys/file.h crt_externs.h fcntl.h sys/fcntl.h sys/cdefs.h err.h libgen.h sys/socket.h \ 82 readline/readline.h readline/history.h pwd.h sys/paths.h ])82 readline/readline.h readline/history.h pwd.h sys/paths.h utime.h]) 83 83 84 84 INCLUDES="-I.. -I. $INCLUDES" 85 85 -
src/pextlib1.0/curl.c
43 43 #include <string.h> 44 44 #endif 45 45 46 #ifdef HAVE_UTIME_H 47 #include <utime.h> 48 #endif 49 46 50 #include <curl/curl.h> 47 51 48 52 #include <tcl.h> … … 124 128 /** 125 129 * curl fetch subcommand entry point. 126 130 * 127 * syntax: curl fetch [-v] [--disable-epsv] [--ignore-ssl-cert] [- u userpass] [--effective-url lasturlvar] url filename131 * syntax: curl fetch [-v] [--disable-epsv] [--ignore-ssl-cert] [--remote-time] [-u userpass] [--effective-url lasturlvar] url filename 128 132 * 129 133 * @param interp current interpreter 130 134 * @param objc number of parameters … … 142 146 int noprogress = 1; 143 147 int useepsv = 1; 144 148 int ignoresslcert = 0; 149 int remotetime = 0; 145 150 const char* theUserPassString = NULL; 146 151 const char* effectiveURLVarName = NULL; 147 152 char* effectiveURL = NULL; … … 149 154 int lastoption; 150 155 const char* theURL; 151 156 const char* theFilePath; 157 long theFileTime = 0; 152 158 CURLcode theCurlCode; 153 159 struct curl_slist *headers = NULL; 154 160 … … 167 173 useepsv = 0; 168 174 } else if (strcmp(theOption, "--ignore-ssl-cert") == 0) { 169 175 ignoresslcert = 1; 176 } else if (strcmp(theOption, "--remote-time") == 0) { 177 remotetime = 1; 170 178 } else if (strcmp(theOption, "-u") == 0) { 171 179 /* check we also have the parameter */ 172 180 if (optioncrsr < lastoption) { … … 296 304 } 297 305 } 298 306 307 /* we want/don't want remote time */ 308 theCurlCode = curl_easy_setopt(theHandle, CURLOPT_FILETIME, remotetime); 309 if (theCurlCode != CURLE_OK) { 310 theResult = SetResultFromCurlErrorCode(interp, theCurlCode); 311 break; 312 } 313 299 314 /* set the l/p, if any */ 300 315 if (theUserPassString) { 301 316 theCurlCode = curl_easy_setopt(theHandle, CURLOPT_USERPWD, theUserPassString); … … 324 339 (void) fclose( theFile ); 325 340 theFile = NULL; 326 341 342 #ifdef HAVE_UTIME_H 343 if (remotetime) { 344 theCurlCode = curl_easy_getinfo(theHandle, CURLINFO_FILETIME, &theFileTime); 345 if (theFileTime > 0) { 346 struct utimbuf times; 347 times.actime = (time_t)theFileTime; 348 times.modtime = (time_t)theFileTime; 349 utime(theFilePath, ×); /* set the time we got */ 350 } 351 } 352 #endif /*HAVE_UTIME_H*/ 353 327 354 /* free header memory */ 328 355 curl_slist_free_all(headers); 329 356 -
src/port1.0/portfetch.tcl
433 433 ui_msg "$UI_PREFIX [format [msgcat::mc "Attempting to fetch %s from %s"] $distfile $site]" 434 434 set file_url [portfetch::assemble_url $site $distfile] 435 435 set effectiveURL "" 436 if {![catch {eval curl fetch -- effective-url effectiveURL $fetch_options {$file_url} ${distpath}/${distfile}.TMP} result] &&436 if {![catch {eval curl fetch --remote-time --effective-url effectiveURL $fetch_options {$file_url} ${distpath}/${distfile}.TMP} result] && 437 437 ![catch {system "mv ${distpath}/${distfile}.TMP ${distpath}/${distfile}"}]} { 438 438 439 439 # Special hack to check for sourceforge mirrors, which don't return a proper error code on failure