diff options
author | Paul Cristian Sarbu <paul.cristian.sarbu@huawei.com> | 2023-02-15 13:07:27 +0100 |
---|---|---|
committer | Paul Cristian Sarbu <paul.cristian.sarbu@huawei.com> | 2023-02-17 16:27:50 +0100 |
commit | b6a4271feaa2ed9eaa553189183a74cb28c4b5fd (patch) | |
tree | 24579aa62eb1bdf537eb9943305ac2b16b2b63d7 /src | |
parent | 307da10caa951c5e8d6d6f256ee3d81a66ed6bb3 (diff) | |
download | justbuild-b6a4271feaa2ed9eaa553189183a74cb28c4b5fd.tar.gz |
structure cleanup: move libarchive utilities to other_tools...
...in order to not include unwanted dependencies in just proper.
As the whole other_tools folder is meant to be excluded from
bootstrapping, also remove the bootstrap guards.
Diffstat (limited to 'src')
-rw-r--r-- | src/other_tools/root_maps/TARGETS | 2 | ||||
-rw-r--r-- | src/other_tools/root_maps/content_git_map.cpp | 2 | ||||
-rw-r--r-- | src/other_tools/utils/TARGETS | 11 | ||||
-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/TARGETS | 10 |
6 files changed, 17 insertions, 52 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"] |