#60 fedpkg man page (can be generated from help texts)
Closed: Fixed Opened by ndim.

Currently, fedpkg has no man page. However, fedpkg has a builtin help system describing its commands.

This patch (series) adds a new fedpkg command

fedpkg man-page [-o OUTFILE]

which generates a fedpkg(1) man page from some static strings and the help text.

Unfortunately, it needs to use some internals of the argparse Python library, but that might be OK for the occasional generation of docs.

See git://fedorapeople.org/~ndim/fedora-packager.git (man-page/raw branch) or http://fedorapeople.org/gitweb?p=ndim/public_git/fedora-packager.git;a=summary for the code.


the generated man page
fedpkg.1

Patch adding man page generation code
0001-Add-basic-man-page-generator.patch

Patch hooking man page generation and installation into Makefile.am
0002-Hook-up-man-page-generator-into-Makefile.am.patch

Patch hiding "man-page" command from help (fedpkg users do not really need it)
0003-Make-man-page-command-invisible-in-help.patch

See also https://bugzilla.redhat.com/show_bug.cgi?id=619078

Most up to date version:

{{{
git remote add ndim git://fedorapeople.org/~ndim/fedora-packager.git
git fetch -v ndim
git merge ndim/enh/man-page
}}}

Cf. http://fedorapeople.org/gitweb?p=ndim/public_git/fedora-packager.git;a=summary

Note that enh/man-page already contains the [http://fedorapeople.org/gitweb?p=ndim/public_git/fedora-packager.git;a=commitdiff;h=279d7c33511b971962c340cdb867feebdc77950e fix for all the def foo(path=os.getcwd()): function declarations].

I have just pushed an reworked man page generator branch to git://fedorapeople.org/~ndim/fedora-packager.git branch 4/man-page (rebased onto 0.5.2.0).

The 4/man-page branch now includes two almost-trivial patches (separately available as branch 4/basic) preparing the fedpkg code for the main patch containing the actual man page generator.

The man page generator now avoids adding a man-page target to fedpkg, as generating a man page is only really useful once at build time, and would just uselessly take up screen space in fedpkg --help output all the time.

So this applies, and mostly looks OK. A couple of issues though. There is no description of the optional arguments one sees when doing "fedpkg --help". These should be documented, but I'm struggling trying to get that data out of argparse.

Second, I'm curious if there is a way to augment the data somehow, to give more lengthy details regarding some of the commands or options. If not, that's OK.

Can you look into making sure the optional arguments for the main fedpkg command get documented somehow?

As to showing the optional arguments... I will have to look into that.

As to giving more lengthy details, there is the description argument to
the subparsers.add_parser(), see e.g. in my patch to #64.

Just pushed to git://fedorapeople.org/~ndim/fedora-packager.git branch 5/man-pages.

This now has a duplicate list of fedpkg subcommands (the two if True branches), so that you can choose the one which looks best in the man page.

Also, the optional global arguments are now in a separate subsection.

Also, the 5/basic branch has grown some docs for the --user argument.

Replying to [comment:6 ndim]:

This now has a duplicate list of fedpkg subcommands (the two if True branches), so that you can choose the one which looks best in the man page.

This means "choose" at merge-time, not at runtime.

Merged and pushed. Thanks!

Any way you can re-arrange this so that fedpkg doesn't need the full import set to run? I'd have to add all the modules fedpkg uses as BuildRequires to get this to work right....

git://fedorapeople.org/~ndim/fedora-packager.git branch lean-man-imports

Creating a tarball with "make distcheck" and using that tarball to fedpkg mockbuild the fedora-packager package

  • without lean-man-imports: fails due to missing pycurl
  • with lean-man-imports: successfully builds package

The other fedpkg operations appear to work. I have not exhaustively tested that, though, due to lack of test suite.

Ok, I merged that and then modified it slightly. Things are better now.

perhaps also apply this patch:

https://github.com/glensc/fedora-packager/commit/f4025905791b65abe6ae5138fae037d98655de40.patch

Replying to [comment:13 glen]:

perhaps also apply this patch:

https://github.com/glensc/fedora-packager/commit/f4025905791b65abe6ae5138fae037d98655de40.patch

That would include the man page in the tarball, as opposed to generating it at build time. I had thought of that, but shied away from it. I'm not a fan of bundling pre-generated content into the release tarball.

Replying to [comment:14 jkeating]:

Replying to [comment:13 glen]:

perhaps also apply this patch:

https://github.com/glensc/fedora-packager/commit/f4025905791b65abe6ae5138fae037d98655de40.patch

That would include the man page in the tarball, as opposed to generating it at build time. I had thought of that, but shied away from it. I'm not a fan of bundling pre-generated content into the release tarball.

that was the intent, to get manual page to tarball. yet you include configure to release tarball which is also pre-generated. makefile could be perhaps updated that it does regenerate at build time as well if mtime of source file(s) is newer if you worry was that it does not get regenerated by default make rule.

Replying to [comment:15 glen]:

that was the intent, to get manual page to tarball.

That is not a good idea as make clean will still (need to) remove it, and so you end up needing to be able to generate it in a tarball based build anyway. Nothing gained here.

yet you include configure to release tarball which is also pre-generated.

The configure script is generated at an entirely different stage, and for entirely different reasons. Patch to follow.

makefile could be perhaps updated that it does regenerate at build time as well if mtime of source file(s) is newer if you worry was that it does not get regenerated by default make rule.

I agree that the deps of the fedpkg.1 make target are not quite what they should be.

Replying to [comment:16 ndim]:

I agree that the deps of the fedpkg.1 make target are not quite what they should be.

Patch to fix those dependencies attached.

glen: If you want to ship the man page in the dist tarball for your own purposes, replacing man1_MANS with dist_man1_MANS will do the job.

Up-to-date man page dependency fix is at git://fedorapeople.org/~ndim/fedora-packager.git branch manpage-target-dep-fix

Grabbed it and put it into a bugfix branch. Thanks.

Metadata