From edb2ee4d94601699bba73652a355cbdb6da8e879 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Tue, 2 May 2017 14:35:23 +0300 Subject: Add suppport for build-task repository parameter --- mod/mod-build-task.cxx | 39 +++++++++++++++++++++++++-------------- mod/options.cli | 3 ++- 2 files changed, 27 insertions(+), 15 deletions(-) (limited to 'mod') 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& 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 repository | r; }; class build_result -- cgit v1.1