build: Fix manpage generation

Seems to be that docs/man/ctr.1.md and docs/man/containerd.1.md were
removed in #3637 and were not updated correctly in the Makefile, leading
to build failures like:

    + make man

    make: *** No rule to make target `man/ctr.1', needed by `man'.  Stop.

Changes the gen-manpages command to be specific on which manpages are to
be generated.

Signed-off-by: Eli Uriegas <eli.uriegas@docker.com>
This commit is contained in:
Eli Uriegas 2019-10-08 00:08:37 +00:00
parent 614c0858f2
commit 036db34f37
No known key found for this signature in database
GPG Key ID: 611F3B998E7A2333
3 changed files with 29 additions and 17 deletions

View File

@ -77,6 +77,7 @@ script:
- go build -i .
- make check
- if [ "$GOOS" = "linux" ]; then make check-protos check-api-descriptors; fi
- if [ "$TRAVIS_GOOS" = "linux" ]; then make man ; fi
- make build
- make binaries
- if [ "$TRAVIS_GOOS" = "linux" ]; then sudo make install ; fi

View File

@ -203,11 +203,19 @@ man: mandir $(addprefix man/,$(MANPAGES))
mandir:
@mkdir -p man
genman: FORCE
go run cmd/gen-manpages/main.go man/
# Kept for backwards compatability
genman: man/containerd.1 man/ctr.1
man/containerd.1: FORCE
@echo "$(WHALE) $@"
go run cmd/gen-manpages/main.go containerd man/
man/ctr.1: FORCE
@echo "$(WHALE) $@"
go run cmd/gen-manpages/main.go ctr man/
man/%: docs/man/%.md FORCE
@echo "$(WHALE) $<"
@echo "$(WHALE) $@"
go-md2man -in "$<" -out "$@"
define installmanpage

View File

@ -41,8 +41,12 @@ func run() error {
"containerd": command.App(),
"ctr": app.New(),
}
dir := flag.Arg(0)
for name, app := range apps {
name := flag.Arg(0)
dir := flag.Arg(1)
app, ok := apps[name]
if !ok {
return fmt.Errorf("Invalid application '%s'", name)
}
// clear out the usage as we use banners that do not display in man pages
app.Usage = ""
data, err := app.ToMan()
@ -55,6 +59,5 @@ func run() error {
if err := ioutil.WriteFile(filepath.Join(dir, fmt.Sprintf("%s.1", name)), []byte(data), 0644); err != nil {
return err
}
}
return nil
}