Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
/docs/*.[158]
/docs/*.[158].gz
/docs/remote
/docs/build/
*.o
*.orig
/pause/pause.o
Expand All @@ -25,3 +26,4 @@ release.txt
podman-remote*.zip
podman*.tar.gz
.idea*
.vscode*
37 changes: 16 additions & 21 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -168,13 +168,11 @@ podman-remote: .gopathok $(PODMAN_VARLINK_DEPENDENCIES) ## Build with podman on
$(GO_BUILD) $(BUILDFLAGS) -gcflags '$(GCFLAGS)' -asmflags '$(ASMFLAGS)' -ldflags '$(LDFLAGS_PODMAN)' -tags "$(BUILDTAGS) remoteclient" -o bin/$@ $(PROJECT)/cmd/podman

.PHONY: podman.msi
podman.msi: podman-remote podman-remote-windows docs ## Will always rebuild exe as there is no podman-remote-windows.exe target to verify timestamp
rm -rf bin/windows
mkdir -p bin/windows
docs/podman-remote.sh windows bin/windows docs
find bin/windows -print \
|wixl-heat --var var.ManSourceDir --component-group ManFiles --directory-ref INSTALLDIR --prefix bin/windows/ >bin/windows/pages.wsx
wixl -D VERSION=$(RELEASE_NUMBER) -D ManSourceDir=bin/windows -o podman-v$(RELEASE_NUMBER).msi contrib/msi/podman.wxs bin/windows/pages.wsx
podman.msi: podman-remote podman-remote-windows install-podman-remote-docs ## Will always rebuild exe as there is no podman-remote-windows.exe target to verify timestamp
$(eval DOCFILE := docs/build/remote/windows)
find $(DOCFILE) -print \
|wixl-heat --var var.ManSourceDir --component-group ManFiles --directory-ref INSTALLDIR --prefix $(DOCFILE)/ >$(DOCFILE)/pages.wsx
wixl -D VERSION=$(RELEASE_NUMBER) -D ManSourceDir=$(DOCFILE) -o podman-v$(RELEASE_NUMBER).msi contrib/msi/podman.wxs $(DOCFILE)/pages.wsx

podman-remote-%: .gopathok $(PODMAN_VARLINK_DEPENDENCIES) ## Build podman for a specific GOOS
$(eval BINSFX := $(shell test "$*" != "windows" || echo ".exe"))
Expand All @@ -197,7 +195,6 @@ clean: ## Clean artifacts
$(wildcard podman*.tar.gz) \
bin \
build \
docs/remote \
test/checkseccomp/checkseccomp \
test/goecho/goecho \
test/testdata/redis-image \
Expand Down Expand Up @@ -311,24 +308,28 @@ install.catatonit:

test-binaries: test/checkseccomp/checkseccomp test/goecho/goecho install.catatonit

MANPAGES_MD ?= $(wildcard docs/source/man/*.md pkg/*/docs/*.md)
MANPAGES_MD ?= $(wildcard docs/source/markdown/*.md pkg/*/docs/*.md)
MANPAGES ?= $(MANPAGES_MD:%.md=%)
MANPAGES_DEST ?= $(subst source,build,$(MANPAGES))

$(MANPAGES): %: %.md .gopathok
@sed -e 's/\((podman.*\.md)\)//' -e 's/\[\(podman.*\)\]/\1/' $< | $(GOMD2MAN) -in /dev/stdin -out $(subst source,build,$@)
@sed -e 's/\((podman.*\.md)\)//' -e 's/\[\(podman.*\)\]/\1/' $< | $(GOMD2MAN) -in /dev/stdin -out $(subst source/markdown,build/man,$@)

docdir:
mkdir -p docs/build/man

docs: docdir $(MANPAGES) ## Generate documentation

install-podman-remote-docs: podman-remote docs
rm -rf docs/remote
docs/podman-remote.sh darwin docs/remote docs
install-podman-remote-docs: podman-remote docs $(MANPAGES)
rm -rf docs/build/remote
mkdir -p docs/build/remote
ln -sf $(shell pwd)/docs/source/markdown/links docs/build/man/
docs/remote-docs.sh darwin docs/build/remote/darwin docs/build/man
docs/remote-docs.sh linux docs/build/remote/linux docs/build/man
docs/remote-docs.sh windows docs/build/remote/windows docs/source/markdown

man-page-check:
./hack/man-page-checker
hack/man-page-checker

# When publishing releases include critical build-time details
.PHONY: release.txt
Expand Down Expand Up @@ -362,13 +363,7 @@ podman-remote-v$(RELEASE_NUMBER)-%.zip:
# release.txt location and content depended upon by automated tooling
cp release.txt "$(TMPDIR)/"
cp ./bin/podman-remote-$*$(BINSFX) "$(TMPDIR)/$(SUBDIR)/podman$(BINSFX)"
cp -r ./docs/remote "$(TMPDIR)/$(SUBDIR)/docs/"
$(eval DOCFILE := $(TMPDIR)/$(SUBDIR)/docs/podman.1)
cp docs/podman-remote.1 "$(DOCFILE)"
sed -i 's/podman\\*-remote/podman/g' "$(DOCFILE)"
sed -i 's/Podman\\*-remote/Podman\ for\ $*/g' "$(DOCFILE)"
sed -i 's/podman\.conf/podman\-remote\.conf/g' "$(DOCFILE)"
sed -i 's/A\ remote\ CLI\ for\ Podman\:\ //g' "$(DOCFILE)"
cp -r ./docs/build/remote/$* "$(TMPDIR)/$(SUBDIR)/docs/"
cd "$(TMPDIR)" && \
zip --recurse-paths "$(CURDIR)/$@" "./release.txt" "./"
-rm -rf "$(TMPDIR)"
Expand Down
21 changes: 21 additions & 0 deletions docs/Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Build the Docs

## Directory Structure

| | Directory |
| ------------------------------------ | --------------------------- |
| Markdown source for man pages | docs/source/markdown/ |
| man pages aliases as .so files | docs/source/markdown/links/ |
| restructured text for readthedocs.io | docs/rst/ |
| target for output | docs/build |
| man pages | docs/build/man |
| remote linux man pages | docs/build/remote/linux |
| remote darwin man pages | docs/build/remote/darwin |
| remote windows html pages | docs/build/remote/windows |

## Support files

| | |
| ------------------------------------ | --------------------------- |
| docs/remote-docs.sh | Read the docs/source/markdown files and format for each platform |
| docs/links-to-html.lua | pandoc filter to do aliases for html files |
56 changes: 30 additions & 26 deletions docs/podman-remote.sh → docs/remote-docs.sh
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
#!/bin/bash -e
# Assemble remote man pages for darwin or windows from markdown files

PLATFORM=$1 ## windows or darwin
TARGET=$2 ## where to output files
PLATFORM=$1 ## linux, windows or darwin
TARGET=${2} ## where to output files
SOURCES=${@:3} ## directories to find markdown files

PODMAN=${PODMAN:-bin/podman-remote} ## location overridden for testing

function usage() {
echo >&2 "$0 PLATFORM TARGET SOURCES..."
echo >&2 "PLATFORM: Is either darwin or windows."
echo >&2 "TARGET: Is the directory where files will be staged."
echo >&2 "SOURCES: Are the directories to source markdown files."
echo >&2 "PLATFORM: Is either linux, darwin or windows."
echo >&2 "TARGET: Is the directory where files will be staged. eg, docs/build/remote/linux"
echo >&2 "SOURCES: Are the directories of source files. eg, docs/markdown"
}

function fail() {
Expand All @@ -21,19 +21,17 @@ function fail() {
}

case $PLATFORM in
'darwin')
EXT=1
PUBLISHER=darwin_fn
darwin|linux)
PUBLISHER=man_fn
;;
'windows')
EXT=1.md
PUBLISHER=windows_fn
windows)
PUBLISHER=html_fn
;;
'-help')
-help)
usage
exit 0
;;
*) fail '"darwin" and "windows" are currently the only supported platforms.' ;;
*) fail '"linux", "darwin" and "windows" are the only supported platforms.' ;;
esac

if [[ -z $TARGET ]]; then
Expand All @@ -48,19 +46,20 @@ if [[ ! -x $PODMAN ]]; then
fail "$PODMAN does not exist"
fi

## darwin_fn copies the markdown page or link to flattened directory
function darwin_fn() {
local markdown=$1
local file=$(basename $markdown)
local dir=$(dirname $markdown)
if [[ -f $dir/../../links/$file ]]; then
markdown=$dir/../../links/$file
## man_fn copies the man page or link to flattened directory
function man_fn() {
local page=$1
local file=$(basename $page)
local dir=$(dirname $page)

if [[ ! -f $page ]]; then
page=$dir/links/${file%.*}.1
fi
install $markdown $TARGET
install $page $TARGET/${file%%.*}.1
}

## windows_fn converts the markdown page or link to HTML
function windows_fn() {
## html_fn converts the markdown page or link to HTML
function html_fn() {
local markdown=$1
local file=$(basename $markdown)
local dir=$(dirname $markdown)
Expand All @@ -69,21 +68,26 @@ function windows_fn() {
local link=$(sed -e 's?.so man1/\(.*\)?\1?' <$dir/links/${file%.md})
markdown=$dir/$link.md
fi
pandoc --ascii --lua-filter=$dir/links-to-html.lua -o $TARGET/${file%.$EXT}.html $markdown
pandoc --ascii --lua-filter=docs/links-to-html.lua -o $TARGET/${file%%.*}.html $markdown
}

## pub_pages finds and publishes the remote manual pages
function pub_pages() {
local source=$1
local publisher=$2
for f in $(ls $source/podman-remote*$EXT); do
for f in $(ls $source/podman-remote*); do
$publisher $f
done

# rename podman-remote.ext to podman.ext and copy
local remote=$(echo $TARGET/podman-remote.*)
local ext=${remote##*.}
cp -f $remote $TARGET/podman.$ext

for c in "container" "image" "pod" "volume" ""; do
local cmd=${c:+-$c}
for s in $($PODMAN $c --help | sed -n '/^Available Commands:/,/^Flags:/p' | sed -e '1d;$d' -e '/^$/d' | awk '{print $1}'); do
$publisher $source/podman$cmd-$s.$EXT
$publisher $(echo $source/podman$cmd-$s.*)
done
done
}
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.