Allow considering pulling-in further dependencies unexpected

This allows one to review further dependencies if pulled-in automatically
during the build preparation first before conducting the build.
This commit is contained in:
Martchus 2023-04-08 19:10:59 +02:00
parent 86581ec002
commit cce83f1f9e
4 changed files with 20 additions and 1 deletions

View File

@ -166,6 +166,12 @@ BuildActionMetaInfo::BuildActionMetaInfo()
.desc = "Resets chroot dir, chroot user and related flags",
.param = "reset-chroot-cfg",
},
BuildActionFlagMetaInfo{
.id = static_cast<BuildActionFlagType>(PrepareBuildFlags::PullingInFurtherDependenciesUnexpected),
.name = "Pulling-in further dependencies unexpected",
.desc = "Whether pulling-in further dependencies leads to an error causing subsequent build actions not to be executed automatically; useful to be able to review packages added to the build before conducting the build",
.param = "pulling-in-new-deps-unexpected",
},
},
.settings = {
BuildActionSettingMetaInfo{

View File

@ -77,6 +77,7 @@ enum class PrepareBuildFlags : BuildActionFlagType {
KeepOrder = (1 << 2),
KeepPkgRelAndEpoch = (1 << 3),
ResetChrootSettings = (1 << 4),
PullingInFurtherDependenciesUnexpected = (1 << 5),
};
enum class ConductBuildFlags : BuildActionFlagType {
None,

View File

@ -512,6 +512,8 @@ private:
bool m_keepOrder = false;
bool m_keepPkgRelAndEpoch = false;
bool m_resetChrootSettings = false;
bool m_pullingInFurtherDependenciesUnexpected = false;
bool m_pulledInFurtherDependencies = false;
};
struct LIBREPOMGR_EXPORT BatchProcessingSession : public MultiSession<std::string> {

View File

@ -75,6 +75,7 @@ void PrepareBuild::run()
m_keepOrder = flags & PrepareBuildFlags::KeepOrder;
m_keepPkgRelAndEpoch = flags & PrepareBuildFlags::KeepPkgRelAndEpoch;
m_resetChrootSettings = flags & PrepareBuildFlags::ResetChrootSettings;
m_pullingInFurtherDependenciesUnexpected = flags & PrepareBuildFlags::PullingInFurtherDependenciesUnexpected;
if (m_forceBumpPackageVersion && m_keepPkgRelAndEpoch) {
reportError("Can not force-bump pkgrel and keeping it at the same time.");
return;
@ -859,6 +860,9 @@ void PrepareBuild::computeDependencies(WebClient::AurSnapshotQuerySession::Conta
}
// pull missing dependencies if all sources could be retrieved so far
if (furtherDependenciesNeeded) {
m_pulledInFurtherDependencies = true;
}
if (!sourcesMissing && furtherDependenciesNeeded) {
fetchMissingBuildData();
return;
@ -893,7 +897,13 @@ void PrepareBuild::computeDependencies(WebClient::AurSnapshotQuerySession::Conta
computeBatches();
}
auto resultData = makeResultData();
// provoke an error if previously pulled-in further dependencies and that's not wanted
auto error = std::string();
if (m_pulledInFurtherDependencies && m_pullingInFurtherDependenciesUnexpected) {
error = "Had to pull-in further dependencies which is considered unexpected";
}
auto resultData = makeResultData(std::move(error));
auto buildActionWriteLock = m_setup.building.lockToWrite();
m_buildAction->resultData = std::move(resultData);
if (resultData.error.empty() && resultData.cyclicLeftovers.empty()) {