On 21/03/18 02:33, 尤立宇 wrote:
2018-03-21 9:49 GMT+08:00 morganamilo <morganamilo@gmail.com>:
I think it would be like: HTTP GET /rpc/?v=5&type=provides&arg[]=java-environment&arg[]=libgala.so {"version":5,"type":"provides","resultcount":2,"results": "java-environment": [] // might be list of package names or list of "info" "libgala.so": [] } Pacman can "-S" and "-Ss" by provides so I would prefer to have the option to search by provides in type=info and type=search rather than a new type=provides. Also I would like each option to be indivudually settable, so "provides", "name" and "desc" can be set indipendantly. I think I'm looking for an alpm_find_satisifier equivalent rather than a pacman -Ss equalviant, and that's why I'm proposing a new type=provides.
For type=info after thinking again, is it a) The dependencies providers' details are listed in the "Depends" "MakeDepends" "OptDepends" b) The "results" items are unchanged, but querying a name not only returns the package name that matches, but also their provides array matches. That is ?type=info&arg[]=java-environment would return resultcount > 1 or something else?
I think b) would work for me, I will just have to verify the version afterwards with vercmp in that case.
An alpm_find_satisifier equivilent is what I want too, thing is once you get the package names from that alpm_find_satisifier equivelent what are you going to do with thoes names? Probably call "info" on all of them. So why not skip that step and just have info support it. Yes point b is what I was thinking. info("foo") would return "foo" because it matches by name, and it would also return "foo-git" because it provides "foo". Maybe it would be &type=info&by[]=provides&by[]=name rather than just "info". Point being you still get the same hunk of json that info gets you. Would your type=provides return just package names or the same stuff info does? If its the latter it's the same as what I want but under a different name.