commit qconf for openSUSE:Factory
Hello community,
here is the log from the commit of package qconf for openSUSE:Factory checked in at 2015-09-30 05:53:27
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/qconf (Old)
and /work/SRC/openSUSE:Factory/.qconf.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "qconf"
Changes:
--------
--- /work/SRC/openSUSE:Factory/qconf/qconf.changes 2015-04-10 09:51:47.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.qconf.new/qconf.changes 2015-09-30 05:53:28.000000000 +0200
@@ -1,0 +2,8 @@
+Tue Sep 29 12:55:39 UTC 2015 - jslaby@suse.com
+
+- update to 20150608
+ * fix paths by escaping
+ * support multiple qt versions
+ * add extraconf flag
+
+-------------------------------------------------------------------
Old:
----
qconf-20150319.c8e969fef8ce.tar.xz
New:
----
qconf-20150608.4a9c329ba879.tar.xz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ qconf.spec ++++++
--- /var/tmp/diff_new_pack.pMT2K4/_old 2015-09-30 05:53:29.000000000 +0200
+++ /var/tmp/diff_new_pack.pMT2K4/_new 2015-09-30 05:53:29.000000000 +0200
@@ -22,7 +22,7 @@
Name: qconf
Url: http://delta.affinix.com/qconf/
-Version: 20150319.c8e969fef8ce
+Version: 20150608.4a9c329ba879
Release: 0
Summary: Configuration tool for qmake
License: GPL-2.0
++++++ qconf-20150319.c8e969fef8ce.tar.xz -> qconf-20150608.4a9c329ba879.tar.xz ++++++
++++ 1611 lines of diff (skipped)
++++ retrying with extended exclude list
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/qconf-20150319.c8e969fef8ce/conf/conf4.cpp new/qconf-20150608.4a9c329ba879/conf/conf4.cpp
--- old/qconf-20150319.c8e969fef8ce/conf/conf4.cpp 2015-03-19 10:05:24.000000000 +0100
+++ new/qconf-20150608.4a9c329ba879/conf/conf4.cpp 2015-09-29 14:54:51.000000000 +0200
@@ -76,7 +76,7 @@
QString qc_findself(const QString &argv0)
{
#ifdef Q_OS_WIN
- if(argv0.contains('\\\\'))
+ if(argv0.contains('\\'))
#else
if(argv0.contains('/'))
#endif
@@ -175,12 +175,77 @@
return true;
}
+// simple command line arguemnts splitter able to understand quoted args.
+// the splitter removes quotes and unescapes symbols as well.
+QStringList qc_splitflags(const QString &flags)
+{
+ QStringList ret;
+ bool searchStart = true;
+ bool inQuotes = false;
+ bool escaped = false;
+ QChar quote, backslash = QLatin1Char('\\');
+ QString buf;
+ buf.reserve(PATH_MAX);
+ for (int i=0; i < flags.length(); i++) {
+ if (searchStart && flags[i].isSpace()) {
+ continue;
+ }
+ if (searchStart) {
+ searchStart = false;
+ buf.clear();
+ }
+ if (escaped) {
+ buf += flags[i];
+ escaped = false;
+ continue;
+ }
+ //buf += flags[i];
+ if (inQuotes) {
+ if (quote == QLatin1Char('\'')) {
+ if (flags[i] == quote) {
+ inQuotes = false;
+ continue;
+ }
+ } else { // we are in double quoetes
+ if (flags[i] == backslash && i < flags.length() - 1 &&
+ (flags[i+1] == QLatin1Char('"') || flags[i+1] == backslash))
+ {
+ // if next symbol is one of in parentheses ("\)
+ escaped = true;
+ continue;
+ }
+ }
+ } else {
+ if (flags[i].isSpace()) {
+ ret.append(buf);
+ searchStart = true;
+ buf.clear();
+ continue;
+#ifndef Q_OS_WIN /* on windows backslash is just a path separator */
+ } else if (flags[i] == backslash) {
+ escaped = true;
+ continue; // just add next symbol
+#endif
+ } else if (flags[i] == QLatin1Char('\'') || flags[i] == QLatin1Char('"')) {
+ inQuotes = true;
+ quote = flags[i];
+ continue;
+ }
+ }
+ buf += flags[i];
+ }
+ if (buf.size()) {
+ ret.append(buf);
+ }
+ return ret;
+}
+
void qc_splitcflags(const QString &cflags, QStringList *incs, QStringList *otherflags)
{
incs->clear();
otherflags->clear();
- QStringList cflagsList = cflags.split(" ");
+ QStringList cflagsList = qc_splitflags(cflags);
for(int n = 0; n < cflagsList.count(); ++n)
{
QString str = cflagsList[n];
@@ -209,6 +274,90 @@
return out;
}
+
+QString qc_trim_char(const QString &s, const QChar &ch)
+{
+ if (s.startsWith(ch) && s.endsWith(ch)) {
+ return s.mid(1, s.size() - 2);
+ }
+ return s;
+}
+
+// removes surrounding quotes, removes trailing slashes, converts to native separators.
+// accepts unescaped but possible quoted path
+QString qc_normalize_path(const QString &str)
+{
+ QString path = str.trimmed();
+ path = qc_trim_char(path, QLatin1Char('"'));
+ path = qc_trim_char(path, QLatin1Char('\''));
+#ifdef Q_OS_WIN
+ QLatin1Char nativeSep('\\');
+ path.replace(QLatin1Char('/'), QLatin1Char('\\'));
+#else
+ QLatin1Char nativeSep('/');
+#endif
+ // trim trailing slashes
+ while (path.length() && path[path.length() - 1] == nativeSep) {
+ path.resize(path.length() - 1);
+ }
+ return path;
+}
+
+// escape filesystem path to be added to qmake pro/pri file.
+QString qc_escape_string_var(const QString &str)
+{
+ QString path = str;
+ path.replace(QLatin1Char('\\'), QLatin1String("\\\\"))
+ .replace(QLatin1Char('"'), QLatin1String("\\\""));
+ if (path.indexOf(QLatin1Char(' ')) != -1) { // has spaces
+ return QLatin1Char('"') + path + QLatin1Char('"');
+ }
+ return path;
+}
+
+// escapes each path in incs and join into single string suiable for INCLUDEPATH var
+QString qc_prepare_includepath(const QStringList &incs)
+{
+ if (incs.empty()) {
+ return QString();
+ }
+ QStringList ret;
+ foreach (const QString &path, incs) {
+ ret.append(qc_escape_string_var(path));
+ }
+ return ret.join(QLatin1String(" "));
+}
+
+// escapes each path in libs and to make it suiable for LIBS var
+// notice, entries of libs are every single arg for linker.
+QString qc_prepare_libs(const QStringList &libs)
+{
+ if (libs.isEmpty()) {
+ return QString();
+ }
+ QSet<QString> pathSet;
+ QStringList paths;
+ QStringList ordered;
+ foreach (const QString &arg, libs) {
+ if (arg.startsWith(QLatin1String("-L"))) {
+ QString path = qc_escape_string_var(arg.mid(2));
+ if (!pathSet.contains(path)) {
+ pathSet.insert(path);
+ paths.append(path);
+ }
+ } else if (arg.startsWith(QLatin1String("-l"))) {
+ ordered.append(arg);
+ } else {
+ ordered.append(qc_escape_string_var(arg));
+ }
+ }
+ QString ret;
+ if (paths.size()) {
+ ret += (QLatin1String(" -L") + paths.join(QLatin1String(" -L")) + QLatin1Char(' '));
+ }
+ return ret + ordered.join(QLatin1String(" "));
+}
+
//----------------------------------------------------------------------------
// ConfObj
//----------------------------------------------------------------------------
@@ -375,14 +524,34 @@
return vars.value(s);
}
+QString Conf::normalizePath(const QString &s) const
+{
+ return qc_normalize_path(s);
+}
+
+QString Conf::escapeQmakeVar(const QString &s) const
+{
+ return qc_escape_string_var(s);
+}
+
+QString Conf::escapedIncludes() const
+{
+ return qc_prepare_includepath(INCLUDEPATH);
+}
+
+QString Conf::escapedLibs() const
+{
+ return qc_prepare_libs(LIBS);
+}
+
QString Conf::expandIncludes(const QString &inc)
{
- return QString("-I") + inc;
+ return QLatin1String("-I") + inc;
}
QString Conf::expandLibs(const QString &lib)
{
- return QString("-L") + lib;
+ return QLatin1String("-L") + lib;
}
int Conf::doCommand(const QString &s, QByteArray *out)
@@ -396,7 +565,7 @@
int Conf::doCommand(const QString &prog, const QStringList &args, QByteArray *out)
{
QString fullcmd = prog;
- QString argstr = args.join(" ");
+ QString argstr = args.join(QLatin1String(" "));
if(!argstr.isEmpty())
fullcmd += QString(" ") + argstr;
debug(QString("[%1]").arg(fullcmd));
@@ -412,10 +581,14 @@
#else
QDir tmp(".qconftemp");
#endif
+ QStringList normalizedLibs;
+ foreach (const QString &l, qc_splitflags(libs)) {
+ normalizedLibs.append(qc_normalize_path(l));
+ }
if(!tmp.mkdir("atest"))
{
- debug("unable to create atest dir");
+ debug(QString("unable to create atest dir: %1").arg(tmp.absoluteFilePath("atest")));
return false;
}
QDir dir(tmp.filePath("atest"));
@@ -447,11 +620,12 @@
"CONFIG -= qt app_bundle\n"
"DESTDIR = $$PWD\n"
"SOURCES += atest.cpp\n");
- QString inc = incs.join(" ");
+ QString inc = qc_prepare_includepath(incs);
if(!inc.isEmpty())
pro += "INCLUDEPATH += " + inc + '\n';
- if(!libs.isEmpty())
- pro += "LIBS += " + libs + '\n';
+ QString escaped_libs = qc_prepare_libs(normalizedLibs);
+ if(!escaped_libs.isEmpty())
+ pro += "LIBS += " + escaped_libs + '\n';
pro += proextra;
fname = dir.filePath("atest.pro");
@@ -512,10 +686,7 @@
bool Conf::checkHeader(const QString &path, const QString &h)
{
- QFileInfo fi(path + '/' + h);
- if(fi.exists())
- return true;
- return false;
+ return QDir(path).exists(h);
}
bool Conf::findHeader(const QString &h, const QStringList &ext, QString *inc)
@@ -652,7 +823,7 @@
*version = version_out;
*incs = incs_out;
*libs = libs_out;
- *otherflags = otherflags_out.join(" ");
+ *otherflags = otherflags_out.join(QLatin1String(" "));
return true;
}
@@ -716,7 +887,7 @@
*version = version_out;
*incs = incs_out;
*libs = libs_out;
- *otherflags = otherflags_out.join(" ");
+ *otherflags = otherflags_out.join(QLatin1String(" "));
return true;
}
@@ -731,19 +902,20 @@
void Conf::addLib(const QString &str)
{
- if(LIBS.isEmpty())
- LIBS = str;
- else
- LIBS += QString(" ") + str;
+ QStringList libs = qc_splitflags(str);
+ foreach (const QString &lib, libs) {
+ if (lib.startsWith("-l")) {
+ LIBS.append(lib);
+ } else {
+ LIBS.append(qc_normalize_path(lib)); // we don't care about -L prefix since normalier does not touch it.
+ }
+ }
debug(QString("LIBS += %1").arg(str));
}
void Conf::addIncludePath(const QString &str)
{
- if(INCLUDEPATH.isEmpty())
- INCLUDEPATH = str;
- else
- INCLUDEPATH += QString(" ") + str;
+ INCLUDEPATH.append(qc_normalize_path(str));
debug(QString("INCLUDEPATH += %1").arg(str));
}
@@ -762,8 +934,9 @@
# include"modules.cpp"
#endif
-int main()
+int main(int argc, char ** argv)
{
+ QCoreApplication app(argc, argv);
Conf *conf = new Conf;
ConfObj *o = 0;
Q_UNUSED(o);
@@ -849,13 +1022,17 @@
if(!conf->DEFINES.isEmpty())
str += "DEFINES += " + conf->DEFINES + '\n';
if(!conf->INCLUDEPATH.isEmpty())
- str += "INCLUDEPATH += " + conf->INCLUDEPATH + '\n';
+ str += "INCLUDEPATH += " + qc_prepare_includepath(conf->INCLUDEPATH) + '\n';
if(!conf->LIBS.isEmpty())
- str += "LIBS += " + conf->LIBS + '\n';
+ str += "LIBS += " + qc_prepare_libs(conf->LIBS) + '\n';
if(!conf->extra.isEmpty())
str += conf->extra;
str += '\n';
+ var = qc_getenv("QC_EXTRACONF");
+ if (!var.isEmpty())
+ str += ("\n# Extra conf from command line\n" + var + "\n");
+
QByteArray cs = str.toLatin1();
f.write(cs);
f.close();
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/qconf-20150319.c8e969fef8ce/conf/conf4.h new/qconf-20150608.4a9c329ba879/conf/conf4.h
--- old/qconf-20150319.c8e969fef8ce/conf/conf4.h 2015-03-19 10:05:24.000000000 +0100
+++ new/qconf-20150608.4a9c329ba879/conf/conf4.h 2015-09-29 14:54:51.000000000 +0200
@@ -62,8 +62,8 @@
QString maketool;
QString DEFINES;
- QString INCLUDEPATH;
- QString LIBS;
+ QStringList INCLUDEPATH;
+ QStringList LIBS;
QString extra;
QList
participants (1)
-
root@hilbert.suse.de