aboutsummaryrefslogtreecommitdiff
path: root/mod
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2017-05-02 14:35:23 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2017-05-02 14:35:23 +0300
commitedb2ee4d94601699bba73652a355cbdb6da8e879 (patch)
tree3778443e1b6af0f9d012c254076cc92fb990f77a /mod
parent662400d824ceab77cb4dc2d0163b4d48d210b3e1 (diff)
Add suppport for build-task repository parameter
Diffstat (limited to 'mod')
-rw-r--r--mod/mod-build-task.cxx39
-rw-r--r--mod/options.cli3
2 files changed, 27 insertions, 15 deletions
diff --git a/mod/mod-build-task.cxx b/mod/mod-build-task.cxx
index e43397c..bff5b7e 100644
--- a/mod/mod-build-task.cxx
+++ b/mod/mod-build-task.cxx
@@ -72,12 +72,12 @@ handle (request& rq, response& rs)
if (build_db_ == nullptr)
throw invalid_request (501, "not implemented");
- // Make sure no parameters passed.
- //
+ params::build_task params;
+
try
{
name_value_scanner s (rq.parameters ());
- params::build_task (s, unknown_mode::fail, unknown_mode::fail);
+ params = params::build_task (s, unknown_mode::fail, unknown_mode::fail);
}
catch (const cli::exception& e)
{
@@ -225,17 +225,28 @@ handle (request& rq, response& rs)
// Skip external and stub packages.
//
- pkg_query pq ((pkg_query::internal_repository.is_not_null () &&
- compare_version_ne (pkg_query::id.version,
- wildcard_version,
- false)) +
- "ORDER BY" +
- pkg_query::id.name + "," +
- pkg_query::id.version.epoch + "," +
- pkg_query::id.version.canonical_upstream + "," +
- pkg_query::id.version.canonical_release + "," +
- pkg_query::id.version.revision +
- "OFFSET" + pkg_query::_ref (offset) + "LIMIT 50");
+ pkg_query pq (pkg_query::package::internal_repository.is_not_null () &&
+ compare_version_ne (pkg_query::package::id.version,
+ wildcard_version,
+ false));
+
+ // Filter by repositories display names (if requested).
+ //
+ const vector<string>& rp (params.repository ());
+
+ if (!rp.empty ())
+ pq = pq &&
+ pkg_query::repository::display_name.in_range (rp.begin (), rp.end ());
+
+ // Specify the portion.
+ //
+ pq += "ORDER BY" +
+ pkg_query::package::id.name + "," +
+ pkg_query::package::id.version.epoch + "," +
+ pkg_query::package::id.version.canonical_upstream + "," +
+ pkg_query::package::id.version.canonical_release + "," +
+ pkg_query::package::id.version.revision +
+ "OFFSET" + pkg_query::_ref (offset) + "LIMIT 50";
connection_ptr pkg_conn (package_db_->connection ());
diff --git a/mod/options.cli b/mod/options.cli
index 79636a8..46bc3fa 100644
--- a/mod/options.cli
+++ b/mod/options.cli
@@ -354,8 +354,9 @@ namespace brep
class build_task
{
- // No parameters so far.
+ // Package repository display name.
//
+ vector<string> repository | r;
};
class build_result