api.opensuse.org: How to GET the list of users (along with their roles) of any given package?
Hello, I would like to perform the API action described in the topic above, ideally in a single request. Is that feasible? Thanks in advance, Adrien
Hi Adrien, "Adrien Glauser" <nycticorax@opensuse.org> writes:
Hello,
I would like to perform the API action described in the topic above, ideally in a single request. Is that feasible?
As far as I am aware, you'll need to perform two requests: GET /source/$proj/$pkg/_meta GET /source/$proj/_meta and extract the users from the `<person>` elements in the `<project>` or `<package>` elements. This will not give you the roles inherited via groups though. If you want to also get the roles inherited via groups, then it'll become a bit more complex, as you'll have to GET `/group/$group_id` for each group that is listed. Hope this helps, Dan -- Dan Čermák <dcermak@suse.com> Software Engineer Development tools SUSE Software Solutions Germany GmbH Maxfeldstr. 5 90409 Nuremberg Germany (HRB 36809, AG Nürnberg) Managing Director: Felix Imendörffer
Hi Dan, Thanks very much for you answer! GET-ting '/source/<project>/<package>/_meta' & '/source/<project>/_meta' is what I am doing already, with little success since as far as I can as few packages under the openSUSE:Factory project declare <person> entries (or at least: such entries didn't show up in response to '/source/<project>/<package>/_meta') Now the rest of your reply makes me wonder: if some/most factory packages don't declare users, does it simply mean that their users are just inherited from groups, such as 'factory-maintainers'? If so, is it correct to say that if I want to aggregate the list of: - <person userid> entries corresponding to the set of people who are in charge of (maintaining / contributing to) openSUSE:Factory package X, for any X , I can simply concatenate: 1) the list of <person userid> returned from '/source/openSUSE:Factory/<package>'; with 2) the list of <person userid> returned from '/group/<group known to be the one in charge of the project to which <package> in the previous command belongs>'? Best, Adrien Le 13/09/2021 à 09:16, Dan Čermák a écrit :
Hi Adrien,
"Adrien Glauser" <nycticorax@opensuse.org> writes:
Hello,
I would like to perform the API action described in the topic above, ideally in a single request. Is that feasible?
As far as I am aware, you'll need to perform two requests:
GET /source/$proj/$pkg/_meta GET /source/$proj/_meta
and extract the users from the `<person>` elements in the `<project>` or `<package>` elements. This will not give you the roles inherited via groups though. If you want to also get the roles inherited via groups, then it'll become a bit more complex, as you'll have to GET `/group/$group_id` for each group that is listed.
Hope this helps,
Dan
Hi Adrien, Adrien Glauser <adrien.glauser@gmail.com> writes:
Hi Dan,
Thanks very much for you answer! GET-ting '/source/<project>/<package>/_meta' & '/source/<project>/_meta' is what I am doing already, with little success since as far as I can as few packages under the openSUSE:Factory project declare <person> entries (or at least: such entries didn't show up in response to '/source/<project>/<package>/_meta')
Yes, that's a caveat with Factory: packages in here generally don't a maintainer or bugowner set.
Now the rest of your reply makes me wonder: if some/most factory packages don't declare users, does it simply mean that their users are just inherited from groups, such as 'factory-maintainers'?
No, the maintainer/bugowner is taken from the respective development project. Unfortunately, I don't know how to query the development project of a package via the API. The issue here is that the development package is a link to Factory. Figuring out where a link points to is rather simple, no idea how to go the other way around though.
If so, is it correct to say that if I want to aggregate the list of: - <person userid> entries corresponding to the set of people who are in charge of (maintaining / contributing to) openSUSE:Factory package X, for any X
, I can simply concatenate:
1) the list of <person userid> returned from '/source/openSUSE:Factory/<package>'; with
2) the list of <person userid> returned from '/group/<group known to be the one in charge of the project to which <package> in the previous command belongs>'?
Sadly no. You have to do that for the package in the devel project, but unfortunately I don't know of the top of my head how to find that one. Cheers, Dan -- Dan Čermák <dcermak@suse.com> Software Engineer Development tools SUSE Software Solutions Germany GmbH Maxfeldstr. 5 90409 Nuremberg Germany (HRB 36809, AG Nürnberg) Managing Director: Felix Imendörffer
On Sep 13 2021, Dan Čermák wrote:
No, the maintainer/bugowner is taken from the respective development project. Unfortunately, I don't know how to query the development project of a package via the API.
It's part of the meta (<devel> element). Andreas. -- Andreas Schwab, schwab@linux-m68k.org GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1 "And now for something completely different."
Dear Dan, Andreas & others, Let me test my understanding of the picture that emerges from what you guys said. For any package <Pack> under *openSUSE:Factory*, I can get the entire set of <person userid> entries answering to the concept *the maintainers and packagers of <Pack>* if I do: 1. `/source/openSUSE:Factory/<Pack>/_meta`, where I extract the attribute $Proj from the entry <devel project=$Proj>; and then 2. `/source/<Proj>/_meta, where I extract the <person userid> entries Is that correct? If yes, it that also complete? In other words, am I missing any <person userid> that should also be included for the result to qualify as *the maintainers and packagers of <Pack>*? If that is not the case, regardless of the actual requests, just for my understanding of how we are structured, what are the contexts I should aggregate from in order to capture exactly the notion of *the maintainers and packagers of <Pack>*, for any <Pack> available to Tumbleweed? Best and thanks, Adrien Le 13/09/2021 à 11:40, Dan Čermák a écrit :
Hi Adrien,
Adrien Glauser <adrien.glauser@gmail.com> writes:
Hi Dan,
Thanks very much for you answer! GET-ting '/source/<project>/<package>/_meta' & '/source/<project>/_meta' is what I am doing already, with little success since as far as I can as few packages under the openSUSE:Factory project declare <person> entries (or at least: such entries didn't show up in response to '/source/<project>/<package>/_meta')
Yes, that's a caveat with Factory: packages in here generally don't a maintainer or bugowner set.
Now the rest of your reply makes me wonder: if some/most factory packages don't declare users, does it simply mean that their users are just inherited from groups, such as 'factory-maintainers'?
No, the maintainer/bugowner is taken from the respective development project. Unfortunately, I don't know how to query the development project of a package via the API. The issue here is that the development package is a link to Factory. Figuring out where a link points to is rather simple, no idea how to go the other way around though.
If so, is it correct to say that if I want to aggregate the list of: - <person userid> entries corresponding to the set of people who are in charge of (maintaining / contributing to) openSUSE:Factory package X, for any X
, I can simply concatenate:
1) the list of <person userid> returned from '/source/openSUSE:Factory/<package>'; with
2) the list of <person userid> returned from '/group/<group known to be the one in charge of the project to which <package> in the previous command belongs>'?
Sadly no. You have to do that for the package in the devel project, but unfortunately I don't know of the top of my head how to find that one.
Cheers,
Dan
On Sep 13 2021, Adrien Glauser wrote:
1. `/source/openSUSE:Factory/<Pack>/_meta`, where I extract the attribute $Proj from the entry <devel project=$Proj>; and then 2. `/source/<Proj>/_meta, where I extract the <person userid> entries
2. /source/<Proj>/<Pack>/_meta 3. /source/<Proj>/_meta, if (2) doesn't have an entry for a role. Andreas. -- Andreas Schwab, schwab@linux-m68k.org GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1 "And now for something completely different."
Great, thanks! Le 13/09/2021 à 19:59, Andreas Schwab a écrit :
On Sep 13 2021, Adrien Glauser wrote:
1. `/source/openSUSE:Factory/<Pack>/_meta`, where I extract the attribute $Proj from the entry <devel project=$Proj>; and then 2. `/source/<Proj>/_meta, where I extract the <person userid> entries
2. /source/<Proj>/<Pack>/_meta 3. /source/<Proj>/_meta, if (2) doesn't have an entry for a role.
Andreas.
On 2021-09-13 19:59:06 +0200, Andreas Schwab wrote:
On Sep 13 2021, Adrien Glauser wrote:
1. `/source/openSUSE:Factory/<Pack>/_meta`, where I extract the attribute $Proj from the entry <devel project=$Proj>; and then 2. `/source/<Proj>/_meta, where I extract the <person userid> entries
2. /source/<Proj>/<Pack>/_meta
Strictly speaking, one should use the value of the "package" attribute of the "devel" element instead of "Pack". (But as Adrian already said, the owner API is probably the way to go...) Marcus
Hey, On 13.09.21 18:19, Adrien Glauser wrote:
For any package <Pack> under *openSUSE:Factory*, I can get the entire set of <person userid> entries answering to the concept *the maintainers and packagers of <Pack>* if I do: 1. `/source/openSUSE:Factory/<Pack>/_meta`, where I extract the attribute $Proj from the entry <devel project=$Proj>; and then 2. `/source/<Proj>/_meta, where I extract the <person userid> entries
3. `/group/<Group>` where you expand the <group groupid> entries from above which contain <person userids> BTW you can also look at what osc does with the API osc -H maintainer openSUSE:Factory 4store|grep send Henne -- Henne Vogelsang http://www.opensuse.org Everybody has a plan, until they get hit. - Mike Tyson
On Montag, 13. September 2021, 21:41:22 CEST Henne Vogelsang wrote:
Hey,
On 13.09.21 18:19, Adrien Glauser wrote:
For any package <Pack> under *openSUSE:Factory*, I can get the entire set of <person userid> entries answering to the concept *the maintainers and packagers of <Pack>* if I do: 1. `/source/openSUSE:Factory/<Pack>/_meta`, where I extract the attribute $Proj from the entry <devel project=$Proj>; and then 2. `/source/<Proj>/_meta, where I extract the <person userid> entries
3. `/group/<Group>` where you expand the <group groupid> entries from above which contain <person userids>
BTW you can also look at what osc does with the API
osc -H maintainer openSUSE:Factory 4store|grep send
please do not try to emulate obs code, it may work in some cases, but there can be different configs in the OBS instances which leads to different results. For owner search use the owner search I mentioned this morning already. Emulating via multiple api queries instead and trying to rebuild the server side logic will always leave wrong cases. -- Adrian Schroeter <adrian@suse.de> Build Infrastructure Project Manager SUSE Software Solutions Germany GmbH, Maxfeldstr. 5, 90409 Nuernberg, Germany (HRB 247165, AG München), Geschäftsführer: Felix Imendörffer
Hello Adrien, On Mon, 2021-09-13 at 07:03 +0000, Adrien Glauser wrote:
Hello,
I would like to perform the API action described in the topic above, ideally in a single request. Is that feasible?
Have you looked at the /search/owner [1] API? I'm not an expert and I'm not very sure of what you are looking for, but here's an example: $ osc -A OBS api "/search/owner?binary=glibc&project=openSUSE:Leap:15.3" <collection> <owner rootproject="openSUSE:Leap:15.3" project="SUSE:SLE-15:Update"> <person name="jumper-bot" role="maintainer"/> <group name="ibs-maintenance-team" role="maintainer"/> </owner> </collection> The webui seems to be making more internal (webui specific) calls to identify if the user and roles are inherited from the project or not. I'm not sure if the same can be queried directly from the API. The `osc maintainer` command seems to be following the same flow that Dan mentioned. Regards, Srinidhi. [1] https://build.opensuse.org/apidocs/index#149
participants (8)
-
Adrian Schröter
-
Adrien Glauser
-
Adrien Glauser
-
Andreas Schwab
-
Dan Čermák
-
Henne Vogelsang
-
Marcus Hüwe
-
Srinidhi B