main
Simon Quigley 1 month ago
parent 19f8fd9481
commit cae78a03bf

@ -15,6 +15,9 @@
#include "common.h" #include "common.h"
#include "launchpad.h" #include "launchpad.h"
#include "distribution.h"
#include "distro_series.h"
#include "person.h"
#include <iostream> #include <iostream>
#include <fstream> #include <fstream>
@ -381,39 +384,20 @@ int main(int argc, char* argv[]) {
// Authenticate with Launchpad // Authenticate with Launchpad
log_info_custom("Logging into Launchpad..."); log_info_custom("Logging into Launchpad...");
std::shared_ptr<launchpad> lp_opt = launchpad::login(); auto lp_opt = launchpad::login();
if (!lp_opt) { if (!lp_opt.has_value()) {
log_error_custom("Failed to authenticate with Launchpad."); std::cerr << "Failed to authenticate with Launchpad.\n";
return 1; return 1;
} }
log_info_custom("Logged into Launchpad."); auto lp = lp_opt.value().get();
launchpad lp = *lp_opt; auto ubuntu_opt = lp->distributions["ubuntu"];
distribution ubuntu = ubuntu_opt.value();
// Access Ubuntu distribution and current series distro_series current_series = ubuntu.current_series;
auto ubuntu_opt = lp.distributions.find("ubuntu");
if (ubuntu_opt == lp.distributions.end()) {
log_error_custom("Failed to retrieve 'ubuntu' distribution.");
return 1;
}
distribution ubuntu = ubuntu_opt->second;
distro_series current_series;
// Assuming current_series is accessible; adjust based on actual Launchpad API
// Here, we assume ubuntu.current_series is a valid member
if (ubuntu.getCurrentSeries(current_series) != 0) {
log_error_custom("Failed to retrieve current series.");
return 1;
}
log_info_custom("Current series: " + current_series.name);
// Retrieve user and PPA // Retrieve user and PPA
auto user_opt = lp.people.find(args.user); auto user_opt = lp->people[args.user];
if (user_opt == lp.people.end()) { person user = user_opt.value();
log_error_custom("Failed to retrieve user: " + args.user);
return 1;
}
person user = user_opt->second;
auto ppa_opt = user.getPPAByName(ubuntu, args.ppa); auto ppa_opt = user.getPPAByName(ubuntu, args.ppa);
if (!ppa_opt.has_value()) { if (!ppa_opt.has_value()) {
@ -451,8 +435,6 @@ int main(int argc, char* argv[]) {
fs::create_directories(lintianDir); fs::create_directories(lintianDir);
fs::create_directories(lintianTmpDir); fs::create_directories(lintianTmpDir);
// Define rsync function (already implemented as rsync_copy)
// Initialize ThreadPool with 5 threads // Initialize ThreadPool with 5 threads
ThreadPool pool(5); ThreadPool pool(5);

Loading…
Cancel
Save