mirror of
https://github.com/borgbackup/borg.git
synced 2024-12-27 02:08:54 +00:00
Merge pull request #6859 from ThomasWaldmann/remove-attic-stuff-borg2
remove remainders of attic legacy
This commit is contained in:
commit
d5c91cd37b
7 changed files with 5 additions and 24 deletions
|
@ -1080,7 +1080,7 @@ def __init__(self, *, noatime, noctime, nobirthtime, numeric_ids, noflags, noacl
|
||||||
|
|
||||||
def stat_simple_attrs(self, st):
|
def stat_simple_attrs(self, st):
|
||||||
attrs = dict(mode=st.st_mode, uid=st.st_uid, gid=st.st_gid, mtime=safe_ns(st.st_mtime_ns))
|
attrs = dict(mode=st.st_mode, uid=st.st_uid, gid=st.st_gid, mtime=safe_ns(st.st_mtime_ns))
|
||||||
# borg can work with archives only having mtime (older attic archives do not have
|
# borg can work with archives only having mtime (very old borg archives do not have
|
||||||
# atime/ctime). it can be useful to omit atime/ctime, if they change without the
|
# atime/ctime). it can be useful to omit atime/ctime, if they change without the
|
||||||
# file content changing - e.g. to get better metadata deduplication.
|
# file content changing - e.g. to get better metadata deduplication.
|
||||||
if not self.noatime:
|
if not self.noatime:
|
||||||
|
|
|
@ -89,8 +89,7 @@ def build_parser_recreate(self, subparsers, common_parser, mid_common_parser):
|
||||||
There is no risk of data loss by this.
|
There is no risk of data loss by this.
|
||||||
|
|
||||||
``--chunker-params`` will re-chunk all files in the archive, this can be
|
``--chunker-params`` will re-chunk all files in the archive, this can be
|
||||||
used to have upgraded Borg 0.xx or Attic archives deduplicate with
|
used to have upgraded Borg 0.xx archives deduplicate with Borg 1.x archives.
|
||||||
Borg 1.x archives.
|
|
||||||
|
|
||||||
**USE WITH CAUTION.**
|
**USE WITH CAUTION.**
|
||||||
Depending on the PATHs and patterns given, recreate can be used to permanently
|
Depending on the PATHs and patterns given, recreate can be used to permanently
|
||||||
|
|
|
@ -135,7 +135,7 @@ class KeyType:
|
||||||
# in borg 2. all of its code and also the "borg key migrate-to-repokey" command was removed.
|
# in borg 2. all of its code and also the "borg key migrate-to-repokey" command was removed.
|
||||||
# if you still need to, you can use "borg key migrate-to-repokey" with borg 1.0, 1.1 and 1.2.
|
# if you still need to, you can use "borg key migrate-to-repokey" with borg 1.0, 1.1 and 1.2.
|
||||||
# Nowadays, we just dispatch this to RepoKey and assume the passphrase was migrated to a repokey.
|
# Nowadays, we just dispatch this to RepoKey and assume the passphrase was migrated to a repokey.
|
||||||
PASSPHRASE = 0x01 # legacy, attic and borg < 1.0
|
PASSPHRASE = 0x01 # legacy, borg < 1.0
|
||||||
PLAINTEXT = 0x02
|
PLAINTEXT = 0x02
|
||||||
REPO = 0x03
|
REPO = 0x03
|
||||||
BLAKE2KEYFILE = 0x04
|
BLAKE2KEYFILE = 0x04
|
||||||
|
|
|
@ -786,11 +786,6 @@ def handle_error(unpacked):
|
||||||
raise IntegrityError("(not available)")
|
raise IntegrityError("(not available)")
|
||||||
else:
|
else:
|
||||||
raise IntegrityError(args[0])
|
raise IntegrityError(args[0])
|
||||||
elif error == "AtticRepository":
|
|
||||||
if old_server:
|
|
||||||
raise Repository.AtticRepository("(not available)")
|
|
||||||
else:
|
|
||||||
raise Repository.AtticRepository(args[0])
|
|
||||||
elif error == "PathNotAllowed":
|
elif error == "PathNotAllowed":
|
||||||
if old_server:
|
if old_server:
|
||||||
raise PathNotAllowed("(unknown)")
|
raise PathNotAllowed("(unknown)")
|
||||||
|
|
|
@ -32,8 +32,6 @@
|
||||||
|
|
||||||
MAGIC = b"BORG_SEG"
|
MAGIC = b"BORG_SEG"
|
||||||
MAGIC_LEN = len(MAGIC)
|
MAGIC_LEN = len(MAGIC)
|
||||||
ATTIC_MAGIC = b"ATTICSEG"
|
|
||||||
assert len(ATTIC_MAGIC) == MAGIC_LEN
|
|
||||||
|
|
||||||
TAG_PUT = 0
|
TAG_PUT = 0
|
||||||
TAG_DELETE = 1
|
TAG_DELETE = 1
|
||||||
|
@ -152,9 +150,6 @@ class InvalidRepository(Error):
|
||||||
class InvalidRepositoryConfig(Error):
|
class InvalidRepositoryConfig(Error):
|
||||||
"""{} does not have a valid configuration. Check repo config [{}]."""
|
"""{} does not have a valid configuration. Check repo config [{}]."""
|
||||||
|
|
||||||
class AtticRepository(Error):
|
|
||||||
"""Attic repository detected. Please use borg <= 1.2 to run "borg upgrade {}"."""
|
|
||||||
|
|
||||||
class CheckNeeded(ErrorWithTraceback):
|
class CheckNeeded(ErrorWithTraceback):
|
||||||
"""Inconsistency detected. Please run "borg check {}"."""
|
"""Inconsistency detected. Please run "borg check {}"."""
|
||||||
|
|
||||||
|
@ -181,7 +176,6 @@ def __init__(
|
||||||
lock=True,
|
lock=True,
|
||||||
append_only=False,
|
append_only=False,
|
||||||
storage_quota=None,
|
storage_quota=None,
|
||||||
check_segment_magic=True,
|
|
||||||
make_parent_dirs=False,
|
make_parent_dirs=False,
|
||||||
):
|
):
|
||||||
self.path = os.path.abspath(path)
|
self.path = os.path.abspath(path)
|
||||||
|
@ -205,7 +199,6 @@ def __init__(
|
||||||
self.storage_quota = storage_quota
|
self.storage_quota = storage_quota
|
||||||
self.storage_quota_use = 0
|
self.storage_quota_use = 0
|
||||||
self.transaction_doomed = None
|
self.transaction_doomed = None
|
||||||
self.check_segment_magic = check_segment_magic
|
|
||||||
self.make_parent_dirs = make_parent_dirs
|
self.make_parent_dirs = make_parent_dirs
|
||||||
# v2 is the default repo version for borg 2.0
|
# v2 is the default repo version for borg 2.0
|
||||||
# v1 repos must only be used in a read-only way, e.g. for
|
# v1 repos must only be used in a read-only way, e.g. for
|
||||||
|
@ -498,12 +491,6 @@ def open(self, path, exclusive, lock_wait=None, lock=True):
|
||||||
self.storage_quota = parse_file_size(self.config.get("repository", "storage_quota", fallback=0))
|
self.storage_quota = parse_file_size(self.config.get("repository", "storage_quota", fallback=0))
|
||||||
self.id = unhexlify(self.config.get("repository", "id").strip())
|
self.id = unhexlify(self.config.get("repository", "id").strip())
|
||||||
self.io = LoggedIO(self.path, self.max_segment_size, self.segments_per_dir)
|
self.io = LoggedIO(self.path, self.max_segment_size, self.segments_per_dir)
|
||||||
if self.check_segment_magic:
|
|
||||||
# read a segment and check whether we are dealing with a non-upgraded Attic repository
|
|
||||||
segment = self.io.get_latest_segment()
|
|
||||||
if segment is not None and self.io.get_segment_magic(segment) == ATTIC_MAGIC:
|
|
||||||
self.close()
|
|
||||||
raise self.AtticRepository(path)
|
|
||||||
|
|
||||||
def info(self):
|
def info(self):
|
||||||
"""return some infos about the repo (must be opened first)"""
|
"""return some infos about the repo (must be opened first)"""
|
||||||
|
|
|
@ -34,7 +34,7 @@ def test_UNENCRYPTED(self):
|
||||||
self.assert_equal(got_data, data)
|
self.assert_equal(got_data, data)
|
||||||
|
|
||||||
def test_AES256_CTR_HMAC_SHA256(self):
|
def test_AES256_CTR_HMAC_SHA256(self):
|
||||||
# this tests the layout as in attic / borg < 1.2 (1 type byte, no aad)
|
# this tests the layout as in borg < 1.2 (1 type byte, no aad)
|
||||||
mac_key = b"Y" * 32
|
mac_key = b"Y" * 32
|
||||||
enc_key = b"X" * 32
|
enc_key = b"X" * 32
|
||||||
iv = 0
|
iv = 0
|
||||||
|
|
|
@ -102,7 +102,7 @@ def upgrade_compressed_chunk(self, *, chunk):
|
||||||
def upgrade_zlib_and_level(chunk):
|
def upgrade_zlib_and_level(chunk):
|
||||||
if ZLIB_legacy.detect(chunk):
|
if ZLIB_legacy.detect(chunk):
|
||||||
ctype = ZLIB.ID
|
ctype = ZLIB.ID
|
||||||
chunk = ctype + level + bytes(chunk) # get rid of the attic legacy: prepend separate type/level bytes
|
chunk = ctype + level + bytes(chunk) # get rid of the legacy: prepend separate type/level bytes
|
||||||
else:
|
else:
|
||||||
ctype = bytes(chunk[0:1])
|
ctype = bytes(chunk[0:1])
|
||||||
chunk = ctype + level + bytes(chunk[2:]) # keep type same, but set level
|
chunk = ctype + level + bytes(chunk[2:]) # keep type same, but set level
|
||||||
|
|
Loading…
Reference in a new issue