'Generic Commit'
All checks were successful
Build-Test-Publish / build (linux/amd64) (push) Successful in 49s
Build-Test-Publish / build (linux/arm64) (push) Successful in 1m1s
Build-Test-Publish / test-install-from-scratch (linux/amd64) (push) Successful in 7s
Build-Test-Publish / test-install-from-scratch (linux/arm64) (push) Successful in 8s

This commit is contained in:
Your Name 2025-06-22 14:13:56 +12:00
parent 40bacab90f
commit bdf8ac66b0
10 changed files with 21 additions and 16 deletions

View File

@ -32,7 +32,8 @@ add_dependencies(${PROJECT_NAME} run_prebuild_script)
# Include directories
target_include_directories(${PROJECT_NAME} PRIVATE
${CMAKE_CURRENT_BINARY_DIR}/src/autogen
src)
src
src/common)
# Find packages
find_package(OpenSSL REQUIRED)

View File

@ -16,6 +16,8 @@
#include <unistd.h>
#include <vector>
namespace common {
// ANSI color codes
namespace colors {
constexpr const char* reset = "\033[0m";
@ -243,4 +245,6 @@ void assert_failed(
}
}
#define ASSERT(condition, message) assert_failed(condition, message, std::source_location::current())
#define ASSERT(condition, message) common::assert_failed(condition, message, std::source_location::current())
} // namespace common

View File

@ -9,7 +9,7 @@
#include <filesystem>
#include <iostream>
namespace dropshell {
namespace common {
uint64_t hash_file(const std::string &path) {
// Create hash state
@ -130,4 +130,4 @@ int hash_demo_raw(const std::string & path)
return 0;
}
} // namespace dropshell
} // namespace common

View File

@ -4,7 +4,7 @@
#include <string>
#include <cstdint>
namespace dropshell {
namespace common {
uint64_t hash_file(const std::string &path);
@ -16,7 +16,7 @@ namespace dropshell {
int hash_demo_raw(const std::string & path);
} // namespace dropshell
} // namespace common
#endif

View File

@ -2,7 +2,7 @@
#include <iostream>
#include <mutex>
namespace dropshell
namespace common
{
// Mutex to synchronize output
std::mutex output_mutex;
@ -130,4 +130,4 @@ namespace dropshell
SetColour(sColour::RESET, os_);
}
} // namespace dropshell
} // namespace common

View File

@ -6,7 +6,7 @@
#include <vector>
#include <ostream>
namespace dropshell {
namespace common {
/*
@ -82,6 +82,6 @@ class SwitchColour
sColour colour_;
};
} // namespace dropshell
} // namespace common
#endif // OUTPUT_HPP

View File

@ -7,7 +7,7 @@
#include <stdexcept>
#include <iostream> // For error reporting in destructor
namespace getpkg {
namespace common {
TempDirectory::TempDirectory(const std::string& prefix) {
auto temp_dir_base = std::filesystem::temp_directory_path();
@ -60,4 +60,4 @@ std::string TempDirectory::string() const {
return path_.string();
}
} // namespace simple_object_storage
} // namespace common

View File

@ -4,7 +4,7 @@
#include <filesystem>
#include <string>
namespace getpkg {
namespace common {
// RAII helper for temporary directory cleanup
class TempDirectory {
@ -25,6 +25,6 @@ private:
std::filesystem::path path_;
};
} // namespace simple_object_storage
} // namespace common
#endif // TEMP_DIRECTORY_HPP

View File

@ -148,7 +148,7 @@ int install_tool(int argc, char* argv[]) {
std::string arch = get_arch();
std::string home = get_home();
getpkg::TempDirectory tempDir;
common::TempDirectory tempDir;
std::filesystem::path configDir = std::filesystem::path(home) / ".config/getpkg";
std::filesystem::path binDir = std::filesystem::path(home) / ".getpkg" / toolName;
std::filesystem::path archivePath = tempDir.path() / (toolName + ".tgz");
@ -486,7 +486,7 @@ int hash_command(int argc, char* argv[]) {
return 1;
}
uint64_t hash = dropshell::hash_path(path);
uint64_t hash = common::hash_path(path);
std::cout << hash << std::endl;
return 0;
}