|
|
@ -30,7 +30,26 @@ build::build()
|
|
|
|
title(""),
|
|
|
|
title(""),
|
|
|
|
self_link(""),
|
|
|
|
self_link(""),
|
|
|
|
id(-1),
|
|
|
|
id(-1),
|
|
|
|
lp(nullptr) {}
|
|
|
|
lp(nullptr),
|
|
|
|
|
|
|
|
current_source_publication([this]() -> std::optional<source_package_publishing_history> {
|
|
|
|
|
|
|
|
if (current_source_publication_link.empty()) return std::nullopt;
|
|
|
|
|
|
|
|
if (_current_source_publication) return _current_source_publication;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
auto response = lp ? lp->api_get(current_source_publication_link) : std::nullopt;
|
|
|
|
|
|
|
|
if (!response) return std::nullopt;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
auto data = nlohmann::json::parse(response.value());
|
|
|
|
|
|
|
|
auto spph = source_package_publishing_history::parse(data.dump());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (spph) {
|
|
|
|
|
|
|
|
spph->set_lp(lp);
|
|
|
|
|
|
|
|
_current_source_publication = spph;
|
|
|
|
|
|
|
|
return spph;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return std::nullopt;
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
|
|
|
build::~build() {}
|
|
|
|
build::~build() {}
|
|
|
|
|
|
|
|
|
|
|
@ -52,6 +71,7 @@ void build::parse_json(const std::string& json_data) {
|
|
|
|
{"can_be_retried", [this](const nlohmann::json& val) { can_be_retried = val.get<bool>(); }},
|
|
|
|
{"can_be_retried", [this](const nlohmann::json& val) { can_be_retried = val.get<bool>(); }},
|
|
|
|
{"title", [this](const nlohmann::json& val) { title = val.get<std::string>(); }},
|
|
|
|
{"title", [this](const nlohmann::json& val) { title = val.get<std::string>(); }},
|
|
|
|
{"self_link", [this](const nlohmann::json& val) { self_link = val.get<std::string>(); }},
|
|
|
|
{"self_link", [this](const nlohmann::json& val) { self_link = val.get<std::string>(); }},
|
|
|
|
|
|
|
|
{"current_source_publication_link", [this](const nlohmann::json& val) { current_source_publication_link = val.get<std::string>(); }},
|
|
|
|
{"build_log_url", [this](const nlohmann::json& val) { build_log_url = val.get<std::string>(); }},
|
|
|
|
{"build_log_url", [this](const nlohmann::json& val) { build_log_url = val.get<std::string>(); }},
|
|
|
|
{"upload_log_url", [this](const nlohmann::json& val) { upload_log_url = val.get<std::string>(); }},
|
|
|
|
{"upload_log_url", [this](const nlohmann::json& val) { upload_log_url = val.get<std::string>(); }},
|
|
|
|
{"duration", [this](const nlohmann::json& val) { duration = val.get<std::string>(); }},
|
|
|
|
{"duration", [this](const nlohmann::json& val) { duration = val.get<std::string>(); }},
|
|
|
@ -149,16 +169,3 @@ bool build::rescore(int score) {
|
|
|
|
void build::set_lp(launchpad* lp_ptr) {
|
|
|
|
void build::set_lp(launchpad* lp_ptr) {
|
|
|
|
lp = lp_ptr;
|
|
|
|
lp = lp_ptr;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const std::optional<source_package_publishing_history> build::getCurrentSourcePublication() {
|
|
|
|
|
|
|
|
if (current_source_publication_link.empty()) return std::nullopt;
|
|
|
|
|
|
|
|
auto response = lp->api_get(current_source_publication_link);
|
|
|
|
|
|
|
|
if (!response) return std::nullopt;
|
|
|
|
|
|
|
|
auto data = nlohmann::json::parse(response.value());
|
|
|
|
|
|
|
|
auto sp = source_package_publishing_history::parse(data.dump());
|
|
|
|
|
|
|
|
if (sp) {
|
|
|
|
|
|
|
|
sp->set_lp(lp);
|
|
|
|
|
|
|
|
return sp.value();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return std::nullopt;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|