diff -r -u duplicity/duplicity/commandline.py duplicity-numeric-owner/duplicity/commandline.py --- duplicity/duplicity/commandline.py 2008-09-16 08:11:01.000000000 -0700 +++ duplicity-numeric-owner/duplicity/commandline.py 2008-10-29 12:54:50.000000000 -0700 @@ -84,6 +84,7 @@ "no-print-statistics", "null-separator", "num-retries=", + "numeric-owner", "restore-dir=", "restore-time=", "s3-european-buckets", @@ -229,6 +230,8 @@ globals.null_separator = 1 elif opt == "--num-retries": globals.num_retries = int(arg) + elif opt == "--numeric-owner": + globals.numeric_owner = True elif opt in ["-r", "--file-to-restore"]: globals.restore_dir = arg elif opt in ["-t", "--restore-time"]: @@ -346,6 +349,7 @@ --no-print-statistics --null-separator --num-retries + --numeric-owner --s3-european-buckets --s3-use-new-style --scp-command diff -r -u duplicity/duplicity/globals.py duplicity-numeric-owner/duplicity/globals.py --- duplicity/duplicity/globals.py 2008-08-01 11:15:53.000000000 -0700 +++ duplicity-numeric-owner/duplicity/globals.py 2008-10-29 10:44:17.000000000 -0700 @@ -126,3 +126,6 @@ # Whether to create European buckets (sorry, hard-coded to only # support european for now). s3_european_buckets = False + +# File owner uid keeps number from tar file. Like same option in gnu tar +numeric_owner = False diff -r -u duplicity/duplicity/tarfile.py duplicity-numeric-owner/duplicity/tarfile.py --- duplicity/duplicity/tarfile.py 2008-09-09 12:57:46.000000000 -0700 +++ duplicity-numeric-owner/duplicity/tarfile.py 2008-10-29 13:30:41.000000000 -0700 @@ -986,18 +986,24 @@ """ if pwd and os.geteuid() == 0: # We have to be root to do so. - try: g = gname2gid(tarinfo.gname) - except KeyError: - try: - gid2gname(tarinfo.gid) # Make sure gid exists - g = tarinfo.gid - except KeyError: g = os.getgid() - try: u = uname2uid(tarinfo.uname) - except KeyError: - try: - uid2uname(tarinfo.uid) # Make sure uid exists - u = tarinfo.uid - except KeyError: u = os.getuid() + if globals.numeric_owner: + g = tarinfo.gid + else: + try: g = gname2gid(tarinfo.gname) + except KeyError: + try: + gid2gname(tarinfo.gid) # Make sure gid exists + g = tarinfo.gid + except KeyError: g = os.getgid() + if globals.numeric_owner: + u = tarinfo.uid + else: + try: u = uname2uid(tarinfo.uname) + except KeyError: + try: + uid2uname(tarinfo.uid) # Make sure uid exists + u = tarinfo.uid + except KeyError: u = os.getuid() try: if tarinfo.issym() and hasattr(os, "lchown"): os.lchown(targetpath, u, g)