Skip to content

mkhtml: Get date from git log #2100

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Jan 19, 2022
Merged

mkhtml: Get date from git log #2100

merged 12 commits into from
Jan 19, 2022

Conversation

ninsbl
Copy link
Member

@ninsbl ninsbl commented Jan 16, 2022

Trying to get the latest change and commit from gitlog.
Requires git and is not yet tested more broadly.
Please test. Feedback on HTML formating is very welcome!

@ninsbl ninsbl added enhancement New feature or request backport_needed manual Documentation related issues HTML Related code is in HTML labels Jan 16, 2022
@ninsbl ninsbl added this to the 8.0.1 milestone Jan 16, 2022
@ninsbl ninsbl requested a review from tmszi January 16, 2022 10:43
@neteler
Copy link
Member

neteler commented Jan 16, 2022

I have tested locally and get the same error as shown in the "GCC C/C++..." pipeline:

Traceback (most recent call last):
  File "/home/runner/work/grass/grass/dist.x86_64-pc-linux-gnu/utils/g.html2man.py", line 39, in main
    p.feed(line)
  File "/usr/lib/python3.8/html/parser.py", line 111, in feed
    self.goahead(0)
  File "/usr/lib/python3.8/html/parser.py", line 171, in goahead
    k = self.parse_starttag(i)
  File "/usr/lib/python3.8/html/parser.py", line 345, in parse_starttag
    self.handle_starttag(tag, attrs)
  File "/home/runner/work/grass/grass/dist.x86_64-pc-linux-gnu/utils/ghtml.py", line 281, in handle_starttag
    while not self.is_allowed(tag):
  File "/home/runner/work/grass/grass/dist.x86_64-pc-linux-gnu/utils/ghtml.py", line 277, in is_allowed
    return tag not in self.excluded and tag in allowed[self.top()]
KeyError: None

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/runner/work/grass/grass/dist.x86_64-pc-linux-gnu/utils/g.html2man.py", line 74, in <module>
    main()
  File "/home/runner/work/grass/grass/dist.x86_64-pc-linux-gnu/utils/g.html2man.py", line 43, in main
    % (infile, err.lineno, err.offset, err.msg)
AttributeError: 'KeyError' object has no attribute 'lineno'

@tmszi
Copy link
Member

tmszi commented Jan 16, 2022

Trying to get the latest change and commit from gitlog. Requires git and is not yet tested more broadly. Please test. Feedback on HTML formating is very welcome!

Great idea, I looked at your code and it required a deeper analysis of the problem, I made changes in this commit 83c3d7d and I tested it, when compiling GRASS GIS the git local repo is used to get the commit and when installing the addon (via g.extension module) it is used to get the commit remote GitHub API server.

@ninsbl
Copy link
Member Author

ninsbl commented Jan 16, 2022

Seems we worked on this in parallel. Here is my approach for Addons and modules that are not part of the official addon repo:
https://github.com/ninsbl/grass/tree/mkhtml_git_addon
Your approach seems much more thorough, though, so i just pushed it to another branch, in case there is something wort transfering...

@ninsbl
Copy link
Member Author

ninsbl commented Jan 17, 2022

Seems addons that are not part of the official repo (e.g. local unversjoned addons, addons on gitlab, bitbucket, ...) need to be handled specificly:
https://github.com/OSGeo/grass/runs/4834443370?check_suite_focus=true#step:10:157
I would suggest to have a (one) fallback solution if no commit can be identified. So, for now it should be OK to not support all possible codesharing APIs (gitlab, bitbucket, gitea, ...))...
gitlab as another major platform may be added later (?)...

@tmszi
Copy link
Member

tmszi commented Jan 17, 2022

Seems addons that are not part of the official repo (e.g. local unversjoned addons, addons on gitlab, bitbucket, ...) need to be handled specificly: https://github.com/OSGeo/grass/runs/4834443370?check_suite_focus=true#step:10:157 I would suggest to have a (one) fallback solution if no commit can be identified.

Yes you are right I fixed it.

So, for now it should be OK to not support all possible codesharing APIs (gitlab, bitbucket, gitea, ...))... gitlab as another major platform may be added later (?)...

Currently only official addons are supported, if addon is not official addon, commit and commit date in addon manual page will has unknown value.

@ninsbl
Copy link
Member Author

ninsbl commented Jan 17, 2022

Now all tests pass. Nice work, @tmszi , as usual. From my point this can be merged...

@tmszi
Copy link
Member

tmszi commented Jan 18, 2022

Now all tests pass. Nice work, @tmszi , as usual. From my point this can be merged...

I will have to test it as a simulation of compiling all add-ons running on our osgeo lxd container server.

@neteler
Copy link
Member

neteler commented Jan 18, 2022

I am +1 for merging, as patching our production system is always rather tricky...

@tmszi
Copy link
Member

tmszi commented Jan 19, 2022

If user install addons via e.g. g.extension i.sentinel proxy="http=<value>" module and use proxy to connect to internet, mkhtml.py script have to use proxy settings too (exchange value between g.extension and mkhmtl.py script via global shell variable GRASS_PROXY). I added global shell variable GRASS_PROXY with explanation among other shell variables in manual page d1437bb.

@tmszi
Copy link
Member

tmszi commented Jan 19, 2022

I successfully tested the simulation of the compilation of all add-ons on the osgeo lxd container server.

@neteler
Copy link
Member

neteler commented Jan 19, 2022

I am +1 for merging, as patching our production system is always rather tricky...

FYI: I have enforced the compilation of binaries / addons on grass.osgeo.org. Hence, the improvements through this PR should now be visible. - nonsense as it hasn't been merged :D Sorry for the confusion.

@tmszi tmszi merged commit 432ceb7 into OSGeo:main Jan 19, 2022
tmszi added a commit to tmszi/grass that referenced this pull request Jan 19, 2022
…al page (OSGeo#2100)

Git commit is getting from local repository if exists (during compilation GRASS GIS core
modules, all addons compilation on our osgeo lxd container server) in others cases getting
commit from remote GitHub API (official addons installed via g.extension module). In case it is not
possible to obtain commit from local git repository or from remote GitHub API server, instead of
commit and commit date, the time when the addon was installed is used (non official addons
installed via g.extension module).

Co-authored-by: Tomas Zigo <[email protected]>
tmszi added a commit to tmszi/grass that referenced this pull request Jan 19, 2022
…al page (OSGeo#2100)

Git commit is getting from local repository if exists (during compilation GRASS GIS core
modules, all addons compilation on our osgeo lxd container server) in others cases getting
commit from remote GitHub API (official addons installed via g.extension module). In case it is not
possible to obtain commit from local git repository or from remote GitHub API server, instead of
commit and commit date, the time when the addon was installed is used (non official addons
installed via g.extension module).

Co-authored-by: Tomas Zigo <[email protected]>
@tmszi
Copy link
Member

tmszi commented Jan 19, 2022

I am +1 for merging, as patching our production system is always rather tricky...

FYI: I have enforced the compilation of binaries / addons on grass.osgeo.org. Hence, the improvements through this PR should now be visible. - nonsense as it hasn't been merged :D Sorry for the confusion.

It's already merged.

@wenzeslaus
Copy link
Member

Similarly to another change in the past, the straight backport of this breaks Travis CI because that one builds with old Python. See the old discussion here: #2070.

VERSION_NUMBER=7.8.7dev VERSION_DATE=2022 MODULE_TOPDIR=../.. \
        python3 /home/travis/build/OSGeo/grass/dist.x86_64-pc-linux-gnu/tools/mkhtml.py cairodriver > /home/travis/build/OSGeo/grass/dist.x86_64-pc-linux-gnu/docs/html/cairodriver.html
  File "/home/travis/build/OSGeo/grass/dist.x86_64-pc-linux-gnu/tools/mkhtml.py", line 74
    addons_url = f"https://github.com/OSGeo/grass-addons/tree/grass{major}/"
                                                                           ^
SyntaxError: invalid syntax

@tmszi
Copy link
Member

tmszi commented Jan 19, 2022

Similarly to another change in the past, the straight backport of this breaks Travis CI because that one builds with old Python. See the old discussion here: #2070.

VERSION_NUMBER=7.8.7dev VERSION_DATE=2022 MODULE_TOPDIR=../.. \
        python3 /home/travis/build/OSGeo/grass/dist.x86_64-pc-linux-gnu/tools/mkhtml.py cairodriver > /home/travis/build/OSGeo/grass/dist.x86_64-pc-linux-gnu/docs/html/cairodriver.html
  File "/home/travis/build/OSGeo/grass/dist.x86_64-pc-linux-gnu/tools/mkhtml.py", line 74
    addons_url = f"https://github.com/OSGeo/grass-addons/tree/grass{major}/"
                                                                           ^
SyntaxError: invalid syntax

My mistake that originate during git cherry-picking.

@tmszi
Copy link
Member

tmszi commented Jan 19, 2022

@neteler Before testing on the osgeo server, I still need to merge these two PRs #2110 #2111.

neteler added a commit to OSGeo/grass-addons that referenced this pull request Feb 2, 2022
* Addon manual pages: remove unneeded SVN Date entry

- remove already commented and unneeded SVN Date entries from all manual relate pages
- selectively update section order to follow https://trac.osgeo.org/grass/wiki/Submitting/Docs#HTMLPages

Note: This change brings in the disadvantage that *all* manual pages are touched in terms of editing date, which influences the recent PR OSGeo/grass#2100 and the `g.citation` efforts ongoing in #677. On the other hand, it needs to be done one day...

See
- discussion in #684 (comment)
- in GRASS-core, see OSGeo/grass#2143

Co-authored-by: Veronica Andreo <[email protected]>
IvanMarchesini pushed a commit to IvanMarchesini/grass-addons that referenced this pull request Feb 24, 2022
* Addon manual pages: remove unneeded SVN Date entry

- remove already commented and unneeded SVN Date entries from all manual relate pages
- selectively update section order to follow https://trac.osgeo.org/grass/wiki/Submitting/Docs#HTMLPages

Note: This change brings in the disadvantage that *all* manual pages are touched in terms of editing date, which influences the recent PR OSGeo/grass#2100 and the `g.citation` efforts ongoing in OSGeo#677. On the other hand, it needs to be done one day...

See
- discussion in OSGeo#684 (comment)
- in GRASS-core, see OSGeo/grass#2143

Co-authored-by: Veronica Andreo <[email protected]>
@wenzeslaus wenzeslaus changed the title mkhtml.py: get date from gitlog mkhtml: Get date from git log Apr 27, 2022
ninsbl added a commit to ninsbl/grass that referenced this pull request Oct 26, 2022
…al page (OSGeo#2100)

Git commit is getting from local repository if exists (during compilation GRASS GIS core
modules, all addons compilation on our osgeo lxd container server) in others cases getting 
commit from remote GitHub API (official addons installed via g.extension module). In case it is not 
possible to obtain commit from local git repository or from remote GitHub API server, instead of 
commit and commit date, the time when the addon was installed is used (non official addons
installed via g.extension module).

Co-authored-by: Tomas Zigo <[email protected]>
ninsbl added a commit to ninsbl/grass that referenced this pull request Feb 17, 2023
…al page (OSGeo#2100)

Git commit is getting from local repository if exists (during compilation GRASS GIS core
modules, all addons compilation on our osgeo lxd container server) in others cases getting 
commit from remote GitHub API (official addons installed via g.extension module). In case it is not 
possible to obtain commit from local git repository or from remote GitHub API server, instead of 
commit and commit date, the time when the addon was installed is used (non official addons
installed via g.extension module).

Co-authored-by: Tomas Zigo <[email protected]>
neteler pushed a commit to nilason/grass that referenced this pull request Nov 7, 2023
…al page (OSGeo#2100)

Git commit is getting from local repository if exists (during compilation GRASS GIS core
modules, all addons compilation on our osgeo lxd container server) in others cases getting 
commit from remote GitHub API (official addons installed via g.extension module). In case it is not 
possible to obtain commit from local git repository or from remote GitHub API server, instead of 
commit and commit date, the time when the addon was installed is used (non official addons
installed via g.extension module).

Co-authored-by: Tomas Zigo <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request HTML Related code is in HTML manual Documentation related issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants