'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 # Include directories
target_include_directories(${PROJECT_NAME} PRIVATE target_include_directories(${PROJECT_NAME} PRIVATE
${CMAKE_CURRENT_BINARY_DIR}/src/autogen ${CMAKE_CURRENT_BINARY_DIR}/src/autogen
src) src
src/common)
# Find packages # Find packages
find_package(OpenSSL REQUIRED) find_package(OpenSSL REQUIRED)

View File

@ -16,6 +16,8 @@
#include <unistd.h> #include <unistd.h>
#include <vector> #include <vector>
namespace common {
// ANSI color codes // ANSI color codes
namespace colors { namespace colors {
constexpr const char* reset = "\033[0m"; 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 <filesystem>
#include <iostream> #include <iostream>
namespace dropshell { namespace common {
uint64_t hash_file(const std::string &path) { uint64_t hash_file(const std::string &path) {
// Create hash state // Create hash state
@ -130,4 +130,4 @@ int hash_demo_raw(const std::string & path)
return 0; return 0;
} }
} // namespace dropshell } // namespace common

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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