summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/other_tools/root_maps/TARGETS2
-rw-r--r--src/other_tools/root_maps/content_git_map.cpp2
-rw-r--r--src/other_tools/utils/TARGETS12
-rw-r--r--src/utils/archive/TARGETS11
-rw-r--r--src/utils/archive/archive_ops.cpp (renamed from src/other_tools/utils/archive_ops.cpp)26
-rw-r--r--src/utils/archive/archive_ops.hpp (renamed from src/other_tools/utils/archive_ops.hpp)6
-rw-r--r--test/end-to-end/just-mr/TARGETS2
-rw-r--r--test/end-to-end/just-mr/create_test_archives.cpp2
-rw-r--r--test/other_tools/utils/TARGETS20
-rw-r--r--test/utils/TARGETS3
-rw-r--r--test/utils/archive/TARGETS15
-rw-r--r--test/utils/archive/archive_usage.test.cpp (renamed from test/other_tools/utils/archive_usage.test.cpp)2
12 files changed, 64 insertions, 39 deletions
diff --git a/src/other_tools/root_maps/TARGETS b/src/other_tools/root_maps/TARGETS
index b2cd1dfb..2b5fbd1a 100644
--- a/src/other_tools/root_maps/TARGETS
+++ b/src/other_tools/root_maps/TARGETS
@@ -81,7 +81,7 @@
]
, "stage": ["src", "other_tools", "root_maps"]
, "private-deps":
- [ ["src/other_tools/utils", "archive_ops"]
+ [ ["src/utils/archive", "archive_ops"]
, ["src/buildtool/execution_api/local", "local"]
, ["src/buildtool/file_system", "file_storage"]
, ["src/buildtool/storage", "storage"]
diff --git a/src/other_tools/root_maps/content_git_map.cpp b/src/other_tools/root_maps/content_git_map.cpp
index 9930984e..c6e0809b 100644
--- a/src/other_tools/root_maps/content_git_map.cpp
+++ b/src/other_tools/root_maps/content_git_map.cpp
@@ -20,7 +20,7 @@
#include "src/buildtool/storage/storage.hpp"
#include "src/other_tools/just_mr/progress_reporting/progress.hpp"
#include "src/other_tools/just_mr/progress_reporting/statistics.hpp"
-#include "src/other_tools/utils/archive_ops.hpp"
+#include "src/utils/archive/archive_ops.hpp"
namespace {
diff --git a/src/other_tools/utils/TARGETS b/src/other_tools/utils/TARGETS
index 9e3fa89d..df08d551 100644
--- a/src/other_tools/utils/TARGETS
+++ b/src/other_tools/utils/TARGETS
@@ -1,14 +1,4 @@
-{ "archive_ops":
- { "type": ["@", "rules", "CC", "library"]
- , "name": ["archive_ops"]
- , "hdrs": ["archive_ops.hpp"]
- , "srcs": ["archive_ops.cpp"]
- , "deps": [["@", "gsl", "", "gsl"]]
- , "stage": ["src", "other_tools", "utils"]
- , "private-deps":
- [["src/buildtool/file_system", "file_system_manager"], ["", "libarchive"]]
- }
-, "curl_context":
+{ "curl_context":
{ "type": ["@", "rules", "CC", "library"]
, "name": ["curl_context"]
, "hdrs": ["curl_context.hpp"]
diff --git a/src/utils/archive/TARGETS b/src/utils/archive/TARGETS
new file mode 100644
index 00000000..df3e6009
--- /dev/null
+++ b/src/utils/archive/TARGETS
@@ -0,0 +1,11 @@
+{ "archive_ops":
+ { "type": ["@", "rules", "CC", "library"]
+ , "name": ["archive_ops"]
+ , "hdrs": ["archive_ops.hpp"]
+ , "srcs": ["archive_ops.cpp"]
+ , "deps": [["@", "gsl", "", "gsl"]]
+ , "stage": ["src", "utils", "archive"]
+ , "private-deps":
+ [["src/buildtool/file_system", "file_system_manager"], ["", "libarchive"]]
+ }
+}
diff --git a/src/other_tools/utils/archive_ops.cpp b/src/utils/archive/archive_ops.cpp
index f0d02531..c92358c1 100644
--- a/src/other_tools/utils/archive_ops.cpp
+++ b/src/utils/archive/archive_ops.cpp
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-#include "src/other_tools/utils/archive_ops.hpp"
+#include "src/utils/archive/archive_ops.hpp"
#include "src/buildtool/file_system/file_system_manager.hpp"
@@ -21,6 +21,7 @@ extern "C" {
#include <archive_entry.h>
}
+#ifndef BOOTSTRAP_BUILD_TOOL
namespace {
/// \brief Default block size for archive extraction.
@@ -90,9 +91,11 @@ auto enable_read_filter(archive* ar, ArchiveType type) -> bool {
}
} // namespace
+#endif // BOOTSTRAP_BUILD_TOOL
auto ArchiveOps::WriteEntry(archive_entry* entry, archive* aw)
-> std::optional<std::string> {
+#ifndef BOOTSTRAP_BUILD_TOOL
std::filesystem::path entry_path{archive_entry_sourcepath(entry)};
// only write to archive if entry is file
if (FileSystemManager::IsFile(entry_path)) {
@@ -106,11 +109,13 @@ auto ArchiveOps::WriteEntry(archive_entry* entry, archive* aw)
archive_write_data(aw, content->c_str(), content_size);
}
}
+#endif // BOOTSTRAP_BUILD_TOOL
return std::nullopt;
}
auto ArchiveOps::CopyData(archive* ar, archive* aw)
-> std::optional<std::string> {
+#ifndef BOOTSTRAP_BUILD_TOOL
int r{};
const void* buff{nullptr};
size_t size{};
@@ -130,11 +135,13 @@ auto ArchiveOps::CopyData(archive* ar, archive* aw)
std::string(archive_error_string(aw));
}
}
+#endif // BOOTSTRAP_BUILD_TOOL
return std::nullopt; // success!
}
auto ArchiveOps::EnableWriteFormats(archive* aw, ArchiveType type)
-> std::optional<std::string> {
+#ifndef BOOTSTRAP_BUILD_TOOL
switch (type) {
case ArchiveType::Zip: {
if (archive_write_set_format_zip(aw) != ARCHIVE_OK) {
@@ -168,11 +175,13 @@ auto ArchiveOps::EnableWriteFormats(archive* aw, ArchiveType type)
return std::string(
"ArchiveOps: Writing a tarball-type archive must be explicit!");
}
+#endif // BOOTSTRAP_BUILD_TOOL
return std::nullopt; // success!
}
auto ArchiveOps::EnableReadFormats(archive* ar, ArchiveType type)
-> std::optional<std::string> {
+#ifndef BOOTSTRAP_BUILD_TOOL
switch (type) {
case ArchiveType::Zip: {
if (archive_read_support_format_zip(ar) != ARCHIVE_OK) {
@@ -210,6 +219,7 @@ auto ArchiveOps::EnableReadFormats(archive* ar, ArchiveType type)
}
} break;
}
+#endif // BOOTSTRAP_BUILD_TOOL
return std::nullopt; // success!
}
@@ -217,6 +227,9 @@ auto ArchiveOps::CreateArchive(ArchiveType type,
std::string const& name,
std::filesystem::path const& source) noexcept
-> std::optional<std::string> {
+#ifdef BOOTSTRAP_BUILD_TOOL
+ return std::nullopt;
+#endif
return CreateArchive(type, name, source, std::filesystem::path("."));
}
@@ -225,6 +238,9 @@ auto ArchiveOps::CreateArchive(ArchiveType type,
std::filesystem::path const& source,
std::filesystem::path const& destDir) noexcept
-> std::optional<std::string> {
+#ifdef BOOTSTRAP_BUILD_TOOL
+ return std::nullopt;
+#else
try {
// make sure paths will be relative wrt current dir
auto rel_source = std::filesystem::relative(source);
@@ -297,11 +313,15 @@ auto ArchiveOps::CreateArchive(ArchiveType type,
LogLevel::Error, "archive create failed with:\n{}", ex.what());
return std::nullopt;
}
+#endif // BOOTSTRAP_BUILD_TOOL
}
auto ArchiveOps::ExtractArchive(ArchiveType type,
std::filesystem::path const& source) noexcept
-> std::optional<std::string> {
+#ifdef BOOTSTRAP_BUILD_TOOL
+ return std::nullopt;
+#endif
return ExtractArchive(type, source, std::filesystem::path("."));
}
@@ -309,6 +329,9 @@ auto ArchiveOps::ExtractArchive(ArchiveType type,
std::filesystem::path const& source,
std::filesystem::path const& destDir) noexcept
-> std::optional<std::string> {
+#ifdef BOOTSTRAP_BUILD_TOOL
+ return std::nullopt;
+#else
try {
std::unique_ptr<archive, decltype(&archive_read_closer)> a_in{
archive_read_new(), archive_read_closer};
@@ -381,4 +404,5 @@ auto ArchiveOps::ExtractArchive(ArchiveType type,
LogLevel::Error, "archive extract failed with:\n{}", ex.what());
return std::nullopt;
}
+#endif // BOOTSTRAP_BUILD_TOOL
}
diff --git a/src/other_tools/utils/archive_ops.hpp b/src/utils/archive/archive_ops.hpp
index 773115bc..933bb814 100644
--- a/src/other_tools/utils/archive_ops.hpp
+++ b/src/utils/archive/archive_ops.hpp
@@ -12,8 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-#ifndef INCLUDED_SRC_OTHER_TOOLS_UTILS_ARCHIVE_OPS_HPP
-#define INCLUDED_SRC_OTHER_TOOLS_UTILS_ARCHIVE_OPS_HPP
+#ifndef INCLUDED_SRC_UTILS_ARCHIVE_ARCHIVE_OPS_HPP
+#define INCLUDED_SRC_UTILS_ARCHIVE_ARCHIVE_OPS_HPP
#include <filesystem>
#include <optional>
@@ -103,4 +103,4 @@ class ArchiveOps {
-> std::optional<std::string>;
};
-#endif // INCLUDED_SRC_OTHER_TOOLS_UTILS_ARCHIVE_OPS_HPP
+#endif // INCLUDED_SRC_UTILS_ARCHIVE_ARCHIVE_OPS_HPP
diff --git a/test/end-to-end/just-mr/TARGETS b/test/end-to-end/just-mr/TARGETS
index 23ad1062..f8a8d10d 100644
--- a/test/end-to-end/just-mr/TARGETS
+++ b/test/end-to-end/just-mr/TARGETS
@@ -25,7 +25,7 @@
, "private-deps":
[ ["@", "src", "src/buildtool/file_system", "file_system_manager"]
, ["@", "src", "src/buildtool/logging", "logging"]
- , ["@", "src", "src/other_tools/utils", "archive_ops"]
+ , ["@", "src", "src/utils/archive", "archive_ops"]
, ["@", "src", "src/utils/cpp", "tmp_dir"]
]
, "private-ldflags": ["-pthread"]
diff --git a/test/end-to-end/just-mr/create_test_archives.cpp b/test/end-to-end/just-mr/create_test_archives.cpp
index f7223410..5f50bade 100644
--- a/test/end-to-end/just-mr/create_test_archives.cpp
+++ b/test/end-to-end/just-mr/create_test_archives.cpp
@@ -17,7 +17,7 @@
#include "src/buildtool/file_system/file_system_manager.hpp"
#include "src/buildtool/logging/log_config.hpp"
#include "src/buildtool/logging/log_sink_cmdline.hpp"
-#include "src/other_tools/utils/archive_ops.hpp"
+#include "src/utils/archive/archive_ops.hpp"
#include "src/utils/cpp/tmp_dir.hpp"
namespace {
diff --git a/test/other_tools/utils/TARGETS b/test/other_tools/utils/TARGETS
index 11bb619b..b43788f1 100644
--- a/test/other_tools/utils/TARGETS
+++ b/test/other_tools/utils/TARGETS
@@ -1,17 +1,4 @@
-{ "archive_usage":
- { "type": ["@", "rules", "CC/test", "test"]
- , "name": ["archive_usage"]
- , "srcs": ["archive_usage.test.cpp"]
- , "private-deps":
- [ ["@", "catch2", "", "catch2"]
- , ["", "catch-main"]
- , ["@", "src", "src/buildtool/file_system", "file_system_manager"]
- , ["@", "src", "", "libarchive"]
- , ["@", "src", "src/other_tools/utils", "archive_ops"]
- ]
- , "stage": ["test", "other_tools", "utils"]
- }
-, "curl_usage_install":
+{ "curl_usage_install":
{ "type": ["@", "rules", "CC", "binary"]
, "tainted": ["test"]
, "name": ["curl_usage_install"]
@@ -43,8 +30,5 @@
, "stage": ["test", "other_tools", "utils"]
}
, "TESTS":
- { "type": "install"
- , "tainted": ["test"]
- , "deps": ["archive_usage", "curl_usage", "curl_url"]
- }
+ {"type": "install", "tainted": ["test"], "deps": ["curl_usage", "curl_url"]}
}
diff --git a/test/utils/TARGETS b/test/utils/TARGETS
index 2a6f99d0..94fb936f 100644
--- a/test/utils/TARGETS
+++ b/test/utils/TARGETS
@@ -92,6 +92,7 @@
, "TESTS":
{ "type": "install"
, "tainted": ["test"]
- , "dirs": [[["./", "cpp", "TESTS"], "cpp"]]
+ , "dirs":
+ [[["./", "cpp", "TESTS"], "cpp"], [["./", "archive", "TESTS"], "archive"]]
}
}
diff --git a/test/utils/archive/TARGETS b/test/utils/archive/TARGETS
new file mode 100644
index 00000000..15b849c5
--- /dev/null
+++ b/test/utils/archive/TARGETS
@@ -0,0 +1,15 @@
+{ "archive_usage":
+ { "type": ["@", "rules", "CC/test", "test"]
+ , "name": ["archive_usage"]
+ , "srcs": ["archive_usage.test.cpp"]
+ , "private-deps":
+ [ ["@", "catch2", "", "catch2"]
+ , ["", "catch-main"]
+ , ["@", "src", "src/buildtool/file_system", "file_system_manager"]
+ , ["@", "src", "", "libarchive"]
+ , ["@", "src", "src/utils/archive", "archive_ops"]
+ ]
+ , "stage": ["test", "utils", "archive"]
+ }
+, "TESTS": {"type": "install", "tainted": ["test"], "deps": ["archive_usage"]}
+}
diff --git a/test/other_tools/utils/archive_usage.test.cpp b/test/utils/archive/archive_usage.test.cpp
index 09d080c5..6a8eb751 100644
--- a/test/other_tools/utils/archive_usage.test.cpp
+++ b/test/utils/archive/archive_usage.test.cpp
@@ -19,7 +19,7 @@
#include "catch2/catch_test_macros.hpp"
#include "catch2/generators/catch_generators_all.hpp"
#include "src/buildtool/file_system/file_system_manager.hpp"
-#include "src/other_tools/utils/archive_ops.hpp"
+#include "src/utils/archive/archive_ops.hpp"
extern "C" {
#include <archive.h>