aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2024-10-10 13:47:06 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2024-10-11 12:12:54 +0300
commit4889704a27b13e9c356108ff2842b41740c1a168 (patch)
tree717939e65e035c54ad37f4c4a49ed0893166b612
parentb30db036c342295b96842f7b90674d414bf4d1ec (diff)
Remove repository caches to free up disk space in worker
-rw-r--r--bbot/worker/worker.cxx43
-rw-r--r--tests/integration/testscript8
2 files changed, 47 insertions, 4 deletions
diff --git a/bbot/worker/worker.cxx b/bbot/worker/worker.cxx
index b019337..a5dd92d 100644
--- a/bbot/worker/worker.cxx
+++ b/bbot/worker/worker.cxx
@@ -60,6 +60,9 @@ namespace bbot
const size_t tftp_put_timeout (3600); // 1 hour (also the default).
const size_t tftp_get_timeout (10); // 10 seconds.
const size_t tftp_get_retries (3); // Task request retries (see startup()).
+
+ const dir_path bpkg_dir (".bpkg");
+ const dir_path repos_dir (dir_path (bpkg_dir) /= "repos");
}
static bool
@@ -2814,6 +2817,12 @@ build (size_t argc, const char* argv[])
// configuration for external build-time tests, if any, and the install
// configuration, if present.
//
+ // While at it, stash the configurations where the repositories have
+ // been fetched to, in order to remove the repository caches when they
+ // become no longer needed to free up a bit of space.
+ //
+ dir_paths fetched_repo_confs;
+
// bpkg add <env-config-args> <tgt-config-args> <pkg-config-args>
// <repository-url>
//
@@ -2858,6 +2867,8 @@ build (size_t argc, const char* argv[])
if (!r.status)
break;
+
+ fetched_repo_confs.push_back (main_pkg_conf);
}
if (create_install)
@@ -2906,6 +2917,8 @@ build (size_t argc, const char* argv[])
if (!r.status)
break;
+
+ fetched_repo_confs.push_back (install_conf);
}
}
@@ -2955,6 +2968,8 @@ build (size_t argc, const char* argv[])
if (!r.status)
break;
+
+ fetched_repo_confs.push_back (target_conf);
}
}
@@ -3500,6 +3515,16 @@ build (size_t argc, const char* argv[])
if (!r.status)
break;
+
+ // Now, as all the packages are configured, remove the repository
+ // caches to free up the space.
+ //
+ for (const dir_path& d: fetched_repo_confs)
+ {
+ dir_path rd (d / repos_dir);
+ if (exists (rd))
+ rm_r (trace, &r.log, rd);
+ }
}
// Redistribute the main package in both build and install
@@ -5066,6 +5091,10 @@ build (size_t argc, const char* argv[])
// Add and fetch the repositories.
//
+ // Stash fetched repositories as above.
+ //
+ dir_paths fetched_repo_confs;
+
if (has_runtime_tests)
{
// bpkg add <env-config-args> <tgt-config-args> <pkg-config-args>
@@ -5114,6 +5143,8 @@ build (size_t argc, const char* argv[])
if (!r.status)
break;
+
+ fetched_repo_confs.push_back (runtime_tests_conf);
}
}
@@ -5165,6 +5196,8 @@ build (size_t argc, const char* argv[])
if (!r.status)
break;
+
+ fetched_repo_confs.push_back (target_conf);
}
}
@@ -5335,6 +5368,16 @@ build (size_t argc, const char* argv[])
if (!r.status)
break;
+
+ // Now, as all the packages are configured, remove the
+ // repository caches to free up the space.
+ //
+ for (const dir_path& d: fetched_repo_confs)
+ {
+ dir_path rd (d / repos_dir);
+ if (exists (rd))
+ rm_r (trace, &r.log, rd);
+ }
}
#ifdef _WIN32
diff --git a/tests/integration/testscript b/tests/integration/testscript
index 2dcd849..942d8ec 100644
--- a/tests/integration/testscript
+++ b/tests/integration/testscript
@@ -222,7 +222,7 @@ bpkg.module.create:config.bin.rpath=[null]
#
#\
pkg = libbuild2-autoconf
-ver = 0.2.0
+ver = 0.3.0
rep_url = "https://github.com/build2/libbuild2-autoconf.git#master"
rep_type = git
rfp = yes
@@ -232,7 +232,7 @@ host = 'host: true'
#\
pkg = curl
-ver = 7.84.0
+ver = 8.8.0+1
rep_url = https://pkg.cppget.org/1/stable
rep_type = pkg
rfp = yes
@@ -303,7 +303,7 @@ bpkg.create:config.bin.rpath=[null]
#\
pkg = libxsd
-ver = 4.2.0-b.3.20220224113525.516981000564
+ver = 4.2.1-a.0.20231121133547.a821131cf17a
rep_url = "https://git.codesynthesis.com/xsd/xsd.git#master"
rep_type = git
#rep_url = https://stage.build2.org/1
@@ -314,7 +314,7 @@ tests="tests: libxsd-tests == $ver"
#\
pkg = xsd
-ver = 4.2.0-b.4.20230320140030.aafc60b2e901
+ver = 4.2.1-a.0.20231121133547.a821131cf17a
rep_url = "https://git.codesynthesis.com/xsd/xsd.git#master"
rep_type = git
#rep_url = https://queue.stage.build2.org/1