aboutsummaryrefslogtreecommitdiff
path: root/libbrep
diff options
context:
space:
mode:
Diffstat (limited to 'libbrep')
-rw-r--r--libbrep/build.cxx26
-rw-r--r--libbrep/build.hxx28
-rw-r--r--libbrep/build.xml2
3 files changed, 50 insertions, 6 deletions
diff --git a/libbrep/build.cxx b/libbrep/build.cxx
index ece2fd7..2391165 100644
--- a/libbrep/build.cxx
+++ b/libbrep/build.cxx
@@ -30,6 +30,30 @@ namespace brep
else throw invalid_argument ("invalid build state '" + s + "'");
}
+ // force_state
+ //
+ string
+ to_string (force_state s)
+ {
+ switch (s)
+ {
+ case force_state::unforced: return "unforced";
+ case force_state::forcing: return "forcing";
+ case force_state::forced: return "forced";
+ }
+
+ return string (); // Should never reach.
+ }
+
+ force_state
+ to_force_state (const string& s)
+ {
+ if (s == "unforced") return force_state::unforced;
+ else if (s == "forcing") return force_state::forcing;
+ else if (s == "forced") return force_state::forced;
+ else throw invalid_argument ("invalid force state '" + s + "'");
+ }
+
// build
//
build::
@@ -46,7 +70,7 @@ namespace brep
toolchain_version (move (tvr)),
state (build_state::building),
timestamp (timestamp_type::clock::now ()),
- forced (false),
+ force (force_state::unforced),
machine (move (mnm)),
machine_summary (move (msm)),
target (move (trg))
diff --git a/libbrep/build.hxx b/libbrep/build.hxx
index 9258bb3..afa96ed 100644
--- a/libbrep/build.hxx
+++ b/libbrep/build.hxx
@@ -82,6 +82,28 @@ namespace brep
to(to_string (?)) \
from(brep::to_build_state (?))
+ // force_state
+ //
+ enum class force_state: std::uint8_t
+ {
+ unforced,
+ forcing, // Rebuild is forced while being in the building state.
+ forced // Rebuild is forced while being in the built state.
+ };
+
+ string
+ to_string (force_state);
+
+ force_state
+ to_force_state (const string&); // May throw invalid_argument.
+
+ inline ostream&
+ operator<< (ostream& os, force_state s) {return os << to_string (s);}
+
+ #pragma db map type(force_state) as(string) \
+ to(to_string (?)) \
+ from(brep::to_force_state (?))
+
// result_status
//
using bbot::result_status;
@@ -118,7 +140,7 @@ namespace brep
using timestamp_type = brep::timestamp;
// Create the build object with the building state, non-existent status,
- // the timestamp set to now and the forced flag set to false.
+ // the timestamp set to now and the force state set to unforced.
//
build (string package_name, version package_version,
string configuration,
@@ -140,9 +162,7 @@ namespace brep
//
timestamp_type timestamp;
- // True if the package rebuild has been forced.
- //
- bool forced;
+ force_state force;
// Must present for the built state, may present for the building state.
//
diff --git a/libbrep/build.xml b/libbrep/build.xml
index 72cbd5f..7466c97 100644
--- a/libbrep/build.xml
+++ b/libbrep/build.xml
@@ -18,7 +18,7 @@
<column name="toolchain_version_release" type="TEXT" null="true"/>
<column name="state" type="TEXT" null="false"/>
<column name="timestamp" type="BIGINT" null="false"/>
- <column name="forced" type="BOOLEAN" null="false"/>
+ <column name="force" type="TEXT" null="false"/>
<column name="status" type="TEXT" null="true"/>
<column name="machine" type="TEXT" null="true"/>
<column name="machine_summary" type="TEXT" null="true"/>