Move generate_contents() from catalyst.support to catalyst.util
authorAndrew Gaffney <agaffney@gentoo.org>
Sun, 11 Jan 2009 22:10:42 +0000 (16:10 -0600)
committerAndrew Gaffney <agaffney@gentoo.org>
Sun, 11 Jan 2009 22:10:42 +0000 (16:10 -0600)
ChangeLog
modules/catalyst/support.py
modules/catalyst/target/generic_stage.py
modules/catalyst/util.py

index 908fc21291abf3be227a2cf16ac0f2a2618a3e6b..93503adab1f748ad608a9985f82163bbc5b82f88 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,11 @@
 # Copyright 2002-2009 Gentoo Foundation; 2008-2009 Various authors (see AUTHORS)
 # Distributed under the GPL v2
 
+  11 Jan 2009; Andrew Gaffney <agaffney@gentoo.org>
+  modules/catalyst/support.py, modules/catalyst/target/generic_stage.py,
+  modules/catalyst/util.py:
+  Move generate_contents() from catalyst.support to catalyst.util
+
   11 Jan 2009; Andrew Gaffney <agaffney@gentoo.org>
   modules/catalyst/support.py, modules/catalyst/target/generic_stage.py,
   modules/catalyst/target/grp.py, modules/catalyst/target/livecd_stage1.py,
index 2d5fec586bc218872333e4d8fa913969f092bace..d18e8ae37de2c3b78eea88074b8c355408fef826 100644 (file)
@@ -53,32 +53,6 @@ def cleanup(pids,block_exceptions=True):
                 except IndexError:      pass
 
 
-
-def generate_contents(file,contents_function="auto",verbose=False):
-       try:
-               _ = contents_function
-               if _ == 'auto' and file.endswith('.iso'):
-                       _ = 'isoinfo-l'
-               if (_ in ['tar-tv','auto']):
-                       if file.endswith('.tgz') or file.endswith('.tar.gz'):
-                               _ = 'tar-tvz'
-                       elif file.endswith('.tbz2') or file.endswith('.tar.bz2'):
-                               _ = 'tar-tvj'
-                       elif file.endswith('.tar'):
-                               _ = 'tar-tv'
-
-               if _ == 'auto':
-                       warn('File %r has unknown type for automatic detection.' % (file, ))
-                       return None
-               else:
-                       contents_function = _
-                       _ = contents_map[contents_function]
-                       return _[0](file,_[1],verbose)
-       except:
-               raise CatalystError,\
-                       "Error generating contents, is appropriate utility (%s) installed on your system?" \
-                       % (contents_function, )
-
 def calc_contents(file,cmd,verbose):
        args={ 'file': file }
        cmd=cmd % dict(args)
index 356ca3be4a1348850e37d993e6dc2a54bf1e3e3f..d4b7f26126ff808a50e459c16337709aca2d8983 100644 (file)
@@ -1586,7 +1586,7 @@ class generic_stage_target(generic_target):
                                        array=keys.keys()
                                        array.sort()
                                for j in array:
-                                       contents=generate_contents(file,contents_function=j,\
+                                       contents=catalyst.util.generate_contents(file,contents_function=j,\
                                                verbose=("VERBOSE" in self.settings))
                                        if contents:
                                                myf.write(contents)
index 1c21579bd4ae7e8c54d32e32fb50016663695aac..74d89e9426455d01d5a41ebb5ad403eb6c42d322 100644 (file)
@@ -103,3 +103,28 @@ def touch(myfile):
        except IOError:
                raise CatalystError, "Could not touch " + myfile + "."
 
+def generate_contents(file, contents_function="auto", verbose=False):
+       try:
+               _ = contents_function
+               if _ == 'auto' and file.endswith('.iso'):
+                       _ = 'isoinfo-l'
+               if (_ in ['tar-tv','auto']):
+                       if file.endswith('.tgz') or file.endswith('.tar.gz'):
+                               _ = 'tar-tvz'
+                       elif file.endswith('.tbz2') or file.endswith('.tar.bz2'):
+                               _ = 'tar-tvj'
+                       elif file.endswith('.tar'):
+                               _ = 'tar-tv'
+
+               if _ == 'auto':
+                       warn('File %r has unknown type for automatic detection.' % (file, ))
+                       return None
+               else:
+                       contents_function = _
+                       _ = contents_map[contents_function]
+                       return _[0](file,_[1],verbose)
+       except:
+               raise CatalystError, \
+                       "Error generating contents, is appropriate utility (%s) installed on your system?" \
+                       % (contents_function, )
+