summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPaul Cristian Sarbu <paul.cristian.sarbu@huawei.com>2023-05-25 16:54:19 +0200
committerPaul Cristian Sarbu <paul.cristian.sarbu@huawei.com>2023-05-31 15:21:02 +0200
commit17031e98529b62afad88c35c0d12491bf12b53ca (patch)
tree7c4d08915be49142137e546623a9959d39bd50d6 /src
parentee15c997efce81d0203757eb5fd9db80aeb610f9 (diff)
downloadjustbuild-17031e98529b62afad88c35c0d12491bf12b53ca.tar.gz
archive repos: Add option for ignore-special root
Diffstat (limited to 'src')
-rw-r--r--src/other_tools/just_mr/main.cpp10
-rw-r--r--src/other_tools/ops_maps/content_cas_map.hpp16
-rw-r--r--src/other_tools/repo_map/repos_to_setup_map.cpp16
-rw-r--r--src/other_tools/root_maps/TARGETS1
-rw-r--r--src/other_tools/root_maps/content_git_map.cpp22
5 files changed, 44 insertions, 21 deletions
diff --git a/src/other_tools/just_mr/main.cpp b/src/other_tools/just_mr/main.cpp
index f47a5993..33a09531 100644
--- a/src/other_tools/just_mr/main.cpp
+++ b/src/other_tools/just_mr/main.cpp
@@ -786,6 +786,9 @@ void DefaultReachableRepositories(
(*resolved_repo_desc)->Get("sha256", Expression::none_t{});
auto repo_desc_sha512 =
(*resolved_repo_desc)->Get("sha512", Expression::none_t{});
+ auto repo_desc_ignore_special =
+ (*resolved_repo_desc)
+ ->Get("ignore_special", Expression::none_t{});
ArchiveRepoInfo archive_info = {
{
repo_desc_content->get()->String(), /* content */
@@ -802,8 +805,11 @@ void DefaultReachableRepositories(
repo_name, /* origin */
false /* origin_from_distdir */
}, /* archive */
- repo_type_str,
- subdir.empty() ? "." : subdir.string()};
+ repo_type_str, /* repo_type */
+ subdir.empty() ? "." : subdir.string(), /* subdir */
+ repo_desc_ignore_special->IsBool()
+ ? repo_desc_ignore_special->Bool()
+ : false /* ignore_special */};
// add to list
repos_to_fetch.emplace_back(std::move(archive_info));
}
diff --git a/src/other_tools/ops_maps/content_cas_map.hpp b/src/other_tools/ops_maps/content_cas_map.hpp
index b2f0fb58..17fa38f1 100644
--- a/src/other_tools/ops_maps/content_cas_map.hpp
+++ b/src/other_tools/ops_maps/content_cas_map.hpp
@@ -40,13 +40,16 @@ struct ArchiveContent {
// Used in callers of ContentCASMap which need extra fields
struct ArchiveRepoInfo {
- ArchiveContent archive;
- std::string repo_type;
- std::string subdir;
+ ArchiveContent archive; /* key */
+ std::string repo_type; /* key */
+ std::string subdir; /* key */
+ // create root that ignores symlinks
+ bool ignore_special; /* key */
[[nodiscard]] auto operator==(const ArchiveRepoInfo& other) const -> bool {
- return archive == other.archive && subdir == other.subdir &&
- repo_type == other.repo_type;
+ return archive == other.archive and repo_type == other.repo_type and
+ subdir == other.subdir and
+ ignore_special == other.ignore_special;
}
};
@@ -73,8 +76,9 @@ struct hash<ArchiveRepoInfo> {
-> std::size_t {
size_t seed{};
hash_combine<ArchiveContent>(&seed, ct.archive);
- hash_combine<std::string>(&seed, ct.subdir);
hash_combine<std::string>(&seed, ct.repo_type);
+ hash_combine<std::string>(&seed, ct.subdir);
+ hash_combine<bool>(&seed, ct.ignore_special);
return seed;
}
};
diff --git a/src/other_tools/repo_map/repos_to_setup_map.cpp b/src/other_tools/repo_map/repos_to_setup_map.cpp
index cca0f565..d537f91b 100644
--- a/src/other_tools/repo_map/repos_to_setup_map.cpp
+++ b/src/other_tools/repo_map/repos_to_setup_map.cpp
@@ -174,6 +174,8 @@ void ArchiveCheckout(ExpressionPtr const& repo_desc,
auto repo_desc_distfile = repo_desc->Get("distfile", Expression::none_t{});
auto repo_desc_sha256 = repo_desc->Get("sha256", Expression::none_t{});
auto repo_desc_sha512 = repo_desc->Get("sha512", Expression::none_t{});
+ auto repo_desc_ignore_special =
+ repo_desc->Get("ignore_special", Expression::none_t{});
// populate struct
ArchiveRepoInfo archive_repo_info = {
{
@@ -187,12 +189,14 @@ void ArchiveCheckout(ExpressionPtr const& repo_desc,
: std::nullopt, /* sha256 */
repo_desc_sha512->IsString()
? std::make_optional(repo_desc_sha512->String())
- : std::nullopt, /* sha512 */
- repo_name, /* origin */
- false /* origin_from_distdir */
- }, /* archive */
- repo_type, /* repo_type */
- subdir.empty() ? "." : subdir.string() /* subdir */
+ : std::nullopt, /* sha512 */
+ repo_name, /* origin */
+ false /* origin_from_distdir */
+ }, /* archive */
+ repo_type, /* repo_type */
+ subdir.empty() ? "." : subdir.string(), /* subdir */
+ repo_desc_ignore_special->IsBool() ? repo_desc_ignore_special->Bool()
+ : false /* ignore_special */
};
// get the WS root as git tree
content_git_map->ConsumeAfterKeysReady(
diff --git a/src/other_tools/root_maps/TARGETS b/src/other_tools/root_maps/TARGETS
index 8240b799..82884b34 100644
--- a/src/other_tools/root_maps/TARGETS
+++ b/src/other_tools/root_maps/TARGETS
@@ -80,6 +80,7 @@
, ["src/buildtool/storage", "config"]
, ["src/other_tools/just_mr/progress_reporting", "progress"]
, ["src/other_tools/just_mr/progress_reporting", "statistics"]
+ , ["src/buildtool/file_system", "file_root"]
]
}
, "tree_id_git_map":
diff --git a/src/other_tools/root_maps/content_git_map.cpp b/src/other_tools/root_maps/content_git_map.cpp
index 9af1c49c..b7a3c25e 100644
--- a/src/other_tools/root_maps/content_git_map.cpp
+++ b/src/other_tools/root_maps/content_git_map.cpp
@@ -14,6 +14,7 @@
#include "src/other_tools/root_maps/content_git_map.hpp"
+#include "src/buildtool/file_system/file_root.hpp"
#include "src/buildtool/file_system/file_storage.hpp"
#include "src/buildtool/storage/config.hpp"
#include "src/buildtool/storage/storage.hpp"
@@ -81,6 +82,7 @@ auto CreateContentGitMap(
{std::move(op_key)},
[archive_tree_id = *archive_tree_id,
subdir = key.subdir,
+ ignore_special = key.ignore_special,
setter,
logger](auto const& values) {
GitOpValue op_result = *values[0];
@@ -114,12 +116,14 @@ auto CreateContentGitMap(
return;
}
// set the workspace root
- (*setter)(
- std::pair(nlohmann::json::array(
- {"git tree",
- *subtree_hash,
- StorageConfig::GitRoot().string()}),
- true));
+ (*setter)(std::pair(
+ nlohmann::json::array(
+ {ignore_special
+ ? FileRoot::kGitTreeIgnoreSpecialMarker
+ : FileRoot::kGitTreeMarker,
+ *subtree_hash,
+ StorageConfig::GitRoot().string()}),
+ true));
},
[logger, target_path = StorageConfig::GitRoot()](
auto const& msg, bool fatal) {
@@ -140,6 +144,7 @@ auto CreateContentGitMap(
repo_type = key.repo_type,
content_id = key.archive.content,
subdir = key.subdir,
+ ignore_special = key.ignore_special,
origin = key.archive.origin,
import_to_git_map,
ts,
@@ -181,6 +186,7 @@ auto CreateContentGitMap(
[tmp_dir, // keep tmp_dir alive
archive_tree_id_file,
subdir,
+ ignore_special,
origin,
setter,
logger](auto const& values) {
@@ -241,7 +247,9 @@ auto CreateContentGitMap(
// set the workspace root
(*setter)(std::pair(
nlohmann::json::array(
- {"git tree",
+ {ignore_special
+ ? FileRoot::kGitTreeIgnoreSpecialMarker
+ : FileRoot::kGitTreeMarker,
*subtree_hash,
StorageConfig::GitRoot().string()}),
false));