Add "AUR-only" flag for "Prepare build" action
This might be useful to avoid accidentally rebuilding a package with a local/custom override withiout actually updating the custom PKGBUILD.
This commit is contained in:
parent
9150d90233
commit
56ee1325f0
|
@ -197,6 +197,12 @@ BuildActionMetaInfo::BuildActionMetaInfo()
|
||||||
.desc = "Uses `makecontainerpkg` instead of using `makepkg` when printing source info; eliminates the need to having pacman on the host by using docker/podman instead",
|
.desc = "Uses `makecontainerpkg` instead of using `makepkg` when printing source info; eliminates the need to having pacman on the host by using docker/podman instead",
|
||||||
.param = "use-container",
|
.param = "use-container",
|
||||||
},
|
},
|
||||||
|
BuildActionFlagMetaInfo{
|
||||||
|
.id = static_cast<BuildActionFlagType>(PrepareBuildFlags::AurOnly),
|
||||||
|
.name = "AUR-only",
|
||||||
|
.desc = "Consider it an error when a PKGBUILD was found locally and thus was not downloaded from the AUR",
|
||||||
|
.param = "aur-only",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
.settings = {
|
.settings = {
|
||||||
BuildActionSettingMetaInfo{
|
BuildActionSettingMetaInfo{
|
||||||
|
|
|
@ -88,6 +88,7 @@ enum class PrepareBuildFlags : BuildActionFlagType {
|
||||||
PullingInFurtherDependenciesUnexpected = (1 << 5),
|
PullingInFurtherDependenciesUnexpected = (1 << 5),
|
||||||
FetchOfficialPackageSources = (1 << 6),
|
FetchOfficialPackageSources = (1 << 6),
|
||||||
UseContainer = (1 << 7),
|
UseContainer = (1 << 7),
|
||||||
|
AurOnly = (1 << 8),
|
||||||
};
|
};
|
||||||
enum class ConductBuildFlags : BuildActionFlagType {
|
enum class ConductBuildFlags : BuildActionFlagType {
|
||||||
None,
|
None,
|
||||||
|
|
|
@ -520,6 +520,7 @@ private:
|
||||||
bool m_pulledInFurtherDependencies = false;
|
bool m_pulledInFurtherDependencies = false;
|
||||||
bool m_fetchOfficialSources = false;
|
bool m_fetchOfficialSources = false;
|
||||||
bool m_useContainer = false;
|
bool m_useContainer = false;
|
||||||
|
bool m_aurOnly = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct LIBREPOMGR_EXPORT BatchProcessingSession : public MultiSession<std::string> {
|
struct LIBREPOMGR_EXPORT BatchProcessingSession : public MultiSession<std::string> {
|
||||||
|
|
|
@ -78,6 +78,7 @@ void PrepareBuild::run()
|
||||||
m_pullingInFurtherDependenciesUnexpected = flags & PrepareBuildFlags::PullingInFurtherDependenciesUnexpected;
|
m_pullingInFurtherDependenciesUnexpected = flags & PrepareBuildFlags::PullingInFurtherDependenciesUnexpected;
|
||||||
m_fetchOfficialSources = flags & PrepareBuildFlags::FetchOfficialPackageSources;
|
m_fetchOfficialSources = flags & PrepareBuildFlags::FetchOfficialPackageSources;
|
||||||
m_useContainer = flags & PrepareBuildFlags::UseContainer;
|
m_useContainer = flags & PrepareBuildFlags::UseContainer;
|
||||||
|
m_aurOnly = flags & PrepareBuildFlags::AurOnly;
|
||||||
if (m_forceBumpPackageVersion && m_keepPkgRelAndEpoch) {
|
if (m_forceBumpPackageVersion && m_keepPkgRelAndEpoch) {
|
||||||
reportError("Can not force-bump pkgrel and keeping it at the same time.");
|
reportError("Can not force-bump pkgrel and keeping it at the same time.");
|
||||||
return;
|
return;
|
||||||
|
@ -890,14 +891,22 @@ void PrepareBuild::computeDependencies(WebClient::AurSnapshotQuerySession::Conta
|
||||||
}
|
}
|
||||||
|
|
||||||
// check for errors
|
// check for errors
|
||||||
set<string> failedPackages;
|
auto failedPackages = std::set<std::string>();
|
||||||
|
auto localPackages = std::set<std::string>();
|
||||||
|
auto errorMessage = std::string();
|
||||||
for (const auto &buildData : m_buildDataByPackage) {
|
for (const auto &buildData : m_buildDataByPackage) {
|
||||||
if (!buildData.second.error.empty()) {
|
if (!buildData.second.error.empty()) {
|
||||||
failedPackages.emplace(buildData.first);
|
failedPackages.emplace(buildData.first);
|
||||||
|
} else if (m_aurOnly && !buildData.second.originalSourceDirectory.empty()) {
|
||||||
|
localPackages.emplace(buildData.first);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!failedPackages.empty()) {
|
if (!failedPackages.empty()) {
|
||||||
auto errorMessage = "Unable to retrieve the following packages (see result data for details): " + joinStrings(failedPackages, " ");
|
errorMessage = "Unable to retrieve the following packages (see result data for details): " + joinStrings(failedPackages, " ");
|
||||||
|
} else if (!localPackages.empty()) {
|
||||||
|
errorMessage = "The following packages have a local override but the AUR-only flag was set: " + joinStrings(localPackages, " ");
|
||||||
|
}
|
||||||
|
if (!errorMessage.empty()) {
|
||||||
m_buildAction->appendOutput(Phrases::ErrorMessage, errorMessage, '\n');
|
m_buildAction->appendOutput(Phrases::ErrorMessage, errorMessage, '\n');
|
||||||
auto resultData = makeResultData(std::move(errorMessage));
|
auto resultData = makeResultData(std::move(errorMessage));
|
||||||
auto buildActionWriteLock = m_setup.building.lockToWrite();
|
auto buildActionWriteLock = m_setup.building.lockToWrite();
|
||||||
|
|
Loading…
Reference in New Issue