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

Unclear how to handle man page generation #151

Open
julianandrews opened this issue Nov 4, 2024 · 5 comments
Open

Unclear how to handle man page generation #151

julianandrews opened this issue Nov 4, 2024 · 5 comments

Comments

@julianandrews
Copy link

I use help2man to generate the man page for my project, and that needs to run post-build but before deb generation. Right now I generate the man page manually and add it to the repo. That works, but isn't ideal.

Since cargo build doesn't support post-build scripts, I was hoping there would be some way to tell cargo deb to run some post-build logic, but I'm not seeing a clean way to make that happen.

Is there a recommended way to generate the man page (or generally do post-build pre-cargo-deb logic)?

@ximon18
Copy link
Contributor

ximon18 commented Nov 4, 2024

Use --no-build and handle this youreelf?

@kornelski
Copy link
Owner

Cargo doesn't support generation of man pages:

rust-lang/cargo#545

and cargo-deb just wraps cargo build, so you need to create a workaround for this yourself.

@julianandrews
Copy link
Author

I thought that might be the case, but wanted to check. Thanks!

I should be able to cobble something together using --no-build and some manual logic. For my purposes I can just write a shell script to generate the .deb. It won't be cross-platform, but then neither is help2man so that's no loss for me.

It would be really helpful if there were some documentation somewhere suggesting workarounds. Though, I recognize that as things stand there isn't an obvious best approach to recommend which makes that kind of tricky.

@AlexTMjugador
Copy link
Contributor

I realize I'm probably a bit late to this party, but the cargo-xtask convention is probably what you're looking for to implement custom post-build steps like this.

@julianandrews
Copy link
Author

I realize I'm probably a bit late to this party, but the cargo-xtask convention is probably what you're looking for to implement custom post-build steps like this.

Yeah, I looked at cargo-xtask. In the end I decided that for my use case, where I basically just want to call help2man that would add a lot of boilerplate for minimal benefit over just calling a shell script from CI. I definitely don't want to re-arrange my whole project layout for workspaces to enable man page building, and while that's not strictly required, the README explicitly recommends against doing xtasks without workspaces.

I can see how cargo-xtask could be useful when you need to do something complicated, or if you need cross platform compatibility, but it's hard to justify all that added complexity when what I want to do is just a few lines of bash.

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

No branches or pull requests

4 participants