fix fallbacks in external property parsing

the fallback chain is "Put" => Raw => Get => Src.
formerly, everything fell back on "Put", which is plain wrong.

Change-Id: I13967120e381ddbb03ed6a877c2960f8e5bc4f7d
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
Oswald Buddenhagen
2017-01-24 13:47:02 +01:00
parent 03e699ce29
commit 61419e7bf0

View File

@@ -345,14 +345,20 @@ void QMakeGlobals::parseProperties(const QByteArray &data, QHash<ProKey, ProStri
value = ProString(""); // Make sure it is not null, to discern from missing keys value = ProString(""); // Make sure it is not null, to discern from missing keys
properties.insert(ProKey(name), value); properties.insert(ProKey(name), value);
if (name.startsWith(QLatin1String("QT_"))) { if (name.startsWith(QLatin1String("QT_"))) {
bool plain = !name.contains(QLatin1Char('/')); enum { PropPut, PropRaw, PropGet } variant;
if (!plain) { if (name.contains(QLatin1Char('/'))) {
if (!name.endsWith(QLatin1String("/get"))) if (name.endsWith(QLatin1String("/raw")))
variant = PropRaw;
else if (name.endsWith(QLatin1String("/get")))
variant = PropGet;
else // Nothing falls back on /src.
continue; continue;
name.chop(4); name.chop(4);
} else {
variant = PropPut;
} }
if (name.startsWith(QLatin1String("QT_INSTALL_"))) { if (name.startsWith(QLatin1String("QT_INSTALL_"))) {
if (plain) { if (variant < PropRaw) {
if (name == QLatin1String("QT_INSTALL_PREFIX") if (name == QLatin1String("QT_INSTALL_PREFIX")
|| name == QLatin1String("QT_INSTALL_DATA") || name == QLatin1String("QT_INSTALL_DATA")
|| name == QLatin1String("QT_INSTALL_LIBS") || name == QLatin1String("QT_INSTALL_LIBS")
@@ -365,11 +371,12 @@ void QMakeGlobals::parseProperties(const QByteArray &data, QHash<ProKey, ProStri
properties.insert(ProKey(hname + QLatin1String("/src")), value); properties.insert(ProKey(hname + QLatin1String("/src")), value);
} }
properties.insert(ProKey(name + QLatin1String("/raw")), value); properties.insert(ProKey(name + QLatin1String("/raw")), value);
properties.insert(ProKey(name + QLatin1String("/get")), value);
} }
if (variant < PropGet)
properties.insert(ProKey(name + QLatin1String("/get")), value);
properties.insert(ProKey(name + QLatin1String("/src")), value); properties.insert(ProKey(name + QLatin1String("/src")), value);
} else if (name.startsWith(QLatin1String("QT_HOST_"))) { } else if (name.startsWith(QLatin1String("QT_HOST_"))) {
if (plain) if (variant < PropGet)
properties.insert(ProKey(name + QLatin1String("/get")), value); properties.insert(ProKey(name + QLatin1String("/get")), value);
properties.insert(ProKey(name + QLatin1String("/src")), value); properties.insert(ProKey(name + QLatin1String("/src")), value);
} }