From b556c39cd7856a7c3fc7efc309bd85ac44205f7d Mon Sep 17 00:00:00 2001 From: Martchus Date: Sat, 13 Feb 2021 12:30:13 +0100 Subject: [PATCH] Skip the current package when checking for failed dependencies We usually wouldn't expect a package to depend on itself but the different packages build as part of one split-package might do. --- librepomgr/buildactions/buildactionprivate.h | 3 ++- librepomgr/buildactions/conductbuild.cpp | 9 +++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/librepomgr/buildactions/buildactionprivate.h b/librepomgr/buildactions/buildactionprivate.h index 768e6a3..b016353 100644 --- a/librepomgr/buildactions/buildactionprivate.h +++ b/librepomgr/buildactions/buildactionprivate.h @@ -548,7 +548,8 @@ private: void downloadSourcesAndContinueBuilding(); void enqueueDownloads(const BatchProcessingSession::SharedPointerType &downloadsSession, std::size_t maxParallelDownloads); void enqueueMakechrootpkg(const BatchProcessingSession::SharedPointerType &makepkgchrootSession, std::size_t maxParallelInvocations); - bool checkForFailedDependency(const std::vector *> &dependencies) const; + bool checkForFailedDependency( + const std::string &packageNameToCheck, const std::vector *> &dependencies) const; InvocationResult invokeUpdatePkgSums(const BatchProcessingSession::SharedPointerType &downloadsSession, const std::string &packageName, PackageBuildProgress &packageProgress, const std::string &buildDirectory); InvocationResult invokeMakepkgToMakeSourcePackage(const BatchProcessingSession::SharedPointerType &downloadsSession, diff --git a/librepomgr/buildactions/conductbuild.cpp b/librepomgr/buildactions/conductbuild.cpp index 98edbbb..a285a78 100644 --- a/librepomgr/buildactions/conductbuild.cpp +++ b/librepomgr/buildactions/conductbuild.cpp @@ -714,10 +714,15 @@ void ConductBuild::enqueueMakechrootpkg(const BatchProcessingSession::SharedPoin dumpBuildProgress(); } -bool ConductBuild::checkForFailedDependency(const std::vector *> &dependencies) const +bool ConductBuild::checkForFailedDependency( + const std::string &packageNameToCheck, const std::vector *> &dependencies) const { // check whether any of the specified dependencies are provided by packages which are supposed to be built but failed for (const auto &[packageName, buildData] : m_buildPreparation.buildData) { + // ignore the package we're checking for failed dependencies + if (packageName == packageNameToCheck) { + continue; + } // ignore packages which have been added to the repository successfully and treat any other packages as failed const auto buildProgress = m_buildProgress.progressByPackage.find(packageName); if (buildProgress != m_buildProgress.progressByPackage.end() && buildProgress->second.addedToRepo) { @@ -850,7 +855,7 @@ InvocationResult ConductBuild::invokeMakechrootpkg( for (const auto &package : buildData.packages) { dependencies.emplace_back(&package->dependencies); } - if (checkForFailedDependency(dependencies)) { + if (checkForFailedDependency(packageName, dependencies)) { const auto writeLock = lockToWrite(lock); packageProgress.error = "unable to build because dependency failed"; return InvocationResult::Error;