From 0149a1301c58a39713c8e2f73382685965f7378a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Aur=C3=A9lien=20Dunand?= <aurelien.dunand@smartjog.com>
Date: Mon, 25 Jul 2011 14:12:59 +0200
Subject: [PATCH] Add function to display packaged image content

---
 installsystems/image.py | 26 +++++++++++++++++++++++++-
 1 file changed, 25 insertions(+), 1 deletion(-)

diff --git a/installsystems/image.py b/installsystems/image.py
index 15b1b2b..860927b 100644
--- a/installsystems/image.py
+++ b/installsystems/image.py
@@ -45,7 +45,6 @@ class Image(object):
         '''
         return re.match("\d+", buf) is not None
 
-
 class SourceImage(Image):
     '''
     Image source manipulation class
@@ -418,6 +417,31 @@ class PackageImage(Image):
         arrowlevel(-1)
         return desc
 
+    def show(self, verbose=False, list=False):
+        '''
+        Display image content
+        '''
+        out('Name        : %s' % self.name)
+        out('Version     : %s' % self.version)
+        out('Date        : %s' % time.asctime(time.gmtime(self.date)))
+        if verbose:
+            out('Description : %s' % self.description)
+            out('Author      : %s' % self.author)
+            out('MD5         : %s' % self.md5 )
+            out('Payload :')
+            payloads = self.payload
+            for payload_name in payloads:
+                payload = payloads[payload_name]
+                out('   Name : %s' % payload_name)
+                out('   Date : %s' % time.asctime(time.gmtime(payload.mtime)))
+                out('   Size : %s' % (istools.human_size(payload.size)))
+                out('   MD5  : %s' % payload.md5)
+                out('')
+        out('')
+        if list:
+            out('Content : ')
+            self._tarball.list(verbose)
+
     def check(self, message="Check MD5"):
         '''
         Check md5 and size of tarballs are correct
-- 
GitLab