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

backport: Merge bitcoin/bitcoin#24263: doc: Fix gen-manpages, rewrite in Python #6555

Merged
merged 1 commit into from
Feb 4, 2025

Conversation

knst
Copy link
Collaborator

@knst knst commented Feb 4, 2025

Issue being fixed or feature implemented

gen-pages.sh doesn't work correctly for dash-cli, it removes all hyphens somehow:

 .IP
 Set a whitelist to filter incoming RPC calls for a specific user. The
 field <whitelist> comes in the format: <USERNAME>:<rpc 1>,<rpc
 2>,...,<rpc n>. If multiple whitelists are set for a given user,
-they are set\-intersected. See \fB\-rpcwhitelistdefault\fR documentation
+they are setintersected. See \fBrpcwhitelistdefault\fR documentation
 for information on default whitelist behavior.
 .HP

What was done?

Rewrite the manual page generation script in Python.

This:

Also change the release process to swap gen-manpages and update RC steps, so that the pages will have the correct rc and/or final version.

How Has This Been Tested?

Produced correct documents for Dash Core v22.1: #6554

Breaking Changes

N/A

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated relevant unit/integration/functional/e2e tests
  • I have made corresponding changes to the documentation
  • I have assigned this pull request to a milestone (for repository code-owners and collaborators only)

87f5406 doc: Swap gen-manpages and update RC steps in release process (laanwj)
42c2028 doc: Fix gen-manpages, rewrite in Python (laanwj)

Pull request description:

  Rewrite the manual page generation script in Python.

  This:
  - solves '-' stripping issue (fixes bitcoin#22681)
  - makes that a copyright footer is generated correctly again

  Also change the release process to swap gen-manpages and update RC steps, so that the pages will have the correct rc and/or final version.

ACKs for top commit:
  dongcarl:
    Code Review ACK 87f5406
  fanquake:
    ACK 87f5406 - tested generating and opening the man pages locally, but didn't run through the release process. Will propose some changes to address consolidating the help / version output.

Tree-SHA512: 39254721ca84e4f223a321c554f2e08c36428b15019a0f9fa3eff408b4c6f1e1d74941143f4d2927427afa3ad7a7e6f999d6ec660132d817809b640a87ae9f7d
@knst knst added this to the 23 milestone Feb 4, 2025
Copy link

coderabbitai bot commented Feb 4, 2025

Walkthrough

The pull request transitions the manpage generation tool from a Bash script to a Python implementation. The new Python script, gen-manpages.py, has been added to the contrib/devtools directory and includes functionality to validate binaries, retrieve version information, and generate manpages using the help2man utility. Consequently, documentation in contrib/devtools/README.md has been updated to reference the new script. Additionally, the release process documentation (doc/release-process.md) has been modified to instruct users to regenerate the manpages with the Python script after rebuilding the binaries. The original Bash script (gen-manpages.sh) has been removed, and its references updated, marking a shift in the tooling from shell to Python without altering the core process of manpage generation.

Tip

🌐 Web search-backed reviews and chat
  • We have enabled web search-based reviews and chat for all users. This feature allows CodeRabbit to access the latest documentation and information on the web.
  • You can disable this feature by setting web_search: false in the knowledge_base settings.
  • Please share any feedback in the Discord discussion.
✨ Finishing Touches
  • 📝 Generate Docstrings (Beta)

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (6)
contrib/devtools/gen-manpages.py (6)

2-4: Update the copyright notice to include Dash developers.

Since this is a backported script in the Dash repository, consider adding Dash developers to the copyright notice.

-# Copyright (c) 2022 The Bitcoin Core developers
+# Copyright (c) 2022 The Bitcoin Core developers
+# Copyright (c) 2024 The Dash Core developers

10-17: Clarify the commented-out binary entry.

The src/dash-util binary is commented out. If it's not needed, consider removing the line entirely. If it will be needed in the future, add a comment explaining why it's commented out.

-#'src/dash-util',

24-27: Improve error handling for Git command.

The Git command could fail if not in a Git repository or if Git is not installed. Consider adding proper error handling.

-    r = subprocess.run([git, 'rev-parse', '--show-toplevel'], stdout=subprocess.PIPE, check=True, universal_newlines=True)
-    topdir = r.stdout.rstrip()
+    try:
+        r = subprocess.run([git, 'rev-parse', '--show-toplevel'], stdout=subprocess.PIPE, stderr=subprocess.PIPE, check=True, universal_newlines=True)
+        topdir = r.stdout.rstrip()
+    except subprocess.CalledProcessError as e:
+        print(f"Error: Failed to determine top directory using git: {e.stderr}", file=sys.stderr)
+        sys.exit(1)

45-48: Make version string validation more robust.

The version string parsing assumes a specific format. Consider making it more flexible to handle different version string formats.

-    verstr = verstr.split()[-1]
-    assert verstr.startswith('v')
+    verstr = verstr.split()[-1]
+    if not verstr.startswith('v'):
+        print(f"Error: Version string '{verstr}' from {abspath} does not start with 'v'", file=sys.stderr)
+        sys.exit(1)

50-53: Improve copyright extraction robustness.

The copyright extraction assumes dash-qt will always output a copyright message in a specific format. Consider adding validation and error handling.

     if relpath == 'src/qt/dash-qt':
+        if len(r.stdout.split('\n')) < 2:
+            print(f"Error: Could not extract copyright information from {abspath}", file=sys.stderr)
+            sys.exit(1)
         copyright = r.stdout.split('\n')[1:]

69-73: Verify help2man availability before use.

Consider checking if help2man is available before attempting to generate manual pages.

+    # Verify help2man is available
+    try:
+        subprocess.run([help2man, '--version'], stdout=subprocess.PIPE, stderr=subprocess.PIPE, check=True)
+    except (subprocess.CalledProcessError, FileNotFoundError):
+        print("Error: help2man is not available. Please install help2man.", file=sys.stderr)
+        sys.exit(1)
+
     # Call the binaries through help2man to produce a manual page for each of them.
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a3d6db6 and 69b1328.

📒 Files selected for processing (4)
  • contrib/devtools/README.md (2 hunks)
  • contrib/devtools/gen-manpages.py (1 hunks)
  • contrib/devtools/gen-manpages.sh (0 hunks)
  • doc/release-process.md (1 hunks)
💤 Files with no reviewable changes (1)
  • contrib/devtools/gen-manpages.sh
✅ Files skipped from review due to trivial changes (2)
  • contrib/devtools/README.md
  • doc/release-process.md
⏰ Context from checks skipped due to timeout of 90000ms (8)
  • GitHub Check: Build (linux64_ubsan, x86_64-pc-linux-gnu, linux64)
  • GitHub Check: Build (linux64_tsan, x86_64-pc-linux-gnu, linux64)
  • GitHub Check: Build (linux64_sqlite, x86_64-pc-linux-gnu, linux64)
  • GitHub Check: Build (linux64_nowallet, x86_64-pc-linux-gnu, linux64)
  • GitHub Check: Build (linux64_fuzz, x86_64-pc-linux-gnu, linux64)
  • GitHub Check: Build (linux64_cxx20, x86_64-pc-linux-gnu, linux64)
  • GitHub Check: Build (linux64, x86_64-pc-linux-gnu, linux64)
  • GitHub Check: Build (arm-linux, arm-linux-gnueabihf, arm-linux)
🔇 Additional comments (1)
contrib/devtools/gen-manpages.py (1)

56-60: LGTM! Clear and helpful warning message.

The warning about dirty tree builds is well-implemented and provides clear instructions for resolution.

@knst knst mentioned this pull request Feb 4, 2025
5 tasks
Copy link
Member

@PastaPastaPasta PastaPastaPasta left a comment

Choose a reason for hiding this comment

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

utACK 69b1328; looks correct

Copy link

@UdjinM6 UdjinM6 left a comment

Choose a reason for hiding this comment

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

utACK 69b1328

PastaPastaPasta added a commit that referenced this pull request Feb 4, 2025
ff785ed docs: update man pages for 22.1 (Konstantin Akimov)

Pull request description:

  ## Issue being fixed or feature implemented
  #6551

  ## What was done?
  Updated man pages by new script `contrib/devtools/gen-manpages.py` see #6555

  ## How Has This Been Tested?
  N/A

  ## Breaking Changes
  N/A

  ## Checklist:
  - [ ] I have performed a self-review of my own code
  - [ ] I have commented my code, particularly in hard-to-understand areas
  - [ ] I have added or updated relevant unit/integration/functional/e2e tests
  - [ ] I have made corresponding changes to the documentation
  - [x] I have assigned this pull request to a milestone _(for repository code-owners and collaborators only)_

ACKs for top commit:
  PastaPastaPasta:
    utACK ff785ed; diff looks good
  UdjinM6:
    utACK ff785ed

Tree-SHA512: 60a81c880e6ff824fc661dc6c6da20d85aa662fe228f7080dcb8c47db69c88adc30a40ab84832d83994ab56a26ed1de4d800dd45cd282c61233fde2d4e2212b7
@UdjinM6 UdjinM6 modified the milestones: 23, 22.1 Feb 4, 2025
Copy link
Collaborator

@kwvg kwvg left a comment

Choose a reason for hiding this comment

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

utACK 69b1328

@PastaPastaPasta PastaPastaPasta merged commit 21fb709 into dashpay:develop Feb 4, 2025
21 of 22 checks passed
PastaPastaPasta added a commit to PastaPastaPasta/dash that referenced this pull request Feb 4, 2025
ff785ed docs: update man pages for 22.1 (Konstantin Akimov)

Pull request description:

  ## Issue being fixed or feature implemented
  dashpay#6551

  ## What was done?
  Updated man pages by new script `contrib/devtools/gen-manpages.py` see dashpay#6555

  ## How Has This Been Tested?
  N/A

  ## Breaking Changes
  N/A

  ## Checklist:
  - [ ] I have performed a self-review of my own code
  - [ ] I have commented my code, particularly in hard-to-understand areas
  - [ ] I have added or updated relevant unit/integration/functional/e2e tests
  - [ ] I have made corresponding changes to the documentation
  - [x] I have assigned this pull request to a milestone _(for repository code-owners and collaborators only)_

ACKs for top commit:
  PastaPastaPasta:
    utACK ff785ed; diff looks good
  UdjinM6:
    utACK ff785ed

Tree-SHA512: 60a81c880e6ff824fc661dc6c6da20d85aa662fe228f7080dcb8c47db69c88adc30a40ab84832d83994ab56a26ed1de4d800dd45cd282c61233fde2d4e2212b7
PastaPastaPasta added a commit to PastaPastaPasta/dash that referenced this pull request Feb 4, 2025
…ges, rewrite in Python

69b1328 Merge bitcoin#24263: doc: Fix gen-manpages, rewrite in Python (fanquake)

Pull request description:

  ## Issue being fixed or feature implemented
  gen-pages.sh doesn't work correctly for `dash-cli`, it removes all hyphens somehow:
  ```diff
   .IP
   Set a whitelist to filter incoming RPC calls for a specific user. The
   field <whitelist> comes in the format: <USERNAME>:<rpc 1>,<rpc
   2>,...,<rpc n>. If multiple whitelists are set for a given user,
  -they are set\-intersected. See \fB\-rpcwhitelistdefault\fR documentation
  +they are setintersected. See \fBrpcwhitelistdefault\fR documentation
   for information on default whitelist behavior.
   .HP
  ```

  ## What was done?
   - backport  bitcoin#24263

   Rewrite the manual page generation script in Python.

    This:
    - solves '-' stripping issue (fixes bitcoin#22681)
    - makes that a copyright footer is generated correctly again

    Also change the release process to swap gen-manpages and update RC steps, so that the pages will have the correct rc and/or final version.

  ## How Has This Been Tested?
  Produced correct documents for Dash Core v22.1: dashpay#6554

  ## Breaking Changes
  N/A

  ## Checklist:
  - [x] I have performed a self-review of my own code
  - [ ] I have commented my code, particularly in hard-to-understand areas
  - [ ] I have added or updated relevant unit/integration/functional/e2e tests
  - [ ] I have made corresponding changes to the documentation
  - [x] I have assigned this pull request to a milestone _(for repository code-owners and collaborators only)_

ACKs for top commit:
  PastaPastaPasta:
    utACK 69b1328; looks correct
  UdjinM6:
    utACK 69b1328
  kwvg:
    utACK 69b1328

Tree-SHA512: 01a7a9a8a4ba762e6ff36035a3fb554d998232d62da8c3441b12741e6a3b626c01c581c1ff3f6aa3dcac02e15d62eec7f2a7f94be9399895557cd0a7115424a7
PastaPastaPasta added a commit that referenced this pull request Feb 4, 2025
e62b4eb Merge #6555: backport: Merge bitcoin#24263: doc: Fix gen-manpages, rewrite in Python (pasta)
53d0ff1 Merge #6552: docs: update supported versions in SECURITY.md (pasta)
4571d89 Merge #6554: docs: update man pages for 22.1 (pasta)
bc91a83 Merge #6553: chore: bump assume valid / checkpoints for v22.1 (pasta)

Pull request description:

  ## Issue being fixed or feature implemented
  Backports from develop to 22.1

  ## What was done?

  ## How Has This Been Tested?

  ## Breaking Changes

  ## Checklist:
    _Go over all the following points, and put an `x` in all the boxes that apply._
  - [ ] I have performed a self-review of my own code
  - [ ] I have commented my code, particularly in hard-to-understand areas
  - [ ] I have added or updated relevant unit/integration/functional/e2e tests
  - [ ] I have made corresponding changes to the documentation
  - [x] I have assigned this pull request to a milestone _(for repository code-owners and collaborators only)_

ACKs for top commit:
  UdjinM6:
    utACK e62b4eb

Tree-SHA512: 9f88c1a77ec1adc453b023b764f91760e13064c86d109c29bb7856f2588c6450e518c9479f8c3e245f7eeaf5ef6d28aa85f00b4b5e94ef5a4d80cb5b3d7fdff2
@knst knst deleted the fix-manpages-24263 branch February 5, 2025 17:21
PastaPastaPasta added a commit that referenced this pull request Feb 11, 2025
774a018 chore: set release to true (pasta)
e62b4eb Merge #6555: backport: Merge bitcoin#24263: doc: Fix gen-manpages, rewrite in Python (pasta)
53d0ff1 Merge #6552: docs: update supported versions in SECURITY.md (pasta)
4571d89 Merge #6554: docs: update man pages for 22.1 (pasta)
bc91a83 Merge #6553: chore: bump assume valid / checkpoints for v22.1 (pasta)
c11ec40 docs: add release notes for 22.1.0 (pasta)

Pull request description:

  ## Issue being fixed or feature implemented
  Manually suppressed configure.ac changes

  ## What was done?

  ## How Has This Been Tested?

  ## Breaking Changes

  ## Checklist:
    _Go over all the following points, and put an `x` in all the boxes that apply._
  - [ ] I have performed a self-review of my own code
  - [ ] I have commented my code, particularly in hard-to-understand areas
  - [ ] I have added or updated relevant unit/integration/functional/e2e tests
  - [ ] I have made corresponding changes to the documentation
  - [x] I have assigned this pull request to a milestone _(for repository code-owners and collaborators only)_

ACKs for top commit:
  UdjinM6:
    utACK fd51512
  kwvg:
    utACK fd51512

Tree-SHA512: 41f08e1879596c0dd339209f869f2e4c7497f275df1928154ed8dfd2df1ff66c0618792afbff8313a818ac4d14ed8aa04f00e0fa96468adcc494042a7a28cc2b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Manual page generation on master broken
5 participants