From 718ae7b25f82213ab9edc9a01a9d50341cf57959 Mon Sep 17 00:00:00 2001 From: akl Date: Fri, 17 Aug 2007 14:07:53 +0000 Subject: [PATCH] To check that required Fortran compilers and libraries are installed on current system. --- src/SALOME_InstallWizard.cxx | 104 ++++++++++++++++++++++++++++++++++- src/SALOME_InstallWizard.hxx | 5 ++ 2 files changed, 106 insertions(+), 3 deletions(-) diff --git a/src/SALOME_InstallWizard.cxx b/src/SALOME_InstallWizard.cxx index ac09dff..1a49501 100644 --- a/src/SALOME_InstallWizard.cxx +++ b/src/SALOME_InstallWizard.cxx @@ -533,6 +533,10 @@ SALOME_InstallWizard::SALOME_InstallWizard(const QString& aXmlFileName, // create instance of class for starting shell install script shellProcess = new QProcess( this, "shellProcess" ); + // create instance of class for starting shell script to check Fortran libraries + checkFLibProc = new QProcess( this, "checkFLibProc" ); + connect(checkFLibProc, SIGNAL( processExited() ), this, SLOT( checkFLibResult() ) ); + // create introduction page setupIntroPage(); // create page to select installation type @@ -1517,7 +1521,7 @@ bool SALOME_InstallWizard::acceptData( const QString& pageTitle ) QMessageBox::NoButton ); return false; } - // AKL: 13/08/07 - skip tmp disk space checking (all files are unpucked into installation directory) ==> + // 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 @@ -1537,7 +1541,7 @@ bool SALOME_InstallWizard::acceptData( const QString& pageTitle ) return false; } */ - // AKL: 13/08/07 - skip tmp disk space checking (all files are unpucked into installation directory) <== + // AKL: 13/08/07 - skip tmp disk space checking (all files are unpacked into installation directory) <== // ########## check installation scripts QCheckListItem* item; @@ -1651,6 +1655,34 @@ void SALOME_InstallWizard::updateAvailableSpace() availableSize->setText( diskSpaceProc->readLineStdout() + " KB"); } // ================================================================ +/*! + * SALOME_InstallWizard::checkFLibResult + * Slot to take result of Fortran libraries checking + */ +// ================================================================ +void SALOME_InstallWizard::checkFLibResult() +{ + cout << "RESULT is " << checkFLibProc->exitStatus() << endl; + if ( checkFLibProc->normalExit() && checkFLibProc->exitStatus() == 1 ) { + cout << "Some libs are absent" << endl; + QString notFoundLibs; + while ( checkFLibProc->canReadLineStdout() ) { + notFoundLibs.append( checkFLibProc->readLineStdout() ); + if ( checkFLibProc->canReadLineStdout() ) + notFoundLibs.append( "\n" ); + } + QMessageBox::warning( this, + tr( "Warning" ), + tr( "The following libraries are absent on current system:\n" + "%1").arg( notFoundLibs ), + QMessageBox::Ok, + QMessageBox::NoButton, + QMessageBox::NoButton ); + } + // Update GUI and check installation errors + completeInstallation(); +} +// ================================================================ /*! * SALOME_InstallWizard::checkProductPage * Checks products page validity (directories and products selection) and @@ -1912,6 +1944,34 @@ void SALOME_InstallWizard::launchScript() } } } + + if ( installType == Binaries ) { + // Check Fortran libraries + // ... update status label + statusLab->setText( tr( "Check Fortran libraries..." ) ); + // ... search "not found" libraries + checkFLibProc->setWorkingDirectory( QDir::cleanDirPath( QFileInfo( "./config_files/" ).absFilePath() ) ); + 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!" ); + } + } + 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 @@ -1944,6 +2004,7 @@ void SALOME_InstallWizard::launchScript() saveLog(); } hasErrors = false; + } // ================================================================ /*! @@ -2372,6 +2433,7 @@ void SALOME_InstallWizard::onStart() statusLab->setText( tr( "Installation has been aborted by user" ) ); return; } + hasErrors = false; progressView->clear(); installInfo->clear(); @@ -2379,6 +2441,7 @@ void SALOME_InstallWizard::onStart() passedParams->clear(); passedParams->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 @@ -2408,6 +2471,41 @@ void SALOME_InstallWizard::onStart() } // if something at all is selected if ( (int)toInstall.count() > 1 ) { + + if ( installType == Compile ) { + // update status label + statusLab->setText( tr( "Check Fortran compiler..." ) ); + // check Fortran compiler. + QString script = "./config_files/checkFortran.sh find_compilers"; + ___MESSAGE___( "script = " << script.latin1() ); + if ( system( script ) ) { + 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 ); + 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() ) ); + 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 ); @@ -2525,7 +2623,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 diff --git a/src/SALOME_InstallWizard.hxx b/src/SALOME_InstallWizard.hxx index 1594ef1..901b46b 100644 --- a/src/SALOME_InstallWizard.hxx +++ b/src/SALOME_InstallWizard.hxx @@ -265,6 +265,8 @@ class SALOME_InstallWizard: public InstallWizard void abort(); // clears and (optionally) removes temporary directory void clean(bool rmDir = false); + // Update GUI and check installation errors + void completeInstallation(); protected slots: // reject slot @@ -303,6 +305,8 @@ class SALOME_InstallWizard: public InstallWizard void onMoreBtn(); // Slot to update 'Available disk space' field void updateAvailableSpace(); + // Slot to take result of Fortran libraries checking + void checkFLibResult(); // page buttons slot void onFinishButton(); @@ -330,6 +334,7 @@ class SALOME_InstallWizard: public InstallWizard HelpWindow* helpWindow; // help window QProcess* shellProcess; // shell process (install script) QProcess* diskSpaceProc; // shell process (to get available disk space script) + QProcess* checkFLibProc; // shell process (to get available disk space script) MapProducts productsMap; // products info (name, dependancies, disk space ) QStringList toInstall; // list of products being installed QStringList notInstall; // list of products being not installed -- 2.39.2