Skip to content

Commit

Permalink
Merge pull request #4403 from mheon/cherrypick_163
Browse files Browse the repository at this point in the history
Cherrypicks for v1.6.3 final
  • Loading branch information
openshift-merge-robot authored Oct 31, 2019
2 parents a15a20d + 28ad439 commit 95b2fd6
Show file tree
Hide file tree
Showing 210 changed files with 1,682 additions and 1,403 deletions.
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*
65 changes: 30 additions & 35 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ export GOPROXY=https://proxy.golang.org

GO ?= go
DESTDIR ?=
EPOCH_TEST_COMMIT ?= 2b0892e757c878cdb087dd22b8986bccef0276ed
EPOCH_TEST_COMMIT ?= ac73fd3fe5dcbf2647d589f9c9f37fe9531ed663
HEAD ?= HEAD
CHANGELOG_BASE ?= HEAD~
CHANGELOG_TARGET ?= HEAD
Expand Down Expand Up @@ -73,8 +73,8 @@ ASMFLAGS ?= all=-trimpath=${PWD}
LDFLAGS_PODMAN ?= $(LDFLAGS) \
-X $(LIBPOD)/define.gitCommit=$(GIT_COMMIT) \
-X $(LIBPOD)/define.buildInfo=$(BUILD_INFO) \
-X $(LIBPOD).installPrefix=$(PREFIX) \
-X $(LIBPOD).etcDir=$(ETCDIR)
-X $(LIBPOD)/config._installPrefix=$(PREFIX) \
-X $(LIBPOD)/config._etcDir=$(ETCDIR)
#Update to LIBSECCOMP_COMMIT should reflect in Dockerfile too.
LIBSECCOMP_COMMIT := release-2.3
# Rarely if ever should integration tests take more than 50min,
Expand Down Expand Up @@ -167,13 +167,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-windows-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 @@ -196,7 +194,6 @@ clean: ## Clean artifacts
$(wildcard podman*.tar.gz) \
bin \
build \
docs/remote \
test/checkseccomp/checkseccomp \
test/goecho/goecho \
test/testdata/redis-image \
Expand All @@ -205,9 +202,7 @@ clean: ## Clean artifacts
libpod/pod_ffjson.go \
libpod/container_easyjson.go \
libpod/pod_easyjson.go \
$(MANPAGES) ||:
find . -name \*~ -delete
find . -name \#\* -delete
docs/build

libpodimage: ## Build the libpod image
${CONTAINER_RUNTIME} build -t ${LIBPOD_IMAGE} .
Expand Down Expand Up @@ -312,20 +307,26 @@ install.catatonit:

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

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

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

docs: $(MANPAGES) ## Generate documentation
docdir:
mkdir -p docs/build/man

install-podman-remote-docs: podman-remote docs
rm -rf docs/remote
docs/podman-remote.sh darwin docs/remote docs
docs: docdir $(MANPAGES) ## Generate documentation

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 $* docs/build/remote/$* $(if $(findstring windows,$*),docs/source/markdown,docs/build/man)

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

# When publishing releases include critical build-time details
.PHONY: release.txt
Expand All @@ -349,7 +350,7 @@ podman-v$(RELEASE_NUMBER).tar.gz: binaries docs release.txt

# Must call make in-line: Dependency-spec. w/ wild-card also consumes variable value.
podman-remote-v$(RELEASE_NUMBER)-%.zip:
$(MAKE) podman-remote-$* install-podman-remote-docs release.txt \
$(MAKE) podman-remote-$* install-podman-remote-$*-docs release.txt \
RELEASE_BASENAME=$(shell hack/get_release_info.sh REMOTENAME) \
RELEASE_DIST=$* RELEASE_DIST_VER="-"
$(eval TMPDIR := $(shell mktemp -d -p '' $podman_remote_XXXX))
Expand All @@ -359,13 +360,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 Expand Up @@ -408,9 +403,9 @@ install.bin: podman
install.man: docs
install ${SELINUXOPT} -d -m 755 $(DESTDIR)$(MANDIR)/man1
install ${SELINUXOPT} -d -m 755 $(DESTDIR)$(MANDIR)/man5
install ${SELINUXOPT} -m 644 $(filter %.1,$(MANPAGES)) -t $(DESTDIR)$(MANDIR)/man1
install ${SELINUXOPT} -m 644 $(filter %.5,$(MANPAGES)) -t $(DESTDIR)$(MANDIR)/man5
install ${SELINUXOPT} -m 644 docs/links/*1 -t $(DESTDIR)$(MANDIR)/man1
install ${SELINUXOPT} -m 644 $(filter %.1,$(MANPAGES_DEST)) -t $(DESTDIR)$(MANDIR)/man1
install ${SELINUXOPT} -m 644 $(filter %.5,$(MANPAGES_DEST)) -t $(DESTDIR)$(MANDIR)/man5
install ${SELINUXOPT} -m 644 docs/source/markdown/links/*1 -t $(DESTDIR)$(MANDIR)/man1

install.config:
install ${SELINUXOPT} -d -m 755 $(DESTDIR)$(SHAREDIR_CONTAINERS)
Expand Down Expand Up @@ -444,16 +439,16 @@ install.systemd:
install ${SELINUXOPT} -m 644 contrib/varlink/podman.conf ${DESTDIR}${TMPFILESDIR}/podman.conf

uninstall:
for i in $(filter %.1,$(MANPAGES)); do \
for i in $(filter %.1,$(MANPAGES_DEST)); do \
rm -f $(DESTDIR)$(MANDIR)/man1/$$(basename $${i}); \
done; \
for i in $(filter %.5,$(MANPAGES)); do \
for i in $(filter %.5,$(MANPAGES_DEST)); do \
rm -f $(DESTDIR)$(MANDIR)/man5/$$(basename $${i}); \
done

.PHONY: .gitvalidation
.gitvalidation: .gopathok
GIT_CHECK_EXCLUDE="./vendor:docs/rtd/make.bat" $(GOBIN)/git-validation -v -run DCO,short-subject,dangling-whitespace -range $(EPOCH_TEST_COMMIT)..$(HEAD)
GIT_CHECK_EXCLUDE="./vendor:docs/make.bat" $(GOBIN)/git-validation -v -run DCO,short-subject,dangling-whitespace -range $(EPOCH_TEST_COMMIT)..$(HEAD)

.PHONY: install.tools
install.tools: .install.gitvalidation .install.gometalinter .install.md2man .install.ginkgo .install.golangci-lint ## Install needed tools
Expand Down
4 changes: 2 additions & 2 deletions cmd/podman/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
buildahcli "github.com/containers/buildah/pkg/cli"
"github.com/containers/image/v5/types"
"github.com/containers/libpod/cmd/podman/cliconfig"
"github.com/containers/libpod/libpod"
"github.com/containers/libpod/libpod/define"
"github.com/containers/libpod/pkg/adapter"
"github.com/docker/go-units"
"github.com/opencontainers/runtime-spec/specs-go"
Expand Down Expand Up @@ -260,7 +260,7 @@ func buildCmd(c *cliconfig.BuildValues) error {
if err != nil {
return err
}
if conf != nil && conf.CgroupManager == libpod.SystemdCgroupsManager {
if conf != nil && conf.CgroupManager == define.SystemdCgroupsManager {
runtimeFlags = append(runtimeFlags, "--systemd-cgroup")
}
// end from buildah
Expand Down
11 changes: 6 additions & 5 deletions cmd/podman/main_local.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ import (

"github.com/containers/libpod/cmd/podman/cliconfig"
"github.com/containers/libpod/cmd/podman/libpodruntime"
"github.com/containers/libpod/libpod"
"github.com/containers/libpod/libpod/config"
"github.com/containers/libpod/libpod/define"
"github.com/containers/libpod/pkg/cgroups"
"github.com/containers/libpod/pkg/rootless"
"github.com/containers/libpod/pkg/tracing"
Expand All @@ -32,8 +33,8 @@ import (
const remote = false

func init() {
cgroupManager := libpod.SystemdCgroupsManager
if runtimeConfig, err := libpod.DefaultRuntimeConfig(); err == nil {
cgroupManager := define.SystemdCgroupsManager
if runtimeConfig, err := config.NewConfig(""); err == nil {
cgroupManager = runtimeConfig.CgroupManager
}
cgroupHelp := "Cgroup manager to use (cgroupfs or systemd)"
Expand Down Expand Up @@ -181,7 +182,7 @@ func setupRootless(cmd *cobra.Command, args []string) error {
if !ownsCgroup {
unitName := fmt.Sprintf("podman-%d.scope", os.Getpid())
if err := utils.RunUnderSystemdScope(os.Getpid(), "user.slice", unitName); err != nil {
if conf.CgroupManager == libpod.SystemdCgroupsManager {
if conf.CgroupManager == define.SystemdCgroupsManager {
logrus.Warnf("Failed to add podman to systemd sandbox cgroup: %v", err)
} else {
logrus.Debugf("Failed to add podman to systemd sandbox cgroup: %v", err)
Expand Down Expand Up @@ -225,7 +226,7 @@ func setupRootless(cmd *cobra.Command, args []string) error {
if err != nil {
return err
}
if conf.CgroupManager == libpod.SystemdCgroupsManager {
if conf.CgroupManager == define.SystemdCgroupsManager {
logrus.Warnf("Failed to add pause process to systemd sandbox cgroup: %v", err)
} else {
logrus.Debugf("Failed to add pause process to systemd sandbox cgroup: %v", err)
Expand Down
23 changes: 23 additions & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Minimal makefile for Sphinx documentation
#

# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = source
BUILDDIR = build

# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

clean:
rm -fr build/

.PHONY: help Makefile

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
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 |
File renamed without changes.
55 changes: 29 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,20 +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)
## 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 $dir/links/$file ]]; then
markdown=$dir/links/$file
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 @@ -70,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.
Loading

0 comments on commit 95b2fd6

Please sign in to comment.