summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJhon Honce <jhonce@redhat.com>2019-09-16 09:23:57 -0700
committerJhon Honce <jhonce@redhat.com>2019-09-19 14:14:38 -0700
commit96bcf8cecc92c70cdb86ee288eb57795ef6395e7 (patch)
tree5dc7417b2e7c583ed7f9ddac3311d8d17c7b9558
parent408f2780a1dd94f99fe36be4573a9887e6c74cf7 (diff)
downloadpodman-96bcf8cecc92c70cdb86ee288eb57795ef6395e7.tar.gz
podman-96bcf8cecc92c70cdb86ee288eb57795ef6395e7.tar.bz2
podman-96bcf8cecc92c70cdb86ee288eb57795ef6395e7.zip
Support podman-remote help on windows
* Update scipts to produce darwin and windows output * Update batch file to re-direct help requests to browser * Add pandoc filter for markdown to html links Signed-off-by: Jhon Honce <jhonce@redhat.com>
-rw-r--r--.cirrus.yml2
-rw-r--r--Makefile14
-rw-r--r--contrib/msi/podman.bat25
-rw-r--r--contrib/msi/podman.wxs5
-rw-r--r--docs/links-to-html.lua5
-rwxr-xr-xdocs/podman-remote.sh105
6 files changed, 143 insertions, 13 deletions
diff --git a/.cirrus.yml b/.cirrus.yml
index 39275f6db..663fb91b8 100644
--- a/.cirrus.yml
+++ b/.cirrus.yml
@@ -491,7 +491,7 @@ special_testing_cgroupv2_task:
TEST_REMOTE_CLIENT: true
TEST_REMOTE_CLIENT: false
- timeout_in: 20m
+ timeout_in: 120m
networking_script: '${CIRRUS_WORKING_DIR}/${SCRIPT_BASE}/networking.sh'
setup_environment_script: '$SCRIPT_BASE/setup_environment.sh |& ${TIMESTAMP}'
diff --git a/Makefile b/Makefile
index 0dc72ce4d..6734ef1b0 100644
--- a/Makefile
+++ b/Makefile
@@ -165,8 +165,13 @@ 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-windows ## Will always rebuild exe as there is no podman-remote-windows.exe target to verify timestamp
- wixl -D VERSION=$(RELEASE_NUMBER) -o bin/podman-v$(RELEASE_NUMBER).msi contrib/msi/podman.wxs
+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-remote-%: .gopathok $(PODMAN_VARLINK_DEPENDENCIES) ## Build podman for a specific GOOS
$(eval BINSFX := $(shell test "$*" != "windows" || echo ".exe"))
@@ -316,8 +321,9 @@ $(MANPAGES): %: %.md .gopathok
docs: $(MANPAGES) ## Generate documentation
-install-podman-remote-docs: docs
- @(cd docs; ./podman-remote.sh ./remote)
+install-podman-remote-docs: podman-remote docs
+ rm -rf docs/remote
+ docs/podman-remote.sh darwin docs/remote docs
man-page-check:
./hack/man-page-checker
diff --git a/contrib/msi/podman.bat b/contrib/msi/podman.bat
index 091c1c4c4..e0c7e1137 100644
--- a/contrib/msi/podman.bat
+++ b/contrib/msi/podman.bat
@@ -3,6 +3,14 @@ setlocal enableextensions
title Podman
+if "%1" EQU "" (
+ goto run_help
+)
+
+if "%1" EQU "/?" (
+ goto run_help
+)
+
:: If remote-host is given on command line -- use it
setlocal enabledelayedexpansion
for %%a in (%*) do (
@@ -39,5 +47,22 @@ set /p user="Please enter the remote user name: "
:run_podman
endlocal
podman-remote-windows.exe %*
+goto end
+
+:run_help
+set run=start "Podman Help" /D "%~dp0" /B
+
+if not "%3" == "" (
+ %run% "podman-%2-%3.html
+ goto end
+)
+
+if not "%2" == "" (
+ %run% "podman-%2.html
+ goto end
+)
+
+%run% "%podman-remote.html"
+goto end
:End
diff --git a/contrib/msi/podman.wxs b/contrib/msi/podman.wxs
index 77c6e2815..ec62a93c5 100644
--- a/contrib/msi/podman.wxs
+++ b/contrib/msi/podman.wxs
@@ -5,6 +5,10 @@
<?error VERSION must be defined via command line argument?>
<?endif?>
+ <?ifndef var.ManSourceDir?>
+ <?define ManSourceDir = "bin/windows" ?>
+ <?endif?>
+
<Product Name="Podman $(var.VERSION)" Id="*" UpgradeCode="696BAB5D-CA1F-4B05-B123-320F245B8D6D" Version="$(var.VERSION)" Language="1033" Manufacturer="Red Hat Inc.">
<Package Id="*" Keywords="Installer" Description="Red Hat's Podman $(var.VERSION) Installer" Comments="Apache 2.0 License" Manufacturer="Red Hat Inc." InstallScope="perMachine" InstallerVersion="100" Compressed="yes"/>
@@ -34,6 +38,7 @@
<Feature Id="Complete" Level="1">
<ComponentRef Id="INSTALLDIR_Component"/>
<ComponentRef Id="MainExecutable"/>
+ <ComponentGroupRef Id="ManFiles"/>
</Feature>
<Icon Id="podman.ico" SourceFile="contrib/msi/podman-logo.ico"/>
diff --git a/docs/links-to-html.lua b/docs/links-to-html.lua
new file mode 100644
index 000000000..74072a9e4
--- /dev/null
+++ b/docs/links-to-html.lua
@@ -0,0 +1,5 @@
+# links-to-html.lua
+function Link(el)
+ el.target = string.gsub(el.target, "%.1.md", ".html")
+ return el
+end
diff --git a/docs/podman-remote.sh b/docs/podman-remote.sh
index db3bb6d50..2f8e76d1b 100755
--- a/docs/podman-remote.sh
+++ b/docs/podman-remote.sh
@@ -1,11 +1,100 @@
-#!/bin/sh
+#!/bin/bash -e
+# Assemble remote man pages for darwin or windows from markdown files
-BREWDIR=$1
-mkdir -p $BREWDIR
-docs() {
-[ -z $1 ] || type="-$1"
-for i in $(podman-remote $1 --help | sed -n '/^Available Commands:/,/^Flags:/p'| sed -e '1d;$d' -e '/^$/d' | awk '{print $1}'); do install podman$type-$i.1 $BREWDIR 2>/dev/null || install links/podman$type-$i.1 $BREWDIR; done
+PLATFORM=$1 ## 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."
+}
+
+function fail() {
+ echo >&2 -e "$@\n"
+ usage
+ exit 1
+}
+
+case $PLATFORM in
+'darwin')
+ EXT=1
+ PUBLISHER=darwin_fn
+ ;;
+'windows')
+ EXT=1.md
+ PUBLISHER=windows_fn
+ ;;
+'-help')
+ usage
+ exit 0
+ ;;
+*) fail '"darwin" and "windows" are currently the only supported platforms.' ;;
+esac
+
+if [[ -z $TARGET ]]; then
+ fail 'TARGET directory is required'
+fi
+
+if [[ -z $SOURCES ]]; then
+ fail 'At least one SOURCE directory is required'
+fi
+
+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
+ fi
+ install $markdown $TARGET
+}
+
+## windows_fn converts the markdown page or link to HTML
+function windows_fn() {
+ local markdown=$1
+ local file=$(basename $markdown)
+ local dir=$(dirname $markdown)
+
+ if [[ ! -f $markdown ]]; then
+ 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
+}
+
+## 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
+ $publisher $f
+ done
+
+ 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
+ done
+ done
}
-docs
-for cmd in 'container image pod volume'; do docs $cmd; done
+## walk the SOURCES for markdown sources
+mkdir -p $TARGET
+for s in $SOURCES; do
+ if [[ -d $s ]]; then
+ pub_pages $s $PUBLISHER
+ else
+ echo >&2 "Warning: $s does not exist"
+ fi
+done