'Generic Commit'
Some checks failed
Build-Test-Publish / build (push) Failing after 30s

This commit is contained in:
Your Name 2025-06-22 09:33:04 +12:00
parent a37e42884f
commit a524d12e0c
2 changed files with 16 additions and 10 deletions

View File

@ -325,12 +325,12 @@ int publish_tool(int argc, char* argv[]) {
int update_tool(int argc, char* argv[]) {
std::cout << "Updating getpkg itself..." << std::endl;
// First update getpkg itself
// First try to update getpkg itself
char* fakeArgv[] = {argv[0], (char*)"install", (char*)"getpkg"};
int result = install_tool(3, fakeArgv);
if (result != 0) {
std::cerr << "Failed to update getpkg" << std::endl;
return result;
std::cerr << "Warning: Failed to update getpkg (may not be published)" << std::endl;
// Continue with updating other tools instead of failing
}
// Then update all installed tools
@ -338,12 +338,18 @@ int update_tool(int argc, char* argv[]) {
std::filesystem::path configDir = std::filesystem::path(home) / ".config/getpkg";
std::cout << "Updating all installed tools..." << std::endl;
for (const auto& entry : std::filesystem::directory_iterator(configDir)) {
if (entry.path().extension() == ".json") {
std::string tname = entry.path().stem();
if (tname != "getpkg") { // Skip getpkg since we already updated it
char* toolArgv[] = {argv[0], (char*)"install", (char*)tname.c_str()};
install_tool(3, toolArgv);
bool anyUpdates = false;
if (std::filesystem::exists(configDir)) {
for (const auto& entry : std::filesystem::directory_iterator(configDir)) {
if (entry.path().extension() == ".json") {
std::string tname = entry.path().stem();
if (tname != "getpkg") { // Skip getpkg since we already tried it
std::cout << "Checking " << tname << "..." << std::endl;
char* toolArgv[] = {argv[0], (char*)"install", (char*)tname.c_str()};
if (install_tool(3, toolArgv) == 0) {
anyUpdates = true;
}
}
}
}
}

View File

@ -331,7 +331,7 @@ fi
# Test 14: Update command (if we have tools installed)
if [ -d ~/.config/getpkg ] && [ "$(find ~/.config/getpkg -name "*.json" -type f 2>/dev/null | wc -l)" -gt 0 ]; then
echo -e "\nTest 14: Update command"
UPDATE_ALL_OUTPUT=$(timeout 3 "$GETPKG" update 2>&1) || UPDATE_ALL_OUTPUT=""
UPDATE_ALL_OUTPUT=$(timeout 30 "$GETPKG" update 2>&1) || UPDATE_ALL_OUTPUT=""
if [[ "$UPDATE_ALL_OUTPUT" =~ Update\ complete ]]; then
print_test_result "Update all tools command" 0
else