This reverts commit 730dbcc53ca4bc3d6186a2c9ef5256c52e56a4a2.
Michal Ludvig authored on 2013/05/23 13:45:26... | ... |
@@ -16,12 +16,6 @@ import base64 |
16 | 16 |
import errno |
17 | 17 |
import urllib |
18 | 18 |
|
19 |
-try: |
|
20 |
- import xattr |
|
21 |
- have_xattr = True |
|
22 |
-except: |
|
23 |
- have_xattr = False |
|
24 |
- |
|
25 | 19 |
from logging import debug, info, warning, error |
26 | 20 |
|
27 | 21 |
|
... | ... |
@@ -233,18 +227,6 @@ def mktmpfile(prefix = "/tmp/tmpfile-", randchars = 20): |
233 | 233 |
__all__.append("mktmpfile") |
234 | 234 |
|
235 | 235 |
def hash_file_md5(filename): |
236 |
- md5_xattr = Config.Config().md5_xattr |
|
237 |
- if have_xattr and md5_xattr is not None: |
|
238 |
- try: |
|
239 |
- md5sum = xattr.get(filename, md5_xattr, namespace=xattr.NS_USER) |
|
240 |
- debug("xattr.get(%s, %s) returned %s" % (filename, md5_xattr, md5sum)) |
|
241 |
- return md5sum |
|
242 |
- except: |
|
243 |
- pass |
|
244 |
- return hash_file_md5_io(filename) |
|
245 |
-__all__.append("hash_file_md5") |
|
246 |
- |
|
247 |
-def hash_file_md5_io(filename): |
|
248 | 236 |
h = md5() |
249 | 237 |
f = open(filename, "rb") |
250 | 238 |
while True: |
... | ... |
@@ -255,6 +237,7 @@ def hash_file_md5_io(filename): |
255 | 255 |
h.update(data) |
256 | 256 |
f.close() |
257 | 257 |
return h.hexdigest() |
258 |
+__all__.append("hash_file_md5") |
|
258 | 259 |
|
259 | 260 |
def mkdir_with_parents(dir_name): |
260 | 261 |
""" |
... | ... |
@@ -12,7 +12,6 @@ import re |
12 | 12 |
from subprocess import Popen, PIPE, STDOUT |
13 | 13 |
import locale |
14 | 14 |
import pwd |
15 |
-import xattr |
|
16 | 15 |
|
17 | 16 |
count_pass = 0 |
18 | 17 |
count_fail = 0 |
... | ... |
@@ -26,10 +25,8 @@ verbose = False |
26 | 26 |
|
27 | 27 |
if os.name == "posix": |
28 | 28 |
have_wget = True |
29 |
- have_md5sum = True |
|
30 | 29 |
elif os.name == "nt": |
31 | 30 |
have_wget = False |
32 |
- have_md5sum = False |
|
33 | 31 |
else: |
34 | 32 |
print "Unknown platform: %s" % os.name |
35 | 33 |
sys.exit(1) |
... | ... |
@@ -407,15 +404,6 @@ test_s3cmd("Don't check MD5", ['sync', 'testsuite/', 's3://%s/xyz/' % bucket(1), |
407 | 407 |
test_s3cmd("Check MD5", ['sync', 'testsuite/', 's3://%s/xyz/' % bucket(1), '--no-encrypt', '--check-md5'], |
408 | 408 |
must_find = [ "cksum1.txt" ]) |
409 | 409 |
|
410 |
-## ====== Check MD5 sum on Sync with Extended Attributes |
|
411 |
-if 'xattr' in sys.modules.keys() and have_md5sum: |
|
412 |
- os.system("echo 1234566789012 > testsuite/checksum/cksum4.txt") |
|
413 |
- test_s3cmd("Overwrite cksum1.txt", ['put', 'testsuite/checksum/cksum4.txt', 's3://%s/xyz/checksum/cksum1.txt' % bucket(1), '--no-encrypt' ]) |
|
414 |
- os.system("rm testsuite/checksum/cksum4.txt") |
|
415 |
- os.system("attr -s md5sum -V $(md5sum testsuite/checksum/cksum1.txt | awk '{print $1}') testsuite/checksum/cksum1.txt > /dev/null") |
|
416 |
- test_s3cmd("Check MD5 with xattr", ['sync', 'testsuite/', 's3://%s/xyz/' % bucket(1), '--no-encrypt', '--check-md5', '--xattr=md5sum'], |
|
417 |
- must_find = [ "cksum1.txt" ]) |
|
418 |
- |
|
419 | 410 |
|
420 | 411 |
## ====== Rename within S3 |
421 | 412 |
test_s3cmd("Rename within S3", ['mv', '%s/xyz/etc/logo.png' % pbucket(1), '%s/xyz/etc2/Logo.PNG' % pbucket(1)], |
... | ... |
@@ -26,8 +26,6 @@ import socket |
26 | 26 |
import shutil |
27 | 27 |
import tempfile |
28 | 28 |
import S3.Exceptions |
29 |
-try: import xattr |
|
30 |
-except: pass |
|
31 | 29 |
|
32 | 30 |
from copy import copy |
33 | 31 |
from optparse import OptionParser, Option, OptionValueError, IndentedHelpFormatter |
... | ... |
@@ -1831,8 +1829,6 @@ def main(): |
1831 | 1831 |
optparser.add_option( "--skip-existing", dest="skip_existing", action="store_true", help="Skip over files that exist at the destination (only for [get] and [sync] commands).") |
1832 | 1832 |
optparser.add_option("-r", "--recursive", dest="recursive", action="store_true", help="Recursive upload, download or removal.") |
1833 | 1833 |
optparser.add_option( "--check-md5", dest="check_md5", action="store_true", help="Check MD5 sums when comparing files for [sync]. (default)") |
1834 |
- if 'xattr' in sys.modules.keys(): |
|
1835 |
- optparser.add_option ("--xattr", dest="md5_xattr", metavar="ATTR", action="store", default=None, help="If possible, use extended file attribute ATTR from the user namespace containing the md5sum for the file, instead of calculating it [sync].") |
|
1836 | 1834 |
optparser.add_option( "--no-check-md5", dest="check_md5", action="store_false", help="Do not check MD5 sums when comparing files for [sync]. Only size will be compared. May significantly speed up transfer but may also miss some changed files.") |
1837 | 1835 |
optparser.add_option("-P", "--acl-public", dest="acl_public", action="store_true", help="Store objects with ACL allowing read for anyone.") |
1838 | 1836 |
optparser.add_option( "--acl-private", dest="acl_public", action="store_false", help="Store objects with default ACL allowing access for you only.") |
... | ... |
@@ -2015,7 +2011,6 @@ def main(): |
2015 | 2015 |
## Special handling for tri-state options (True, False, None) |
2016 | 2016 |
cfg.update_option("enable", options.enable) |
2017 | 2017 |
cfg.update_option("acl_public", options.acl_public) |
2018 |
- cfg.update_option("md5_xattr", options.md5_xattr) |
|
2019 | 2018 |
|
2020 | 2019 |
## Check multipart chunk constraints |
2021 | 2020 |
if cfg.multipart_chunk_size_mb < MultiPartUpload.MIN_CHUNK_SIZE_MB: |
... | ... |
@@ -165,9 +165,6 @@ Check MD5 sums when comparing files for [sync]. (default) |
165 | 165 |
\fB\-\-no\-check\-md5\fR |
166 | 166 |
Do not check MD5 sums when comparing files for [sync]. Only size will be compared. May significantly speed up transfer but may also miss some changed files. |
167 | 167 |
.TP |
168 |
-\fB-\-xattr\fR=ATTR |
|
169 |
-If possible, use extended file attribute ATTR from the user namespace containing the md5sum for the file, instead of calculating it [sync]. |
|
170 |
-.TP |
|
171 | 168 |
\fB\-P\fR, \fB\-\-acl\-public\fR |
172 | 169 |
Store objects with ACL allowing read for anyone. |
173 | 170 |
.TP |