X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSALOME_InstallWizard.cxx;h=7502e00cfb9111f7f1d5b6145810ddd22eb7994a;hb=88e0de629cb8b2bfd00be065ea9d4e9cb4f5bd08;hp=28eeb135e62501d00480d7e5214167d9f2b618e9;hpb=c78011f0236881acfe030420ff0108a558c7cb06;p=tools%2Finstall.git diff --git a/src/SALOME_InstallWizard.cxx b/src/SALOME_InstallWizard.cxx index 28eeb13..7502e00 100644 --- a/src/SALOME_InstallWizard.cxx +++ b/src/SALOME_InstallWizard.cxx @@ -3,7 +3,7 @@ // Author : Vadim SANDLER, Open CASCADE SAS (vadim.sandler@opencascade.com) // Project : SALOME // Module : Installation Wizard -// Copyright : 2002-2007 CEA +// Copyright : 2002-2010 CEA #include "globals.h" @@ -43,6 +43,7 @@ #include #include #include +#include #ifdef WNT #include @@ -50,6 +51,7 @@ #else #include #include +#include #endif #ifdef WNT @@ -59,10 +61,48 @@ QString tmpDirName() { return QString( "/INSTALLWORK" ) + QString::number( getpid() ); } #define TEMPDIRNAME tmpDirName() +// uncomment next line to redirect all shell output (usually for errors) to /dev/null device +// #define USE_DEV_NULL + +// ================================================================ +/*! + * Script + * Helper class to generate shell command + */ +// ================================================================ +class Script +{ +public: + Script( const QString& cmd = QString::null, const QString& sep = " " ) : mySeparator( sep ) + { + append( cmd ); + } + void append( const QString& cmd ) + { + if ( !cmd.isEmpty() ) myList.append( cmd ); + } + Script& operator<<( const QString& cmd ) + { + append( cmd ); + return *this; + } + QString script() const + { + return myList.join( mySeparator ); + } + void clear() + { + myList.clear(); + } +private: + QStringList myList; + QString mySeparator; +}; + // ================================================================ /*! * ProcessThread - * Class for executing systen commands + * Class for executing system commands */ // ================================================================ static QMutex myMutex(false); @@ -203,29 +243,29 @@ private: // ================================================================ /*! - * DefineDependeces [ static ] - * Defines list of dependancies as string separated by space symbols + * getAllProducts [ static ] + * Defines list of all products as a string separated by space symbols */ // ================================================================ -static QString DefineDependeces(MapProducts& theProductsMap) +static QString getAllProducts(MapProducts& theProductsMap) { - QStringList aProducts; + QStringList aModules, aPrereqs; for ( MapProducts::Iterator mapIter = theProductsMap.begin(); mapIter != theProductsMap.end(); ++mapIter ) { QCheckListItem* item = mapIter.key(); Dependancies dep = mapIter.data(); - QStringList deps = dep.getDependancies(); - for (int i = 0; i<(int)deps.count(); i++ ) { - if ( !aProducts.contains( deps[i] ) ) { - aProducts.append( deps[i] ); - aProducts.append( deps[i] + "_src" ); + QString curModule = item->text(0); + if ( !aModules.contains( curModule ) && !aPrereqs.contains( curModule ) ) { + if ( dep.getType() == "component" ) { + aModules.append( curModule ); + aModules.append( curModule + "_src" ); + } + else { + aPrereqs.append( curModule ); + aPrereqs.append( curModule + "_src" ); } - } - if ( !aProducts.contains( item->text(0) ) ) { - aProducts.append( item->text(0) ); - aProducts.append( item->text(0) + "_src" ); } } - return aProducts.join(" "); + return QStringList(aPrereqs+aModules).join(" "); } // ================================================================ @@ -275,10 +315,18 @@ static bool makeDir( const QString& theDir, QString& theCreated ) QFileInfo fi( aDir.left( start ) ); if ( !fi.exists() ) { // VSR: Create directory and set permissions to allow other users to remove it - QString script = "mkdir " + fi.absFilePath(); - script += "; chmod 777 " + fi.absFilePath(); - script += " > /dev/null"; - if ( system( script.latin1() ) ) + Script script; + script << "mkdir" << QUOTE( fi.absFilePath() ); +#ifdef USE_DEV_NULL + script << ">& /dev/null"; +#endif + script << "&&"; + script << "chmod 777" << QUOTE( fi.absFilePath() ); +#ifdef USE_DEV_NULL + script << ">& /dev/null"; +#endif + ___MESSAGE___( "script = " << script.script().latin1() ); + if ( system( script.script().latin1() ) ) return false; // VSR: Remember the top of the created directory (to remove it in the end of the installation) if ( theCreated.isNull() ) @@ -289,9 +337,13 @@ static bool makeDir( const QString& theDir, QString& theCreated ) } if ( !QFileInfo( aDir ).exists() ) { // VSR: Create directory, other users should NOT have possibility to remove it!!! - QString script = "mkdir " + aDir; - script += " > /dev/null"; - if ( system( script.latin1() ) ) + Script script; + script << "mkdir" << QUOTE( aDir ); +#ifdef USE_DEV_NULL + script << ">& /dev/null"; +#endif + ___MESSAGE___( "script = " << script.script().latin1() ); + if ( system( script.script().latin1() ) ) return false; // VSR: Remember the top of the created directory (to remove it in the end of the installation) if ( theCreated.isNull() ) @@ -343,7 +395,7 @@ static bool hasSpace( const QString& dir ) * Creates HTML-wrapped title text */ // ================================================================ -QString makeTitle( const QString& text, const QString& separator = " ", bool fl = true ) +static QString makeTitle( const QString& text, const QString& separator = " ", bool fl = true ) { QStringList words = QStringList::split( separator, text ); if ( fl ) { @@ -426,7 +478,7 @@ public: .arg( __IW_VERSION_MINOR__ ) \ .arg( __IW_VERSION_PATCH__ ) ); QLabel* copyright = new QLabel( this, "copyright" ); - copyright->setText( "Copyright © 2004-2007 CEA" ); + copyright->setText( "Copyright © 2007-2011 CEA/DEN" ); QFont font = title->font(); font.setPointSize( (int)( font.pointSize() * 1.8 ) ); title->setFont( font ); @@ -453,7 +505,7 @@ public: QFontMetrics fm( title->font() ); int width = (int)( fm.width( tlt ) * 1.5 ); title->setMinimumWidth( width ); - setMaximumSize( minimumSize() ); +// setMaximumSize( minimumSize() ); } void mousePressEvent( QMouseEvent* ) { @@ -469,7 +521,9 @@ public: // ================================================================ SALOME_InstallWizard::SALOME_InstallWizard(const QString& aXmlFileName, const QString& aTargetDir, - const QString& aTmpDir) + const QString& aTmpDir, + const bool aForceSrc, + const bool aSingleDir) : InstallWizard( qApp->desktop(), "SALOME_InstallWizard", false, 0 ), helpWindow( NULL ), moreMode( false ), @@ -482,17 +536,24 @@ SALOME_InstallWizard::SALOME_InstallWizard(const QString& aXmlFileName, xmlFileName = aXmlFileName; myTargetPath = aTargetDir; myTmpPath = aTmpDir; + forceSrc = aForceSrc; + singleDir = aSingleDir; stateChanged = true; - binPath = QDir::currentDirPath() + "/Products/BINARIES"; - srcPath = QDir::currentDirPath() + "/Products/SOURCES"; + + QDir rootDir( rootDirPath() ); + binPath = rootDir.filePath( "Products/BINARIES" ); + srcPath = rootDir.filePath( "Products/SOURCES" ); + oneProdDirName = "PRODUCTS"; + + commonPlatform = "Debian 3.1"; // // get XML filename and current platform // // ... get current platform - curPlatform = currentPlatform(); -// cout << "curOS = " << curPlatform << endl; -// curPlatform = ""; + curPlatform = currentPlatform().join(" "); + //cout << "curOS = " << curPlatform << endl; + refPlatform = ""; // ... check XML and platform definition getXmlAndPlatform(); @@ -511,10 +572,11 @@ SALOME_InstallWizard::SALOME_InstallWizard(const QString& aXmlFileName, addLogo( pixmap( pxLogo ) ); // set defaults - setVersion( "3.2.6" ); + setVersion( "6.3.0" ); setCaption( tr( "SALOME %1" ).arg( myVersion ) ); - setCopyright( tr( "Copyright (C) 2007 CEA" ) ); - setLicense( tr( "All right reserved" ) ); + setCopyright( tr( "
Copyright © 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
" + "
Copyright © 2003-2007 OPEN CASCADE,
EADS/CCR, LIP6, CEA/DEN, CEDRAT, EDF R&D,
LEG, PRINCIPIA R&D, BUREAU VERITAS
" )); + setLicense( tr( "
GNU LGPL
" ) ); ___MESSAGE___( "Configuration file : " << xmlFileName.latin1() ); ___MESSAGE___( "Target directory : " << myTargetPath.latin1() ); @@ -528,10 +590,12 @@ SALOME_InstallWizard::SALOME_InstallWizard(const QString& aXmlFileName, // create instance of class for starting shell script to get available disk space diskSpaceProc = new QProcess( this, "procDiskSpace" ); - connect( diskSpaceProc, SIGNAL( processExited() ), this, SLOT( updateAvailableSpace() ) ); - // create instance of class for starting shell install script shellProcess = new QProcess( this, "shellProcess" ); + // create instance of class for starting shell script to modify SALOME *.la files + modifyLaProc = new QProcess( this, "modifyLaProc" ); + // create instance of class for starting shell script to check Fortran libraries + checkFLibProc = new QProcess( this, "checkFLibProc" ); // create introduction page setupIntroPage(); @@ -563,11 +627,19 @@ SALOME_InstallWizard::SALOME_InstallWizard(const QString& aXmlFileName, connect( this, SIGNAL( helpClicked() ), this, SLOT( helpClicked() ) ); connect( this, SIGNAL( aboutClicked() ), this, SLOT( onAbout() ) ); - // catch signals from launched script + // catch signals from launched diskSpaceProc + connect( diskSpaceProc, SIGNAL( processExited() ), this, SLOT( updateAvailableSpace() ) ); + // catch signals from launched shellProcess connect(shellProcess, SIGNAL( readyReadStdout() ), this, SLOT( readFromStdout() ) ); connect(shellProcess, SIGNAL( readyReadStderr() ), this, SLOT( readFromStderr() ) ); connect(shellProcess, SIGNAL( processExited() ), this, SLOT( productInstalled() ) ); connect(shellProcess, SIGNAL( wroteToStdin() ), this, SLOT( wroteToStdin() ) ); + // catch signals from launched modifyLaProc + connect(modifyLaProc, SIGNAL( readyReadStdout() ), this, SLOT( readFromStdout() ) ); + connect(modifyLaProc, SIGNAL( readyReadStderr() ), this, SLOT( readFromStderr() ) ); + connect(modifyLaProc, SIGNAL( processExited() ), this, SLOT( checkModifyLaResult() ) ); + // catch signals from launched checkFLibProc + connect(checkFLibProc, SIGNAL( processExited() ), this, SLOT( checkFLibResult() ) ); // create validation thread myThread = new ProcessThread( this ); @@ -585,63 +657,119 @@ SALOME_InstallWizard::SALOME_InstallWizard(const QString& aXmlFileName, SALOME_InstallWizard::~SALOME_InstallWizard() { shellProcess->kill(); // kill it for sure - QString script = "kill -9 "; int PID = (int)shellProcess->processIdentifier(); if ( PID > 0 ) { - script += QString::number( PID ); - script += " > /dev/null"; - ___MESSAGE___( "script: " << script.latin1() ); - if ( system( script.latin1() ) ) { + Script script; + script << "kill -9" << QString::number( PID ); +#ifdef USE_DEV_NULL + script << ">& /dev/null"; +#endif + ___MESSAGE___( "script: " << script.script().latin1() ); + if ( system( script.script().latin1() ) ) { + // error } } delete myThread; } // ================================================================ +/*! + * SALOME_InstallWizard::getBasePlatform + * Determine the base platform for binaries installation + */ +// ================================================================ +QString SALOME_InstallWizard::getBasePlatform() +{ + QString aBasePlt = ""; + if ( platformsMap.find( curPlatform ) != platformsMap.end() ) + aBasePlt = curPlatform; + else + aBasePlt = commonPlatform; + return aBasePlt; +} +// ================================================================ /*! * SALOME_InstallWizard::currentPlatform * Tries to determine the current user's operating system */ // ================================================================ -QString SALOME_InstallWizard::currentPlatform() +QStringList SALOME_InstallWizard::currentPlatform() { // file parsing - QString curOS = ""; + QString platName, platVersion, platArch; QString osFileName = "/etc/issue"; if ( QFile::exists( osFileName ) ) { QFile file( osFileName ); if ( file.open( IO_ReadOnly ) ) { QTextStream stream( &file ); - QString str = stream.readLine(); + QStringList lines = QStringList::split( "\n", stream.read() ); file.close(); - // line parsing - QString pltName = "", platVersion = "", platBit = ""; - QRegExp rx( "(.*)[L|l]inux.*release\\s+([\\d.]*)" ); -// str = "Debian GNU/Linux 3.1 \n \l"; -// str = "Red Hat Enterprise Linux WS release 4 (Nahant)"; -// str = "Mandriva Linux release 2006.0 (Official) for x86_64"; - int pos = rx.search( str ); - if ( pos == -1 ) {// Debian case - rx = QRegExp( "(.*)GNU/Linux\\s+([\\d.]*)" ); - pos = rx.search( str ); - } - if ( pos > -1 ) { - pltName = rx.cap( 1 ); - platVersion = rx.cap( 2 ); - rx = QRegExp( "x86_64" ); - pos = rx.search( str ); - if ( pos > -1 ) - platBit = "_64"; - curOS = pltName + platVersion + platBit; + for ( uint i = 0; i < lines.count(); i++ ) { + QString str = lines[i]; + if ( str.isEmpty() ) continue; + // parse line + QRegExp regvar = QRegExp( "(.*)\\s+[^\\s]*[R|r]elease[^\\s]*\\s+([\\d.]*)" ); + int pos = regvar.search( str ); + if ( pos == -1 ) { + regvar = QRegExp( "(.*)\\s+[^\\s]*[L|l][I|i][N|n][U|u][X|x][^\\s]*(.*)\\s+([\\d.]*)\\s+" ); + pos = regvar.search( str ); + } + if ( pos >= 0 ) { + QStringList name; + for ( int i = 1; i < regvar.numCaptures(); i++ ) + name.append( regvar.cap( i ) ); + + // retrieve platform name + platName = QStringList::split( " ", name.join( " " ) ).join( " " ); + platName = platName.replace( "Linux", "" ).replace( "linux", "" ).replace( "LINUX", "" ).stripWhiteSpace(); + platName = platName.replace( "Welcome to", "" ).stripWhiteSpace(); + platName = QStringList::split( " ", platName ).join( " " ); + // retrieve platform version number + platVersion = regvar.cap( regvar.numCaptures() ); + // retrieve platform + utsname uname_data; + uname( &uname_data ); + if ( QString( uname_data.machine ) == "x86_64" ) + platArch = "64bit"; + break; + } } } } - // return curOS.remove( " " ); - QString str( " " ); - int index = 0; - while ( (index = curOS.find( str, index, true)) != -1 ) - curOS.remove( index, str.length() ); - return curOS; + QStringList vals; + if ( !platName.isEmpty() ) vals.append( platName ); + if ( !platVersion.isEmpty() ) vals.append( platVersion ); + if ( !platArch.isEmpty() ) vals.append( platArch ); + return vals; } + +// ================================================================ +/*! + * SALOME_InstallWizard::rootDirPath + * Get application root dir + */ +// ================================================================ +QString SALOME_InstallWizard::rootDirPath() +{ + static QString rootDir; + if ( rootDir.isEmpty() ) { + QDir appDir( qApp->applicationDirPath() ); + appDir.cdUp(); + rootDir = appDir.absPath(); + } + return rootDir; +} + +// ================================================================ +/*! + * SALOME_InstallWizard::getPlatformBinPath + * Get platform binaries path + */ +// ================================================================ +QString SALOME_InstallWizard::getPlatformBinPath( const QString& plt ) const +{ + return QDir::cleanDirPath( getBinPath() + "/" + QStringList::split( " ", plt ).join( "_" ) ); +} + // ================================================================ /*! * SALOME_InstallWizard::getXmlMap @@ -649,17 +777,20 @@ QString SALOME_InstallWizard::currentPlatform() * corresponding XML files. */ // ================================================================ -MapXmlFiles SALOME_InstallWizard::getXmlMap( const QString& xmlFileName ) +MapXmlFiles SALOME_InstallWizard::getXmlMap( const QString& aXmlFileName ) { MapXmlFiles xmlMap; QStringList xmlList; - if ( xmlFileName ) - xmlList.append( xmlFileName ); + if ( !aXmlFileName.isEmpty() ) + xmlList.append( QFileInfo( aXmlFileName ).absFilePath() ); else { - QDir dir( QDir::currentDirPath() ); - xmlList = dir.entryList( "*.xml", QDir::Files | QDir::Readable ); + QDir dir( rootDirPath() ); + QStringList entries = dir.entryList( "*.xml", QDir::Files | QDir::Readable ); + if ( entries.remove( "config.xml" ) ) + entries.append( "config.xml" ); + for ( uint i = 0; i < entries.count(); i++ ) + xmlList.append( QDir( rootDirPath() ).filePath( entries[i] ) ); } -// cout << xmlList.join(",") << endl; // XML files parsing QFile file; QDomDocument doc( "xml_doc" ); @@ -688,11 +819,10 @@ MapXmlFiles SALOME_InstallWizard::getXmlMap( const QString& xmlFileName ) platforms = elem.attribute( "platforms" ).stripWhiteSpace(); QStringList platList = QStringList::split( ",", platforms ); for ( uint j = 0; j < platList.count(); j++ ) { - if ( !platList[j].isEmpty() && xmlMap.find( platList[j] ) == xmlMap.end() ) + QString platform = platList[j].stripWhiteSpace(); + if ( !platform.isEmpty() && xmlMap.find( platform ) == xmlMap.end() ) xmlMap[ platList[j] ] = xmlList[i]; } -// if ( !curPlatform.isEmpty() && xmlMap.find( curPlatform ) != xmlMap.end() ) -// return xmlMap; } } } @@ -707,12 +837,18 @@ MapXmlFiles SALOME_InstallWizard::getXmlMap( const QString& xmlFileName ) void SALOME_InstallWizard::getXmlAndPlatform() { MapXmlFiles xmlMap; - if ( xmlFileName.isNull() ) { + if ( xmlFileName.isEmpty() ) { xmlMap = getXmlMap(); if ( !curPlatform.isEmpty() ) { // try to get XML file for current platform - if ( xmlMap.find( curPlatform ) != xmlMap.end() ) + if ( xmlMap.find( curPlatform ) != xmlMap.end() ) { xmlFileName = xmlMap[ curPlatform ]; + QFileInfo fibp( getPlatformBinPath( curPlatform ) ); + if ( !fibp.isDir() ) { + warnMsg = tr( "Binaries are absent for current platform" ); + } + platformsMap = xmlMap; + } else { platformsMap = xmlMap; warnMsg = tr( "Your Linux platform is not supported by this SALOME package" ); @@ -721,7 +857,7 @@ void SALOME_InstallWizard::getXmlAndPlatform() else { // get all supported platforms platformsMap = xmlMap; - warnMsg = tr( "Install Wizard can't define your Linux platform" ); + warnMsg = tr( "Installation Wizard can't identify target Linux platform" ); } } else { @@ -735,6 +871,9 @@ void SALOME_InstallWizard::getXmlAndPlatform() platformsMap.insert( it.key(), it.data(), true ); warnMsg = tr( "The given configuration file doesn't support your Linux platform" ); } + else { + platformsMap = xmlMap; + } } else { // get all supported platforms @@ -742,7 +881,7 @@ void SALOME_InstallWizard::getXmlAndPlatform() MapXmlFiles::Iterator it; for ( it = xmlMap.begin(); it != xmlMap.end(); ++it ) platformsMap.insert( it.key(), it.data(), true ); - warnMsg = tr( "Install Wizard can't define your Linux platform" ); + warnMsg = tr( "Installation Wizard can't define your Linux platform" ); } } } @@ -903,10 +1042,11 @@ void SALOME_InstallWizard::setupTypePage() QLabel* srcCompileLab3 = new QLabel( " " + tr( "it is a long time operation and it can take more than 24 hours depending\n on the computer." ), buttonGrp ); - removeSrcBtn = new QMyCheckBox( tr( "Remove sources and temporary files after compilation" ), typePage ); + removeSrcBtn = new QCheckBox( tr( "Remove sources and temporary files after compilation" ), typePage ); setAboutInfo( removeSrcBtn, tr( "Check this option if you want to remove sources of the products\nwith all the temporary files after build finishing" ) ); - removeSrcBtn->setState( QButton::Off ); + removeSrcBtn->setChecked( false ); removeSrcBtn->setEnabled( false ); + rmSrcPrevState = removeSrcBtn->isChecked(); srcCompileLayout->addMultiCellWidget( srcCompileBtn, 0, 0, 0, 2 ); srcCompileLayout->addMultiCell ( spacer6, 1, 2, 0, 0 ); @@ -926,7 +1066,6 @@ void SALOME_InstallWizard::setupTypePage() pageLayout->addWidget( buttonGrp, 0, 0 ); // connecting signals connect( buttonGrp, SIGNAL( clicked(int) ), this, SLOT ( onButtonGroup(int) ) ); - connect( removeSrcBtn, SIGNAL( toggled( bool ) ), this, SLOT( onRemoveSrcBtn() ) ); // adding page addPage( typePage, tr( "Installation type" ) ); } @@ -938,10 +1077,6 @@ void SALOME_InstallWizard::setupTypePage() // ================================================================ void SALOME_InstallWizard::setupPlatformPage() { - // create page or not? - if ( platformsMap.isEmpty() ) - return; - // create page platformsPage = new QWidget( this, "PlatformsPage" ); QGridLayout* pageLayout = new QGridLayout( platformsPage ); @@ -952,13 +1087,9 @@ void SALOME_InstallWizard::setupPlatformPage() QFont fnt = warnLab2->font(); fnt.setBold( true ); warnLab2->setFont( fnt ); - if ( installType == Compile && platformsMap.find( curPlatform ) == platformsMap.end() ) - warnMsg += tr( " and compilation is not tested on this one." ); - else - warnMsg += "."; warnLab = new QLabel( warnMsg, platformsPage ); warnLab->setAlignment( Qt::AlignHCenter | Qt::WordBreak ); - QLabel* warnLab3 = new QLabel( tr( "If you want to proceed anyway, please select platform from the following list:" ), + warnLab3 = new QLabel( tr( "If you want to proceed anyway, please select platform from the following list:" ), platformsPage ); warnLab3->setAlignment( Qt::AlignHCenter | Qt::WordBreak ); // create button group @@ -1025,6 +1156,11 @@ void SALOME_InstallWizard::setupDirPage() tempLayout->addMultiCellWidget( tempLab, 0, 0, 0, 1 ); tempLayout->addWidget ( tempFolder, 1, 0 ); tempLayout->addWidget ( tempBtn, 1, 1 ); + // AKL: 13/08/07 - disable temporary directory setting in GUI ==> + tempLab->hide(); + tempFolder->hide(); + tempBtn->hide(); + // AKL: 13/08/07 - disable temporary directory setting in GUI <== // layout widgets pageLayout->addItem ( spacer1, 0, 0 ); pageLayout->addLayout( targetLayout, 1, 0 ); @@ -1040,7 +1176,7 @@ void SALOME_InstallWizard::setupDirPage() connect( tempBtn, SIGNAL( clicked() ), this, SLOT( browseDirectory() ) ); // adding page - addPage( dirPage, tr( "Installation directories" ) ); + addPage( dirPage, tr( "Installation directory" ) ); } // ================================================================ /*! @@ -1110,11 +1246,22 @@ void SALOME_InstallWizard::setupProductsPage() sizeLayout->addWidget( requiredTemp, 1, 1 ); sizeLayout->addWidget( reqLab3, 2, 0 ); sizeLayout->addWidget( availableSize, 2, 1 ); + // ... 'single installation directory' check-boxes + oneModDirBtn = new QMyCheckBox( tr( "Install modules to a single directory" ), productsPage ); + setAboutInfo( oneModDirBtn, tr( "Check this box if you want to install binaries of\nthe selected SALOME modules into a single directory" ) ); + oneProdDirBtn = new QMyCheckBox( tr( "Install prerequisites to a single directory" ), productsPage ); + setAboutInfo( oneProdDirBtn, tr( "Check this box if you want to install binaries of\nthe selected prerequisites into a single directory" ) ); + oneProdDirBtn->hide(); // temporarily! waiting for correct prerequisites availability + QFrame* split_line = new QFrame( productsPage, "split_line" ); + split_line->setFrameStyle( QFrame::HLine | QFrame::Sunken ); // layout common widgets - pageLayout->addMultiCellLayout( leftBoxLayout, 0, 1, 0, 0 ); + pageLayout->addMultiCellLayout( leftBoxLayout, 0, 4, 0, 0 ); pageLayout->addWidget ( productInfo, 0, 1 ); pageLayout->addLayout ( sizeLayout, 1, 1 ); + pageLayout->addWidget ( split_line, 2, 1 ); + pageLayout->addWidget ( oneModDirBtn, 3, 1 ); + pageLayout->addWidget ( oneProdDirBtn, 4, 1 ); // adding page addPage( productsPage, tr( "Choice of the products to be installed" ) ); @@ -1213,14 +1360,20 @@ void SALOME_InstallWizard::setupProgressPage() progressView = new ProgressView( widget ); progressView->setSizePolicy( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Expanding ) ); progressView->setMinimumSize( 100, 10 ); + // possibility to ignore all errors + ignoreErrCBox = new QCheckBox( tr( "Ignore errors" ), widget ); + setAboutInfo( ignoreErrCBox, tr( "Check this option if you want to proceed installation \nprocess even there will be some errors" ) ); + ignoreErrCBox->setChecked( false ); + // product installation status bar statusLab = new QLabel( widget ); statusLab->setFrameShape( QButtonGroup::LineEditPanel ); setAboutInfo( progressView, tr( "Installation status on the selected products" ) ); // layouting layout->addRowSpacing( 0, 6 ); - layout->addWidget( resultLab, 1, 0 ); - layout->addWidget( progressView, 2, 0 ); - layout->addWidget( statusLab, 3, 0 ); + layout->addWidget( resultLab, 1, 0 ); + layout->addWidget( progressView, 2, 0 ); + layout->addWidget( ignoreErrCBox, 3, 0 ); + layout->addWidget( statusLab, 4, 0 ); // layouting pageLayout->addWidget( splitter, 0, 0 ); // adding page @@ -1260,7 +1413,7 @@ void SALOME_InstallWizard::setupReadmePage() pageLayout->addLayout( hLayout ); // loading README file - QString readmeFile = QDir::currentDirPath() + "/README"; + QString readmeFile = QDir( rootDirPath() ).filePath( "README" ); QString text; if ( readFile( readmeFile, text ) ) readme->setText( text ); @@ -1314,11 +1467,6 @@ void SALOME_InstallWizard::showChoiceInfo() item = (QCheckListItem*)( prereqsView->firstChild() ); while( item ) { if ( productsMap.contains( item ) ) { - if ( productsMap[ item ].hasType( "salome sources" ) || - productsMap[ item ].hasType( "salome binaries" ) ) { - item = (QCheckListItem*)( item->nextSibling() ); - continue; // skip SALOME sources and binaries - } if ( item->isOn() ) { text += "
  • " + item->text() + " " + productsMap[ item ].getVersion() + "
    "; nbProd++; @@ -1346,26 +1494,45 @@ bool SALOME_InstallWizard::acceptData( const QString& pageTitle ) QWidget* aPage = InstallWizard::page( pageTitle ); if ( aPage == typePage ) { // installation type page + warnLab3->show(); + this->setAppropriate( platformsPage, false ); if ( installType == Binaries ) { // 'Binary' installation type // check binaries directory QFileInfo fib( QDir::cleanDirPath( getBinPath() ) ); - if ( !fib.exists() ) { + if ( !fib.isDir() ) { QMessageBox::warning( this, tr( "Warning" ), tr( "The directory %1 doesn't exist.\n" - "This directory must contain sources archives.\n").arg( fib.absFilePath() ), + "This directory must contains another one directory with binary archives for current platform.").arg( fib.absFilePath() ), QMessageBox::Ok, QMessageBox::NoButton, QMessageBox::NoButton ); return false; } + if ( platformsMap.find( curPlatform ) == platformsMap.end() ) { + // Unknown platform case + QString aMsg = warnMsg + tr( ".\nBy default the universal binary package will be installed." ); + aMsg += tr( "\nIf you want to select another one, please use the following list:" ); + warnLab->setText( aMsg ); + warnLab3->hide(); + this->setAppropriate( platformsPage, true ); + } + else { + // Supported platform case + QFileInfo fibp( getPlatformBinPath( curPlatform ) ); + if ( !fibp.isDir() ) { + warnLab->setText( tr( "Binaries are absent for current platform." ) ); + this->setAppropriate( platformsPage, true ); + } + } + // check sources directory QFileInfo fis( QDir::cleanDirPath( getSrcPath() ) ); - if ( !fis.exists() ) + if ( !fis.isDir() ) if ( QMessageBox::warning( this, tr( "Warning" ), tr( "The directory %1 doesn't exist.\n" - "This directory must contain sources archives.\n" + "This directory must contains sources archives.\n" "Continue?" ).arg( fis.absFilePath() ), tr( "&Yes" ), tr( "&No" ), @@ -1375,21 +1542,73 @@ bool SALOME_InstallWizard::acceptData( const QString& pageTitle ) else { // 'Source' or 'Compile' installation type // check sources directory QFileInfo fis( QDir::cleanDirPath( getSrcPath() ) ); - if ( !fis.exists() ) { + if ( !fis.isDir() ) { QMessageBox::warning( this, tr( "Warning" ), tr( "The directory %1 doesn't exist.\n" - "This directory must contain sources archives.\n" ).arg( fis.absFilePath() ), + "This directory must contains sources archives.\n" ).arg( fis.absFilePath() ), QMessageBox::Ok, QMessageBox::NoButton, QMessageBox::NoButton ); return false; } + else if ( !QDir( fis.filePath(), "*.tar.gz" ).count() ) { + QMessageBox::warning( this, + tr( "Warning" ), + tr( "The directory %1 doesn't contain source archives.\n" ).arg( fis.absFilePath() ), + QMessageBox::Ok, + QMessageBox::NoButton, + QMessageBox::NoButton ); + return false; + } + if ( platformsMap.find( curPlatform ) == platformsMap.end() ) { + QString aMsg = warnMsg + "."; + if ( installType == Compile ) + aMsg = warnMsg + tr( " and compilation is not tested on this one." ); + warnLab->setText( aMsg ); + this->setAppropriate( platformsPage, true ); + } } } - else if ( aPage == dirPage ) { + else if ( aPage == platformsPage ) { // installation platform page + if ( platBtnGrp->id( platBtnGrp->selected() ) == -1 ) { + QMessageBox::warning( this, + tr( "Warning" ), + tr( "Select installation platform before" ), + QMessageBox::Ok, + QMessageBox::NoButton, + QMessageBox::NoButton ); + return false; + } + else if ( installType == Binaries ) { + QString aPlatform = platBtnGrp->selected()->name(); + QFileInfo fib( getPlatformBinPath( aPlatform ) ); + if ( !fib.isDir() ) { + QMessageBox::warning( this, + tr( "Warning" ), + tr( "The directory %1 doesn't exist.\n" + "This directory must contains binary archives.\n" ).arg( fib.absFilePath() ), + QMessageBox::Ok, + QMessageBox::NoButton, + QMessageBox::NoButton ); + return false; + } + else if ( QDir( fib.filePath(), "*.tar.gz" ).count() == 0 ) { + QMessageBox::warning( this, + tr( "Warning" ), + tr( "The directory %1 doesn't contain binary archives.\n" ).arg( fib.absFilePath() ), + QMessageBox::Ok, + QMessageBox::NoButton, + QMessageBox::NoButton ); + return false; + } + } + } + + else if ( aPage == dirPage ) { + // installation directory page // ########## check target and temp directories (existence and available disk space) // get dirs QString targetDir = QDir::cleanDirPath( targetFolder->text().stripWhiteSpace() ); @@ -1405,7 +1624,7 @@ bool SALOME_InstallWizard::acceptData( const QString& pageTitle ) return false; } QFileInfo fi( QDir::cleanDirPath( targetDir ) ); - if ( !fi.exists() ) { + if ( !fi.isDir() ) { bool toCreate = QMessageBox::warning( this, tr( "Warning" ), @@ -1439,7 +1658,7 @@ bool SALOME_InstallWizard::acceptData( const QString& pageTitle ) if ( !fi.isWritable() ) { QMessageBox::warning( this, tr( "Warning" ), - tr( "The directory %1 is not writeable.\n" + tr( "The directory %1 is not writable.\n" "Please, enter valid target directory path or change permissions" ).arg( fi.absFilePath() ), QMessageBox::Ok, QMessageBox::NoButton, @@ -1484,6 +1703,9 @@ bool SALOME_InstallWizard::acceptData( const QString& pageTitle ) // ########## check if any products are selected to be installed long totSize, tempSize; bool anySelected = checkSize( &totSize, &tempSize ); + if ( installType == Compile && removeSrcBtn->isOn() ) { + totSize += tempSize; + } if ( !anySelected ) { QMessageBox::warning( this, tr( "Warning" ), @@ -1494,13 +1716,13 @@ bool SALOME_InstallWizard::acceptData( const QString& pageTitle ) return false; } // run script that checks available disk space for installing of products // returns 1 in case of error + QDir rd( rootDirPath() ); QFileInfo fi( QDir::cleanDirPath( targetFolder->text().stripWhiteSpace() ) ); - QString script = "./config_files/checkSize.sh '"; - script += fi.absFilePath(); - script += "' "; - script += QString( "%1" ).arg( totSize ); - ___MESSAGE___( "script = " << script.latin1() ); - if ( system( script ) ) { + Script script; + script << QUOTE( rd.filePath( "config_files/checkSize.sh" ) ); + script << QUOTE( fi.absFilePath() ) << QString::number( totSize ); + ___MESSAGE___( "script = " << script.script().latin1() ); + if ( system( script.script().latin1() ) ) { QMessageBox::critical( this, tr( "Out of space" ), tr( "There is no available disk space for installing of selected products" ), @@ -1509,15 +1731,16 @@ bool SALOME_InstallWizard::acceptData( const QString& pageTitle ) QMessageBox::NoButton ); return false; } + // AKL: 13/08/07 - skip tmp disk space checking (all files are unpacked into installation directory) ==> + /* // run script that check available disk space for temporary files // returns 1 in case of error QFileInfo fit( QDir::cleanDirPath( tempFolder->text().stripWhiteSpace() ) ); - QString tscript = "./config_files/checkSize.sh '"; - tscript += fit.absFilePath(); - tscript += "' "; - tscript += QString( "%1" ).arg( tempSize ); - ___MESSAGE___( "script = " << tscript.latin1() ); - if ( system( tscript ) ) { + Script tscript; + tscript << QUOTE( rd.filePath( "config_files/checkSize.sh" ) ); + tscript << QUOTE( fit.absFilePath() ) << QString::number( tempSize ); + ___MESSAGE___( "script = " << tscript.script().latin1() ); + if ( system( tscript.script().latin1() ) ) { QMessageBox::critical( this, tr( "Out of space" ), tr( "There is no available disk space for the temporary files" ), @@ -1525,7 +1748,10 @@ bool SALOME_InstallWizard::acceptData( const QString& pageTitle ) QMessageBox::NoButton, QMessageBox::NoButton ); return false; - } + } + */ + // AKL: 13/08/07 - skip tmp disk space checking (all files are unpacked into installation directory) <== + // ########## check installation scripts QCheckListItem* item; ProductsView* prodsView = modulesView; @@ -1550,11 +1776,12 @@ bool SALOME_InstallWizard::acceptData( const QString& pageTitle ) } // check installation script existence else { - QFileInfo fi( QString("./config_files/") + item->text(2) ); + QDir rd( rootDirPath() ); + QFileInfo fi( rd.filePath( QString( "config_files/%1" ).arg( item->text(2) ) ) ); if ( !fi.exists() || !fi.isExecutable() ) { QMessageBox::warning( this, tr( "Error" ), - tr( "The script %1 required for %2 doesn't exist or doesn't have execute permissions.").arg("./config_files/" + item->text(2)).arg(item->text(0)), + tr( "The script %1 required for %2 doesn't exist or doesn't have execute permissions.").arg(fi.filePath()).arg(item->text(0)), QMessageBox::Ok, QMessageBox::NoButton, QMessageBox::NoButton ); @@ -1609,18 +1836,15 @@ bool SALOME_InstallWizard::checkSize( long* totSize, long* tempSize ) Dependancies dep = mapIter.data(); if ( !item->isOn() ) continue; - if ( installType == Compile && removeSrcBtn->state() == QButton::On ) - tots += dep.getSize( Binaries ); - else - tots += dep.getSize( installType ); + tots += ( QStringList::split( " ", item->text(1) )[0] ).toLong(); maxSrcTmp = max( maxSrcTmp, dep.getSize( Compile ) - dep.getSize( Binaries ) ); temps += dep.getTempSize( installType ); nbSelected++; } if ( totSize ) - if ( installType == Compile && removeSrcBtn->state() == QButton::On ) - tots += maxSrcTmp; + if ( installType == Compile && removeSrcBtn->isOn() ) + temps += maxSrcTmp; *totSize = tots; if ( tempSize ) *tempSize = temps; @@ -1638,6 +1862,172 @@ void SALOME_InstallWizard::updateAvailableSpace() availableSize->setText( diskSpaceProc->readLineStdout() + " KB"); } // ================================================================ +/*! + * SALOME_InstallWizard::runModifyLaFiles + * Run the modification of SALOME *.la files + */ +// ================================================================ +void SALOME_InstallWizard::runModifyLaFiles() +{ + modifyLaProc->clearArguments(); + // ... update status label + statusLab->setText( tr( "Modification of *.la files of SALOME modules..." ) ); + // set process arguments + modifyLaProc->setWorkingDirectory( QDir( rootDirPath() ).filePath( "config_files" ) ); + modifyLaProc->addArgument( "modifyLaFiles.sh" ); + modifyLaProc->addArgument( "modify_la_files" ); + modifyLaProc->addArgument( QDir::cleanDirPath( QFileInfo( targetFolder->text().stripWhiteSpace() ).absFilePath() ) ); + // ... run script + if ( !modifyLaProc->start() ) + ___MESSAGE___( "Error: process could not start!" ); +} +// ================================================================ +/*! + * SALOME_InstallWizard::checkModifyLaResult + * Slot to take result of modification SALOME *.la files + */ +// ================================================================ +void SALOME_InstallWizard::checkModifyLaResult() +{ + if ( modifyLaProc->normalExit() && modifyLaProc->exitStatus() == 1 ) + runCheckFLib(); + else { + // abort of the current installation + abort(); + statusLab->setText( tr( "Installation has been aborted" ) ); + QMessageBox::critical( this, + tr( "Error" ), + tr( "Modification of *.la SALOME files has not been completed."), + QMessageBox::Ok, + QMessageBox::NoButton, + QMessageBox::NoButton ); + // enable button + setNextEnabled( true ); + doPostActions( tr( "&Start" ), tr( "Start installation process" ) ); + connect( this, SIGNAL( nextClicked() ), this, SLOT( onStart() ) ); + // enable button + setBackEnabled( true ); + } +} +// ================================================================ +/*! + * SALOME_InstallWizard::runCheckFLib + * Run the Fortran and other required libraries checking + */ +// ================================================================ +void SALOME_InstallWizard::runCheckFLib() +{ + // Check Fortran libraries + checkFLibProc->clearArguments(); + // ... update status label + statusLab->setText( tr( "Check Fortran and other required libraries..." ) ); + // ... search "not found" libraries + checkFLibProc->setWorkingDirectory( QDir( rootDirPath() ).filePath( "config_files" ) ); + checkFLibProc->addArgument( "checkFortran.sh" ); + checkFLibProc->addArgument( "find_libraries" ); + checkFLibProc->addArgument( QDir::cleanDirPath( QFileInfo( targetFolder->text().stripWhiteSpace() ).absFilePath() ) ); + // ... run script + if ( !checkFLibProc->start() ) + ___MESSAGE___( "Error: process could not start!" ); +} +// ================================================================ +/*! + * SALOME_InstallWizard::checkFLibResult + * Slot to take result of Fortran and other required libraries checking + */ +// ================================================================ +void SALOME_InstallWizard::checkFLibResult() +{ + if ( checkFLibProc->normalExit() && checkFLibProc->exitStatus() == 1 ) { + QStringList notFoundLibsList, notFoundOptLibsList; + QString record = ""; + QStringList prefOptLibs = getOptionalLibs(); + // create list of strings with all 'not found' libraries + while ( checkFLibProc->canReadLineStdout() ) { + record = checkFLibProc->readLineStdout().stripWhiteSpace(); + if ( !record.isEmpty() ) { + record = QStringList::split( " ", record )[0]; + if ( !notFoundLibsList.contains( record ) && + !notFoundOptLibsList.contains( record ) ) { + bool isOptional = false; + QStringList::Iterator it_opt; + for ( it_opt = prefOptLibs.begin(); it_opt != prefOptLibs.end(); ++it_opt ) + if ( record.startsWith( (*it_opt).stripWhiteSpace(), false ) ) { + isOptional = true; + break; + } + isOptional ? notFoundOptLibsList.append( record ) \ + : notFoundLibsList.append( record ); + } + } + } + QString msg = tr( "Some libraries are absent!

    " ); + if ( !notFoundLibsList.isEmpty() ) { + msg += tr( "One or several mandatory libraries listed below are not found. SALOME may not work properly.
    " ); + msg += notFoundLibsList.join( "
    " ); + msg += "

    "; + } + if ( !notFoundOptLibsList.isEmpty() ) { + msg += tr( "One or several optional libraries listed below are not found. This does not affect on the correct work of SALOME platform.
    " ); + msg += notFoundOptLibsList.join( "
    " ); + } + if ( !notFoundLibsList.isEmpty() ) + QMessageBox::warning( this, + tr( "Warning" ), + msg, + QMessageBox::Ok, + QMessageBox::NoButton, + QMessageBox::NoButton ); + else if ( !notFoundOptLibsList.isEmpty() ) + QMessageBox::information( this, + tr( "Information" ), + msg, + QMessageBox::Ok, + QMessageBox::NoButton, + QMessageBox::NoButton ); + } + // Update GUI and check installation errors + completeInstallation(); +} +// ================================================================ +/*! + * SALOME_InstallWizard::updateSizeColumn + * Sets required size for each product according to + * installation type and 'Remove SRC & TMP' checkbox state + */ +// ================================================================ +void SALOME_InstallWizard::updateSizeColumn() +{ + long prodSize = 0; + bool removeSrc = removeSrcBtn->isChecked(); + MapProducts::Iterator mapIter; + for ( mapIter = productsMap.begin(); mapIter != productsMap.end(); ++mapIter ) { + QCheckListItem* item = mapIter.key(); + Dependancies dep = mapIter.data(); + // get required size for current product + long binSize = dep.getSize( Binaries ); + long srcSize = dep.getSize( Sources ); + long bldSize = dep.getSize( Compile ); + InstallationType instType = getInstType(); + if ( instType == Binaries ) { + if ( dep.getType() == "component" ) + prodSize = binSize + srcSize; + else + prodSize = ( binSize != 0 ? binSize : srcSize ); + } + else if ( instType == Sources ) + prodSize = srcSize; + else + if ( removeSrc ) + prodSize = ( binSize != 0 ? binSize : srcSize ); + else { + prodSize = ( bldSize != 0 ? bldSize : srcSize ); + } + // fill in 'Size' field + item->setText( 1, QString::number( prodSize )+" KB" ); + } +} +// ================================================================ /*! * SALOME_InstallWizard::checkProductPage * Checks products page validity (directories and products selection) and @@ -1660,8 +2050,8 @@ void SALOME_InstallWizard::checkProductPage() QFileInfo fi( QDir::cleanDirPath( targetFolder->text().stripWhiteSpace() ) ); if ( fi.exists() ) { diskSpaceProc->clearArguments(); - QString script = "./config_files/diskSpace.sh"; - diskSpaceProc->addArgument( script ); + diskSpaceProc->setWorkingDirectory( QDir( rootDirPath() ).filePath( "config_files" ) ); + diskSpaceProc->addArgument( "diskSpace.sh" ); diskSpaceProc->addArgument( fi.absFilePath() ); // run script diskSpaceProc->start(); @@ -1684,8 +2074,10 @@ void SALOME_InstallWizard::setPrerequisites( QCheckListItem* item ) return; // get all prerequisites QStringList dependOn = productsMap[ item ].getDependancies(); - // install MED without GUI case - if ( installGuiBtn->state() != QButton::On && item->text(0) == "MED" ) { + // install SALOME without GUI case + if ( installGuiBtn->state() != QButton::On && + woGuiModules.find( item->text(0) ) != woGuiModules.end() && + woGuiModules[item->text(0)] == True ) { dependOn.remove( "GUI" ); } // setting prerequisites @@ -1699,6 +2091,7 @@ void SALOME_InstallWizard::setPrerequisites( QCheckListItem* item ) itProd.key()->setOn( true ); itProd.key()->setEnabled( false ); } + break; } } } @@ -1722,10 +2115,6 @@ void SALOME_InstallWizard::unsetPrerequisites( QCheckListItem* item ) for ( itProd = productsMap.begin(); itProd != productsMap.end(); ++itProd ) { if ( itProd.data().getType() == productsMap[ item ].getType() ) { QStringList dependOn = itProd.data().getDependancies(); - // install MED without GUI case - if ( installGuiBtn->state() != QButton::On && itemName == "GUI" ) { - dependOn.remove( "MED" ); - } for ( int i = 0; i < (int)dependOn.count(); i++ ) { if ( dependOn[ i ] == itemName ) { if ( itProd.key()->isOn() ) { @@ -1748,12 +2137,12 @@ void SALOME_InstallWizard::unsetPrerequisites( QCheckListItem* item ) if ( itProd1.data().getType() == "prerequisite" ) { MapProducts::Iterator itProd2; for ( itProd2 = productsMap.begin(); itProd2 != productsMap.end(); ++itProd2 ) { - // if ( itProd2.data().getType() == "component" ) { if ( itProd2.key()->isOn() ) { QStringList prereqsList = productsMap[ itProd2.key() ].getDependancies(); for ( int k = 0; k < (int)prereqsList.count(); k++ ) { if ( prereqsList[ k ] == itProd1.data().getName() ) { nbDependents++; + break; } } } @@ -1763,6 +2152,7 @@ void SALOME_InstallWizard::unsetPrerequisites( QCheckListItem* item ) itProd1.key()->setOn( false ); } } + break; } } } @@ -1796,38 +2186,39 @@ void SALOME_InstallWizard::launchScript() progressView->setStatus( prodProc, Processing ); progressView->ensureVisible( prodProc ); - QCheckListItem* item; - if ( prodProc != "gcc" ) - item = findItem( prodProc ); + QCheckListItem* item = 0; // fill in script parameters shellProcess->clearArguments(); // ... script name - shellProcess->setWorkingDirectory( QDir::cleanDirPath( QFileInfo( "./config_files/" ).absFilePath() ) ); - if ( prodProc != "gcc" ) + shellProcess->setWorkingDirectory( QDir( rootDirPath() ).filePath( "config_files" ) ); + if ( !extraProducts.contains( prodProc ) ) { + item = findItem( prodProc ); shellProcess->addArgument( item->text(2) ); + } else - shellProcess->addArgument( "gcc-common.sh" ); + shellProcess->addArgument( extraProducts[ prodProc ] ); + // ... get folder with binaries + QString OS = getPlatform(); + if ( refPlatform.isEmpty() && platformsMap.find( curPlatform ) == platformsMap.end() ) + OS = commonPlatform; + QString binDir = getPlatformBinPath( OS ); // ... temp folder QString tmpFolder = QDir::cleanDirPath( tempFolder->text().stripWhiteSpace() ) + TEMPDIRNAME; //if( !tempFolder->isEnabled() ) // tmpFolder = "/tmp"; // ... not install : try to find preinstalled - if ( !progressView->isVisible( prodProc ) ) { + if ( notInstall.contains( prodProc ) || prodProc == "gcc" ) { shellProcess->addArgument( "try_preinstalled" ); shellProcess->addArgument( QFileInfo( tmpFolder ).absFilePath() ); - shellProcess->addArgument( QDir::currentDirPath() + "/Products" ); + shellProcess->addArgument( QDir( rootDirPath() ).filePath( "Products" ) ); statusLab->setText( tr( "Collecting environment for '" ) + prodProc + "'..." ); } // ... binaries ? else if ( installType == Binaries ) { shellProcess->addArgument( "install_binary" ); shellProcess->addArgument( QFileInfo( tmpFolder ).absFilePath() ); - QString binDir = QDir::cleanDirPath( getBinPath() ); - QString OS = getPlatform(); - if ( !OS.isEmpty() ) - binDir += "/" + OS; shellProcess->addArgument( binDir ); statusLab->setText( tr( "Installing '" ) + prodProc + "'..." ); } @@ -1843,28 +2234,54 @@ void SALOME_InstallWizard::launchScript() QString tgtFolder = QDir::cleanDirPath( targetFolder->text().stripWhiteSpace() ); shellProcess->addArgument( QFileInfo( tgtFolder ).absFilePath() ); // ... list of all products - QString depproducts = DefineDependeces(productsMap); - depproducts.prepend( "gcc " ); + QString depproducts = getAllProducts(productsMap); + depproducts.prepend( QStringList( extraProducts.keys() ).join(" ") + " " ); ___MESSAGE___( "Dependancies"<< depproducts.latin1() ); shellProcess->addArgument( depproducts ); // ... product name - currently installed product - if ( prodProc != "gcc" ) + if ( !extraProducts.contains( prodProc ) ) shellProcess->addArgument( item->text(0) ); else - shellProcess->addArgument( "gcc" ); + shellProcess->addArgument( prodProc ); // ... list of products being installed shellProcess->addArgument( prodSequence.join( " " ) ); // ... sources directory shellProcess->addArgument( QDir::cleanDirPath( getSrcPath() ) ); // ... remove sources and tmp files or not? - if ( installType == Compile && removeSrcBtn->state() == QButton::On ) + if ( installType == Compile && removeSrcBtn->isOn() ) shellProcess->addArgument( "TRUE" ); else shellProcess->addArgument( "FALSE" ); - // ... install MED with GUI or not? - if ( installGuiBtn->state() != QButton::On && prodProc == "MED" && - (installType == Binaries || installType == Compile) ) - shellProcess->addArgument( "FALSE" ); + // ... binaries directory + shellProcess->addArgument( binDir ); + // ... install SALOME with GUI or not? + if ( woGuiModules.find( prodProc ) != woGuiModules.end() ) + ( installGuiBtn->state() != QButton::On && woGuiModules[ prodProc ] == True ) ? + shellProcess->addArgument( "FALSE" ) : + shellProcess->addArgument( "TRUE" ); + // ... single installation directory for SALOME modules, if this option was selected + if ( oneModDirBtn->isChecked() ) { + MapProducts::Iterator mapIter; + for ( mapIter = productsMap.begin(); mapIter != productsMap.end(); ++mapIter ) + if ( mapIter.data().getName() == prodProc && mapIter.data().getType() == "component" ) { + shellProcess->addArgument( "TRUE" ); + break; + } + } + // ... single installation directory for prerequisites, if this option was selected + if ( oneProdDirBtn->isChecked() ) { + if ( prodProc == "DebianLibsForSalome" ) + shellProcess->addArgument( oneProdDirName ); + else { + MapProducts::Iterator mapIter; + for ( mapIter = productsMap.begin(); mapIter != productsMap.end(); ++mapIter ) + if ( mapIter.data().getName() == prodProc && mapIter.data().getType() == "prerequisite" ) { + shellProcess->addArgument( oneProdDirName ); + break; + } + } + } + // run script if ( !shellProcess->start() ) { // error handling can be here @@ -1872,41 +2289,63 @@ void SALOME_InstallWizard::launchScript() } return; } + + // else try to find aborted product + prodProc = progressView->findStatus( Aborted ); + if ( !prodProc.isNull() ) + return; // installation has been aborted + ___MESSAGE___( "All products have been installed successfully" ); // all products are installed successfully MapProducts::Iterator mapIter; ___MESSAGE___( "starting pick-up environment" ); - QString depproducts = QUOTE( DefineDependeces(productsMap).prepend( "gcc " ) ); + QString depproducts = QUOTE( getAllProducts(productsMap).prepend( QStringList( extraProducts.keys() ).join(" ") + " " ) ); for ( mapIter = productsMap.begin(); mapIter != productsMap.end(); ++mapIter ) { QCheckListItem* item = mapIter.key(); Dependancies dep = mapIter.data(); if ( item->isOn() && dep.pickUpEnvironment() ) { statusLab->setText( tr( "Pick-up products environment for " ) + dep.getName().latin1() + "..." ); ___MESSAGE___( "... for " << dep.getName().latin1() ); - QString script; - script += "cd " + QUOTE( QFileInfo( QDir::cleanDirPath( "./config_files/" ) ).absFilePath() ) + "; "; - script += item->text(2) + " "; - script += "pickup_env "; - script += QUOTE( QFileInfo( QDir::cleanDirPath( tempFolder->text().stripWhiteSpace() ) + TEMPDIRNAME ).absFilePath() ) + " "; - script += QUOTE( QFileInfo( QDir::cleanDirPath( QDir::currentDirPath() + "/Products" ) ).absFilePath() ) + " "; - script += QUOTE( QFileInfo( QDir::cleanDirPath( targetFolder->text().stripWhiteSpace() ) ).absFilePath() ) + " "; - script += depproducts + " "; - script += item->text(0) + " "; - script += QUOTE( prodSequence.join( " " ) ); - ___MESSAGE___( "... --> " << script.latin1() ); - if ( system( script.latin1() ) ) { + QDir rd( rootDirPath() ); + Script script; + script << "cd" << QUOTE( rd.filePath( "config_files" ) ) << ";"; + script << item->text(2) << "pickup_env"; + script << QUOTE( QFileInfo( QDir::cleanDirPath( tempFolder->text().stripWhiteSpace() ) + TEMPDIRNAME ).absFilePath() ); + script << QUOTE( QFileInfo( QDir::cleanDirPath( QDir( rootDirPath() ).filePath( "Products" ) ) ).absFilePath() ); + script << QUOTE( QFileInfo( QDir::cleanDirPath( targetFolder->text().stripWhiteSpace() ) ).absFilePath() ); + script << depproducts << item->text(0) << QUOTE( prodSequence.join( " " ) ); + ___MESSAGE___( "... --> " << script.script().latin1() ); + if ( system( script.script().latin1() ) ) { ___MESSAGE___( "ERROR" ); } } } + + if ( installType == Binaries ) { + if ( oneModDirBtn->isChecked() ) + runModifyLaFiles(); + else + runCheckFLib(); + } + else { + // Update GUI and check installation errors + completeInstallation(); + } + +} +// ================================================================ +/*! + * SALOME_InstallWizard::completeInstallation + * Update GUI and check installation errors + */ +// ================================================================ +void SALOME_InstallWizard::completeInstallation() +{ // update status label statusLab->setText( tr( "Installation completed" ) ); // button setNextEnabled( true ); - nextButton()->setText( tr( "&Next >" ) ); - setAboutInfo( nextButton(), tr( "Move to the next step of the installation procedure" ) ); - disconnect( this, SIGNAL( nextClicked() ), this, SLOT( next() ) ); - disconnect( this, SIGNAL( nextClicked() ), this, SLOT( onStart() ) ); + doPostActions( tr( "&Next >" ), tr( "Move to the next step of the installation procedure" ) ); connect( this, SIGNAL( nextClicked() ), this, SLOT( next() ) ); // button setBackEnabled( true ); @@ -1921,7 +2360,7 @@ void SALOME_InstallWizard::launchScript() if ( hasErrors ) { if ( QMessageBox::warning( this, tr( "Warning" ), - tr( "There were some errors and/or warnings during the installation.\n" + tr( "There were some errors during the installation.\n" "Do you want to save the installation log?" ), tr( "&Save" ), tr( "&Cancel" ), @@ -1931,6 +2370,7 @@ void SALOME_InstallWizard::launchScript() saveLog(); } hasErrors = false; + } // ================================================================ /*! @@ -1949,7 +2389,8 @@ void SALOME_InstallWizard::onInstallGuiBtn() } else { QString itemName = itProd.data().getName(); - if ( itemName != "KERNEL" && itemName != "MED" && itemName != "SAMPLES" ) { + if ( woGuiModules.find( itemName ) == woGuiModules.end() || + woGuiModules[ itemName ] == False ) { itProd.key()->setOn( false ); itProd.key()->setEnabled( false ); } @@ -1998,15 +2439,17 @@ void SALOME_InstallWizard::onFinishButton() ButtonList::Iterator it; for ( it = buttons.begin(); it != buttons.end(); ++it ) { if ( (*it).button() && (*it).button() == btn ) { - QString script; - script += "( cd " + QUOTE( QFileInfo( QDir::cleanDirPath( "./config_files/" ) ).absFilePath() ) + "; "; - script += + (*it).script(); - script += " execute "; - script += QUOTE( QFileInfo( QDir::cleanDirPath( targetFolder->text().stripWhiteSpace() ) ).absFilePath() ) + " "; - script += QUOTE( QFileInfo( QDir::cleanDirPath( tempFolder->text().stripWhiteSpace() ) + TEMPDIRNAME ).absFilePath() ) + " "; - script += " > /dev/null )"; - ___MESSAGE___( "script: " << script.latin1() ); - if ( (*it).script().isEmpty() || system( script.latin1() ) ) { + QDir rd( rootDirPath() ); + Script script; + script << "cd" << QUOTE( rd.filePath( "config_files" ) ) << ";"; + script << (*it).script() << "execute"; + script << QUOTE( QFileInfo( QDir::cleanDirPath( targetFolder->text().stripWhiteSpace() ) ).absFilePath() ); + script << QUOTE( QFileInfo( QDir::cleanDirPath( tempFolder->text().stripWhiteSpace() ) + TEMPDIRNAME ).absFilePath() ); +#ifdef USE_DEV_NULL + script << ">& /dev/null"; +#endif + ___MESSAGE___( "script: " << script.script().latin1() ); + if ( (*it).script().isEmpty() || system( script.script().latin1() ) ) { QMessageBox::warning( this, tr( "Error" ), tr( "Can't perform action!"), @@ -2114,22 +2557,30 @@ void SALOME_InstallWizard::clean(bool rmDir) myWC.wakeAll(); while ( myThread->running() ); // first remove temporary files - QString script = "cd ./config_files/; remove_tmp.sh '"; - script += tempFolder->text().stripWhiteSpace() + TEMPDIRNAME; - script += "' "; - script += QUOTE(DefineDependeces(productsMap)); - script += " > /dev/null"; - ___MESSAGE___( "script = " << script.latin1() ); - if ( system( script.latin1() ) ) { + QDir rd( rootDirPath() ); + Script script; + script << "cd" << QUOTE( rd.filePath( "config_files" ) ) << ";"; + script << "remove_tmp.sh" << QUOTE( tempFolder->text().stripWhiteSpace() + TEMPDIRNAME ); + script << QUOTE( getAllProducts( productsMap ) ); +#ifdef USE_DEV_NULL + script << ">& /dev/null"; +#endif + ___MESSAGE___( "script = " << script.script().latin1() ); + if ( system( script.script().latin1() ) ) { + // error } // then try to remove created temporary directory //script = "rm -rf " + QDir::cleanDirPath( tempFolder->text().stripWhiteSpace() ) + TEMPDIRNAME; if ( rmDir && !tmpCreated.isNull() ) { - script = "rm -rf " + tmpCreated; - script += " > /dev/null"; - if ( system( script.latin1() ) ) { + script.clear(); + script << "rm -rf" << QUOTE( tmpCreated ); +#ifdef USE_DEV_NULL + script << ">& /dev/null"; +#endif + if ( system( script.script().latin1() ) ) { + // error } - ___MESSAGE___( "script = " << script.latin1() ); + ___MESSAGE___( "script = " << script.script().latin1() ); } } // ================================================================ @@ -2140,10 +2591,7 @@ void SALOME_InstallWizard::clean(bool rmDir) // ================================================================ void SALOME_InstallWizard::pageChanged( const QString & mytitle) { - nextButton()->setText( tr( "&Next >" ) ); - setAboutInfo( nextButton(), tr( "Move to the next step of the installation procedure" ) ); - disconnect( this, SIGNAL( nextClicked() ), this, SLOT( next() ) ); - disconnect( this, SIGNAL( nextClicked() ), this, SLOT( onStart() ) ); + doPostActions( tr( "&Next >" ), tr( "Move to the next step of the installation procedure" ) ); connect( this, SIGNAL( nextClicked() ), this, SLOT( next() ) ); cancelButton()->disconnect(); connect( cancelButton(), SIGNAL( clicked()), this, SLOT( reject() ) ); @@ -2156,9 +2604,12 @@ void SALOME_InstallWizard::pageChanged( const QString & mytitle) if ( aPage == typePage ) { // installation type page if ( buttonGrp->id( buttonGrp->selected() ) == -1 ) - binBtn->animateClick(); // set default installation type + // set default installation type + forceSrc ? srcCompileBtn->animateClick() : binBtn->animateClick(); + else + buttonGrp->selected()->animateClick(); } - if ( aPage == platformsPage ) { + else if ( aPage == platformsPage ) { // installation platforms page MapXmlFiles::Iterator it; if ( previousPage == typePage ) { @@ -2166,21 +2617,21 @@ void SALOME_InstallWizard::pageChanged( const QString & mytitle) QString plat = it.key(); QRadioButton* rb = ( (QRadioButton*) platBtnGrp->child( plat ) ); if ( installType == Binaries ) { - QFileInfo fib( QDir::cleanDirPath( getBinPath() + "/" + plat ) ); - rb->setEnabled( fib.exists() ); - } - else { - QFileInfo fis( QDir::cleanDirPath( getSrcPath() ) ); - rb->setEnabled( fis.exists() ); + QFileInfo fib( getPlatformBinPath( plat ) ); + rb->setEnabled( true/*fib.isDir()*/ ); + if ( platBtnGrp->id( platBtnGrp->selected() ) == -1 && plat == getBasePlatform() ) + rb->animateClick(); } - rb->setChecked( rb->isChecked() && rb->isEnabled() ); +// rb->setChecked( rb->isChecked() && rb->isEnabled() ); + if ( rb->isChecked() && rb->isEnabled() ) + rb->animateClick(); } setNextEnabled( platformsPage, platBtnGrp->id( platBtnGrp->selected() ) != -1 ); } } else if ( aPage == dirPage ) { // installation and temporary directories page - if ( ( indexOf( platformsPage ) != -1 ? + if ( ( ( this->indexOf( platformsPage ) != -1 && this->appropriate( platformsPage ) ) ? previousPage == platformsPage : previousPage == typePage ) && stateChanged ) { // clear global variables before reading XML file @@ -2195,6 +2646,18 @@ void SALOME_InstallWizard::pageChanged( const QString & mytitle) if ( tempFolder->text().isEmpty() ) parser->setTempDir( tempFolder ); parser->readXmlFile( xmlFileName ); + // create a map of SALOME modules names, that can support installation without GUI mode + if ( woGuiModules.isEmpty() ) { + MapProducts::Iterator mapIter; + for ( mapIter = productsMap.begin(); mapIter != productsMap.end(); mapIter++ ) { + Dependancies dep = mapIter.data(); + if ( dep.getType() == "component" && dep.supportWoGuiMode() != NotDefined ) + woGuiModules[ dep.getName() ] = dep.supportWoGuiMode(); + } + } + + // update required size for each product + updateSizeColumn(); // take into account command line parameters if ( !myTargetPath.isEmpty() ) targetFolder->setText( myTargetPath ); @@ -2206,7 +2669,17 @@ void SALOME_InstallWizard::pageChanged( const QString & mytitle) if ( modulesView->childCount() > 0 && !modulesView->selectedItem() ) modulesView->setSelected( modulesView->firstChild(), true ); stateChanged = false; + } + else if ( rmSrcPrevState != removeSrcBtn->isChecked() ) { + // only update required size for each product + updateSizeColumn(); + rmSrcPrevState = removeSrcBtn->isChecked(); } + // add extra products to install list + extraProducts.clear(); + //extraProducts.insert( "gcc", "gcc-common.sh" ); + if ( refPlatform == commonPlatform && installType == Binaries ) + extraProducts.insert( "DebianLibsForSalome", "DEBIANFORSALOME-3.1.sh" ); } else if ( aPage == productsPage ) { // products page @@ -2227,11 +2700,7 @@ void SALOME_InstallWizard::pageChanged( const QString & mytitle) passedParams->clear(); passedParams->setEnabled( false ); QFont f = parametersLab->font(); f.setBold( false ); parametersLab->setFont( f ); - nextButton()->setText( tr( "&Start" ) ); - setAboutInfo( nextButton(), tr( "Start installation process" ) ); - // reconnect Next button - to use it as Start button - disconnect( this, SIGNAL( nextClicked() ), this, SLOT( next() ) ); - disconnect( this, SIGNAL( nextClicked() ), this, SLOT( onStart() ) ); + doPostActions( tr( "&Start" ), tr( "Start installation process" ) ); connect( this, SIGNAL( nextClicked() ), this, SLOT( onStart() ) ); setNextEnabled( true ); // reconnect Cancel button to terminate process @@ -2243,15 +2712,17 @@ void SALOME_InstallWizard::pageChanged( const QString & mytitle) ButtonList::Iterator it; for ( it = buttons.begin(); it != buttons.end(); ++it ) { if ( (*it).button() ) { - QString script; - script += "( cd " + QUOTE( QFileInfo( QDir::cleanDirPath( "./config_files/" ) ).absFilePath() ) + "; "; - script += + (*it).script(); - script += " check_enabled "; - script += QUOTE( QFileInfo( QDir::cleanDirPath( targetFolder->text().stripWhiteSpace() ) ).absFilePath() ) + " "; - script += QUOTE( QFileInfo( QDir::cleanDirPath( tempFolder->text().stripWhiteSpace() ) + TEMPDIRNAME ).absFilePath() ) + " "; - script += " > /dev/null )"; - ___MESSAGE___( "script: " << script.latin1() ); - (*it).button()->setEnabled( !(*it).script().isEmpty() && !system( script.latin1() ) ); + QDir rd( rootDirPath() ); + Script script; + script << "cd" << QUOTE( rd.filePath( "config_files" ) ) << ";"; + script << (*it).script() << "check_enabled"; + script << QUOTE( QFileInfo( QDir::cleanDirPath( targetFolder->text().stripWhiteSpace() ) ).absFilePath() ); + script << QUOTE( QFileInfo( QDir::cleanDirPath( tempFolder->text().stripWhiteSpace() ) + TEMPDIRNAME ).absFilePath() ); +#ifdef USE_DEV_NULL + script << ">& /dev/null"; +#endif + ___MESSAGE___( "script: " << script.script().latin1() ); + (*it).button()->setEnabled( !(*it).script().isEmpty() && !system( script.script().latin1() ) ); } } finishButton()->setEnabled( true ); @@ -2274,16 +2745,21 @@ void SALOME_InstallWizard::onButtonGroup( int rbIndex ) installType = InstallationType( rbIndex ); // management of the check-box removeSrcBtn->setEnabled( installType == Compile ); + oneModDirBtn->setEnabled( installType == Binaries /*|| installType == Compile*/ ); + oneProdDirBtn->setEnabled( installType == Binaries || installType == Compile ); + refPlatform = ""; + xmlFileName = getXmlFile( curPlatform ); } else if ( aPage == platformsPage ) { refPlatform = platBtnGrp->find( rbIndex )->name(); - xmlFileName = platformsMap[ refPlatform ]; - cout << xmlFileName << endl; + xmlFileName = getXmlFile( refPlatform ); setNextEnabled( platformsPage, true ); } if ( prevType != installType || ( indexOf( platformsPage ) != -1 ? prevPlat != getPlatform() : false ) ) { stateChanged = true; + oneModDirBtn->setChecked( installType == Binaries && singleDir ); + oneProdDirBtn->setChecked( false ); } } // ================================================================ @@ -2351,28 +2827,32 @@ void SALOME_InstallWizard::directoryChanged( const QString& /*text*/ ) // ================================================================ void SALOME_InstallWizard::onStart() { - cout << "" << endl; if ( nextButton()->text() == tr( "&Stop" ) ) { statusLab->setText( tr( "Aborting installation..." ) ); shellProcess->kill(); + modifyLaProc->kill(); while( shellProcess->isRunning() ); statusLab->setText( tr( "Installation has been aborted by user" ) ); return; } + hasErrors = false; progressView->clear(); installInfo->clear(); installInfo->setFinished( false ); passedParams->clear(); passedParams->setEnabled( false ); + // disable 'Ignore errors' checkbox during installation process + ignoreErrCBox->setEnabled( false ); QFont f = parametersLab->font(); f.setBold( false ); parametersLab->setFont( f ); + // update status label statusLab->setText( tr( "Preparing for installation..." ) ); // clear lists of products toInstall.clear(); notInstall.clear(); + toInstall += extraProducts.keys(); // ... and fill it for new process - toInstall.append( "gcc" ); QCheckListItem* item = (QCheckListItem*)( prereqsView->firstChild() ); while( item ) { if ( productsMap.contains( item ) ) { @@ -2394,7 +2874,41 @@ void SALOME_InstallWizard::onStart() item = (QCheckListItem*)( item->nextSibling() ); } // if something at all is selected - if ( (int)toInstall.count() > 1 ) { + if ( (int)toInstall.count() > 0 ) { + + if ( installType == Compile ) { + // update status label + statusLab->setText( tr( "Check Fortran compiler..." ) ); + // check Fortran compiler. + QDir rd( rootDirPath() ); + Script script; + script << QUOTE( rd.filePath( "config_files/checkFortran.sh" ) ) << "find_compilers"; + script << QUOTE( QFileInfo( QDir::cleanDirPath( tempFolder->text().stripWhiteSpace() ) + TEMPDIRNAME ).absFilePath() ); + ___MESSAGE___( "script = " << script.script().latin1() ); + if ( system( script.script().latin1() ) ) { + QMessageBox::critical( this, + tr( "Error" ), + tr( "Fortran compiler was not found at current system!\n" + "Installation can not be continued!"), + QMessageBox::Ok, + QMessageBox::NoButton, + QMessageBox::NoButton ); + // installation aborted + abort(); + statusLab->setText( tr( "Installation has been aborted" ) ); + // enable button + setNextEnabled( true ); + doPostActions( tr( "&Start" ), tr( "Start installation process" ) ); + connect( this, SIGNAL( nextClicked() ), this, SLOT( onStart() ) ); + // enable button + setBackEnabled( true ); + return; + } + } + + // update status label + statusLab->setText( tr( "Preparing for installation..." ) ); + clean(false); // VSR 07/02/05 - bug fix: first we should clear temporary directory // disable button //setNextEnabled( false ); @@ -2408,12 +2922,12 @@ void SALOME_InstallWizard::onStart() ProgressViewItem* progressItem; // set status for installed products for ( int i = 0; i < (int)toInstall.count(); i++ ) { - if ( toInstall[i] != "gcc" ) { + if ( !extraProducts.contains( toInstall[i] ) ) { item = findItem( toInstall[i] ); progressView->addProduct( item->text(0), item->text(2) ); continue; } - progressItem = progressView->addProduct( "gcc", "gcc-common.sh" ); + progressItem = progressView->addProduct( toInstall[i], extraProducts[toInstall[i]] ); progressItem->setVisible( false ); } // set status for not installed products @@ -2425,7 +2939,7 @@ void SALOME_InstallWizard::onStart() // get specified list of products being installed prodSequence.clear(); for (int i = 0; i<(int)toInstall.count(); i++ ) { - if ( toInstall[i] == "gcc" ) { + if ( extraProducts.contains( toInstall[i] ) ) { prodSequence.append( toInstall[i] ); continue; } @@ -2450,10 +2964,12 @@ void SALOME_InstallWizard::onStart() // create a backup of 'env_build.csh', 'env_build.sh', 'env_products.csh', 'env_products.sh' // ( backup of 'salome.csh' and 'salome.sh' is made if pick-up environment is called ) - QString script = "./config_files/backupEnv.sh "; - script += QUOTE( QFileInfo( QDir::cleanDirPath( targetFolder->text().stripWhiteSpace() ) ).absFilePath() ); - ___MESSAGE___( "script = " << script.latin1() ); - if ( system( script ) ) { + QDir rd( rootDirPath() ); + Script script; + script << QUOTE( rd.filePath( "config_files/backupEnv.sh" ) ); + script << QUOTE( QFileInfo( QDir::cleanDirPath( targetFolder->text().stripWhiteSpace() ) ).absFilePath() ); + ___MESSAGE___( "script = " << script.script().latin1() ); + if ( system( script.script().latin1() ) ) { if ( QMessageBox::warning( this, tr( "Warning" ), tr( "Backup environment files have not been created.\n" @@ -2464,13 +2980,9 @@ void SALOME_InstallWizard::onStart() // installation aborted abort(); statusLab->setText( tr( "Installation has been aborted by user" ) ); - // enable button + // update button setNextEnabled( true ); - nextButton()->setText( tr( "&Start" ) ); - setAboutInfo( nextButton(), tr( "Start installation process" ) ); - // reconnect Next button - to use it as Start button - disconnect( this, SIGNAL( nextClicked() ), this, SLOT( next() ) ); - disconnect( this, SIGNAL( nextClicked() ), this, SLOT( onStart() ) ); + doPostActions( tr( "&Start" ), tr( "Start installation process" ) ); connect( this, SIGNAL( nextClicked() ), this, SLOT( onStart() ) ); // enable button setBackEnabled( true ); @@ -2512,7 +3024,7 @@ void SALOME_InstallWizard::productInstalled() } else { ___MESSAGE___( "...abnormal exit" ); - statusLab->setText( tr( "Script is not completed and installation has been aborted" ) ); + statusLab->setText( tr( "Installation has been aborted" ) ); // installation aborted abort(); // clear script passed parameters lineedit @@ -2522,16 +3034,9 @@ void SALOME_InstallWizard::productInstalled() installInfo->setFinished( true ); // enable button setNextEnabled( true ); - nextButton()->setText( tr( "&Start" ) ); - setAboutInfo( nextButton(), tr( "Start installation process" ) ); - // reconnect Next button - to use it as Start button - disconnect( this, SIGNAL( nextClicked() ), this, SLOT( next() ) ); - disconnect( this, SIGNAL( nextClicked() ), this, SLOT( onStart() ) ); + doPostActions( tr( "&Start" ), tr( "Start installation process" ) ); connect( this, SIGNAL( nextClicked() ), this, SLOT( onStart() ) ); - //nextButton()->setText( tr( "&Next >" ) ); - //setAboutInfo( nextButton(), tr( "Move to the next step of the installation procedure" ) ); - //disconnect( this, SIGNAL( nextClicked() ), this, SLOT( next() ) ); - //disconnect( this, SIGNAL( nextClicked() ), this, SLOT( onStart() ) ); + //doPostActions( tr( "&Next >" ), tr( "Move to the next step of the installation procedure" ) ); //connect( this, SIGNAL( nextClicked() ), this, SLOT( next() ) ); // enable button setBackEnabled( true ); @@ -2577,23 +3082,26 @@ void SALOME_InstallWizard::tryTerminate() void SALOME_InstallWizard::onCancel() { shellProcess->kill(); + modifyLaProc->kill(); + checkFLibProc->kill(); reject(); } // ================================================================ /*! * SALOME_InstallWizard::onSelectionChanged * Called when selection is changed in the products list view + * to fill in the 'Information about product' text box */ // ================================================================ void SALOME_InstallWizard::onSelectionChanged() { const QObject* snd = sender(); - productInfo->clear(); QListViewItem* item = modulesView->selectedItem(); if ( snd == prereqsView ) item = prereqsView->selectedItem(); if ( !item ) return; + productInfo->clear(); QCheckListItem* anItem = (QCheckListItem*)item; if ( !productsMap.contains( anItem ) ) return; @@ -2605,14 +3113,13 @@ void SALOME_InstallWizard::onSelectionChanged() if ( !dep.getDescription().isEmpty() ) { text += "" + dep.getDescription() + "

    "; } - long totSize = 0, tempSize = 0; - if ( installType == Compile && removeSrcBtn->state() == QButton::On ) - totSize = dep.getSize( Binaries ); - else - totSize = dep.getSize( installType ); - tempSize = dep.getTempSize( installType ); - text += tr( "Disk space required" ) + ": " + QString::number( totSize ) + " KB
    "; - text += tr( "Disk space for tmp files required" ) + ": " + QString::number( tempSize ) + " KB
    "; + /* AKL: 07/08/28 - hide required disk space for tmp files for each product ==> + long tempSize = 0; + tempSize = dep.getTempSize( installType ); + text += tr( "Disk space for tmp files required" ) + ": " + QString::number( tempSize ) + " KB
    "; + AKL: 07/08/28 - hide required disk space for tmp files for each product <== + */ + text += tr( "Disk space required" ) + ": " + item->text(1) + "
    "; text += "
    "; QString req = ( dep.getDependancies().count() > 0 ? dep.getDependancies().join(", ") : tr( "none" ) ); text += tr( "Prerequisites" ) + ": " + req; @@ -2655,11 +3162,12 @@ void SALOME_InstallWizard::wroteToStdin( ) void SALOME_InstallWizard::readFromStdout( ) { ___MESSAGE___( "Something was sent to stdout" ); - while ( shellProcess->canReadLineStdout() ) { - installInfo->append( QString( shellProcess->readLineStdout() ) ); + QProcess* theProcess = ( QProcess* )sender(); + while ( theProcess->canReadLineStdout() ) { + installInfo->append( QString( theProcess->readLineStdout() ) ); installInfo->scrollToBottom(); } - QString str( shellProcess->readStdout() ); + QString str( theProcess->readStdout() ); if ( !str.isEmpty() ) { installInfo->append( str ); installInfo->scrollToBottom(); @@ -2677,17 +3185,22 @@ void SALOME_InstallWizard::readFromStdout( ) void SALOME_InstallWizard::readFromStderr( ) { ___MESSAGE___( "Something was sent to stderr" ); - while ( shellProcess->canReadLineStderr() ) { - installInfo->append( OUTLINE_TEXT( QString( shellProcess->readLineStderr() ) ) ); + QProcess* theProcess = ( QProcess* )sender(); + while ( theProcess->canReadLineStderr() ) { + installInfo->append( OUTLINE_TEXT( QString( theProcess->readLineStderr() ) ) ); installInfo->scrollToBottom(); hasErrors = true; } - QString str( shellProcess->readStderr() ); + QString str( theProcess->readStderr() ); if ( !str.isEmpty() ) { installInfo->append( OUTLINE_TEXT( str ) ); installInfo->scrollToBottom(); hasErrors = true; } + + // stop or proceed installation process + manageInstProc(); + // VSR: 10/11/05 - disable answer mode ==> // passedParams->setEnabled( true ); // passedParams->setFocus(); @@ -2695,6 +3208,41 @@ void SALOME_InstallWizard::readFromStderr( ) // VSR: 10/11/05 - disable answer mode <== } // ================================================================ +/*! + * SALOME_InstallWizard::manageInstProc + * QProcess slot: -->stop installation if there is an error in stderr + */ +// ================================================================ +void SALOME_InstallWizard::manageInstProc() +{ + if ( !hasErrors || ignoreErrCBox->isChecked() ) + return; //proceed installation process + + // abort the current installation + statusLab->setText( tr( "Aborting installation..." ) ); + abort(); + statusLab->setText( tr( "Installation has been aborted because some errors" ) ); + if ( QMessageBox::critical( this, + tr( "Error" ), + tr( "Installation process has been stopped, because an error occured \n" + "during an installation of the current product!\n" + "Please see the installation progress view for more details about the error.\n\n" + "Do you want to save the installation log?" ), + tr( "&Save" ), + tr( "&Cancel" ), + QString::null, + 0, + 1 ) == 0 ) + saveLog(); + // enable button + setNextEnabled( true ); + doPostActions( tr( "&Start" ), tr( "Start installation process" ) ); + connect( this, SIGNAL( nextClicked() ), this, SLOT( onStart() ) ); + // enable button + setBackEnabled( true ); + installInfo->setFinished( true ); +} +// ================================================================ /*! * SALOME_InstallWizard::setDependancies * Sets dependancies for the product item @@ -2705,6 +3253,24 @@ void SALOME_InstallWizard::setDependancies( QCheckListItem* item, Dependancies d productsMap[item] = dep; } // ================================================================ +/*! + * SALOME_InstallWizard::doPostActions + * Executes some actions after finish of installation process (successful or not) + */ +// ================================================================ +void SALOME_InstallWizard::doPostActions( const QString& btnText, + const QString& btnAboutInfo ) +{ + // update button + nextButton()->setText( btnText ); + setAboutInfo( nextButton(), btnAboutInfo ); + // reconnect Next button - to use it as Start button + disconnect( this, SIGNAL( nextClicked() ), this, SLOT( next() ) ); + disconnect( this, SIGNAL( nextClicked() ), this, SLOT( onStart() ) ); + // enable 'Ignore errors' checkbox + ignoreErrCBox->setEnabled( true ); +} +// ================================================================ /*! * SALOME_InstallWizard::addFinishButton * Add button for the page. @@ -2765,6 +3331,7 @@ void SALOME_InstallWizard::saveLog() QDateTime dt = QDateTime::currentDateTime(); QString fileName = dt.toString("ddMMyy-hhmm"); fileName.prepend("install-"); fileName.append(".html"); + fileName = QFileInfo( QDir::cleanDirPath( targetFolder->text().stripWhiteSpace() ), fileName ).absFilePath(); fileName = QFileDialog::getSaveFileName( fileName, QString( "HTML files (*.htm *.html)" ), this, 0,