From b8046ac57a466d24fca1f8a998ab82e195e4dbfd Mon Sep 17 00:00:00 2001 From: Michael 'Mickey' Lauer Date: Wed, 6 Jul 2005 15:42:10 +0000 Subject: Shell: grab a deepcopy from the initial cooker data to reuse it in file**** commands. Otherwise we would pollute cooker.configuration.data (i.e. do_configure_append() appending multiple times). This fixes BitBake bug #133 --- lib/bb/shell.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/lib/bb/shell.py b/lib/bb/shell.py index 8c157793d..9a6c66fda 100644 --- a/lib/bb/shell.py +++ b/lib/bb/shell.py @@ -53,7 +53,7 @@ try: set except NameError: from sets import Set as set -import sys, os, imp, readline, socket, httplib, urllib, commands, popen2 +import sys, os, imp, readline, socket, httplib, urllib, commands, popen2, copy imp.load_source( "bitbake", os.path.dirname( sys.argv[0] )+"/bitbake" ) from bb import data, parse, build, fatal @@ -66,6 +66,7 @@ leave_mainloop = False last_exception = None cooker = None parsed = False +initdata = None debug = os.environ.get( "BBSHELL_DEBUG", "" ) ########################################################################## @@ -211,8 +212,13 @@ class BitBakeShellCommands: cooker.build_cache = [] cooker.build_cache_fail = [] + thisdata = copy.deepcopy( initdata ) + # Caution: parse.handle modifies thisdata, hence it would + # lead to pollution cooker.configuration.data, which is + # why we use it on a safe copy we obtained from cooker right after + # parsing the initial *.conf files try: - bbfile_data = parse.handle( bf, cooker.configuration.data ) + bbfile_data = parse.handle( bf, thisdata ) except parse.ParseError: print "ERROR: Unable to open or parse '%s'" % bf else: @@ -649,6 +655,10 @@ class BitBakeShell: print __credits__ + # save initial cooker configuration (will be reused in file*** commands) + global initdata + initdata = copy.deepcopy( cooker.configuration.data ) + def cleanup( self ): """Write readline history and clean up resources""" debugOut( "writing command history" ) -- cgit 1.2.3-korg