aboutsummaryrefslogtreecommitdiff
path: root/bpkg/database.cxx
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2016-08-19 17:37:29 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2016-08-29 18:20:03 +0300
commit53c2aa8e382dd50d09b385285bc3fa0b645ace0a (patch)
tree6d23d091bc57c0aa8d8a529e63ec2f2f22322a3a /bpkg/database.cxx
parenta4b29effed15b0a3e9309a4633a3ada37f3081e6 (diff)
Support system packages
Diffstat (limited to 'bpkg/database.cxx')
-rw-r--r--bpkg/database.cxx17
1 files changed, 17 insertions, 0 deletions
diff --git a/bpkg/database.cxx b/bpkg/database.cxx
index 6eec6f8..418265c 100644
--- a/bpkg/database.cxx
+++ b/bpkg/database.cxx
@@ -7,7 +7,10 @@
#include <odb/schema-catalog.hxx>
#include <odb/sqlite/exceptions.hxx>
+#include <bpkg/package>
+#include <bpkg/package-odb>
#include <bpkg/diagnostics>
+#include <bpkg/system-repository>
using namespace std;
@@ -76,6 +79,20 @@ namespace bpkg
fail << "configuration " << d << " is already used by another process";
}
+ // Query for all the packages with the system substate and enter their
+ // versions into system_repository as non-authoritative. This way an
+ // available_package (e.g., a stub) will automatically "see" system
+ // version, if one is known.
+ //
+ transaction t (db.begin ());
+
+ for (const auto& p:
+ db.query<selected_package> (
+ query<selected_package>::substate == "system"))
+ system_repository.insert (p.name, p.version, false);
+
+ t.commit ();
+
db.tracer (tr); // Switch to the caller's tracer.
return db;
}