summaryrefslogtreecommitdiff
path: root/dump-bag
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2015-07-11 08:59:36 +0300
committerLars Wirzenius <liw@liw.fi>2015-07-11 08:59:36 +0300
commit02fcfa60efd70278ea40660abae3ea0ea6524649 (patch)
tree57fae5393b74e56bb2819533df247f5e078e240f /dump-bag
parent7166cf31347cdaa6bc333ccde1273c477235d6f8 (diff)
downloadobnam-02fcfa60efd70278ea40660abae3ea0ea6524649.tar.gz
Rename objdump and bagdump
This avoids me having to retrain my fingers, which are now very used to typing "ob<TAB>l<TAB>" to complete "obnamlib".
Diffstat (limited to 'dump-bag')
-rwxr-xr-xdump-bag43
1 files changed, 43 insertions, 0 deletions
diff --git a/dump-bag b/dump-bag
new file mode 100755
index 00000000..3c0fe6e5
--- /dev/null
+++ b/dump-bag
@@ -0,0 +1,43 @@
+#!/usr/bin/env python
+# Copyright 2015 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/>.
+#
+# =*= License: GPL-3+ =*=
+
+
+import sys
+
+import yaml
+
+import obnamlib
+
+
+def strip_filtering(blob):
+ # Dummy version, does not actually work if any compression or
+ # encryption has been used.
+ tag, remaining = blob.split('\0', 1)
+ return remaining
+
+
+for filename in sys.argv[1:]:
+ with open(filename) as f:
+ blob = f.read()
+ blob = strip_filtering(blob)
+ bag = obnamlib.deserialise_bag(blob)
+
+ decoded = []
+ for obj_blob in bag:
+ obj = obnamlib.deserialise_object(obj_blob)
+ yaml.safe_dump(obj, stream=sys.stdout)