|
|
@ -974,84 +974,78 @@ int main(int argc, char** argv) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Stage 2: Build all packages in parallel
|
|
|
|
// Stage 2: Build all packages in parallel
|
|
|
|
if(!has_failures) {
|
|
|
|
log_info("Starting Stage 2: Building all packages.");
|
|
|
|
log_info("Starting Stage 2: Building all packages.");
|
|
|
|
std::vector<std::future<void>> build_futures;
|
|
|
|
std::vector<std::future<void>> build_futures;
|
|
|
|
for(auto &pkg : packages) {
|
|
|
|
for(auto &pkg : packages) {
|
|
|
|
build_futures.emplace_back(std::async(std::launch::async, build_package_stage_wrapper, std::ref(pkg), releases));
|
|
|
|
build_futures.emplace_back(std::async(std::launch::async, build_package_stage_wrapper, std::ref(pkg), releases));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for(auto &fut : build_futures) {
|
|
|
|
for(auto &fut : build_futures) {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
fut.get();
|
|
|
|
fut.get();
|
|
|
|
log_info("Package built successfully.");
|
|
|
|
log_info("Package built successfully.");
|
|
|
|
} catch(std::exception &e) {
|
|
|
|
} catch(std::exception &e) {
|
|
|
|
log_error(std::string("Build task generated an exception: ") + e.what());
|
|
|
|
log_error(std::string("Build task generated an exception: ") + e.what());
|
|
|
|
// Failure already recorded inside build_package_stage_wrapper
|
|
|
|
// Failure already recorded inside build_package_stage_wrapper
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
log_info("Completed Stage 2: All packages built.");
|
|
|
|
}
|
|
|
|
|
|
|
|
log_info("Completed Stage 2: All packages built.");
|
|
|
|
// Check for failures after Stage 2
|
|
|
|
|
|
|
|
{
|
|
|
|
// Check for failures after Stage 2
|
|
|
|
std::lock_guard<std::mutex> lock(failures_mutex);
|
|
|
|
{
|
|
|
|
if(!failed_packages.empty()) {
|
|
|
|
std::lock_guard<std::mutex> lock(failures_mutex);
|
|
|
|
log_error("Failures detected after Stage 2: Building packages.");
|
|
|
|
if(!failed_packages.empty()) {
|
|
|
|
has_failures = true;
|
|
|
|
log_error("Failures detected after Stage 2: Building packages.");
|
|
|
|
}
|
|
|
|
has_failures = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Stage 3: Dput upload all packages in parallel
|
|
|
|
// Stage 3: Dput upload all packages in parallel
|
|
|
|
if(!has_failures) {
|
|
|
|
log_info("Starting Stage 3: Uploading all packages with dput.");
|
|
|
|
log_info("Starting Stage 3: Uploading all packages with dput.");
|
|
|
|
std::vector<std::future<void>> upload_futures;
|
|
|
|
std::vector<std::future<void>> upload_futures;
|
|
|
|
for(auto &pkg : packages) {
|
|
|
|
for(auto &pkg : packages) {
|
|
|
|
upload_futures.emplace_back(std::async(std::launch::async, upload_package_stage, std::ref(pkg), skip_dput));
|
|
|
|
upload_futures.emplace_back(std::async(std::launch::async, upload_package_stage, std::ref(pkg), skip_dput));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for(auto &fut : upload_futures) {
|
|
|
|
for(auto &fut : upload_futures) {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
fut.get();
|
|
|
|
fut.get();
|
|
|
|
log_info("Package uploaded successfully.");
|
|
|
|
log_info("Package uploaded successfully.");
|
|
|
|
} catch(std::exception &e) {
|
|
|
|
} catch(std::exception &e) {
|
|
|
|
log_error(std::string("Upload task generated an exception: ") + e.what());
|
|
|
|
log_error(std::string("Upload task generated an exception: ") + e.what());
|
|
|
|
// Failure already recorded inside upload_package_stage
|
|
|
|
// Failure already recorded inside upload_package_stage
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
log_info("Completed Stage 3: All packages uploaded.");
|
|
|
|
}
|
|
|
|
|
|
|
|
log_info("Completed Stage 3: All packages uploaded.");
|
|
|
|
// Check for failures after Stage 3
|
|
|
|
|
|
|
|
{
|
|
|
|
// Check for failures after Stage 3
|
|
|
|
std::lock_guard<std::mutex> lock(failures_mutex);
|
|
|
|
{
|
|
|
|
if(!failed_packages.empty()) {
|
|
|
|
std::lock_guard<std::mutex> lock(failures_mutex);
|
|
|
|
log_error("Failures detected after Stage 3: Uploading packages.");
|
|
|
|
if(!failed_packages.empty()) {
|
|
|
|
has_failures = true;
|
|
|
|
log_error("Failures detected after Stage 3: Uploading packages.");
|
|
|
|
}
|
|
|
|
has_failures = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Stage 4: Run Lintian on all packages in parallel
|
|
|
|
// Stage 4: Run Lintian on all packages in parallel
|
|
|
|
if(!has_failures) {
|
|
|
|
log_info("Starting Stage 4: Running Lintian on all packages.");
|
|
|
|
log_info("Starting Stage 4: Running Lintian on all packages.");
|
|
|
|
std::vector<std::future<void>> lintian_futures;
|
|
|
|
std::vector<std::future<void>> lintian_futures;
|
|
|
|
for(auto &pkg : packages) {
|
|
|
|
for(auto &pkg : packages) {
|
|
|
|
lintian_futures.emplace_back(std::async(std::launch::async, run_lintian_stage, std::ref(pkg)));
|
|
|
|
lintian_futures.emplace_back(std::async(std::launch::async, run_lintian_stage, std::ref(pkg)));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for(auto &fut : lintian_futures) {
|
|
|
|
for(auto &fut : lintian_futures) {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
fut.get();
|
|
|
|
fut.get();
|
|
|
|
log_info("Lintian run successfully.");
|
|
|
|
log_info("Lintian run successfully.");
|
|
|
|
} catch(std::exception &e) {
|
|
|
|
} catch(std::exception &e) {
|
|
|
|
log_error(std::string("Lintian task generated an exception: ") + e.what());
|
|
|
|
log_error(std::string("Lintian task generated an exception: ") + e.what());
|
|
|
|
// Record the failure
|
|
|
|
// Record the failure
|
|
|
|
std::lock_guard<std::mutex> lock_fail(failures_mutex);
|
|
|
|
std::lock_guard<std::mutex> lock_fail(failures_mutex);
|
|
|
|
failed_packages["Lintian"] = "Exception during Lintian run: " + std::string(e.what());
|
|
|
|
failed_packages["Lintian"] = "Exception during Lintian run: " + std::string(e.what());
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
log_info("Completed Stage 4: All Lintian runs completed.");
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
log_info("Completed Stage 4: All Lintian runs completed.");
|
|
|
|
|
|
|
|
|
|
|
|
// Proceed to summary and cleanup
|
|
|
|
// Proceed to summary and cleanup
|
|
|
|
summary(skip_cleanup);
|
|
|
|
summary(skip_cleanup);
|
|
|
|