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:
parent
614c0858f2
commit
036db34f37
@ -77,6 +77,7 @@ script:
|
|||||||
- go build -i .
|
- go build -i .
|
||||||
- make check
|
- make check
|
||||||
- if [ "$GOOS" = "linux" ]; then make check-protos check-api-descriptors; fi
|
- if [ "$GOOS" = "linux" ]; then make check-protos check-api-descriptors; fi
|
||||||
|
- if [ "$TRAVIS_GOOS" = "linux" ]; then make man ; fi
|
||||||
- make build
|
- make build
|
||||||
- make binaries
|
- make binaries
|
||||||
- if [ "$TRAVIS_GOOS" = "linux" ]; then sudo make install ; fi
|
- if [ "$TRAVIS_GOOS" = "linux" ]; then sudo make install ; fi
|
||||||
|
14
Makefile
14
Makefile
@ -203,11 +203,19 @@ man: mandir $(addprefix man/,$(MANPAGES))
|
|||||||
mandir:
|
mandir:
|
||||||
@mkdir -p man
|
@mkdir -p man
|
||||||
|
|
||||||
genman: FORCE
|
# Kept for backwards compatability
|
||||||
go run cmd/gen-manpages/main.go man/
|
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
|
man/%: docs/man/%.md FORCE
|
||||||
@echo "$(WHALE) $<"
|
@echo "$(WHALE) $@"
|
||||||
go-md2man -in "$<" -out "$@"
|
go-md2man -in "$<" -out "$@"
|
||||||
|
|
||||||
define installmanpage
|
define installmanpage
|
||||||
|
@ -41,20 +41,23 @@ func run() error {
|
|||||||
"containerd": command.App(),
|
"containerd": command.App(),
|
||||||
"ctr": app.New(),
|
"ctr": app.New(),
|
||||||
}
|
}
|
||||||
dir := flag.Arg(0)
|
name := flag.Arg(0)
|
||||||
for name, app := range apps {
|
dir := flag.Arg(1)
|
||||||
// clear out the usage as we use banners that do not display in man pages
|
app, ok := apps[name]
|
||||||
app.Usage = ""
|
if !ok {
|
||||||
data, err := app.ToMan()
|
return fmt.Errorf("Invalid application '%s'", name)
|
||||||
if err != nil {
|
}
|
||||||
return err
|
// clear out the usage as we use banners that do not display in man pages
|
||||||
}
|
app.Usage = ""
|
||||||
if _, err := os.Stat(dir); os.IsNotExist(err) {
|
data, err := app.ToMan()
|
||||||
os.Mkdir(dir, os.ModePerm)
|
if err != nil {
|
||||||
}
|
return err
|
||||||
if err := ioutil.WriteFile(filepath.Join(dir, fmt.Sprintf("%s.1", name)), []byte(data), 0644); err != nil {
|
}
|
||||||
return err
|
if _, err := os.Stat(dir); os.IsNotExist(err) {
|
||||||
}
|
os.Mkdir(dir, os.ModePerm)
|
||||||
|
}
|
||||||
|
if err := ioutil.WriteFile(filepath.Join(dir, fmt.Sprintf("%s.1", name)), []byte(data), 0644); err != nil {
|
||||||
|
return err
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user