commit:     3228dec78968e5f0b831cd477039decee6c79838
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Fri Nov 20 21:20:35 2015 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Fri Nov 20 21:24:31 2015 +0000
URL:        https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=3228dec7

Debug autoextension detection not working for stage2

Remove the set_source_path() re-definition from stage2.  This only modified the 
seedcache location from the normal one to the previous build directory.
This is wrong.  The previous build location is normally cleaned and removed.
Also, if this is actually needed, then it should be done globally and 
configurable.
Add extra log messages to stagebase.
Clean out a no longer relevant log.info message

 catalyst/base/stagebase.py | 17 ++++++++---------
 catalyst/targets/stage2.py | 21 ---------------------
 2 files changed, 8 insertions(+), 30 deletions(-)

diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py
index df19c0b..69b7b0d 100644
--- a/catalyst/base/stagebase.py
+++ b/catalyst/base/stagebase.py
@@ -420,10 +420,15 @@ class StageBase(TargetBase, ClearBase, GenBase):
                        self.settings["source_path"] = 
normpath(self.settings["storedir"] +
                                "/tmp/" + self.settings["source_subpath"] + "/")
                else:
+                       log.debug('Checking source path existence and '
+                               'get the final filepath. subpath: %s',
+                               self.settings["source_subpath"])
                        self.settings["source_path"] = file_check(
                                normpath(self.settings["storedir"] + "/builds/" 
+
                                        self.settings["source_subpath"])
                                )
+                       log.debug('Source path returned from file_check is: %s',
+                               self.settings["source_path"])
                        if os.path.isfile(self.settings["source_path"]):
                                # XXX: Is this even necessary if the previous 
check passes?
                                if os.path.exists(self.settings["source_path"]):
@@ -431,14 +436,7 @@ class StageBase(TargetBase, ClearBase, GenBase):
                                                
self.settings["hash_map"].generate_hash(
                                                        
self.settings["source_path"],
                                                        
hash_=self.settings["hash_function"])
-               log.info('Source path set to %s', self.settings['source_path'])
-               if os.path.isdir(self.settings["source_path"]):
-                       log.warning(
-                               'If this is not desired, remove this directory 
or turn off\n'
-                               'seedcache in the options of catalyst.conf the 
source path\n'
-                               'will then be %s',
-                               normpath(self.settings['storedir'] + '/builds/' 
+
-                                       self.settings['source_subpath']))
+               log.notice('Source path set to %s', 
self.settings['source_path'])
 
        def set_dest_path(self):
                if "root_path" in self.settings:
@@ -749,7 +747,8 @@ class StageBase(TargetBase, ClearBase, GenBase):
                                elif 
os.path.isdir(self.settings["source_path"]):
                                        # We should never reach this, so 
something is very wrong
                                        raise CatalystError(
-                                               "source path is a dir but 
seedcache is not enabled")
+                                               "source path is a dir but 
seedcache is not enabled: %s"
+                                               % self.settings["source_path"])
 
                if _unpack:
                        self.mount_safety_check()

diff --git a/catalyst/targets/stage2.py b/catalyst/targets/stage2.py
index ff060d2..9658a49 100644
--- a/catalyst/targets/stage2.py
+++ b/catalyst/targets/stage2.py
@@ -3,10 +3,8 @@ stage2 target, builds upon previous stage1 tarball
 """
 # NOTE: That^^ docstring has influence catalyst-spec(5) man page generation.
 
-import os
 
 from catalyst import log
-from catalyst.support import normpath
 from catalyst.base.stagebase import StageBase
 
 
@@ -19,25 +17,6 @@ class stage2(StageBase):
                self.valid_values=["chost"]
                StageBase.__init__(self,spec,addlargs)
 
-       def set_source_path(self):
-               if "seedcache" in self.settings["options"] and 
os.path.isdir(normpath(self.settings["storedir"]+"/tmp/"+self.settings["source_subpath"]+"/tmp/stage1root")):
-                       
self.settings["source_path"]=normpath(self.settings["storedir"]+"/tmp/"+self.settings["source_subpath"]+"/tmp/stage1root")
-               else:
-                       
self.settings["source_path"]=normpath(self.settings["storedir"]+"/builds/"+self.settings["source_subpath"])
-                       if os.path.isfile(self.settings["source_path"]):
-                               if os.path.exists(self.settings["source_path"]):
-                               # XXX: Is this even necessary if the previous 
check passes?
-                                       self.settings["source_path_hash"] = \
-                                               
self.settings["hash_map"].generate_hash(
-                                                       
self.settings["source_path"],\
-                                                       
hash_=self.settings["hash_function"])
-               log.notice('Source path set to %s', 
self.settings['source_path'])
-               if os.path.isdir(self.settings["source_path"]):
-                       log.warning(
-                               'If this is not desired, remove this directory 
or turn off seedcache in the\n'
-                               'options of catalyst.conf.  The source path 
will then be:\n%s',
-                               normpath(self.settings['storedir'] + '/builds/' 
+ self.settings['source_subpath']))
-
        # XXX: How do these override_foo() functions differ from the ones in
        # StageBase and why aren't they in stage3_target?
 

Reply via email to