Lines 2550-2579
Link Here
|
2550 |
sys.exit(1) |
2550 |
sys.exit(1) |
2551 |
mytimeout=180 |
2551 |
mytimeout=180 |
2552 |
if portage.settings.has_key("RSYNC_TIMEOUT"): |
2552 |
if portage.settings.has_key("RSYNC_TIMEOUT"): |
|
|
2553 |
print "WARNING: usage of RSYNC_TIMEOUT is deprecated, use PORTAGE_RSYNC_OPTS instead" |
2553 |
try: |
2554 |
try: |
2554 |
mytimeout=int(portage.settings["RSYNC_TIMEOUT"]) |
2555 |
mytimeout=int(portage.settings["RSYNC_TIMEOUT"]) |
|
|
2556 |
rsync_flags.append("--timeout=%d" % mytimeout) |
2555 |
except SystemExit, e: |
2557 |
except SystemExit, e: |
2556 |
raise # Needed else can't exit |
2558 |
raise # Needed else can't exit |
2557 |
except: |
2559 |
except: |
2558 |
pass |
2560 |
pass |
2559 |
|
2561 |
|
2560 |
rsync_flags = [ |
2562 |
if (not portage.settings.has_key("PORTAGE_RSYNC_OPTS")) \ |
2561 |
"--recursive", # Recurse directories |
2563 |
or portage.settings["PORTAGE_RSYNC_OPTS"] == "": |
2562 |
"--links", # Consider symlinks |
2564 |
print "PORTAGE_RSYNC_OPTS empty or unset, using hardcoded defaults" |
2563 |
"--safe-links", # Ignore links outside of tree |
2565 |
rsync_flags = [ |
2564 |
"--perms", # Preserve permissions |
2566 |
"--recursive", # Recurse directories |
2565 |
"--times", # Preserive mod times |
2567 |
"--links", # Consider symlinks |
2566 |
"--compress", # Compress the data transmitted |
2568 |
"--safe-links", # Ignore links outside of tree |
2567 |
"--force", # Force deletion on non-empty dirs |
2569 |
"--perms", # Preserve permissions |
2568 |
"--whole-file", # Don't do block transfers, only entire files |
2570 |
"--times", # Preserive mod times |
2569 |
"--delete", # Delete files that aren't in the master tree |
2571 |
"--compress", # Compress the data transmitted |
2570 |
"--delete-after", # Delete only after everything else is done |
2572 |
"--force", # Force deletion on non-empty dirs |
2571 |
"--stats", # Show final statistics about what was transfered |
2573 |
"--whole-file", # Don't do block transfers, only entire files |
2572 |
"--timeout="+str(mytimeout), # IO timeout if not done in X seconds |
2574 |
"--delete", # Delete files that aren't in the master tree |
2573 |
"--exclude='/distfiles'", # Exclude distfiles from consideration |
2575 |
"--delete-after", # Delete only after everything else is done |
2574 |
"--exclude='/local'", # Exclude local from consideration |
2576 |
"--stats", # Show final statistics about what was transfered |
2575 |
"--exclude='/packages'", # Exclude packages from consideration |
2577 |
"--timeout="+str(mytimeout), # IO timeout if not done in X seconds |
2576 |
] |
2578 |
"--exclude='/distfiles'", # Exclude distfiles from consideration |
|
|
2579 |
"--exclude='/local'", # Exclude local from consideration |
2580 |
"--exclude='/packages'", # Exclude packages from consideration |
2581 |
] |
2582 |
rsync_opts = "" |
2583 |
else: |
2584 |
# handle default opts later |
2585 |
print "using PORTAGE_RSYNC_OPTS instead of hardcoded defaults" |
2586 |
rsync_flags = [] |
2587 |
rsync_opts = portage.settings["PORTAGE_RSYNC_OPTS"] |
2588 |
|
2589 |
# TODO: determine required options |
2590 |
for opt in ["--recursive","--times"]: |
2591 |
if not rsync_opts.find(opt) >= 0: |
2592 |
print yellow("WARNING:")+" adding required option %s not included in PORTAGE_RSYNC_OPTS" % opt |
2593 |
rsync_flags.append(opt) |
2594 |
|
2595 |
# TODO: determine options required for official servers |
2596 |
if syncuri.rstrip("/").endswith(".gentoo.org/gentoo-portage"): |
2597 |
if not rsync_opts.find("--timeout") >= 0: |
2598 |
rsync_flags.append("--timeout=180") |
2599 |
for opt in ["--compress", "--whole-file"]: |
2600 |
if not rsync_opts.find(opt) >= 0: |
2601 |
print yellow("WARNING:")+" adding required option %s not included in PORTAGE_RSYNC_OPTS" % opt |
2602 |
rsync_flags.append(opt) |
2603 |
for exclude in ["distfiles","local","packages"]: |
2604 |
opt = "--exclude='/"+exclude+"'" |
2605 |
if not rsync_opts.find(opt) >= 0: |
2606 |
print yellow("WARNING:")+" adding required option %s not included in PORTAGE_RSYNC_OPTS" % opt |
2607 |
rsync_flags.append(opt) |
2577 |
|
2608 |
|
2578 |
if "--quiet" in myopts: |
2609 |
if "--quiet" in myopts: |
2579 |
rsync_flags.append("--quiet") # Shut up a lot |
2610 |
rsync_flags.append("--quiet") # Shut up a lot |
Lines 2587-2601
Link Here
|
2587 |
rsync_flags.append("--checksum") # Force checksum on all files |
2618 |
rsync_flags.append("--checksum") # Force checksum on all files |
2588 |
|
2619 |
|
2589 |
if portage.settings.has_key("RSYNC_EXCLUDEFROM"): |
2620 |
if portage.settings.has_key("RSYNC_EXCLUDEFROM"): |
|
|
2621 |
print yellow("WARNING:")+" usage of RSYNC_EXCLUDEFROM is deprecated, use PORTAGE_RSYNC_OPTS instead" |
2590 |
if os.path.exists(portage.settings["RSYNC_EXCLUDEFROM"]): |
2622 |
if os.path.exists(portage.settings["RSYNC_EXCLUDEFROM"]): |
2591 |
rsync_flags.append("--exclude-from="+portage.settings["RSYNC_EXCLUDEFROM"]) |
2623 |
rsync_flags.append("--exclude-from="+portage.settings["RSYNC_EXCLUDEFROM"]) |
2592 |
else: |
2624 |
else: |
2593 |
print "!!! RSYNC_EXCLUDEFROM specified, but file does not exist." |
2625 |
print "!!! RSYNC_EXCLUDEFROM specified, but file does not exist." |
2594 |
|
2626 |
|
2595 |
if portage.settings.has_key("RSYNC_RATELIMIT"): |
2627 |
if portage.settings.has_key("RSYNC_RATELIMIT"): |
|
|
2628 |
print yellow("WARNING:")+" usage of RSYNC_RATELIMIT is deprecated, use PORTAGE_RSYNC_OPTS instead" |
2596 |
rsync_flags.append("--bwlimit="+portage.settings["RSYNC_RATELIMIT"]) |
2629 |
rsync_flags.append("--bwlimit="+portage.settings["RSYNC_RATELIMIT"]) |
2597 |
|
2630 |
|
2598 |
rsynccommand = "/usr/bin/rsync " + string.join(rsync_flags, " ") |
2631 |
rsynccommand = "/usr/bin/rsync " + rsync_opts + " " + string.join(rsync_flags, " ") |
|
|
2632 |
|
2633 |
print rsynccommand |
2599 |
|
2634 |
|
2600 |
servertimestampdir = portage.settings.depcachedir+"/" |
2635 |
servertimestampdir = portage.settings.depcachedir+"/" |
2601 |
servertimestampfile = portage.settings.depcachedir+"/timestamp.chk" |
2636 |
servertimestampfile = portage.settings.depcachedir+"/timestamp.chk" |