@@ -14,7 +14,7 @@ namespace dds::cli::cmd { | |||
int build(const options& opts) { | |||
if (!opts.build.add_repos.empty()) { | |||
auto cat = opts.open_catalog(); | |||
auto cat = opts.open_pkg_db(); | |||
for (auto& str : opts.build.add_repos) { | |||
auto repo = pkg_remote::connect(str); | |||
repo.store(cat.database()); | |||
@@ -22,7 +22,7 @@ int build(const options& opts) { | |||
} | |||
if (opts.build.update_repos || !opts.build.add_repos.empty()) { | |||
update_all_remotes(opts.open_catalog().database()); | |||
update_all_remotes(opts.open_pkg_db().database()); | |||
} | |||
auto builder = create_project_builder(opts); |
@@ -37,7 +37,7 @@ int build_deps(const options& opts) { | |||
auto all_deps = ranges::views::concat(all_file_deps, cmd_deps) | ranges::to_vector; | |||
auto cat = opts.open_catalog(); | |||
auto cat = opts.open_pkg_db(); | |||
dds::pkg_cache::with_cache( // | |||
opts.pkg_cache_dir.value_or(pkg_cache::default_local_path()), | |||
dds::pkg_cache_flags::write_lock | dds::pkg_cache_flags::create_if_absent, |
@@ -14,7 +14,7 @@ | |||
namespace dds::cli::cmd { | |||
static int _pkg_get(const options& opts) { | |||
auto cat = opts.open_catalog(); | |||
auto cat = opts.open_pkg_db(); | |||
for (const auto& item : opts.pkg.get.pkgs) { | |||
auto id = pkg_id::parse(item); | |||
dds::dym_target dym; |
@@ -8,7 +8,7 @@ | |||
namespace dds::cli::cmd { | |||
static int _pkg_repo_add(const options& opts) { | |||
auto cat = opts.open_catalog(); | |||
auto cat = opts.open_pkg_db(); | |||
auto repo = pkg_remote::connect(opts.pkg.repo.add.url); | |||
repo.store(cat.database()); | |||
if (opts.pkg.repo.add.update) { |
@@ -10,7 +10,7 @@ | |||
namespace dds::cli::cmd { | |||
static int _pkg_repo_ls(const options& opts) { | |||
auto pkg_db = opts.open_catalog(); | |||
auto pkg_db = opts.open_pkg_db(); | |||
neo::sqlite3::database_ref db = pkg_db.database(); | |||
auto st = db.prepare("SELECT name, remote_url, db_mtime FROM dds_pkg_remotes"); |
@@ -8,7 +8,7 @@ | |||
namespace dds::cli::cmd { | |||
static int _pkg_repo_update(const options& opts) { | |||
update_all_remotes(opts.open_catalog().database()); | |||
update_all_remotes(opts.open_pkg_db().database()); | |||
return 0; | |||
} | |||
@@ -428,7 +428,7 @@ void cli::options::setup_parser(debate::argument_parser& parser) noexcept { | |||
setup{*this}.do_setup(parser); | |||
} | |||
pkg_db dds::cli::options::open_catalog() const { | |||
pkg_db dds::cli::options::open_pkg_db() const { | |||
return pkg_db::open(this->pkg_db_dir.value_or(pkg_db::default_path())); | |||
} | |||
@@ -119,7 +119,7 @@ struct options { | |||
* @brief Open the package pkg_db based on the user-specified options. | |||
* @return pkg_db | |||
*/ | |||
pkg_db open_catalog() const; | |||
pkg_db open_pkg_db() const; | |||
/** | |||
* @brief Load a dds toolchain as specified by the user, or a default. | |||
* @return dds::toolchain |
@@ -20,12 +20,11 @@ TEST_CASE("Open a database in a non-ascii path") { | |||
dds::fs::remove_all(subdir); | |||
} | |||
class catalog_test_case { | |||
public: | |||
struct pkg_db_test_case { | |||
dds::pkg_db db = dds::pkg_db::open(":memory:"s); | |||
}; | |||
TEST_CASE_METHOD(catalog_test_case, "Store a simple package") { | |||
TEST_CASE_METHOD(pkg_db_test_case, "Store a simple package") { | |||
db.store(dds::pkg_listing{ | |||
dds::pkg_id{"foo", semver::version::parse("1.2.3")}, | |||
{}, | |||
@@ -56,7 +55,7 @@ TEST_CASE_METHOD(catalog_test_case, "Store a simple package") { | |||
CHECK(info->remote_pkg.to_url_string() == "git+http://example.com#develop"); | |||
} | |||
TEST_CASE_METHOD(catalog_test_case, "Package requirements") { | |||
TEST_CASE_METHOD(pkg_db_test_case, "Package requirements") { | |||
db.store(dds::pkg_listing{ | |||
dds::pkg_id{"foo", semver::version::parse("1.2.3")}, | |||
{ |