Skip to content

docs: generate manpages#504

Open
supakeen wants to merge 2 commits intoosbuild:mainfrom
supakeen:manpages
Open

docs: generate manpages#504
supakeen wants to merge 2 commits intoosbuild:mainfrom
supakeen:manpages

Conversation

@supakeen
Copy link
Copy Markdown
Member

@supakeen supakeen commented Apr 28, 2026

Create manpages by using Cobra's built-in ability to do so. Add a hidden command that we call in our RPM specfile to generate the pages and install them in the appropriate location.

Also adds a new Makefile option to generate the manpages.


Looks like:

image image

Etc.

@supakeen supakeen requested a review from a team as a code owner April 28, 2026 06:04
@supakeen
Copy link
Copy Markdown
Member Author

supakeen commented Apr 28, 2026

Mmm; seems to fail with on CentOS/RHEL, but not Fedora.

+ '%{gobuilddir}/bin/image-builder' gen-man-pages man/man1/
/var/tmp/rpm-tmp.r2wsy8: line 64: fg: no job control

Wonder what the actual error is.

@supakeen
Copy link
Copy Markdown
Member Author

Mmm; seems to fail with on CentOS/RHEL, but not Fedora.

+ '%{gobuilddir}/bin/image-builder' gen-man-pages man/man1/
/var/tmp/rpm-tmp.r2wsy8: line 64: fg: no job control

Wonder what the actual error is.

It means that the macro isn't expanded at all; maybe we're lacking a buildrequires for Go macros or the version in EL doesn't contain this macro.

lzap
lzap previously approved these changes Apr 28, 2026
Copy link
Copy Markdown
Contributor

@lzap lzap left a comment

Choose a reason for hiding this comment

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

Looks good, not sure what you mean by the macro not being expanded, it is used in the file already why it would not error out there?

@supakeen
Copy link
Copy Markdown
Member Author

Looks good, not sure what you mean by the macro not being expanded, it is used in the file already why it would not error out there?

Mmm; you're right. Confusing. Maybe it's only available under %install on RHEL I don't know if macros can do that.

Comment thread cmd/image-builder/manpages.go Outdated

func addManPageCmd(rootCmd *cobra.Command) {
manCmd := &cobra.Command{
Use: "gen-man-pages <output-dir>",
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

For whatever it's worth I called this command doc in composer-cli. But I don't have strong feelings either way, other than consistency would be a good idea.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I'll call it doc.

@brlane-rht
Copy link
Copy Markdown

Yeah, it's not getting expanded on RHEL :) From a different PR where it works on accident:

+ install -m 0755 -vp '%{gobuilddir}/bin/image-builder' /builddir/build/BUILDROOT/image-builder-62-1.20260428083453660281.pr462.6.gc430891.el10.x86_64/usr/bin/
'%{gobuilddir}/bin/image-builder' -> '/builddir/build/BUILDROOT/image-builder-62-1.20260428083453660281.pr462.6.gc430891.el10.x86_64/usr/bin/image-builder'

You could just write it to . in gobuild and install and run from there instead.

@supakeen
Copy link
Copy Markdown
Member Author

Yeah, it's not getting expanded on RHEL :) From a different PR where it works on accident:


+ install -m 0755 -vp '%{gobuilddir}/bin/image-builder' /builddir/build/BUILDROOT/image-builder-62-1.20260428083453660281.pr462.6.gc430891.el10.x86_64/usr/bin/

'%{gobuilddir}/bin/image-builder' -> '/builddir/build/BUILDROOT/image-builder-62-1.20260428083453660281.pr462.6.gc430891.el10.x86_64/usr/bin/image-builder'

You could just write it to . in gobuild and install and run from there instead.

Ah because it's quoted in the other case. Ok I'll change both of them. Thanks 🙂

Create manpages by using Cobra's built-in ability to do so. Add a hidden
command that we call in our RPM specfile to generate the pages and
install them in the appropriate location.

Also adds a new Makefile option to generate the manpages.

Signed-off-by: Simon de Vlieger <[email protected]>
This macro doesn't exist (yet) on ELs; instead use `_bin` as the prefix.
This accidentally works because install quotes the paths so they work
even when not expanded.

We use `_bin` in our other spec files for Go projects.

Signed-off-by: Simon de Vlieger <[email protected]>
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.

3 participants