diff --git a/libpkg/data/package.h b/libpkg/data/package.h index ebae423..4292ada 100644 --- a/libpkg/data/package.h +++ b/libpkg/data/package.h @@ -300,7 +300,7 @@ struct LIBPKG_EXPORT Package : public ReflectiveRapidJSON::JsonSerializable &dllsReferencedByImportLibs); void addDepsAndProvidesFromContents(const FileMap &contents); - void processDllsReferencedByImportLibs(std::set &&dllsReferencedByImportLibs); + std::vector processDllsReferencedByImportLibs(std::set &&dllsReferencedByImportLibs); bool addDepsAndProvidesFromOtherPackage(const Package &otherPackage, bool force = false); bool isArchAny() const; diff --git a/libpkg/parser/package.cpp b/libpkg/parser/package.cpp index 5aba2f0..8293069 100644 --- a/libpkg/parser/package.cpp +++ b/libpkg/parser/package.cpp @@ -785,23 +785,29 @@ void Package::addDepsAndProvidesFromContainedFile(const ArchiveFile &file, std:: } } -void Package::processDllsReferencedByImportLibs(std::set &&dllsReferencedByImportLibs) +std::vector Package::processDllsReferencedByImportLibs(std::set &&dllsReferencedByImportLibs) { // check whether all DLLs referenced by import libraries are actually part of the package + auto issues = std::vector(); if (dllsReferencedByImportLibs.empty()) { - return; + return issues; } else if (name == "mingw-w64-crt") { // assume the CRT references DLLs provided by Windows itself libprovides = move(dllsReferencedByImportLibs); } for (const auto &referencedDLL : dllsReferencedByImportLibs) { - // TODO: report these errors in a better way if (libprovides.find(referencedDLL) == libprovides.end()) { - cerr << Phrases::SubMessage << "DLL " << referencedDLL << " is missing in " << name << Phrases::End; + issues.emplace_back("DLL " % referencedDLL % " is missing in " + name); } } + return issues; } +/*! + * \brief Adds dependencies and provides from the specified \a contents. + * \deprecated This function is not actually used anymore because ReloadLibraryDependencies does this in a better way + * using LibPkg::walkThroughArchive(). + */ void Package::addDepsAndProvidesFromContents(const FileMap &contents) { std::set dllsReferencedByImportLibs; diff --git a/librepomgr/buildactions/reloadlibrarydependencies.cpp b/librepomgr/buildactions/reloadlibrarydependencies.cpp index ff2cff2..03c5f76 100644 --- a/librepomgr/buildactions/reloadlibrarydependencies.cpp +++ b/librepomgr/buildactions/reloadlibrarydependencies.cpp @@ -249,11 +249,11 @@ void ReloadLibraryDependencies::loadPackageInfoFromContents() } // load info from package contents utilizing hardware concurrency - std::mutex nextPackageMutex, submitErrorMutex; + std::mutex nextPackageMutex, submitErrorMutex, submitWarningMutex; auto dbIterator = m_relevantPackagesByDatabase.begin(), dbEnd = m_relevantPackagesByDatabase.end(); auto pkgIterator = dbIterator->packages.begin(), pkgEnd = dbIterator->packages.end(); m_buildAction->appendOutput(Phrases::SuccessMessage, "Parsing ", m_remainingPackages.load(), " binary packages ...\n"); - const auto processPackage = [this, &dbIterator, &dbEnd, &pkgIterator, &pkgEnd, &nextPackageMutex, &submitErrorMutex] { + const auto processPackage = [this, &dbIterator, &dbEnd, &pkgIterator, &pkgEnd, &nextPackageMutex, &submitErrorMutex, &submitWarningMutex] { for (; !m_buildAction->isAborted();) { // get the next package std::unique_lock nextPackagelock(nextPackageMutex); @@ -307,7 +307,12 @@ void ReloadLibraryDependencies::loadPackageInfoFromContents() } currentPkg.info.addDepsAndProvidesFromContainedDirectory(directoryPath); }); - currentPkg.info.processDllsReferencedByImportLibs(std::move(dllsReferencedByImportLibs)); + if (auto dllIssues = currentPkg.info.processDllsReferencedByImportLibs(std::move(dllsReferencedByImportLibs)); !dllIssues.empty()) { + std::unique_lock submitWarningLock(submitWarningMutex); + for (auto &issue : dllIssues) { + m_messages.warnings.emplace_back(std::move(issue)); + } + } currentPkg.info.origin = LibPkg::PackageOrigin::PackageContents; } catch (const std::runtime_error &e) { std::unique_lock submitErrorLock(submitErrorMutex);