summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--obnamlib/plugins/convert5to6_plugin.py47
-rwxr-xr-xtests/convert5to6.script28
-rw-r--r--without-tests1
3 files changed, 76 insertions, 0 deletions
diff --git a/obnamlib/plugins/convert5to6_plugin.py b/obnamlib/plugins/convert5to6_plugin.py
new file mode 100644
index 00000000..b376981d
--- /dev/null
+++ b/obnamlib/plugins/convert5to6_plugin.py
@@ -0,0 +1,47 @@
+# 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 stat
+import ttystatus
+
+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.repo = self.app.open_repository()
+
+ self.convert_chunks()
+ self.convert_clients()
+
+ self.repo.fs.close()
+
+ def convert_chunks(self):
+ pass
+
+ def convert_clients(self):
+ pass
+
diff --git a/tests/convert5to6.script b/tests/convert5to6.script
new file mode 100755
index 00000000..9fb2cd79
--- /dev/null
+++ b/tests/convert5to6.script
@@ -0,0 +1,28 @@
+#!/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
+"$SRCDIR/tests/obnam" restore -r repo --to restored
+summain -r "restored/$DATADIR/data" > restored.summain
+diff -u data.summain restored.summain
+
diff --git a/without-tests b/without-tests
index 602ecf2f..0b0d1792 100644
--- a/without-tests
+++ b/without-tests
@@ -31,3 +31,4 @@
./.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