[PATCH] [RFC] Allow to search packages by "*depends" fields
Lukas Fleischer
lfleischer at archlinux.org
Sun Jan 28 12:32:50 UTC 2018
On Sun, 28 Jan 2018 at 01:20:55, Baptiste Jonglez wrote:
> From: Baptiste Jonglez <git at bitsofnetworks.org>
>
> It is now possible to search for packages that depend on a given package,
> for instance:
>
> /rpc/?v=5&type=search&by=depends&arg=ocaml
>
> It is also possible to match on "makedepends", "checkdepends" and
> "optdepends".
>
> Remaining tasks for a complete patch:
>
> - actually test it...
> - update documentation
> - see if the additional SQL JOINs increase database load
> - maybe add something like "by=anydepends" to match across all types of dependencies?
>
> Signed-off-by: Baptiste Jonglez <git at bitsofnetworks.org>
> ---
> web/lib/aurjson.class.php | 16 +++++++++++++++-
> 1 file changed, 15 insertions(+), 1 deletion(-)
I like the overall idea and given the implementation is pretty simple
and straightforward, I do not see anything speaking against it.
The documentation definitely needs to be updated, preferably in the same
patch. One small comment below...
>
> diff --git a/web/lib/aurjson.class.php b/web/lib/aurjson.class.php
> index 9eeaafd..addb92e 100644
> --- a/web/lib/aurjson.class.php
> +++ b/web/lib/aurjson.class.php
> [...]
> @@ -407,6 +412,15 @@ class AurJSON {
> $keyword_string = $this->dbh->quote($keyword_string);
> $where_condition = "Users.Username = $keyword_string ";
> }
> + } else if ($search_by === 'depends' || $search_by === 'makedepends' || $search_by === 'checkdepends' || $search_by === 'optdepends') {
This can be written in a more compact way, using in_array().
Everything else looks good to me!
Thanks,
Lukas
More information about the aur-dev
mailing list