3 # https://sourceware.org/bugzilla/show_bug.cgi?id=26034
4 export "BUP_ARGV_0"="$0"
7 export "BUP_ARGV_${arg_i}"="$arg"
11 bup_python="$(dirname "$0")/bup-python" || exit $?
12 exec "$bup_python" "$0"
16 from __future__ import absolute_import, print_function
19 sys.path[:0] = [os.path.dirname(os.path.realpath(__file__)) + '/../lib']
21 from bup import compat
22 from bup.io import byte_stream
25 # Print the full paths of all the files in each hardlink set
26 # underneath one of the paths. Separate sets with a blank line, sort
27 # the paths within each set, and sort the sets by their first path.
30 print("Usage: hardlink-sets <paths ...>", file=sys.stderr)
32 if len(compat.argv) < 2:
40 out = byte_stream(sys.stdout)
44 for p in compat.argvb[1:]:
45 for root, dirs, files in os.walk(p, onerror = on_walk_error):
46 for filename in files:
47 full_path = os.path.join(root, filename)
48 st = os.lstat(full_path)
49 if not stat.S_ISDIR(st.st_mode):
50 node = b'%d:%d' % (st.st_dev, st.st_ino)
51 link_paths = hardlink_set.get(node)
53 link_paths.append(full_path)
55 hardlink_set[node] = [full_path]
58 for node, link_paths in hardlink_set.items():
62 for link_paths in sorted(hardlink_set.values(), key = lambda x : x[0]):
63 if len(link_paths) > 1:
68 for p in sorted(link_paths):