diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2018-04-27 15:53:00 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2018-04-27 15:55:18 +0300 |
commit | a2b084651909929d58f6b4bc0f3c742d87ee31f6 (patch) | |
tree | 63ef970e6edc44473ca9450dce93cbd130127d57 /bpkg/cfg-create.cxx | |
parent | f86216071cd4d8d120a8afb83f4b452ef7892ea1 (diff) |
Add support for repository fragments
Diffstat (limited to 'bpkg/cfg-create.cxx')
-rw-r--r-- | bpkg/cfg-create.cxx | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/bpkg/cfg-create.cxx b/bpkg/cfg-create.cxx index b62163e..04d97f4 100644 --- a/bpkg/cfg-create.cxx +++ b/bpkg/cfg-create.cxx @@ -96,10 +96,31 @@ namespace bpkg // database db (open (c, trace, true)); - // Add the special, root repository object with empty location. + // Add the special, root repository object with empty location and + // containing a single repository fragment having an empty location as + // well. + // + // Note that the root repository serves as a complement for dir and git + // repositories that have neither prerequisites nor complements. The + // root repository fragment is used for transient available package + // locations and as a search starting point for held packages (see + // pkg-build for details). // transaction t (db); - db.persist (repository (repository_location ())); + + shared_ptr<repository_fragment> fr ( + make_shared<repository_fragment> (repository_location ())); + + db.persist (fr); + + shared_ptr<repository> r ( + make_shared<repository> (repository_location ())); + + r->fragments.push_back ( + repository::fragment_type {string () /* friendly_name */, move (fr)}); + + db.persist (r); + t.commit (); if (verb && !o.no_result ()) |