aboutsummaryrefslogtreecommitdiff
path: root/bpkg/package.cxx
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2022-03-21 21:32:42 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2022-03-23 14:50:00 +0300
commitfdaa71c503c04aa35230b7f932f9ad43cc994a08 (patch)
tree210bcc6268e9291a9c71919a725e8f26df32a148 /bpkg/package.cxx
parentedeb250d50ca3f2dfb88a8b623abae43d4229bbc (diff)
Add configuration variable sources to selected packages
Diffstat (limited to 'bpkg/package.cxx')
-rw-r--r--bpkg/package.cxx22
1 files changed, 22 insertions, 0 deletions
diff --git a/bpkg/package.cxx b/bpkg/package.cxx
index 4b9cdc3..3a356f8 100644
--- a/bpkg/package.cxx
+++ b/bpkg/package.cxx
@@ -529,6 +529,28 @@ namespace bpkg
return lazy_shared_ptr<selected_package> (ddb, move (prerequisite));
}
+ string
+ to_string (config_source s)
+ {
+ switch (s)
+ {
+ case config_source::user: return "user";
+ case config_source::dependent: return "dependent";
+ case config_source::reflect: return "reflect";
+ }
+
+ return string (); // Should never reach.
+ }
+
+ config_source
+ to_config_source (const string& s)
+ {
+ if (s == "user") return config_source::user;
+ else if (s == "dependent") return config_source::dependent;
+ else if (s == "reflect") return config_source::reflect;
+ else throw invalid_argument ("invalid config source '" + s + "'");
+ }
+
shared_ptr<available_package>
make_available (const common_options& options,
database& db,