Compare commits

...

2 Commits

5 changed files with 12 additions and 14 deletions

View File

@ -902,7 +902,8 @@ bool PackageConf::can_check_source_upload() {
if (upload_ok && !source_check_ok) return true;
else if (!upload_ok && source_check_ok) return false;
else if (upload_ok && source_check_ok && !source_check_successful && (source_check_time >= (now - (60 * 60 * 1000)))) return true;
else if (upload_ok && source_check_ok && !source_check_successful && (source_check_time >= (now - (30 * 60 * 1000)))) return false;
else if (upload_ok && source_check_ok && !source_check_successful && (upload_time >= (now - (24 * 60 * 60 * 1000)))) return true;
else return upload_ok && source_check_ok && (source_check_time <= upload_time);
}
@ -928,8 +929,8 @@ bool PackageConf::can_check_builds() {
if (!build_check_ok && source_check_ok) return true;
else if (!build_check_ok && !source_check_ok) return false;
else if (source_check_ok && build_check_ok && !build_check_successful && (build_check_time >= (now - (60 * 60 * 1000)))) return false;
else if (source_check_ok && build_check_ok && !build_check_successful && (build_check_time >= (now - (4 * 24 * 60 * 60 * 1000)))) return true;
else if (source_check_ok && build_check_ok && !build_check_successful && (build_check_time >= (now - (30 * 60 * 1000)))) return false;
else if (source_check_ok && build_check_ok && !build_check_successful && (source_check_time >= (now - (4 * 24 * 60 * 60 * 1000)))) return true;
else return source_check_ok && build_check_ok && (build_check_time <= source_check_time);
}
// End of PackageConf

View File

@ -17,6 +17,13 @@
#include <fstream>
void ensure_git_inited() {
static std::once_flag git_init_flag;
std::call_once(git_init_flag, []() {
git_libgit2_init();
});
}
static int submodule_trampoline(git_submodule* sm, const char* name, void* payload) {
// Cast payload back to the C++ lambda
auto* callback = static_cast<std::function<int(git_submodule*, const char*, void*)>*>(payload);

View File

@ -21,6 +21,7 @@
namespace fs = std::filesystem;
void ensure_git_inited();
GitCommit get_commit_from_pkg_repo(const std::string& repo_name,
std::shared_ptr<Log> log);
void clone_or_fetch(const fs::path &repo_dir,

View File

@ -270,13 +270,6 @@ std::pair<int, bool> get_version_from_codename(const std::string& codename) {
return {version, is_last};
}
void ensure_git_inited() {
static std::once_flag git_init_flag;
std::call_once(git_init_flag, []() {
git_libgit2_init();
});
}
void run_task_every(std::stop_token _stop_token, int interval_minutes, std::function<void()> task) {
if (interval_minutes < 2) interval_minutes = 2;
std::this_thread::sleep_for(std::chrono::minutes(interval_minutes / 2));

View File

@ -23,7 +23,6 @@
#include <shared_mutex>
#include <semaphore>
#include <functional>
#include <git2.h>
#include <QProcess>
namespace fs = std::filesystem;
@ -102,9 +101,6 @@ std::string generate_random_string(size_t length);
// Get version from codename using distro-info
std::pair<int, bool> get_version_from_codename(const std::string& codename);
// Git utilities
void ensure_git_inited();
void run_task_every(std::stop_token _stop_token, int interval_minutes, std::function<void()> task);
// Logger functions