Skip to content
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

[RHELC-1037] Auto-generate manpages #876

Merged
merged 5 commits into from
Sep 20, 2023

Conversation

Andrew-ang9
Copy link
Contributor

@Andrew-ang9 Andrew-ang9 commented Aug 4, 2023

Convert2RHEL has moved away from using optparse, and we have decided to use argparse to generate our manpages now; this PR will change this by adding in a bash script to generate the manpages using argparse, and then it will be automated using GitHub actions.

Jira Issues: RHELC-1037

Checklist

  • PR has been tested manually in a VM (either author or reviewer)
  • Jira issue has been made public if possible
  • [RHELC-] is part of the PR title
  • GitHub label has been added to help with Release notes
  • PR title explains the change from the user's point of view
  • Code and tests are documented properly
  • The commits are squashed to as few commits as possible (without losing data)
  • When merged: Jira issue has been updated to Release Pending if relevant

@codecov
Copy link

codecov bot commented Aug 4, 2023

Codecov Report

Patch and project coverage have no change.

Comparison is base (6476ef8) 94.07% compared to head (9ec4038) 94.07%.
Report is 31 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #876   +/-   ##
=======================================
  Coverage   94.07%   94.07%           
=======================================
  Files          40       40           
  Lines        3864     3864           
  Branches      695      695           
=======================================
  Hits         3635     3635           
  Misses        162      162           
  Partials       67       67           
Flag Coverage Δ
centos-linux-7 89.10% <ø> (ø)
centos-linux-8 89.72% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@r0x0d
Copy link
Member

r0x0d commented Aug 8, 2023

@Andrew-ang9, I believe you can use this https://github.com/praiskup/argparse-manpage to generate the manpages right now, this is what we used for the last release to generate the manpage, so, I think that using this project in your automation will be a good choice

@Andrew-ang9 Andrew-ang9 added kind/documentation Improvements or additions to documentation kind/feature New feature or request labels Aug 14, 2023
@Venefilyn Venefilyn changed the title [RHEL-C1037] (Draft) Auto generate manpage [RHELC-1037] (Draft) Auto generate manpage Aug 14, 2023
@Andrew-ang9 Andrew-ang9 added the tests/tier0 PR ready to run the essential test suit. Equivalent to `/packit test --labels tier0`. label Aug 21, 2023
@has-bot
Copy link
Member

has-bot commented Aug 21, 2023

/packit test --labels tier0


@oamg/conversions-qe please review results and provide ack.

scripts/manpage_generation.sh Outdated Show resolved Hide resolved
.github/workflows/release.yml Outdated Show resolved Hide resolved
Copy link
Member

@r0x0d r0x0d left a comment

Choose a reason for hiding this comment

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

Made a few comments to improve the PR.

Also, it would be good if you can test this workflow in your own fork,. creating tags/releases and seeing if this is being executed properly.

@Venefilyn Venefilyn changed the title [RHELC-1037] (Draft) Auto generate manpage [RHELC-1037] Auto-generate manpage Sep 18, 2023
@Venefilyn Venefilyn changed the title [RHELC-1037] Auto-generate manpage [RHELC-1037] Auto-generate manpages Sep 18, 2023
scripts/manpage_generation.sh Outdated Show resolved Hide resolved
@Venefilyn
Copy link
Member

Approved, lets merge and see how it looks when we run it in main

@bocekm please approve

.github/workflows/generate_manpages.yml Outdated Show resolved Hide resolved
.github/workflows/release.yml Outdated Show resolved Hide resolved
scripts/manpage_generation.sh Outdated Show resolved Hide resolved
* We are moving away from optparse and we are moving to argparse. So
  with that chaange we have to alter how we generate manpages. We now
  use git actions and a bash script to generate the manpages and add
  that to the release workflow
python -c 'from convert2rhel import toolopts; print("[synopsis]\n."+toolopts.CLI.usage())' > man/synopsis

# Generate the manpage using argparse-manpage
PYTHONPATH=. argparse-manpage --pyfile man/__init__.py --function get_parser --manual-title="General Commands Manual" --description="Automates the conversion of Red Hat Enterprise Linux derivative distributions to Red Hat Enterprise Linux." --project-name "convert2rhle $Ver" --prog="convert2rhel" --include man/distribution --include man/synopsis > "$MANPAGE_DIR/convert2rhel.8"
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
PYTHONPATH=. argparse-manpage --pyfile man/__init__.py --function get_parser --manual-title="General Commands Manual" --description="Automates the conversion of Red Hat Enterprise Linux derivative distributions to Red Hat Enterprise Linux." --project-name "convert2rhle $Ver" --prog="convert2rhel" --include man/distribution --include man/synopsis > "$MANPAGE_DIR/convert2rhel.8"
PYTHONPATH=. argparse-manpage --pyfile man/__init__.py --function get_parser --manual-title="General Commands Manual" --description="Automates the conversion of Red Hat Enterprise Linux derivative distributions to Red Hat Enterprise Linux." --project-name "convert2rhel $VER" --prog="convert2rhel" --include man/distribution --include man/synopsis > "$MANPAGE_DIR/convert2rhel.8"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have fixed this error!

python -c 'from convert2rhel import toolopts; print("[synopsis]\n."+toolopts.CLI.usage())' > man/synopsis

# Generate the manpage using argparse-manpage
PYTHONPATH=. argparse-manpage --pyfile man/__init__.py --function get_parser --manual-title="General Commands Manual" --description="Automates the conversion of Red Hat Enterprise Linux derivative distributions to Red Hat Enterprise Linux." --project-name "convert2rhel $Ver" --prog="convert2rhel" --include man/distribution --include man/synopsis > "$MANPAGE_DIR/convert2rhel.8"
Copy link
Member

Choose a reason for hiding this comment

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

Issue is still here, we need $VER not $Ver, otherwise it isn't the same as on line 6

Suggested change
PYTHONPATH=. argparse-manpage --pyfile man/__init__.py --function get_parser --manual-title="General Commands Manual" --description="Automates the conversion of Red Hat Enterprise Linux derivative distributions to Red Hat Enterprise Linux." --project-name "convert2rhel $Ver" --prog="convert2rhel" --include man/distribution --include man/synopsis > "$MANPAGE_DIR/convert2rhel.8"
PYTHONPATH=. argparse-manpage --pyfile man/__init__.py --function get_parser --manual-title="General Commands Manual" --description="Automates the conversion of Red Hat Enterprise Linux derivative distributions to Red Hat Enterprise Linux." --project-name "convert2rhel $VER" --prog="convert2rhel" --include man/distribution --include man/synopsis > "$MANPAGE_DIR/convert2rhel.8"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

whoops my apologies will fix now!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@SpyTec fixed and pushed

@Venefilyn Venefilyn merged commit 8ef55c6 into oamg:main Sep 20, 2023
12 of 16 checks passed
hosekadam pushed a commit to hosekadam/convert2rhel that referenced this pull request Oct 2, 2023
Andrew-ang9 added a commit to Andrew-ang9/convert2rhel that referenced this pull request Oct 10, 2023
@bocekm bocekm mentioned this pull request Oct 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/documentation Improvements or additions to documentation kind/feature New feature or request tests/tier0 PR ready to run the essential test suit. Equivalent to `/packit test --labels tier0`.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants