Use build instead of build_record

main
Simon Quigley 1 week ago
parent 2cbe2897a2
commit b7011711b3

@ -20,6 +20,7 @@
#include "archive_permission.h" #include "archive_permission.h"
#include "binary_package_publishing_history.h" #include "binary_package_publishing_history.h"
#include "archive_dependency.h" #include "archive_dependency.h"
#include "build.h"
#include <iostream> #include <iostream>
#include <nlohmann/json.hpp> #include <nlohmann/json.hpp>
@ -244,7 +245,7 @@ std::optional<nlohmann::json> archive::getBuildCounters(bool include_needsbuild)
return nlohmann::json::parse(response.value()); return nlohmann::json::parse(response.value());
} }
std::generator<build_record> archive::getBuildRecords(const std::string& build_state, std::generator<build> archive::getBuildRecords(const std::string& build_state,
const std::string& pocket, const std::string& pocket,
const std::string& source_name) const { const std::string& source_name) const {
std::map<std::string,std::string> params; std::map<std::string,std::string> params;
@ -258,9 +259,10 @@ std::generator<build_record> archive::getBuildRecords(const std::string& build_s
while (true) { while (true) {
if (data.contains("entries") && data["entries"].is_array()) { if (data.contains("entries") && data["entries"].is_array()) {
for (auto& e : data["entries"]) { for (auto& e : data["entries"]) {
build_record br; auto b_opt = build::parse(e.dump());
br.data = e; if(!b_opt) continue;
co_yield br; b_opt->set_lp(lp);
co_yield b_opt.value();
} }
} }
if(!data.contains("next_collection_link") || data["next_collection_link"].is_null() || data["next_collection_link"]=="") break; if(!data.contains("next_collection_link") || data["next_collection_link"].is_null() || data["next_collection_link"]=="") break;

@ -20,6 +20,7 @@
#include "archive_permission.h" #include "archive_permission.h"
#include "binary_package_publishing_history.h" #include "binary_package_publishing_history.h"
#include "archive_dependency.h" #include "archive_dependency.h"
#include "build.h"
#include <generator> #include <generator>
#include <nlohmann/json.hpp> #include <nlohmann/json.hpp>
#include <optional> #include <optional>
@ -36,10 +37,6 @@
class launchpad; class launchpad;
struct build_record {
nlohmann::json data;
};
class archive { class archive {
public: public:
archive(); archive();
@ -102,7 +99,7 @@ public:
bool strict_component = false) const; bool strict_component = false) const;
std::optional<archive_dependency> getArchiveDependency(const std::string& dependency_link) const; std::optional<archive_dependency> getArchiveDependency(const std::string& dependency_link) const;
std::optional<nlohmann::json> getBuildCounters(bool include_needsbuild = false) const; std::optional<nlohmann::json> getBuildCounters(bool include_needsbuild = false) const;
std::generator<build_record> getBuildRecords(const std::string& build_state = "", std::generator<build> getBuildRecords(const std::string& build_state = "",
const std::string& pocket = "", const std::string& pocket = "",
const std::string& source_name = "") const; const std::string& source_name = "") const;
std::optional<nlohmann::json> getBuildSummariesForSourceIds(const std::vector<std::string>& source_ids) const; std::optional<nlohmann::json> getBuildSummariesForSourceIds(const std::vector<std::string>& source_ids) const;

Loading…
Cancel
Save