diff options
-rw-r--r-- | NEWS | 4 | ||||
-rw-r--r-- | obnam.1.in | 14 | ||||
-rw-r--r-- | obnamlib/plugins/convert5to6_plugin.py | 87 | ||||
-rwxr-xr-x | tests/convert5to6.script | 39 | ||||
-rw-r--r-- | without-tests | 1 |
5 files changed, 4 insertions, 141 deletions
@@ -6,6 +6,10 @@ This file summarizes changes between releases of Obnam. Version 1./, released UNRELEASED -------------------------------- +* The `convert5to6` subcommand has been removed. If you need to + convert from a pre-1.0 backup repository, and haven't done so yet, + please use Obnam version 1.6.1 or earlier to do so. + Bug fixes: * Obnam now creates a `trustdb.gpg` in the temporary GNUPGHOME it uses @@ -517,20 +517,6 @@ This can result in a crash. It will not result in corrupt data, or incorrect restores. However, you may need to restart the read-only operation after a crash. -.SS "Repository format conversion" -The -.B convert5to6 -subcommand converts a repository of format 5 to format 6. -It is somewhat dangerous! -It modifies the repository in place, -so you should be careful. -You should do a hardlink copy of the repository before converting: -.IP -cp -al repo repo.format5 -.PP -You should also run this with local filesystem access to the repository, -rather than sftp, -to avoid abysmal performance. .\"--------------------------------------------------------------------- .SH OPTIONS .SS "Option values" diff --git a/obnamlib/plugins/convert5to6_plugin.py b/obnamlib/plugins/convert5to6_plugin.py deleted file mode 100644 index cc5515a4..00000000 --- a/obnamlib/plugins/convert5to6_plugin.py +++ /dev/null @@ -1,87 +0,0 @@ -# Copyright (C) 2012 Lars Wirzenius -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. - - -import logging -import os -import re -import stat -import tracing -import zlib - -import obnamlib - - -class Convert5to6Plugin(obnamlib.ObnamPlugin): - - '''Convert a version 5 repository to version 6, in place.''' - - def enable(self): - self.app.add_subcommand('convert5to6', self.convert, arg_synopsis='') - - def convert(self, args): - self.app.settings.require('repository') - - self.rawfs = self.app.fsf.new(self.app.settings['repository']) - self.convert_format() - self.repo = self.app.open_repository() - self.convert_files() - - def convert_files(self): - funcs = [] - if self.app.settings['compress-with'] == 'gzip': - funcs.append(self.gunzip) - if self.app.settings['encrypt-with']: - self.symmetric_keys = {} - funcs.append(self.decrypt) - tracing.trace('funcs=%s' % repr(funcs)) - - for filename in self.find_files(): - logging.debug('converting file %s' % filename) - data = self.rawfs.cat(filename) - tracing.trace('old data is %d bytes' % len(data)) - for func in funcs: - data = func(filename, data) - tracing.trace('new data is %d bytes' % len(data)) - self.repo.fs.overwrite_file(filename, data) - - def find_files(self): - ignored_pat = re.compile(r'^(tmp.*|lock|format|userkeys|key)$') - for filename, st in self.rawfs.scan_tree('.'): - ignored = ignored_pat.match(os.path.basename(filename)) - if stat.S_ISREG(st.st_mode) and not ignored: - assert filename.startswith('./') - yield filename[2:] - - def get_symmetric_key(self, filename): - toplevel = filename.split('/')[0] - tracing.trace('toplevel=%s' % toplevel) - - if toplevel not in self.symmetric_keys: - encoded = self.rawfs.cat(os.path.join(toplevel, 'key')) - key = obnamlib.decrypt_with_secret_keys(encoded) - self.symmetric_keys[toplevel] = key - return self.symmetric_keys[toplevel] - - def decrypt(self, filename, data): - symmetric_key = self.get_symmetric_key(filename) - return obnamlib.decrypt_symmetric(data, symmetric_key) - - def gunzip(self, filename, data): - return zlib.decompress(data) - - def convert_format(self): - self.rawfs.overwrite_file('metadata/format', '6\n') - diff --git a/tests/convert5to6.script b/tests/convert5to6.script deleted file mode 100755 index 92627d34..00000000 --- a/tests/convert5to6.script +++ /dev/null @@ -1,39 +0,0 @@ -#!/bin/sh -# Copyright 2012 Lars Wirzenius -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. - -# Do not include roots from previous generations in a new generation, -# when the user stops specifying them. - -set -eu - -cd "$DATADIR" -tar -xf "$SRCDIR/test-data/repo-format-5-encrypted-gzipped.tar.gz" -"$SRCDIR/tests/obnam" convert5to6 \ - -r repo --encrypt-with=1B321347 --compress-with=gzip -"$SRCDIR/tests/obnam" restore \ - -r repo --encrypt-with=1B321347 --compress-with=gzip --to=restored -(cd "restored/home/liw/obnam/convert-5to6/t" && - summain --exclude=Username --exclude=Uid --exclude=Group --exclude=Gid data) \ - > restored.summain - -# Not all filesystems support nanosecond timestamps, but that doesn't -# matter for us. So we remove the sub-second timestamps from both -# summain files. -"$SRCDIR/sed-in-place" '/^Mtime:/s/\.[0-9]* /.IGNORED /' \ - data.summain restored.summain - -diff -u data.summain restored.summain - diff --git a/without-tests b/without-tests index 8364d849..7263cb3e 100644 --- a/without-tests +++ b/without-tests @@ -27,6 +27,5 @@ ./.pc/debian-changes-0.22-2/obnamlib/plugins/backup_plugin.py ./.pc/debian-changes-0.22-2/obnamlib/plugins/fsck_plugin.py ./.pc/debian-changes-0.22-2/obnamlib/plugins/restore_plugin.py -obnamlib/plugins/convert5to6_plugin.py obnamlib/repo_interface.py obnamlib/plugins/fuse_plugin.py |