aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libbrep/build.cxx4
-rw-r--r--libbrep/build.hxx7
-rw-r--r--libbrep/build.xml4
-rw-r--r--mod/mod-build-force.cxx7
-rw-r--r--mod/mod-build-log.cxx4
-rw-r--r--mod/mod-build-task.cxx29
-rw-r--r--mod/mod-builds.cxx12
7 files changed, 23 insertions, 44 deletions
diff --git a/libbrep/build.cxx b/libbrep/build.cxx
index 0941c5f..78a3a2d 100644
--- a/libbrep/build.cxx
+++ b/libbrep/build.cxx
@@ -13,7 +13,6 @@ namespace brep
{
switch (s)
{
- case build_state::unbuilt: return "unbuilt";
case build_state::building: return "building";
case build_state::built: return "built";
}
@@ -24,8 +23,7 @@ namespace brep
build_state
to_build_state (const string& s)
{
- if (s == "unbuilt") return build_state::unbuilt;
- else if (s == "building") return build_state::building;
+ if (s == "building") return build_state::building;
else if (s == "built") return build_state::built;
else throw invalid_argument ("invalid build state '" + s + "'");
}
diff --git a/libbrep/build.hxx b/libbrep/build.hxx
index 6b58402..dd6f10d 100644
--- a/libbrep/build.hxx
+++ b/libbrep/build.hxx
@@ -64,7 +64,6 @@ namespace brep
//
enum class build_state: std::uint8_t
{
- unbuilt,
building,
built
};
@@ -176,10 +175,8 @@ namespace brep
optional<string> agent_fingerprint;
optional<string> agent_challenge;
- // Present only for building and built states.
- //
- optional<string> machine;
- optional<string> machine_summary;
+ string machine;
+ string machine_summary;
// Default for the machine if absent.
//
diff --git a/libbrep/build.xml b/libbrep/build.xml
index cee65ac..5b45d6d 100644
--- a/libbrep/build.xml
+++ b/libbrep/build.xml
@@ -22,8 +22,8 @@
<column name="status" type="TEXT" null="true"/>
<column name="agent_fingerprint" type="TEXT" null="true"/>
<column name="agent_challenge" type="TEXT" null="true"/>
- <column name="machine" type="TEXT" null="true"/>
- <column name="machine_summary" type="TEXT" null="true"/>
+ <column name="machine" type="TEXT" null="false"/>
+ <column name="machine_summary" type="TEXT" null="false"/>
<column name="target" type="TEXT" null="true"/>
<primary-key>
<column name="package_name"/>
diff --git a/mod/mod-build-force.cxx b/mod/mod-build-force.cxx
index c0c3d2d..325a1c7 100644
--- a/mod/mod-build-force.cxx
+++ b/mod/mod-build-force.cxx
@@ -166,13 +166,6 @@ handle (request& rq, response& rs)
if (b == nullptr)
config_expired ("no package configuration");
- // Respond with 409 (conflict) if the package configuration is in
- // inappropriate state for being rebuilt.
- //
- else if (b->state != build_state::built &&
- b->state != build_state::building)
- throw invalid_request (409, "state is " + to_string (b->state));
-
force_state force (b->state == build_state::built
? force_state::forced
: force_state::forcing);
diff --git a/mod/mod-build-log.cxx b/mod/mod-build-log.cxx
index 3daa1e3..281eec6 100644
--- a/mod/mod-build-log.cxx
+++ b/mod/mod-build-log.cxx
@@ -206,14 +206,12 @@ handle (request& rq, response& rs)
//
ostream& os (rs.content (200, "text/plain;charset=utf-8", false));
- assert (b->machine && b->machine_summary);
-
os << "package: " << b->package_name << endl
<< "version: " << b->package_version << endl
<< "toolchain: " << b->toolchain_name << '-' << b->toolchain_version
<< endl
<< "config: " << b->configuration << endl
- << "machine: " << *b->machine << " (" << *b->machine_summary << ")"
+ << "machine: " << b->machine << " (" << b->machine_summary << ")"
<< endl
<< "target: " << (b->target ? b->target->string () : "<default>")
<< endl
diff --git a/mod/mod-build-task.cxx b/mod/mod-build-task.cxx
index dc9910f..a56d75b 100644
--- a/mod/mod-build-task.cxx
+++ b/mod/mod-build-task.cxx
@@ -158,11 +158,10 @@ handle (request& rq, response& rs)
}
// Go through packages until we find one that has no build configuration
- // present in the database, or has the unbuilt one, or in the building state
- // but expired (collectively called unbuilt). If such a package
- // configuration is found then put it into the building state, set the
- // current timestamp and respond with the task for building this package
- // configuration.
+ // present in the database, or is in the building state but expired
+ // (collectively called unbuilt). If such a package configuration is found
+ // then put it into the building state, set the current timestamp and respond
+ // with the task for building this package configuration.
//
// While trying to find a non-built package configuration we will also
// collect the list of the built package configurations which it's time to
@@ -213,8 +212,8 @@ handle (request& rq, response& rs)
move (task));
};
- // Calculate the expiration time for package configurations being in the
- // building (build expiration) or the built (rebuild expiration) state.
+ // Calculate the build (building state) or rebuild (built state) expiration
+ // time for package configurations
//
timestamp now (timestamp::clock::now ());
@@ -385,11 +384,10 @@ handle (request& rq, response& rs)
true) &&
(bld_query::state == "built" ||
- (bld_query::state == "building" &&
- ((bld_query::force == "forcing" &&
- bld_query::timestamp > forced_result_expiration_ns) ||
- (bld_query::force != "forcing" && // Unforced or forced.
- bld_query::timestamp > normal_result_expiration_ns)))));
+ ((bld_query::force == "forcing" &&
+ bld_query::timestamp > forced_result_expiration_ns) ||
+ (bld_query::force != "forcing" && // Unforced or forced.
+ bld_query::timestamp > normal_result_expiration_ns))));
connection_ptr bld_conn (build_db_->connection ());
@@ -490,8 +488,8 @@ handle (request& rq, response& rs)
}
else
{
- // The package configuration can be in the building or unbuilt
- // state, and there are no results.
+ // The package configuration is in the building state, and there
+ // are no results.
//
// Note that in both cases we keep the status intact to be able
// to compare it with the final one in the result request
@@ -503,7 +501,8 @@ handle (request& rq, response& rs)
//
build_db_->load (*b, b->results_section);
- assert (b->state != build_state::built && b->results.empty ());
+ assert (b->state == build_state::building &&
+ b->results.empty ());
b->state = build_state::building;
diff --git a/mod/mod-builds.cxx b/mod/mod-builds.cxx
index 8bd6f88..da72e17 100644
--- a/mod/mod-builds.cxx
+++ b/mod/mod-builds.cxx
@@ -96,8 +96,7 @@ build_query (const C& configs, const brep::params::builds& params)
};
query q (
- query::id.configuration.in_range (configs.begin (), configs.end ()) &&
- (query::state == "building" || query::state == "built"));
+ query::id.configuration.in_range (configs.begin (), configs.end ()));
// Note that there is no error reported if the filter parameters parsing
// fails. Instead, it is considered that no package builds match such a
@@ -363,8 +362,6 @@ handle (request& rq, response& rs)
"OFFSET" + to_string (page * page_configs) +
"LIMIT" + to_string (page_configs)))
{
- assert (b.machine);
-
string ts (butl::to_string (b.timestamp,
"%Y-%m-%d %H:%M:%S %Z",
true,
@@ -376,10 +373,9 @@ handle (request& rq, response& rs)
<< TR_NAME (b.package_name, string (), root)
<< TR_VERSION (b.package_name, b.package_version, root)
<< TR_VALUE ("toolchain",
- b.toolchain_name + '-' +
- b.toolchain_version.string ())
+ b.toolchain_name + '-' + b.toolchain_version.string ())
<< TR_VALUE ("config", b.configuration)
- << TR_VALUE ("machine", *b.machine)
+ << TR_VALUE ("machine", b.machine)
<< TR_VALUE ("target", b.target ? b.target->string () : "<default>")
<< TR_VALUE ("timestamp", ts)
<< TR(CLASS="result")
@@ -391,8 +387,6 @@ handle (request& rq, response& rs)
s << "building | ";
else
{
- assert (b.state == build_state::built);
-
build_db_->load (b, b.results_section);
// If no unsuccessful operations results available, then print the