aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2017-12-25 01:26:01 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2017-12-28 14:42:11 +0300
commit21d9f67600a53af44d0f7365074de5312a829193 (patch)
treeb6a09420c12049fc91e07bef80f2333a81ce6330
parent911f505667eb8c8fd8b69d3f4b0969160eb1de55 (diff)
Adapt to repository location interface change
-rw-r--r--libbrep/common.hxx9
-rw-r--r--load/load.cxx17
-rw-r--r--tests/load/driver.cxx35
3 files changed, 29 insertions, 32 deletions
diff --git a/libbrep/common.hxx b/libbrep/common.hxx
index 581784d..fc03a9a 100644
--- a/libbrep/common.hxx
+++ b/libbrep/common.hxx
@@ -201,12 +201,17 @@ namespace brep
}
};
+ // repository_type
+ //
+ using bpkg::repository_type;
+
// repository_location
//
using bpkg::repository_location;
- #pragma db map type(repository_location) as(string) \
- to((?).string ()) from(brep::repository_location (?))
+ #pragma db map type(repository_location) as(string) \
+ to((?).string ()) \
+ from(brep::repository_location ((?), brep::repository_type::bpkg))
// Version comparison operators.
//
diff --git a/load/load.cxx b/load/load.cxx
index 8cc9730..db552e4 100644
--- a/load/load.cxx
+++ b/load/load.cxx
@@ -49,6 +49,9 @@ struct failed {};
static const char* help_info (
" info: run 'brep-load --help' for more information");
+static const path packages ("packages");
+static const path repositories ("repositories");
+
struct internal_repository
{
repository_location location;
@@ -57,11 +60,10 @@ struct internal_repository
optional<string> fingerprint;
path
- packages_path () const {return cache_location.path () / path ("packages");}
+ packages_path () const {return cache_location.path () / packages;}
path
- repositories_path () const {
- return cache_location.path () / path ("repositories");}
+ repositories_path () const {return cache_location.path () / repositories;}
};
using internal_repositories = vector<internal_repository>;
@@ -114,7 +116,7 @@ load_repositories (path p)
try
{
- r.location = repository_location (tl[i].value);
+ r.location = repository_location (tl[i].value, repository_type::bpkg);
}
catch (const invalid_argument& e)
{
@@ -161,7 +163,8 @@ load_repositories (path p)
if (cache_path.relative ())
cache_path = p.directory () / cache_path;
- r.cache_location = repository_location (cache_path.string ());
+ r.cache_location = repository_location (cache_path.string (),
+ repository_type::bpkg);
// Created from the absolute path repository location can not be
// other than absolute.
@@ -314,7 +317,7 @@ load_packages (const shared_ptr<repository>& rp, database& db)
assert (!rp->cache_location.empty ());
package_manifests pkm;
- path p (rp->cache_location.path () / path ("packages"));
+ path p (rp->cache_location.path () / packages);
try
{
@@ -474,7 +477,7 @@ load_repositories (const shared_ptr<repository>& rp, database& db)
repository_manifests rpm;
- path p (rp->cache_location.path () / path ("repositories"));
+ path p (rp->cache_location.path () / repositories);
try
{
diff --git a/tests/load/driver.cxx b/tests/load/driver.cxx
index 868b393..9322773 100644
--- a/tests/load/driver.cxx
+++ b/tests/load/driver.cxx
@@ -27,6 +27,9 @@ using namespace odb::core;
using namespace butl;
using namespace brep;
+static const path packages ("packages");
+static const path repositories ("repositories");
+
static bool
check_location (shared_ptr<package>& p)
{
@@ -178,9 +181,7 @@ main (int argc, char* argv[])
assert (sr->packages_timestamp == srt);
assert (sr->repositories_timestamp ==
- file_mtime (
- dir_path (
- sr->cache_location.path ()) / path ("repositories")));
+ file_mtime (sr->cache_location.path () / repositories));
assert (sr->internal);
assert (sr->complements.empty ());
@@ -436,13 +437,10 @@ main (int argc, char* argv[])
assert (mr->cache_location.path () == mrp.normalize ());
assert (mr->packages_timestamp ==
- file_mtime (
- dir_path (mr->cache_location.path ()) / path ("packages")));
+ file_mtime (mr->cache_location.path () / packages));
assert (mr->repositories_timestamp ==
- file_mtime (
- dir_path (
- mr->cache_location.path ()) / path ("repositories")));
+ file_mtime (mr->cache_location.path () / repositories));
assert (mr->internal);
@@ -692,13 +690,10 @@ main (int argc, char* argv[])
assert (cr->cache_location.path () == crp.normalize ());
assert (cr->packages_timestamp ==
- file_mtime (
- dir_path (cr->cache_location.path ()) / path ("packages")));
+ file_mtime (cr->cache_location.path () / packages));
assert (cr->repositories_timestamp ==
- file_mtime (
- dir_path (
- cr->cache_location.path ()) / path ("repositories")));
+ file_mtime (cr->cache_location.path () / repositories));
assert (!cr->internal);
assert (cr->prerequisites.empty ());
@@ -755,13 +750,10 @@ main (int argc, char* argv[])
assert (tr->cache_location.path () == trp.normalize ());
assert (tr->packages_timestamp ==
- file_mtime (
- dir_path (tr->cache_location.path ()) / path ("packages")));
+ file_mtime (tr->cache_location.path () / packages));
assert (tr->repositories_timestamp ==
- file_mtime (
- dir_path (
- tr->cache_location.path ()) / path ("repositories")));
+ file_mtime (tr->cache_location.path () / repositories));
assert (!tr->internal);
assert (tr->prerequisites.empty ());
@@ -806,13 +798,10 @@ main (int argc, char* argv[])
assert (gr->cache_location.path () == grp.normalize ());
assert (gr->packages_timestamp ==
- file_mtime (
- dir_path (gr->cache_location.path ()) / path ("packages")));
+ file_mtime (gr->cache_location.path () / packages));
assert (gr->repositories_timestamp ==
- file_mtime (
- dir_path (
- gr->cache_location.path ()) / path ("repositories")));
+ file_mtime (gr->cache_location.path () / repositories));
assert (!gr->internal);
assert (gr->prerequisites.empty ());