Skip to content

g.extension: allow to install extensions from a fork of the official repo#1177

Merged
ninsbl merged 1 commit into
OSGeo:masterfrom
ninsbl:g_extension_official_fork
Feb 2, 2021
Merged

g.extension: allow to install extensions from a fork of the official repo#1177
ninsbl merged 1 commit into
OSGeo:masterfrom
ninsbl:g_extension_official_fork

Conversation

@ninsbl

@ninsbl ninsbl commented Dec 15, 2020

Copy link
Copy Markdown
Member

This PR adds an o-flag to specify that the url points to a fork of the official repo. In combination with the branch option, this allows easy testing of changes in addons by others...

See #625

@ninsbl ninsbl added the enhancement New feature or request label Dec 15, 2020
@ninsbl ninsbl added this to the 8.0.0 milestone Dec 15, 2020
@ninsbl ninsbl requested a review from tmszi December 15, 2020 09:16

@tmszi tmszi left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work, I tested it and it works fine.

@ninsbl

ninsbl commented Dec 15, 2020

Copy link
Copy Markdown
Member Author

Thanks @tmszi for reviewing.

It is not necessary to define the relationship between the url and the branch option. Branch option has default answer main.

Yes. That is right. However, as it is right now, the branch option will be ignored if no url is given...
The official addon repository currently does not really have branches anyway (in contrast to feature branches in forks).

In the long run and for GRASS 8 we should probably aim at throwing out SVN and use the github/gitlab API to fetch addons (esp. as we already started using it for branches)...

Something along this lines:

curl https://api.github.com/repos/ninsbl/grass-addons/contents/grass7/imagery/i.sentinel/i.sentinel.import

This results in the following response (with a download URL for every file (folders have null)):

[
  {
    "name": "Makefile",
    "path": "grass7/imagery/i.sentinel/i.sentinel.import/Makefile",
    "sha": "50dfe89f5ecbd917b2e2d9019cf42bc55a4b23a0",
    "size": 115,
    "url": "https://api.github.com/repos/ninsbl/grass-addons/contents/grass7/imagery/i.sentinel/i.sentinel.import/Makefile?ref=master",
    "html_url": "https://github.com/ninsbl/grass-addons/blob/master/grass7/imagery/i.sentinel/i.sentinel.import/Makefile",
    "git_url": "https://api.github.com/repos/ninsbl/grass-addons/git/blobs/50dfe89f5ecbd917b2e2d9019cf42bc55a4b23a0",
    "download_url": "https://raw.githubusercontent.com/ninsbl/grass-addons/master/grass7/imagery/i.sentinel/i.sentinel.import/Makefile",
    "type": "file",
    "_links": {
      "self": "https://api.github.com/repos/ninsbl/grass-addons/contents/grass7/imagery/i.sentinel/i.sentinel.import/Makefile?ref=master",
      "git": "https://api.github.com/repos/ninsbl/grass-addons/git/blobs/50dfe89f5ecbd917b2e2d9019cf42bc55a4b23a0",
      "html": "https://github.com/ninsbl/grass-addons/blob/master/grass7/imagery/i.sentinel/i.sentinel.import/Makefile"
    }
  },
  {
    "name": "i.sentinel.import.html",
    "path": "grass7/imagery/i.sentinel/i.sentinel.import/i.sentinel.import.html",
    "sha": "e0e3826fb48c721523643144608799fb575e4f6d",
    "size": 8244,
    "url": "https://api.github.com/repos/ninsbl/grass-addons/contents/grass7/imagery/i.sentinel/i.sentinel.import/i.sentinel.import.html?ref=master",
    "html_url": "https://github.com/ninsbl/grass-addons/blob/master/grass7/imagery/i.sentinel/i.sentinel.import/i.sentinel.import.html",
    "git_url": "https://api.github.com/repos/ninsbl/grass-addons/git/blobs/e0e3826fb48c721523643144608799fb575e4f6d",
    "download_url": "https://raw.githubusercontent.com/ninsbl/grass-addons/master/grass7/imagery/i.sentinel/i.sentinel.import/i.sentinel.import.html",
    "type": "file",
    "_links": {
      "self": "https://api.github.com/repos/ninsbl/grass-addons/contents/grass7/imagery/i.sentinel/i.sentinel.import/i.sentinel.import.html?ref=master",
      "git": "https://api.github.com/repos/ninsbl/grass-addons/git/blobs/e0e3826fb48c721523643144608799fb575e4f6d",
      "html": "https://github.com/ninsbl/grass-addons/blob/master/grass7/imagery/i.sentinel/i.sentinel.import/i.sentinel.import.html"
    }
  },

But that is a different PR and more work...

@tmszi

tmszi commented Dec 15, 2020

Copy link
Copy Markdown
Member

Thanks @tmszi for reviewing.

You are welcome.

It is not necessary to define the relationship between the url and the branch option. Branch option has default answer main.

Yes. That is right. However, as it is right now, the branch option will be ignored if no url is given...
The official addon repository currently does not really have branches anyway (in contrast to feature branches in forks).

Yes, you're right.

In the long run and for GRASS 8 we should probably aim at throwing out SVN and use the github/gitlab API to fetch addons (esp. as we already started using it for branches)...

We can use it, but the problem is that you need to download each file separately, number of files == number of requests/responses. It would be better if GitHub API had one REST endpoint to download any repository directory as an archive (zip or another format) with one request/response. I haven't found that yet. My opinion is that it will therefore be better to continue to use svn checkout.

@ninsbl ninsbl merged commit 4140ebd into OSGeo:master Feb 2, 2021
marisn pushed a commit to marisn/grass that referenced this pull request Mar 22, 2021
ninsbl added a commit to ninsbl/grass that referenced this pull request Oct 26, 2022
ninsbl added a commit to ninsbl/grass that referenced this pull request Feb 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants