Do not set packages in conduct build actions when creating it form task

Usually this doesn't make sense because we want to build all packages which
were determined in the previous prepare action. When specifying the
packages again in the conduct build action we'd skip packages which are
pulled into the build as dependencies which is normally not desired.
This commit is contained in:
Martchus 2021-05-01 23:11:20 +02:00
parent 6101eaa6b6
commit 05ff6cd00f
3 changed files with 11 additions and 6 deletions

View File

@ -220,6 +220,7 @@ BuildActionMetaInfo::BuildActionMetaInfo()
.sourceDb = false,
.destinationDb = false,
.packageNames = true,
.implyPackagesFromPrevAction = true,
},
BuildActionTypeMetaInfo{
.id = BuildActionType::MakeLicenseInfo,

View File

@ -109,6 +109,7 @@ struct LIBREPOMGR_EXPORT BuildActionTypeMetaInfo : public ReflectiveRapidJSON::J
const bool sourceDb = true;
const bool destinationDb = true;
const bool packageNames = true;
const bool implyPackagesFromPrevAction = false;
};
struct LIBREPOMGR_EXPORT BuildActionStatusMetaInfo : public ReflectiveRapidJSON::JsonSerializable<BuildActionStatusMetaInfo> {
const BuildActionStatus id = BuildActionStatus::Created;

View File

@ -318,7 +318,7 @@ struct SequencedBuildActions {
static std::string allocateNewBuildAction(const BuildActionMetaInfo &metaInfo, const std::string &taskName,
const std::vector<std::string> &packageNames, const std::string &directory,
const std::unordered_map<std::string, BuildActionTemplate> &actionTemplates, SequencedBuildActions &newActionSequence,
std::vector<std::shared_ptr<BuildAction>> &allocatedActions, const std::string &actionTemplateToAllocate)
std::vector<std::shared_ptr<BuildAction>> &allocatedActions, const std::string &actionTemplateToAllocate, bool asFirstActions)
{
const auto actionTemplateIterator = actionTemplates.find(actionTemplateToAllocate);
if (actionTemplateIterator == actionTemplates.end()) {
@ -339,7 +339,9 @@ static std::string allocateNewBuildAction(const BuildActionMetaInfo &metaInfo, c
buildAction->type = buildActionType;
buildAction->sourceDbs = actionTemplate.sourceDbs;
buildAction->destinationDbs = actionTemplate.destinationDbs;
buildAction->packageNames = !typeInfo.packageNames || packageNames.empty() ? actionTemplate.packageNames : packageNames;
if (asFirstActions || !typeInfo.implyPackagesFromPrevAction) {
buildAction->packageNames = !typeInfo.packageNames || packageNames.empty() ? actionTemplate.packageNames : packageNames;
}
buildAction->flags = actionTemplate.flags;
buildAction->settings = actionTemplate.settings;
return std::string();
@ -348,18 +350,19 @@ static std::string allocateNewBuildAction(const BuildActionMetaInfo &metaInfo, c
static std::string allocateNewBuildActionSequence(const BuildActionMetaInfo &metaInfo, const std::string &taskName,
const std::vector<std::string> &packageNames, const std::string &directory,
const std::unordered_map<std::string, BuildActionTemplate> &actionTemplates, SequencedBuildActions &newActionSequence,
std::vector<std::shared_ptr<BuildAction>> &allocatedActions, const BuildActionSequence &actionSequenceToAllocate)
std::vector<std::shared_ptr<BuildAction>> &allocatedActions, const BuildActionSequence &actionSequenceToAllocate, bool asFirstActions = true)
{
auto error = std::string();
newActionSequence.name = actionSequenceToAllocate.name;
newActionSequence.concurrent = actionSequenceToAllocate.concurrent;
for (const auto &actionNode : actionSequenceToAllocate.actions) {
if (const auto *const actionTemplateName = std::get_if<std::string>(&actionNode)) {
error = allocateNewBuildAction(
metaInfo, taskName, packageNames, directory, actionTemplates, newActionSequence, allocatedActions, *actionTemplateName);
error = allocateNewBuildAction(metaInfo, taskName, packageNames, directory, actionTemplates, newActionSequence, allocatedActions,
*actionTemplateName, newActionSequence.concurrent ? asFirstActions : newActionSequence.actions.empty());
} else if (const auto *const actionSequence = std::get_if<BuildActionSequence>(&actionNode)) {
error = allocateNewBuildActionSequence(metaInfo, taskName, packageNames, directory, actionTemplates,
std::get<SequencedBuildActions>(newActionSequence.actions.emplace_back(SequencedBuildActions())), allocatedActions, *actionSequence);
std::get<SequencedBuildActions>(newActionSequence.actions.emplace_back(SequencedBuildActions())), allocatedActions, *actionSequence,
newActionSequence.concurrent ? asFirstActions : false);
}
if (!error.empty()) {
return error;