diff --git a/appmanagerjob.cpp b/appmanagerjob.cpp index 94d5b124056ae0d449c3e6aa21ec9ed376ece71c..3d8d42c357ec05e8b2de485db5889fa0782bc012 100644 --- a/appmanagerjob.cpp +++ b/appmanagerjob.cpp @@ -91,6 +91,7 @@ ComPressError zlibUnCompress(const char *srcName, const char *destName) AppManagerJob::AppManagerJob(QObject *parent) : QObject(parent) , m_runningStatus(Normal) + , m_isOnlyLoadCurrentArchAppInfos(true) , m_isInitiallized(false) , m_downloadingFile(nullptr) , m_netManager(nullptr) @@ -170,8 +171,20 @@ void AppManagerJob::reloadAppInfos() QDir aptPkgInfoListDir("/var/lib/apt/lists"); const QStringList fileNameList = aptPkgInfoListDir.entryList(QDir::Filter::Files | QDir::Filter::NoDot | QDir::Filter::NoDotDot); + // 判断架构包信息文件名过滤信息 + QString archPkgsFilterStr; + if (m_isOnlyLoadCurrentArchAppInfos) { + const QString ¤tCpuArch = QSysInfo::currentCpuArchitecture(); + archPkgsFilterStr = ("x86_64" == currentCpuArch) ? + QString("%1_Packages").arg("amd64") : + QString("%1_Packages").arg(currentCpuArch); + } else { + archPkgsFilterStr = "_Packages"; + } + for (const QString &fileName : fileNameList) { - if (fileName.endsWith("_Packages")) { + // 过滤出包信息文件路径 + if (fileName.endsWith(archPkgsFilterStr)) { const QString filePath = QString("%1/%2").arg(aptPkgInfoListDir.path()).arg(fileName); //// loadSrvAppInfosFromFile(m_appInfosMap, filePath); } diff --git a/appmanagerjob.h b/appmanagerjob.h index 6c48a3b5d2e643a26ce8bf97ff66e77bac8863fb..c359de6510c245c353ad35d3bfef59e31ca80f40 100644 --- a/appmanagerjob.h +++ b/appmanagerjob.h @@ -116,6 +116,7 @@ private: QMutex m_mutex; RunningStatus m_runningStatus; QList m_sourceUrlList; + bool m_isOnlyLoadCurrentArchAppInfos; QMap m_appInfosMap; bool m_isInitiallized;