Skip to content

Commit 2970a4c

Browse files
committed
Fixed exclude list read loop and reading list just once.
1 parent f10b556 commit 2970a4c

File tree

2 files changed

+39
-35
lines changed

2 files changed

+39
-35
lines changed

src/shared.cpp

Lines changed: 37 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,7 @@ Deploy::Deploy():
198198
m_qtDetected(0),
199199
m_deployLibrary(false)
200200
{
201+
this->m_excludeList = this->readExcludeList();
201202
}
202203

203204
Deploy::~Deploy()
@@ -330,43 +331,10 @@ LibraryInfo Deploy::parseLddLibraryLine(const QString &line,
330331
return info;
331332

332333
if (bundleAllButCoreLibs) {
333-
/*
334-
Bundle every lib including the low-level ones except those that are explicitly blacklisted.
335-
This is more suitable for bundling in a way that is portable between different distributions and target systems.
336-
Along the way, this also takes care of non-Qt libraries.
337-
338-
The excludelist can be updated by running
339-
#/bin/bash
340-
blacklisted=$(wget https://raw.githubusercontent.com/probonopd/AppImages/master/excludelist -O - | sort | uniq | grep -v "^#.*" | grep "[^-\s]")
341-
for item in $blacklisted; do
342-
echo -ne '"'$item'" << '
343-
done
344-
*/
345-
346-
QFile excludelistFile(":/excludelist");
347-
348-
if (!excludelistFile.open(QIODevice::ReadOnly | QIODevice::Text))
349-
return info;
350-
351-
QStringList excludelist;
352-
353-
for (auto line = excludelistFile.readLine().trimmed(); !excludelistFile.atEnd();) {
354-
if (line.startsWith("#"))
355-
continue;
356-
else {
357-
int comment = line.indexOf("#");
358-
359-
if (comment > 0)
360-
line = line.left(comment);
361-
}
362-
363-
excludelist << line;
364-
}
365-
366-
LogDebug() << "excludelist:" << excludelist;
334+
LogDebug() << "excludelist:" << this->m_excludeList;
367335

368336
if (!trimmed.contains("libicu")) {
369-
if (containsHowOften(excludelist, QFileInfo(trimmed).completeBaseName())) {
337+
if (containsHowOften(this->m_excludeList, QFileInfo(trimmed).completeBaseName())) {
370338
LogDebug() << "Skipping blacklisted" << trimmed;
371339

372340
return info;
@@ -1876,3 +1844,37 @@ QStringList Deploy::translationNameFilters(quint64 modules,
18761844

18771845
return result;
18781846
}
1847+
1848+
QStringList Deploy::readExcludeList() const
1849+
{
1850+
/* Bundle every lib including the low-level ones except those that are explicitly blacklisted.
1851+
* This is more suitable for bundling in a way that is portable between different distributions and target systems.
1852+
* Along the way, this also takes care of non-Qt libraries.
1853+
*/
1854+
QFile excludelistFile(":/excludelist");
1855+
1856+
if (!excludelistFile.open(QIODevice::ReadOnly | QIODevice::Text))
1857+
return QStringList();
1858+
1859+
QStringList excludelist;
1860+
1861+
while (!excludelistFile.atEnd()) {
1862+
auto line = excludelistFile.readLine().trimmed();
1863+
1864+
if (line.startsWith("#"))
1865+
continue;
1866+
else {
1867+
int comment = line.indexOf("#");
1868+
1869+
if (comment > 0)
1870+
line = line.left(comment);
1871+
}
1872+
1873+
if (line.isEmpty())
1874+
continue;
1875+
1876+
excludelist << line;
1877+
}
1878+
1879+
return excludelist;
1880+
}

src/shared.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ class Deploy
164164
bool m_appstoreCompliant;
165165
int m_qtDetected;
166166
bool m_deployLibrary;
167+
QStringList m_excludeList;
167168

168169
bool lddOutputContainsLinuxVDSO(const QString &lddOutput);
169170
bool copyFilePrintStatus(const QString &from, const QString &to);
@@ -188,6 +189,7 @@ class Deploy
188189
const QString &importName);
189190
QStringList translationNameFilters(quint64 modules,
190191
const QString &prefix);
192+
QStringList readExcludeList() const;
191193
};
192194

193195
#endif

0 commit comments

Comments
 (0)