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.
This commit is contained in:
Martchus 2021-02-13 12:30:13 +01:00
parent 3fe15fb081
commit b556c39cd7
2 changed files with 9 additions and 3 deletions

View File

@ -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<const std::vector<LibPkg::Dependency> *> &dependencies) const;
bool checkForFailedDependency(
const std::string &packageNameToCheck, const std::vector<const std::vector<LibPkg::Dependency> *> &dependencies) const;
InvocationResult invokeUpdatePkgSums(const BatchProcessingSession::SharedPointerType &downloadsSession, const std::string &packageName,
PackageBuildProgress &packageProgress, const std::string &buildDirectory);
InvocationResult invokeMakepkgToMakeSourcePackage(const BatchProcessingSession::SharedPointerType &downloadsSession,

View File

@ -714,10 +714,15 @@ void ConductBuild::enqueueMakechrootpkg(const BatchProcessingSession::SharedPoin
dumpBuildProgress();
}
bool ConductBuild::checkForFailedDependency(const std::vector<const std::vector<LibPkg::Dependency> *> &dependencies) const
bool ConductBuild::checkForFailedDependency(
const std::string &packageNameToCheck, const std::vector<const std::vector<LibPkg::Dependency> *> &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;