Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Feb 24, 2020. It is now read-only.

Conversation

@alban
Copy link
Member

@alban alban commented Apr 4, 2016

manpages: generate manpages with cobra

To update the manpages, use:

    $ make manpages

It will generate the manpages in dist/manpages/.

Also the bash completion file is no longer built manually, but you can
use:

    $ make bash-completion

It will generate dist/bash_completion/rkt.bash.

The release guide (release.md) is updated to make sure that each release
contains an up-to-date version of the manpages and the bash completion
file.

Fixes #2370

rkt/rkt.go Outdated
os.Exit(0)
}

// update rkt.bash
Copy link
Member

Choose a reason for hiding this comment

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

wrong comment

rkt/rkt.go Outdated
Section: "1",
}

doc.GenManTree(cmdRkt, header, "dist/manpages")
Copy link
Member

Choose a reason for hiding this comment

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

Maybe we should not ignore errors?

Copy link
Member Author

Choose a reason for hiding this comment

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

I will fix.

@alban
Copy link
Member Author

alban commented Apr 4, 2016

Assigning to @s-urbaniak to get a review.

@s-urbaniak
Copy link
Contributor

Seems odd that we are using the rkt binary to generate man pages by setting a magic env var and also checking in generated files. Generation of man pages is something we should rather do at build time only and not pollute the runtime behavior of rkt?!

How about having a separate man.go file having a +man build flag being invoked as a make target make doc to generate the man pages explicitly using go run?

// // Uncomment to update rkt.bash
// stdout.Print("Generating rkt.bash")
// cmdRkt.GenBashCompletionFile("dist/bash_completion/rkt.bash")
// os.Exit(0)
Copy link
Contributor

Choose a reason for hiding this comment

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

👍 for removing commented code

@alban
Copy link
Member Author

alban commented Apr 4, 2016

@s-urbaniak PR updated. I also updated the description above. PTAL.


err := doc.GenManTree(cmdRkt, header, "dist/manpages")
if err != nil {
fmt.Printf("Failed to generate the man pages: %v\n", err)
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: use stderr instead?

Copy link
Member Author

Choose a reason for hiding this comment

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

ok

@s-urbaniak
Copy link
Contributor

@alban small nits, I am still unsure of checking in the generated man files (@jonboulle, comments?), else LGTM :-)

@jonboulle
Copy link
Contributor

I agree with @s-urbaniak that we should avoid committing the generated artefacts - otherwise we're inevitably going to have rot between them. Can't we just keep the generation as part of the release process and in notes for distributors?

@alban
Copy link
Member Author

alban commented Apr 4, 2016

@s-urbaniak @jonboulle Updated. I added new commits and I will squash them once it looks good to you. I removed the generated files from the git repository (except the protobuf generated files, see #2004 - to be done in a different PR), and updated the build scripts.

@@ -1,3 +1,12 @@
## vUNRELEASED
Copy link
Contributor

Choose a reason for hiding this comment

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

the v is superfluous.

Copy link
Collaborator

Choose a reason for hiding this comment

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

We usually prepend v to version number, so I think it's ok.

Copy link
Contributor

Choose a reason for hiding this comment

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

got it, thanks!

@s-urbaniak
Copy link
Contributor

LGTM

set -e

./autogen.sh && ./configure --enable-tpm=no --with-stage1-default-images-directory=/usr/lib/rkt/stage1-images --with-stage1-default-location=/usr/lib/rkt/stage1-images/stage1-coreos.aci && make -j4
./autogen.sh && \
Copy link
Collaborator

Choose a reason for hiding this comment

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

Hm, we have the set -e call above so chaining everything with && is not really necessary. Could you simplify it by removing those && and removing one level of indentation in the lines below?

Copy link
Member Author

Choose a reason for hiding this comment

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

ok

rkt/rkt.mk Outdated
# RKT_STAMP deliberately not cleared
# RKT_BINARY deliberately not cleared

manpages:
Copy link
Collaborator

Choose a reason for hiding this comment

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

/me turns a blind eye on this. The concerns I have, and which maybe I'll address later when I simplify some bits and document them, are:

  • I would make it a part of make all.
  • I would prefer the files to be generated inside $(BUILDDIR)
    • That would require passing that directory to the generator, so it would know where to put the files.
    • But that complicates things (make clean, deps, forwarding variables, blah blah blah), so don't bother with it for now.
  • Pretty printers could be used there.
    • No big deal, since the output is rather short.
  • These additions should be put above the $(call undefine-namespaces,LOCAL) line.

Copy link
Member Author

Choose a reason for hiding this comment

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

I would make it a part of make all.

It would make the compilation quite slow if we run make manpages/bash-completion at each make though... On my laptop:

  • time make manpages: 25 seconds
  • time make bash-completion: 24 seconds
  • total: 49 seconds

I would prefer the files to be generated inside $(BUILDDIR)
That would require passing that directory to the generator, so it would know where to put the files.
But that complicates things (make clean, deps, forwarding variables, blah blah blah), so don't bother with it for now.

Ok, I'll skip that for now.

Pretty printers could be used there.
No big deal, since the output is rather short.

How to do that?

These additions should be put above the $(call undefine-namespaces,LOCAL) line.

Will do in the next update.

Copy link
Collaborator

Choose a reason for hiding this comment

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

It would make the compilation quite slow if we run make manpages/bash-completion at each make though... On my laptop:

  • time make manpages: 25 seconds
  • time make bash-completion: 24 seconds
  • total: 49 seconds

I wanted it to be a part of make all, because it is about building everything. Possibly this could be controlled with --enable-man and --enable-bash-completion flags which could be disabled by default.

Pretty printers could be used there.
No big deal, since the output is rather short.

How to do that?

manpages:
    $(VQ) \ <- this expands to @ when pretty printing (V=0,1,2) or to nothing for raw output (V=3)
    set -e; \
    $(call vb,vt,GEN,manpages) \ <- this will print "GEN     manpages" for V=1,2, nothing otherwise)
    ls rkt/*.go | blah blah blah

@alban
Copy link
Member Author

alban commented Apr 5, 2016

Updated. PTAL.

@iaguis
Copy link
Member

iaguis commented Apr 5, 2016

Running

$ ./autogen.sh && ./configure --enable-tpm=no && make manpages

doesn't work for me because before make, there's nothing in $BUILDDIR/gopath:

mkdir -p dist/manpages/
ls rkt/*.go | grep -vE '_test.go|main.go|_gen.go' | xargs go run rkt/manpages_gen.go
rkt/image_cmd_common.go:24:2: cannot find package "github.com/appc/spec/discovery" in any of:
    /usr/lib/go/src/github.com/appc/spec/discovery (from $GOROOT)
    /home/iaguis/work/coreos/go/src/github.com/coreos/rkt/build-rkt-1.3.0+git/gopath/src/github.com/coreos/rkt/Godeps/_workspace/src/github.com/appc/spec/discovery (from $GOPATH)
    /home/iaguis/work/coreos/go/src/github.com/coreos/rkt/build-rkt-1.3.0+git/gopath/src/github.com/appc/spec/discovery
rkt/api_service.go:28:2: cannot find package "github.com/appc/spec/schema" in any of:
    /usr/lib/go/src/github.com/appc/spec/schema (from $GOROOT)
    /home/iaguis/work/coreos/go/src/github.com/coreos/rkt/build-rkt-1.3.0+git/gopath/src/github.com/coreos/rkt/Godeps/_workspace/src/github.com/appc/spec/schema (from $GOPATH)
    /home/iaguis/work/coreos/go/src/github.com/coreos/rkt/build-rkt-1.3.0+git/gopath/src/github.com/appc/spec/schema

[...]

@krnowak
Copy link
Collaborator

krnowak commented Apr 5, 2016

Meh, as a workaround for this issue (./autogen.sh && ./configure && make manpages) just do:

manpages: | $(GOPATH_TO_CREATE)/src/$(REPO_PATH)
bash-completion: | $(GOPATH_TO_CREATE)/src/$(REPO_PATH)

@iaguis
Copy link
Member

iaguis commented Apr 5, 2016

The workaround works 👷

@krnowak
Copy link
Collaborator

krnowak commented Apr 5, 2016

Cool.

@iaguis
Copy link
Member

iaguis commented Apr 5, 2016

LGTM

@alban
Copy link
Member Author

alban commented Apr 5, 2016

Ok, commits squashed.

@iaguis
Copy link
Member

iaguis commented Apr 5, 2016

LGTMTMOG

@iaguis
Copy link
Member

iaguis commented Apr 5, 2016

Nit: actually you don't update the release guide but the release script (commit message).

To update the manpages, use:
    $ make manpages

It will generate the manpages in dist/manpages/.

Also the bash completion file is no longer built manually, but you can
use:
    $ make bash-completion

It will generate dist/bash_completion/rkt.bash.

The release scripts are updated to make sure that each release
contains an up-to-date version of the manpages and the bash completion
file.
@alban alban merged commit 7b347bb into rkt:master Apr 5, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants