remove support for bpath placeholder

this needs to get done differently later, maybe base64 for json output.
This commit is contained in:
Thomas Waldmann 2022-12-12 19:39:52 +01:00
parent 1e2741ad3d
commit b9dc2be661
No known key found for this signature in database
GPG Key ID: 243ACFA951F78E01
2 changed files with 4 additions and 7 deletions

View File

@ -114,8 +114,7 @@ class ListMixIn:
help="Format output as JSON Lines. " help="Format output as JSON Lines. "
"The form of ``--format`` is ignored, " "The form of ``--format`` is ignored, "
"but keys used in it are added to the JSON output. " "but keys used in it are added to the JSON output. "
"Some keys are always present. Note: JSON can only represent text. " "Some keys are always present. Note: JSON can only represent text.",
'A "bpath" key is therefore not available.',
) )
subparser.add_argument("name", metavar="NAME", type=NameSpec, help="specify the archive name") subparser.add_argument("name", metavar="NAME", type=NameSpec, help="specify the archive name")
subparser.add_argument( subparser.add_argument(

View File

@ -616,7 +616,7 @@ class BaseFormatter:
return ( return (
"- NEWLINE: OS dependent line separator\n" "- NEWLINE: OS dependent line separator\n"
"- NL: alias of NEWLINE\n" "- NL: alias of NEWLINE\n"
"- NUL: NUL character for creating print0 / xargs -0 like output, see bpath key below\n" "- NUL: NUL character for creating print0 / xargs -0 like output\n"
"- SPACE\n" "- SPACE\n"
"- TAB\n" "- TAB\n"
"- CR\n" "- CR\n"
@ -753,8 +753,7 @@ class ItemFormatter(BaseFormatter):
# shake_* is not provided because it uses an incompatible .digest() method to support variable length. # shake_* is not provided because it uses an incompatible .digest() method to support variable length.
hash_algorithms = set(hashlib.algorithms_guaranteed).union({"xxh64"}).difference({"shake_128", "shake_256"}) hash_algorithms = set(hashlib.algorithms_guaranteed).union({"xxh64"}).difference({"shake_128", "shake_256"})
KEY_DESCRIPTIONS = { KEY_DESCRIPTIONS = {
"bpath": "verbatim POSIX path, can contain any character except NUL", "path": "file path",
"path": "path interpreted as text (might be missing non-text characters, see bpath)",
"source": "link target for symlinks (identical to linktarget)", "source": "link target for symlinks (identical to linktarget)",
"hlid": "hard link identity (same if hardlinking same fs object)", "hlid": "hard link identity (same if hardlinking same fs object)",
"extra": 'prepends {source} with " -> " for soft links and " link to " for hard links', "extra": 'prepends {source} with " -> " for soft links and " link to " for hard links',
@ -765,7 +764,7 @@ class ItemFormatter(BaseFormatter):
"health": 'either "healthy" (file ok) or "broken" (if file has all-zero replacement chunks)', "health": 'either "healthy" (file ok) or "broken" (if file has all-zero replacement chunks)',
} }
KEY_GROUPS = ( KEY_GROUPS = (
("type", "mode", "uid", "gid", "user", "group", "path", "bpath", "source", "linktarget", "hlid", "flags"), ("type", "mode", "uid", "gid", "user", "group", "path", "source", "linktarget", "hlid", "flags"),
("size", "dsize", "num_chunks", "unique_chunks"), ("size", "dsize", "num_chunks", "unique_chunks"),
("mtime", "ctime", "atime", "isomtime", "isoctime", "isoatime"), ("mtime", "ctime", "atime", "isomtime", "isoctime", "isoatime"),
tuple(sorted(hash_algorithms)), tuple(sorted(hash_algorithms)),
@ -869,7 +868,6 @@ class ItemFormatter(BaseFormatter):
if self.json_lines: if self.json_lines:
item_data["healthy"] = "chunks_healthy" not in item item_data["healthy"] = "chunks_healthy" not in item
else: else:
item_data["bpath"] = item.path
item_data["extra"] = extra item_data["extra"] = extra
item_data["health"] = "broken" if "chunks_healthy" in item else "healthy" item_data["health"] = "broken" if "chunks_healthy" in item else "healthy"
item_data["source"] = source item_data["source"] = source