[PATCH] add rpc v6: support multiple _by_ fields

Eli Schwartz eschwartz at archlinux.org
Mon Nov 5 22:39:52 UTC 2018

On 5/31/18 11:24 PM, 尤立宇 wrote:
> Hi, this is a WIP patch following up the one at March:
> [PATCH] feat(rpc): return "providers" packages when querying by `name`
> or `name-desc`
> (I failed to make git-send-email to reply to the thread)
> The goal is to allow tools to use the RPC to resolve dependencies reliably,
> by introducing a new version of the RPC (v6):
> 1. Support querying by the provides field
> 2. Support querying with multiple _by_, for example, by[]=name&by[]=provides
> The design pretty much follows the one discussed (in the thread
> mentioned above) previously,
> I can bring up more context if needed.
> Here's a draft document of how it works:
> https://github.com/afg984/aurweb/wiki/aurweb-RPC-Interface-(v6-draft)
> This is a WIP patch, and I'd like to get some feedback before moving on.
> There are a few things worth noting:
> 1. commit 1ff40987 implemented search by depends, checkdepends,
> optdepends. They are currently left out.

This means we're in a funny situation where in order to get depfields
searches we would need to still recommend the v5 interface. Could we
implement this as well? If not, we should document it...

> 2. v5 allowed searching for orphan packages by leaving out the arg=
> argument. This is left out as well.
> 3. as search and info is now a similar concept (and a little different
> than those in v5), I've implemented them in a separate function. I'd
> like to know if this is the way to go, or I should try to reuse the
> existing structure.
> 2018-06-01 10:50 GMT+08:00 Li-Yu Yu <afg984 at gmail.com>:
>> ---
>>  web/lib/aurjson.class.php | 125 ++++++++++++++++++++++++++++++++++++--
>>  1 file changed, 120 insertions(+), 5 deletions(-)
>> diff --git a/web/lib/aurjson.class.php b/web/lib/aurjson.class.php
>> index c51e9c2..db11117 100644
>> --- a/web/lib/aurjson.class.php
>> +++ b/web/lib/aurjson.class.php
>> @@ -20,6 +20,14 @@ class AurJSON {
>>                 'name', 'name-desc', 'maintainer',
>>                 'depends', 'makedepends', 'checkdepends', 'optdepends'
>>         );
>> +       private static $exposed_fields_v6 = array(
>> +               'name', 'description', 'maintainer', 'provides',
>> +       );
>> +       private static $exposed_fields_map_v6 = array(
>> +               'name' => 'Packages.Name',
>> +               'description' => 'Packages.Description',
>> +               'maintainer' => 'Packages.Maintainer',
>> +       );

Why is this pulling indexes from a map? It's only ever used once, and I
don't think listing search qualifiers here really helps code clarity vs.
a case statement. Moreso when we need to drop the special handling of
finding NULL maintainers, and don't do provides here because it doesn't
fit into the architecture at all.

Eli Schwartz
Bug Wrangler and Trusted User

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <https://lists.archlinux.org/pipermail/aur-dev/attachments/20181105/c2336789/attachment.asc>

More information about the aur-dev mailing list