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/TARGETS11
-rw-r--r--src/other_tools/utils/archive_ops.cpp (renamed from src/utils/cpp/archive_ops.cpp)38
-rw-r--r--src/other_tools/utils/archive_ops.hpp (renamed from src/utils/cpp/archive_ops.hpp)6
-rw-r--r--src/utils/cpp/TARGETS10
-rw-r--r--test/other_tools/TARGETS1
-rw-r--r--test/other_tools/just_mr/TARGETS2
-rw-r--r--test/other_tools/just_mr/create_test_archives.cpp2
-rw-r--r--test/other_tools/utils/TARGETS17
-rw-r--r--test/other_tools/utils/archive_usage.test.cpp (renamed from test/utils/cpp/archive_usage.test.cpp)2
-rw-r--r--test/utils/cpp/TARGETS16
12 files changed, 39 insertions, 70 deletions
diff --git a/src/other_tools/root_maps/TARGETS b/src/other_tools/root_maps/TARGETS
index a17bdecd..0d5c18f9 100644
--- a/src/other_tools/root_maps/TARGETS
+++ b/src/other_tools/root_maps/TARGETS
@@ -61,7 +61,7 @@
]
, "stage": ["src", "other_tools", "root_maps"]
, "private-deps":
- [ ["src/utils/cpp", "archive_ops"]
+ [ ["src/other_tools/utils", "archive_ops"]
, ["src/buildtool/execution_api/local", "local"]
, ["src/buildtool/file_system", "file_storage"]
]
diff --git a/src/other_tools/root_maps/content_git_map.cpp b/src/other_tools/root_maps/content_git_map.cpp
index cab723b4..9d1130e5 100644
--- a/src/other_tools/root_maps/content_git_map.cpp
+++ b/src/other_tools/root_maps/content_git_map.cpp
@@ -16,7 +16,7 @@
#include "src/buildtool/execution_api/local/local_cas.hpp"
#include "src/buildtool/file_system/file_storage.hpp"
-#include "src/utils/cpp/archive_ops.hpp"
+#include "src/other_tools/utils/archive_ops.hpp"
namespace {
diff --git a/src/other_tools/utils/TARGETS b/src/other_tools/utils/TARGETS
new file mode 100644
index 00000000..0893821d
--- /dev/null
+++ b/src/other_tools/utils/TARGETS
@@ -0,0 +1,11 @@
+{ "archive_ops":
+ { "type": ["@", "rules", "CC", "library"]
+ , "name": ["archive_ops"]
+ , "hdrs": ["archive_ops.hpp"]
+ , "srcs": ["archive_ops.cpp"]
+ , "deps": [["@", "gsl-lite", "", "gsl-lite"]]
+ , "stage": ["src", "other_tools", "utils"]
+ , "private-deps":
+ [["src/buildtool/file_system", "file_system_manager"], ["", "libarchive"]]
+ }
+}
diff --git a/src/utils/cpp/archive_ops.cpp b/src/other_tools/utils/archive_ops.cpp
index 3944e4d5..49fb8c50 100644
--- a/src/utils/cpp/archive_ops.cpp
+++ b/src/other_tools/utils/archive_ops.cpp
@@ -12,12 +12,10 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-#include "src/utils/cpp/archive_ops.hpp"
+#include "src/other_tools/utils/archive_ops.hpp"
#include "src/buildtool/file_system/file_system_manager.hpp"
-#ifndef BOOTSTRAP_BUILD_TOOL
-
extern "C" {
#include <archive.h>
#include <archive_entry.h>
@@ -53,13 +51,8 @@ void archive_read_closer(archive* a_in) {
} // namespace
-#endif // BOOTSTRAP_BUILD_TOOL
-
auto ArchiveOps::WriteEntry(archive_entry* entry, archive* aw)
-> std::optional<std::string> {
-#ifdef BOOTSTRAP_BUILD_TOOL
- return std::nullopt;
-#else
std::filesystem::path entry_path{archive_entry_sourcepath(entry)};
// only write to archive if entry is file
if (FileSystemManager::IsFile(entry_path)) {
@@ -74,14 +67,10 @@ auto ArchiveOps::WriteEntry(archive_entry* entry, archive* aw)
}
}
return std::nullopt;
-#endif // BOOTSTRAP_BUILD_TOOL
}
auto ArchiveOps::CopyData(archive* ar, archive* aw)
-> std::optional<std::string> {
-#ifdef BOOTSTRAP_BUILD_TOOL
- return std::nullopt;
-#else
int r{};
const void* buff{nullptr};
size_t size{};
@@ -102,14 +91,10 @@ auto ArchiveOps::CopyData(archive* ar, archive* aw)
}
}
return std::nullopt; // success!
-#endif // BOOTSTRAP_BUILD_TOOL
}
auto ArchiveOps::EnableWriteFormats(archive* aw, ArchiveType type)
-> std::optional<std::string> {
-#ifdef BOOTSTRAP_BUILD_TOOL
- return std::nullopt;
-#else
switch (type) {
case ArchiveType::kArchiveTypeZip: {
if (archive_write_set_format_zip(aw) != ARCHIVE_OK) {
@@ -139,14 +124,10 @@ auto ArchiveOps::EnableWriteFormats(archive* aw, ArchiveType type)
} break;
}
return std::nullopt; // success!
-#endif // BOOTSTRAP_BUILD_TOOL
}
auto ArchiveOps::EnableReadFormats(archive* ar, ArchiveType type)
-> std::optional<std::string> {
-#ifdef BOOTSTRAP_BUILD_TOOL
- return std::nullopt;
-#else
switch (type) {
case ArchiveType::kArchiveTypeZip: {
if (archive_read_support_format_zip(ar) != ARCHIVE_OK) {
@@ -176,18 +157,13 @@ auto ArchiveOps::EnableReadFormats(archive* ar, ArchiveType type)
} break;
}
return std::nullopt; // success!
-#endif // BOOTSTRAP_BUILD_TOOL
}
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;
-#else
return CreateArchive(type, name, source, std::filesystem::path("."));
-#endif // BOOTSTRAP_BUILD_TOOL
}
auto ArchiveOps::CreateArchive(ArchiveType type,
@@ -195,9 +171,6 @@ 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);
@@ -270,26 +243,18 @@ 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;
-#else
return ExtractArchive(type, source, std::filesystem::path("."));
-#endif // BOOTSTRAP_BUILD_TOOL
}
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};
@@ -362,5 +327,4 @@ 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/utils/cpp/archive_ops.hpp b/src/other_tools/utils/archive_ops.hpp
index b5726f9d..7fccae45 100644
--- a/src/utils/cpp/archive_ops.hpp
+++ b/src/other_tools/utils/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_ARCHIVE_OPS_HPP
-#define INCLUDED_SRC_OTHER_TOOLS_ARCHIVE_OPS_HPP
+#ifndef INCLUDED_SRC_OTHER_TOOLS_UTILS_ARCHIVE_OPS_HPP
+#define INCLUDED_SRC_OTHER_TOOLS_UTILS_ARCHIVE_OPS_HPP
#include <filesystem>
#include <optional>
@@ -97,4 +97,4 @@ class ArchiveOps {
-> std::optional<std::string>;
};
-#endif // INCLUDED_SRC_OTHER_TOOLS_ARCHIVE_OPS_HPP \ No newline at end of file
+#endif // INCLUDED_SRC_OTHER_TOOLS_UTILS_ARCHIVE_OPS_HPP \ No newline at end of file
diff --git a/src/utils/cpp/TARGETS b/src/utils/cpp/TARGETS
index b835023f..4bc79e8e 100644
--- a/src/utils/cpp/TARGETS
+++ b/src/utils/cpp/TARGETS
@@ -79,16 +79,6 @@
, ["", "libcurl"]
]
}
-, "archive_ops":
- { "type": ["@", "rules", "CC", "library"]
- , "name": ["archive_ops"]
- , "hdrs": ["archive_ops.hpp"]
- , "srcs": ["archive_ops.cpp"]
- , "deps": [["@", "gsl-lite", "", "gsl-lite"]]
- , "stage": ["src", "utils", "cpp"]
- , "private-deps":
- [["src/buildtool/file_system", "file_system_manager"], ["", "libarchive"]]
- }
, "file_locking":
{ "type": ["@", "rules", "CC", "library"]
, "name": ["file_locking"]
diff --git a/test/other_tools/TARGETS b/test/other_tools/TARGETS
index c7a4cfe0..a5ad01be 100644
--- a/test/other_tools/TARGETS
+++ b/test/other_tools/TARGETS
@@ -4,6 +4,7 @@
, "dirs":
[ [["./", "git_operations", "TESTS"], "git_operations"]
, [["./", "just_mr", "TESTS"], "just_mr"]
+ , [["./", "utils", "TESTS"], "utils"]
]
}
}
diff --git a/test/other_tools/just_mr/TARGETS b/test/other_tools/just_mr/TARGETS
index d3b016a5..15d31445 100644
--- a/test/other_tools/just_mr/TARGETS
+++ b/test/other_tools/just_mr/TARGETS
@@ -10,7 +10,7 @@
, "private-deps":
[ ["src/buildtool/file_system", "file_system_manager"]
, ["src/buildtool/logging", "logging"]
- , ["src/utils/cpp", "archive_ops"]
+ , ["src/other_tools/utils", "archive_ops"]
, ["src/utils/cpp", "tmp_dir"]
]
, "private-ldflags": ["-lpthread"]
diff --git a/test/other_tools/just_mr/create_test_archives.cpp b/test/other_tools/just_mr/create_test_archives.cpp
index fbda0f6e..031ca1ab 100644
--- a/test/other_tools/just_mr/create_test_archives.cpp
+++ b/test/other_tools/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/utils/cpp/archive_ops.hpp"
+#include "src/other_tools/utils/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
new file mode 100644
index 00000000..d709b532
--- /dev/null
+++ b/test/other_tools/utils/TARGETS
@@ -0,0 +1,17 @@
+{ "archive_usage":
+ { "type": ["@", "rules", "CC/test", "test"]
+ , "tainted": ["test"]
+ , "name": ["archive_usage"]
+ , "srcs": ["archive_usage.test.cpp"]
+ , "private-deps":
+ [ ["@", "catch2", "", "catch2"]
+ , ["test", "catch-main"]
+ , ["src/buildtool/file_system", "file_system_manager"]
+ , ["", "libarchive"]
+ , ["src/other_tools/utils", "archive_ops"]
+ ]
+ , "stage": ["test", "other_tools", "utils"]
+ }
+, "TESTS":
+ {"type": "install", "tainted": ["test"], "deps": ["archive_usage"]}
+} \ No newline at end of file
diff --git a/test/utils/cpp/archive_usage.test.cpp b/test/other_tools/utils/archive_usage.test.cpp
index 9c03d81a..2fe38460 100644
--- a/test/utils/cpp/archive_usage.test.cpp
+++ b/test/other_tools/utils/archive_usage.test.cpp
@@ -17,7 +17,7 @@
#include "catch2/catch.hpp"
#include "src/buildtool/file_system/file_system_manager.hpp"
-#include "src/utils/cpp/archive_ops.hpp"
+#include "src/other_tools/utils/archive_ops.hpp"
extern "C" {
#include <archive.h>
diff --git a/test/utils/cpp/TARGETS b/test/utils/cpp/TARGETS
index 9dc5f83b..05e344cd 100644
--- a/test/utils/cpp/TARGETS
+++ b/test/utils/cpp/TARGETS
@@ -29,20 +29,6 @@
, "test": ["curl_usage_test.sh"]
, "deps": [["test/utils", "test_utils_install"], "curl_usage_install"]
}
-, "archive_usage":
- { "type": ["@", "rules", "CC/test", "test"]
- , "tainted": ["test"]
- , "name": ["archive_usage"]
- , "srcs": ["archive_usage.test.cpp"]
- , "private-deps":
- [ ["@", "catch2", "", "catch2"]
- , ["test", "catch-main"]
- , ["src/buildtool/file_system", "file_system_manager"]
- , ["", "libarchive"]
- , ["src/utils/cpp", "archive_ops"]
- ]
- , "stage": ["test", "utils", "cpp"]
- }
, "file_locking":
{ "type": ["@", "rules", "CC/test", "test"]
, "name": ["file_locking"]
@@ -59,6 +45,6 @@
, "TESTS":
{ "type": "install"
, "tainted": ["test"]
- , "deps": ["path", "curl_usage_test", "archive_usage", "file_locking"]
+ , "deps": ["path", "curl_usage_test", "file_locking"]
}
}