summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Cristian Sarbu <paul.cristian.sarbu@huawei.com>2023-05-25 11:19:55 +0200
committerPaul Cristian Sarbu <paul.cristian.sarbu@huawei.com>2023-05-31 15:21:02 +0200
commit26e7149fe8cc1be820ab35ebb6b92a683f9809bb (patch)
treed4cc1bf3cddbd54302e4e8c43af0dfe9fa128d75
parent052c762d16885b198989e2de164d37f8a8d19462 (diff)
downloadjustbuild-26e7149fe8cc1be820ab35ebb6b92a683f9809bb.tar.gz
just: Add handling of ignore-special roots
-rw-r--r--src/buildtool/file_system/file_root.hpp3
-rw-r--r--src/buildtool/main/main.cpp36
2 files changed, 39 insertions, 0 deletions
diff --git a/src/buildtool/file_system/file_root.hpp b/src/buildtool/file_system/file_root.hpp
index af61c8fd..ed03f55d 100644
--- a/src/buildtool/file_system/file_root.hpp
+++ b/src/buildtool/file_system/file_root.hpp
@@ -98,6 +98,9 @@ class FileRoot {
public:
static constexpr auto kGitTreeMarker = "git tree";
+ static constexpr auto kGitTreeIgnoreSpecialMarker =
+ "git tree ignore-special";
+ static constexpr auto kFileIgnoreSpecialMarker = "file ignore-special";
class DirectoryEntries {
friend class FileRoot;
diff --git a/src/buildtool/main/main.cpp b/src/buildtool/main/main.cpp
index 79c7c0cb..2bfe631b 100644
--- a/src/buildtool/main/main.cpp
+++ b/src/buildtool/main/main.cpp
@@ -664,6 +664,42 @@ auto ParseRoot(std::string const& repo,
root[1]);
std::exit(kExitFailure);
}
+ if (root[0] == FileRoot::kFileIgnoreSpecialMarker) {
+ if (root.size() != 2 or (not root[1].is_string())) {
+ Logger::Log(
+ LogLevel::Error,
+ "\"file ignore-special\" scheme expects precisely one string "
+ "argument, but found {} for {} of repository {}",
+ root.dump(),
+ keyword,
+ repo);
+ std::exit(kExitFailure);
+ }
+ auto path = std::filesystem::path{root[1]};
+ return {FileRoot{path, /*ignore_special=*/true}, std::move(path)};
+ }
+ if (root[0] == FileRoot::kGitTreeIgnoreSpecialMarker) {
+ if (root.size() != 3 or (not root[1].is_string()) or
+ (not root[2].is_string())) {
+ Logger::Log(LogLevel::Error,
+ "\"git tree ignore-special\" scheme expects two string "
+ "arguments, but found {} for {} of repository {}",
+ root.dump(),
+ keyword,
+ repo);
+ std::exit(kExitFailure);
+ }
+ if (auto git_root =
+ FileRoot::FromGit(root[2], root[1], /*ignore_special=*/true)) {
+ return {std::move(*git_root), std::nullopt};
+ }
+ Logger::Log(LogLevel::Error,
+ "Could not create file root for git repository {} and tree "
+ "id {}",
+ root[2],
+ root[1]);
+ std::exit(kExitFailure);
+ }
Logger::Log(LogLevel::Error,
"Unknown scheme in the specification {} of {} of repository {}",
root.dump(),