[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gentoo-dev
Subject:    Re: [gentoo-dev] How to correctly use golang-vcs with the Google API libraries?
From:       Andrew Udvare <audvare () gmail ! com>
Date:       2015-08-26 20:56:20
Message-ID: 55DE27F4.5020708 () gmail ! com
[Download RAW message or body]

On 26/08/15 12:41, William Hubbs wrote:
> On Mon, Aug 24, 2015 at 05:35:39PM -0700, Andrew Udvare wrote:
> 
> Let me know what you think about how we could automate it. I think
> we'll have to manually create the ebuilds.

It appears they either use GitHub as the official place to get the API
or it is a mirror. Either way, it is on GitHub so the API can be
utilised. This can be scripted more astutely but jq can be used against
the GitHub API (and no login is required; however unauthenticated users
have limits).

Example getting all the directories at the top level (uses app-misc/jq):

curl -H 'Accept: application/vnd.github.v3+json'
https://api.github.com/repos/google/google-api-go-client/contents/ | jq
-r '.[] | select(type="dir") | .name'

Once you have this, for each one you have to get the v1, v2, etc. I do
not know how that should work in Portage because I think it is very
likely one package would require v1 while another will require v2. This
would seem to indicate slotting.

An ugly example to generate GO_PN lines:

contents_uri='https://api.github.com/repos/google/google-api-go-client/contents/'
accept='Accept: application/vnd.github.v3+json'
pn_prefix=github.com/google/google-api-go-client/
jq_filter='.[] | select(.type=="dir") | .name')


for i in $(curl -H $accept "$contents_uri" | jq -r "$jq_filter"); do
    versions=$(curl -H $accept "${contents_uri}${i}" | jq -r "$jq_filter")
    for j in versions; do
        echo "SLOT=\"${j/v/ }\""  # Remove v prefix
        echo "GO_PN="${pn_prefix}${i}/${j}"
    done

    break # Added to not exceed the very small API limit
done

As for the actual version number for the ebuild, from the API I think
you can get the last modified date for the directory. This would be to
create a version number like some of the others: 0_pre<date>, e.g.
0_pre20150729.

Andrew

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic