secureswitools/swisistools/source/interpretsislib/installer.cpp
branchRCL_3
changeset 34 741e5bba2bd1
parent 19 7ca52d38f8c3
child 62 5cc91383ab1e
equal deleted inserted replaced
28:98a43fae6e2b 34:741e5bba2bd1
     1 /*
     1 /*
     2 * Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of the License "Eclipse Public License v1.0"
     5 * under the terms of the License "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
   250 	throw InterpretSisError(L"Generating stub SIS file for " + shortName +
   250 	throw InterpretSisError(L"Generating stub SIS file for " + shortName +
   251 				L" (PU type) is not supported", SIS_NOT_SUPPORTED);
   251 				L" (PU type) is not supported", SIS_NOT_SUPPORTED);
   252 	}
   252 	}
   253 }
   253 }
   254 
   254 
       
   255 void Installer::ProcessConditionalBlockWarnings(const CSISInstallBlock& aInstallBlock, 
       
   256 											  ExpressionEvaluator& aEvaluator,
       
   257 											  const SisFile& aFile
       
   258 											  ) 
       
   259 	{
       
   260 	const CSISArray<CSISIf, CSISFieldRoot::ESISIf>& ifs = aInstallBlock.Ifs();
       
   261 	for (int i = 0; i < ifs.size(); ++i)
       
   262 		{
       
   263 		const CSISIf& ifBlock = ifs[i];
       
   264 
       
   265 		if (ifBlock.WasteOfSpace())
       
   266 			{
       
   267 			return;
       
   268 			}
       
   269 
       
   270 		// Main expression
       
   271 		if ( aEvaluator.Evaluate(ifBlock.Expression(),false).BoolValue() )
       
   272 			{
       
   273 			ProcessInstallBlockWarnings(ifBlock.InstallBlock(), aFile);
       
   274 			ProcessConditionalBlockWarnings(ifBlock.InstallBlock(), aEvaluator, aFile);
       
   275 			continue;
       
   276 			}
       
   277 		
       
   278 		int elseCount = ifBlock.ElseIfCount();
       
   279 		for (int i = 0; i < elseCount; ++i)
       
   280 			{
       
   281 			const CSISElseIf& elseIfBlock = ifBlock.ElseIf(i) ;
       
   282 			if ( aEvaluator.Evaluate(elseIfBlock.Expression(),false).BoolValue())
       
   283 				{
       
   284 				ProcessInstallBlockWarnings(elseIfBlock.InstallBlock(), aFile);
       
   285 				ProcessConditionalBlockWarnings(elseIfBlock.InstallBlock(), aEvaluator, aFile);
       
   286 				break;	// Stop processing else if blocks
       
   287 				}
       
   288 			}
       
   289 		} 
       
   290 	}
       
   291 
       
   292 void Installer::ProcessInstallBlockWarnings(const CSISInstallBlock& aInstallBlock, const SisFile& aFile)
       
   293 	{
       
   294 	aFile.ProcessEmbeddedFileWarning(aInstallBlock);
       
   295 	
       
   296 	std::string error;
       
   297 	bool result = aFile.ProcessInstallOptionsWarning(aInstallBlock,error);	
       
   298 	if(result == false)
       
   299 		{
       
   300 		std::string x;
       
   301 		throw InvalidSis(Ucs2ToUtf8(aFile.GetPackageName(),x),
       
   302 			error, SIS_NOT_SUPPORTED);
       
   303 		}
       
   304 	}
   255 
   305 
   256 TInt Installer::Install(const InstallSISFile& aInstallSISFile)
   306 TInt Installer::Install(const InstallSISFile& aInstallSISFile)
   257 {
   307 {
   258 	SisFile file(aInstallSISFile.iFileName);
   308 	SisFile file(aInstallSISFile.iFileName);
   259 
   309 
   268 		}
   318 		}
   269 
   319 
   270 	// check file is acceptable
   320 	// check file is acceptable
   271 	file.CheckValid();
   321 	file.CheckValid();
   272 
   322 
       
   323 	const CSISController& ctrl = file.GetController();	
       
   324 	ProcessConditionalBlockWarnings(ctrl.InstallBlock(), *iExpressionEvaluator, file);
       
   325 	
   273 	if (!DependenciesOk(file))
   326 	if (!DependenciesOk(file))
   274 	{
   327 	{
   275 		return MISSING_DEPENDENCY;
   328 		return MISSING_DEPENDENCY;
   276 	}
   329 	}
   277 
   330