From d76a756b03840ef9339ecc30f16e8580c7f323ea Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Tue, 23 Aug 2016 14:22:19 +0200 Subject: [PATCH] clean up qconfig/qmodule.pri handling in configure instead of saving the files away and restoring them afterwards, use the new and shiny discard_from() function to throw away everything the files might contain. strictly speaking, this is not precise, as the pris may also use *=, -=, and possibly other operations which cannot be trivially undone, but the purpose is essentially to discard the special outputs of some features which may affect subsequent tests, for which this is sufficient. as a side effect, the failure to load qmodule.pri is not fatal any more (like for qconfig.pri), to save the pointless effort of ensuring that it exists. Change-Id: I07625b60c4f2e27b21206b2c16d24ab111737395 Reviewed-by: Lars Knoll --- configure | 19 ------------------- configure.pri | 4 ++++ mkspecs/features/qt_build_config.prf | 2 +- tools/configure/configureapp.cpp | 28 ---------------------------- 4 files changed, 5 insertions(+), 48 deletions(-) diff --git a/configure b/configure index ac68f3ce4b..9ab3834cf8 100755 --- a/configure +++ b/configure @@ -1886,14 +1886,6 @@ config.input.qt_licheck = $Licheck config.input.qt_release_date = $ReleaseDate EOF -# create a clean qmodule/qconfig.pri for running the tests -# .qmake.cache loads qt_build_parts which requires that qmodule.pri exists -for arg in qconfig qmodule; do - file="$outpath/mkspecs/$arg.pri" - [ ! -f "$file.old" ] && [ -f "$file" ] && mv "$file" "$file.old" - : > "$file" -done - # recreate command line for qmake set -f SAVED_IFS=$IFS @@ -1909,17 +1901,6 @@ IFS=$SAVED_IFS $CFG_QMAKE_PATH -o Makefile.cfg -qtconf "$QTCONFFILE" $relpath/configure.pri -- "$@" || exit 101 rm Makefile.cfg -# Re-use old file if unchanged, to avoid needless rebuilds -for arg in qconfig qmodule; do - file="$outpath/mkspecs/$arg.pri" - if cmp -s "$file" "$file.old"; then - rm -f "$file" - mv "$file.old" "$file" - else - rm -f "$file.old" - fi -done - #------------------------------------------------------------------------------- # give feedback on configuration #------------------------------------------------------------------------------- diff --git a/configure.pri b/configure.pri index 0a25d46b00..bd899073c4 100644 --- a/configure.pri +++ b/configure.pri @@ -773,6 +773,10 @@ defineTest(qtConfReport_buildMode) { qtConfReportPadded($$1, $$build_mode) } +# ensure pristine environment for configuration +discard_from($$[QT_HOST_DATA/get]/mkspecs/qconfig.pri) +discard_from($$[QT_HOST_DATA/get]/mkspecs/qmodule.pri) + # load and process input from configure exists("$$OUT_PWD/config.tests/configure.cfg") { include("$$OUT_PWD/config.tests/configure.cfg") diff --git a/mkspecs/features/qt_build_config.prf b/mkspecs/features/qt_build_config.prf index f12cbb88fc..e0e8ef9f51 100644 --- a/mkspecs/features/qt_build_config.prf +++ b/mkspecs/features/qt_build_config.prf @@ -12,7 +12,7 @@ !contains(QMAKE_INTERNAL_INCLUDED_FILES, .*qmodule\\.pri) { QMAKE_QT_MODULE = $$[QT_HOST_DATA/get]/mkspecs/qmodule.pri !exists($$QMAKE_QT_MODULE)|!include($$QMAKE_QT_MODULE, "", true) { - error("Cannot load qmodule.pri!") + debug(1, "Cannot load qmodule.pri!") } else { debug(1, "Loaded qmodule.pri from ($$QMAKE_QT_MODULE)") } diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp index f9782e0920..650ede7474 100644 --- a/tools/configure/configureapp.cpp +++ b/tools/configure/configureapp.cpp @@ -999,21 +999,6 @@ void Configure::buildQmake() void Configure::configure() { - static const char * const files[] = { "qmodule", "qconfig" }; - - for (int i = 0; i < 2; i++) { - QFile file(buildPath + "/mkspecs/" + files[i] + ".pri"); - QString oldfn = file.fileName() + ".old"; - if (file.exists() && !QFileInfo::exists(oldfn)) - QFile::rename(file.fileName(), oldfn); - if (!file.open(QFile::WriteOnly | QFile::Text)) { - cout << "Failed to create file " << qPrintable(file.fileName()) << endl; - dictionary[ "DONE" ] = "error"; - return; - } - file.close(); - } - FileWriter ci(buildPath + "/config.tests/configure.cfg"); ci << "# Feature defaults set by configure command line\n" << "config.input.qt_edition = " << dictionary["EDITION"] << "\n" @@ -1034,19 +1019,6 @@ void Configure::configure() cout << "Qmake failed, return code " << exitCode << endl << endl; dictionary[ "DONE" ] = "error"; } - - for (int i = 0; i < 2; i++) { - QFile file(buildPath + "/mkspecs/" + files[i] + ".pri"); - QFile oldFile(file.fileName() + ".old"); - if (oldFile.open(QIODevice::ReadOnly | QIODevice::Text) - && file.open(QIODevice::ReadOnly | QIODevice::Text) - && oldFile.readAll() == file.readAll()) { - file.remove(); - oldFile.rename(file.fileName()); - } else { - oldFile.remove(); - } - } } void Configure::generateMakefiles()