git-svn-id: https://s3tools.svn.sourceforge.net/svnroot/s3tools/s3cmd/branches/amax-follow-symlinks@424 830e0280-6d2a-0410-9c65-932aecc39d9d
... | ... |
@@ -335,7 +335,7 @@ if have_wget: |
335 | 335 |
## ====== Sync more to S3 |
336 | 336 |
test_s3cmd("Sync more to S3", ['sync', 'testsuite/', 's3://%s/xyz/' % bucket(1), '--no-encrypt' ], |
337 | 337 |
must_find = [ "File 'testsuite/.svn/entries' stored as '%s/xyz/.svn/entries' " % pbucket(1) ], |
338 |
- must_not_find_re = [ "linked.png"]) |
|
338 |
+ must_not_find = [ "File 'testsuite/etc/linked.png' stored as '%s/xyz/etc/linked.png" % pbucket(1) ]) |
|
339 | 339 |
|
340 | 340 |
|
341 | 341 |
|
... | ... |
@@ -392,6 +392,10 @@ test_s3cmd("Recursive copy, set ACL", ['cp', '-r', '--acl-public', '%s/xyz/' % p |
392 | 392 |
"File %s/xyz/blahBlah/blah.txt copied to %s/copy/blahBlah/blah.txt" % (pbucket(1), pbucket(2)) ], |
393 | 393 |
must_not_find = [ ".svn" ]) |
394 | 394 |
|
395 |
+## ====== Sync symbolic links |
|
396 |
+test_s3cmd("Sync symbolic links", ['sync', 'testsuite/', 's3://%s/xyz/' % bucket(1), '--no-encrypt', '--follow-symlinks' ], |
|
397 |
+ must_find_re = [ "linked.png"]) |
|
398 |
+ |
|
395 | 399 |
## ====== Verify ACL and MIME type |
396 | 400 |
test_s3cmd("Verify ACL and MIME type", ['info', '%s/copy/etc2/Logo.PNG' % pbucket(2) ], |
397 | 401 |
must_find_re = [ "MIME type:.*image/png", |
... | ... |
@@ -440,7 +444,3 @@ test_s3cmd("Remove empty bucket", ['rb', pbucket(1)], |
440 | 440 |
test_s3cmd("Remove remaining buckets", ['rb', '--recursive', pbucket(2), pbucket(3)], |
441 | 441 |
must_find = [ "Bucket '%s/' removed" % pbucket(2), |
442 | 442 |
"Bucket '%s/' removed" % pbucket(3) ]) |
443 |
- |
|
444 |
-## ====== Sync symbolic links |
|
445 |
-test_s3cmd("Sync symbolic links", ['sync', 'testsuite/', 's3://%s/xyz/' % bucket(1), '--no-encrypt' ], |
|
446 |
- must_find_re = [ "linked.png"]) |
... | ... |
@@ -635,9 +635,8 @@ def _get_filelist_local(local_uri): |
635 | 635 |
if not os.path.isfile(full_name): |
636 | 636 |
continue |
637 | 637 |
if os.path.islink(full_name): |
638 |
- ## Synchronize symlinks... one day |
|
639 |
- ## for now skip over |
|
640 |
- continue |
|
638 |
+ if not cfg.follow_symlinks: |
|
639 |
+ continue |
|
641 | 640 |
relative_file = unicodise(os.path.join(rel_root, f)) |
642 | 641 |
if os.path.sep != "/": |
643 | 642 |
# Convert non-unix dir separators to '/' |
... | ... |
@@ -1623,6 +1622,7 @@ def main(): |
1623 | 1623 |
optparser.add_option("-v", "--verbose", dest="verbosity", action="store_const", const=logging.INFO, help="Enable verbose output.") |
1624 | 1624 |
optparser.add_option("-d", "--debug", dest="verbosity", action="store_const", const=logging.DEBUG, help="Enable debug output.") |
1625 | 1625 |
optparser.add_option( "--version", dest="show_version", action="store_true", help="Show s3cmd version (%s) and exit." % (PkgInfo.version)) |
1626 |
+ optparser.add_option("-F", "--follow-symlinks", dest="follow_symlinks", action="store_true", default=False, help="Follow symbolic links as if they are regular files") |
|
1626 | 1627 |
|
1627 | 1628 |
optparser.set_usage(optparser.usage + " COMMAND [parameters]") |
1628 | 1629 |
optparser.set_description('S3cmd is a tool for managing objects in '+ |
... | ... |
@@ -1757,6 +1757,9 @@ def main(): |
1757 | 1757 |
cfg.include.extend(patterns_list) |
1758 | 1758 |
cfg.debug_include.update(patterns_textual) |
1759 | 1759 |
|
1760 |
+ ## Process --follow-symlinks |
|
1761 |
+ cfg.update_option("follow_symlinks", options.follow_symlinks) |
|
1762 |
+ |
|
1760 | 1763 |
if cfg.encrypt and cfg.gpg_passphrase == "": |
1761 | 1764 |
error(u"Encryption requested but no passphrase set in config file.") |
1762 | 1765 |
error(u"Please re-run 's3cmd --configure' and supply it.") |