@ -633,13 +633,10 @@ class Slot:
"""
if self . state != STATE_IDLE :
return False
cmd = list ( self . make_cmd )
cmd . append ( defconfig )
self . ps = subprocess . Popen ( cmd , stdout = self . devnull ,
stderr = subprocess . PIPE )
self . defconfig = defconfig
self . state = STATE_DEFCONFIG
self . log = ' '
self . do_defconfig ( )
return True
def poll ( self ) :
@ -665,21 +662,65 @@ class Slot:
return False
if self . ps . poll ( ) != 0 :
self . handle_error ( )
elif self . state == STATE_DEFCONFIG :
self . do_autoconf ( )
elif self . state == STATE_AUTOCONF :
self . do_savedefconfig ( )
elif self . state == STATE_SAVEDEFCONFIG :
self . update_defconfig ( )
else :
sys . exit ( " Internal Error. This should not happen. " )
return True if self . state == STATE_IDLE else False
def handle_error ( self ) :
""" Handle error cases. """
self . log + = color_text ( self . options . color , COLOR_LIGHT_RED ,
" Failed to process. \n " )
if self . options . verbose :
self . log + = color_text ( self . options . color , COLOR_LIGHT_CYAN ,
self . ps . stderr . read ( ) )
self . finish ( False )
return True
if self . state == STATE_AUTOCONF :
def do_defconfig ( self ) :
""" Run ' make <board>_defconfig ' to create the .config file. """
cmd = list ( self . make_cmd )
cmd . append ( self . defconfig )
self . ps = subprocess . Popen ( cmd , stdout = self . devnull ,
stderr = subprocess . PIPE )
self . state = STATE_DEFCONFIG
def do_autoconf ( self ) :
""" Run ' make include/config/auto.conf ' . """
self . cross_compile = self . parser . get_cross_compile ( )
if self . cross_compile is None :
self . log + = color_text ( self . options . color , COLOR_YELLOW ,
" Compiler is missing. Do nothing. \n " )
self . finish ( False )
return
cmd = list ( self . make_cmd )
if self . cross_compile :
cmd . append ( ' CROSS_COMPILE= %s ' % self . cross_compile )
cmd . append ( ' KCONFIG_IGNORE_DUPLICATES=1 ' )
cmd . append ( ' include/config/auto.conf ' )
self . ps = subprocess . Popen ( cmd , stdout = self . devnull ,
stderr = subprocess . PIPE )
self . state = STATE_AUTOCONF
def do_savedefconfig ( self ) :
""" Update the .config and run ' make savedefconfig ' . """
( updated , log ) = self . parser . update_dotconfig ( )
self . log + = log
if not self . options . force_sync and not updated :
self . finish ( True )
return True
return
if updated :
self . log + = color_text ( self . options . color , COLOR_LIGHT_GREEN ,
" Syncing by savedefconfig... \n " )
@ -691,9 +732,10 @@ class Slot:
self . ps = subprocess . Popen ( cmd , stdout = self . devnull ,
stderr = subprocess . PIPE )
self . state = STATE_SAVEDEFCONFIG
return False
if self . state == STATE_SAVEDEFCONFIG :
def update_defconfig ( self ) :
""" Update the input defconfig and go back to the idle state. """
self . log + = self . parser . check_defconfig ( )
orig_defconfig = os . path . join ( ' configs ' , self . defconfig )
new_defconfig = os . path . join ( self . build_dir , ' defconfig ' )
@ -706,24 +748,6 @@ class Slot:
if not self . options . dry_run and updated :
shutil . move ( new_defconfig , orig_defconfig )
self . finish ( True )
return True
self . cross_compile = self . parser . get_cross_compile ( )
if self . cross_compile is None :
self . log + = color_text ( self . options . color , COLOR_YELLOW ,
" Compiler is missing. Do nothing. \n " )
self . finish ( False )
return True
cmd = list ( self . make_cmd )
if self . cross_compile :
cmd . append ( ' CROSS_COMPILE= %s ' % self . cross_compile )
cmd . append ( ' KCONFIG_IGNORE_DUPLICATES=1 ' )
cmd . append ( ' include/config/auto.conf ' )
self . ps = subprocess . Popen ( cmd , stdout = self . devnull ,
stderr = subprocess . PIPE )
self . state = STATE_AUTOCONF
return False
def finish ( self , success ) :
""" Display log along with progress and go to the idle state.