Allow resetting chroot settings as well when preparing build
This commit is contained in:
parent
efbcef5e6e
commit
9359004a10
|
@ -84,7 +84,8 @@ enum class PackageStagingNeeded {
|
|||
struct LIBREPOMGR_EXPORT PackageBuildProgress : public ReflectiveRapidJSON::JsonSerializable<PackageBuildProgress>,
|
||||
public ReflectiveRapidJSON::BinarySerializable<PackageBuildProgress> {
|
||||
bool hasBeenAnyProgressMade() const;
|
||||
void reset();
|
||||
void resetProgress();
|
||||
void resetChrootSettings();
|
||||
|
||||
CppUtilities::DateTime started;
|
||||
CppUtilities::DateTime finished;
|
||||
|
|
|
@ -140,6 +140,12 @@ BuildActionMetaInfo::BuildActionMetaInfo()
|
|||
.desc = "Never bumps pkgrel and epoch",
|
||||
.param = "keep-pkgrel-and-epoch",
|
||||
},
|
||||
BuildActionFlagMetaInfo{
|
||||
.id = static_cast<BuildActionFlagType>(PrepareBuildFlags::ResetChrootSettings),
|
||||
.name = "Reset chroot settings",
|
||||
.desc = "Resets chroot dir, chroot user and related flags",
|
||||
.param = "keep-pkgrel-and-epoch",
|
||||
},
|
||||
},
|
||||
.settings = {
|
||||
BuildActionSettingMetaInfo{
|
||||
|
|
|
@ -66,6 +66,7 @@ enum class PrepareBuildFlags : BuildActionFlagType {
|
|||
CleanSrcDir = (1 << 1),
|
||||
KeepOrder = (1 << 2),
|
||||
KeepPkgRelAndEpoch = (1 << 3),
|
||||
ResetChrootSettings = (1 << 4),
|
||||
};
|
||||
enum class ConductBuildFlags : BuildActionFlagType {
|
||||
None,
|
||||
|
|
|
@ -505,6 +505,7 @@ private:
|
|||
bool m_cleanSourceDirectory = false;
|
||||
bool m_keepOrder = false;
|
||||
bool m_keepPkgRelAndEpoch = false;
|
||||
bool m_resetChrootSettings = false;
|
||||
};
|
||||
|
||||
struct LIBREPOMGR_EXPORT BatchProcessingSession : public MultiSession<std::string> {
|
||||
|
|
|
@ -39,20 +39,6 @@ using namespace CppUtilities::EscapeCodes;
|
|||
|
||||
namespace LibRepoMgr {
|
||||
|
||||
bool PackageBuildProgress::hasBeenAnyProgressMade() const
|
||||
{
|
||||
return checksumsUpdated || hasSources || !finished.isNull() || addedToRepo || stagingNeeded != PackageStagingNeeded::Undetermined;
|
||||
}
|
||||
|
||||
void PackageBuildProgress::reset()
|
||||
{
|
||||
checksumsUpdated = false;
|
||||
hasSources = false;
|
||||
finished = DateTime();
|
||||
addedToRepo = false;
|
||||
stagingNeeded = PackageStagingNeeded::Undetermined;
|
||||
}
|
||||
|
||||
void RebuildInfo::add(const LibPkg::DependencySet &deps, const std::unordered_set<std::string> &libs)
|
||||
{
|
||||
for (const auto &dep : deps) {
|
||||
|
|
|
@ -34,6 +34,27 @@ using namespace CppUtilities::EscapeCodes;
|
|||
|
||||
namespace LibRepoMgr {
|
||||
|
||||
bool PackageBuildProgress::hasBeenAnyProgressMade() const
|
||||
{
|
||||
return checksumsUpdated || hasSources || !finished.isNull() || addedToRepo || stagingNeeded != PackageStagingNeeded::Undetermined;
|
||||
}
|
||||
|
||||
void PackageBuildProgress::resetProgress()
|
||||
{
|
||||
checksumsUpdated = false;
|
||||
hasSources = false;
|
||||
finished = DateTime();
|
||||
addedToRepo = false;
|
||||
stagingNeeded = PackageStagingNeeded::Undetermined;
|
||||
}
|
||||
|
||||
void PackageBuildProgress::resetChrootSettings()
|
||||
{
|
||||
chrootDirectory.clear();
|
||||
chrootUser.clear();
|
||||
skipChrootUpgrade = skipChrootCleanup = keepPreviousSourceTree = false;
|
||||
}
|
||||
|
||||
PrepareBuild::PrepareBuild(ServiceSetup &setup, const std::shared_ptr<BuildAction> &buildAction)
|
||||
: InternalBuildAction(setup, buildAction)
|
||||
{
|
||||
|
@ -53,6 +74,7 @@ void PrepareBuild::run()
|
|||
m_cleanSourceDirectory = flags & PrepareBuildFlags::CleanSrcDir;
|
||||
m_keepOrder = flags & PrepareBuildFlags::KeepOrder;
|
||||
m_keepPkgRelAndEpoch = flags & PrepareBuildFlags::KeepPkgRelAndEpoch;
|
||||
m_resetChrootSettings = flags & PrepareBuildFlags::ResetChrootSettings;
|
||||
if (m_forceBumpPackageVersion && m_keepPkgRelAndEpoch) {
|
||||
reportError("Can not force-bump pkgrel and keeping it at the same time.");
|
||||
return;
|
||||
|
@ -1039,7 +1061,10 @@ BuildPreparation PrepareBuild::makeResultData(std::string &&error)
|
|||
continue;
|
||||
}
|
||||
if (buildProgress.buildDirectory.empty()) {
|
||||
buildProgress.reset();
|
||||
buildProgress.resetProgress();
|
||||
if (m_resetChrootSettings) {
|
||||
buildProgress.resetChrootSettings();
|
||||
}
|
||||
continue;
|
||||
}
|
||||
const std::filesystem::path srcDirPkgbuild = buildData.sourceDirectory + "/PKGBUILD";
|
||||
|
@ -1047,7 +1072,10 @@ BuildPreparation PrepareBuild::makeResultData(std::string &&error)
|
|||
try {
|
||||
if (!std::filesystem::exists(buildDirPkgbuild)
|
||||
|| std::filesystem::last_write_time(srcDirPkgbuild) > std::filesystem::last_write_time(buildDirPkgbuild)) {
|
||||
buildProgress.reset();
|
||||
buildProgress.resetProgress();
|
||||
if (m_resetChrootSettings) {
|
||||
buildProgress.resetChrootSettings();
|
||||
}
|
||||
}
|
||||
} catch (const std::filesystem::filesystem_error &e) {
|
||||
m_buildAction->appendOutput(
|
||||
|
|
Loading…
Reference in New Issue