aboutsummaryrefslogtreecommitdiff
path: root/bpkg/rep-list.cxx
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2018-04-27 15:53:00 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2018-04-27 15:55:18 +0300
commita2b084651909929d58f6b4bc0f3c742d87ee31f6 (patch)
tree63ef970e6edc44473ca9450dce93cbd130127d57 /bpkg/rep-list.cxx
parentf86216071cd4d8d120a8afb83f4b452ef7892ea1 (diff)
Add support for repository fragments
Diffstat (limited to 'bpkg/rep-list.cxx')
-rw-r--r--bpkg/rep-list.cxx52
1 files changed, 30 insertions, 22 deletions
diff --git a/bpkg/rep-list.cxx b/bpkg/rep-list.cxx
index 8d308dd..f1e251c 100644
--- a/bpkg/rep-list.cxx
+++ b/bpkg/rep-list.cxx
@@ -20,7 +20,7 @@ namespace bpkg
//
// Each line has the following form:
//
- // [(complement|prerequisite) ]<name> <location>
+ // [(complement|prerequisite) ]<name> <location>[ (<fragment>)]
//
// and is indented with 2 additional spaces for each recursion level.
//
@@ -44,34 +44,42 @@ namespace bpkg
indent += " ";
- if (o.complements ())
+ auto print_repo = [&o, &indent, &chain] (
+ const shared_ptr<repository>& r,
+ const char* role,
+ const repository::fragment_type& fr)
{
- for (const lazy_shared_ptr<repository>& rp: r->complements)
- {
- // Skip the root complement (see rep_fetch() for details).
- //
- if (rp.object_id () == "")
- continue;
+ cout << indent << role << ' ' << r->name << ' ' << r->location;
- shared_ptr<repository> r (rp.load ());
+ if (!fr.friendly_name.empty ())
+ cout << " (" << fr.friendly_name << ")";
- cout << indent << "complement "
- << r->location.canonical_name () << " " << r->location << endl;
+ cout << endl;
- print_dependencies (o, r, indent, chain);
- }
- }
+ print_dependencies (o, r, indent, chain);
+ };
- if (o.prerequisites ())
+ for (const repository::fragment_type& rfr: r->fragments)
{
- for (const lazy_weak_ptr<repository>& rp: r->prerequisites)
- {
- shared_ptr<repository> r (rp.load ());
+ shared_ptr<repository_fragment> fr (rfr.fragment.load ());
- cout << indent << "prerequisite "
- << r->location.canonical_name () << " " << r->location << endl;
+ if (o.complements ())
+ {
+ for (const lazy_shared_ptr<repository>& rp: fr->complements)
+ {
+ // Skip the root complement (see rep_fetch() for details).
+ //
+ if (rp.object_id () == "")
+ continue;
+
+ print_repo (rp.load (), "complement", rfr);
+ }
+ }
- print_dependencies (o, r, indent, chain);
+ if (o.prerequisites ())
+ {
+ for (const lazy_weak_ptr<repository>& rp: fr->prerequisites)
+ print_repo (rp.load (), "prerequisite", rfr);
}
}
@@ -104,7 +112,7 @@ namespace bpkg
transaction t (db);
session s; // Repository dependencies can have cycles.
- shared_ptr<repository> root (db.load<repository> (""));
+ shared_ptr<repository_fragment> root (db.load<repository_fragment> (""));
for (const lazy_shared_ptr<repository>& rp: root->complements)
{