diff --git a/.travis.yml b/.travis.yml index 3198a18263..9db943b3f5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,143 +1,104 @@ # Copyright 2012-2019 the Pacemaker project contributors # # The version control history for this file may have further details. # Control file for the Travis autobuilder # https://docs.travis-ci.com/user/customizing-the-build/ language: c +# We build with both gcc and clang. If MAINT_EXTRA=1 (gcc only), the +# schema regression tests will additionally be run. matrix: include: - compiler: gcc - env: MAINT_EXTRA=0 + env: MAINT_EXTRA=1 - compiler: clang env: MAINT_EXTRA=0 - #- compiler: cov-build - # env: MAINT_EXTRA=0 - - compiler: gcc - env: MAINT_EXTRA=1 - -env: - global: - - # -- BEGIN Coverity Scan ENV - # Used by https://scan.coverity.com/scripts/travisci_build_coverity_scan.sh - # The build command with all of the arguments that you would apply to a manual `cov-build` - - COVERITY_SCAN_BUILD_COMMAND="make" - - # Email address for notifications related to this build - - OWNER_EMAIL="admin@clusterlabs.org" - - # Regular expression selects on which branches to run analysis - # Be aware of quotas. Do not run on every branch/commit - - COVERITY_SCAN_BRANCH_PATTERN="1.1" - - # COVERITY_SCAN_TOKEN via "travis encrypt" using the repo's public key - - secure: "qnrF7L8RejLUY7URdNe7XP4Hu4R55C0tvAuMRg4EjVtelOpw+nIgA7BLiX19q/70VjFuKcGnMhW28TdYl0uwMMdWKKxmwTim04Sy3UfOE2BPeuQOBphr+8s9gd0U1MO8j2dZ84A40t5Mkk946wWZwT0okpjOr/PfBOZkU3o87FM=" - - # -- END Coverity Scan ENV cache: directories: - xml/.relaxng.org # sudo add-apt-repository ppa:hotot-team before_install: - sudo add-apt-repository "deb http://archive.ubuntu.com/ubuntu/ trusty main" - sudo apt-get update -qq # To switch to Travis-CI's containerized (non-sudo) architecture, # all our dependencies need to be on Travis's whitelist: # https://github.com/travis-ci/apt-package-whitelist # # The only ones that aren't already are: # - cluster-glue-dev: see open issue: # https://github.com/travis-ci/apt-package-whitelist/issues/2936 # - resource-agents: see open issue: # https://github.com/travis-ci/apt-package-whitelist/issues/4261 # - libdbus-1-dev: see multiple open issues: # https://github.com/travis-ci/apt-package-whitelist/issues?utf8=%E2%9C%93&q=is%3Aissue+libdbus+-1-dev # (a workaround is to install libdbus-glib-1-dev, which depends on it and is whitelisted) install: - - test $MAINT_EXTRA -ne 0 - || sudo apt-get install -qq + - sudo apt-get install -qq automake autoconf libtool python python-dev libbz2-dev libdbus-1-dev libglib2.0-dev libgnutls-dev libltdl-dev libncurses5-dev libpam0g-dev libxml2-dev libxslt1-dev uuid-dev libqb-dev libcfg-dev libcmap-dev libcorosync-common-dev libcpg-dev libquorum-dev libsam-dev libtotem-pg-dev libvotequorum-dev cluster-glue-dev resource-agents - - test $MAINT_EXTRA -eq 0 - || sudo apt-get install -qq - make libxml2-utils xsltproc + - test $MAINT_EXTRA -eq 0 || sudo apt-get install -qq libxml2-utils xsltproc before_script: -# Save and restore CC so that ./configure can pass; # some tests (e.g. cts-exec-helper) require actual system-wide credentials - - test $MAINT_EXTRA -ne 0 || { - export CC_SAVED=$CC; - export CC=$(echo ${CC} | sed s/cov-build/gcc/); - sed -e 's|^\(CRM_DAEMON_USER=\).*$|\1nobody|' + - sed -e 's|^\(CRM_DAEMON_USER=\).*$|\1nobody|' -e 's|^\(CRM_DAEMON_GROUP=\).*$|\1nobody|' - -i -- configure.ac; - ./autogen.sh; - ./configure; - export CC=$CC_SAVED; - } - - test $MAINT_EXTRA -eq 0 || ( - cd xml; - { cat Makefile.am; printf 'hack_rng\x3a %s' '${RNG_generated}'; } - | make -f- top_srcdir=$(pwd)/.. top_builddir=$(pwd)/.. hack_rng - ) + -i -- configure.ac + - ./autogen.sh + - ./configure script: -# XXX Is the following item needed? -- test $MAINT_EXTRA -ne 0 || test ${CC} = cov-build - || sudo make install-exec-local || true -- test $MAINT_EXTRA -ne 0 || test ${CC} = cov-build - || { make && ./cts/cts-regression -V cli scheduler exec; } -- test $MAINT_EXTRA -ne 0 || test ${CC} != cov-build - || export CC=gcc; bash ./maint/travisci_build_coverity_scan.sh +# Create directories needed by commands used by regression tests +- sudo make install-exec-local || true +- make +- ./cts/cts-regression -V cli scheduler exec - test $MAINT_EXTRA -eq 0 || { { echo 'looking for presence of control characters...'; { git ls-files | xargs grep -Ensv "^([^[:cntrl:]]*|$(printf '\t'))*$"||:; } 2>/dev/null | { ! grep -Ev '^Binary file' && echo 'ALL OK'; }; } && ( cd xml; ./regression.sh && ./regression.sh -B && ./regression.sh -S && { schemas=; for schema in *.rng; do case ${schema} in *cibtr*);; *)schemas="${schemas} ${schema}";; esac; done; test -s .relaxng.org/relaxng.rng 2>/dev/null || curl --create-dirs -SsLo .relaxng.org/relaxng.rng 'https://raw.githubusercontent.com/relaxng/relaxng.org/master/relaxng.rng'; xmllint --noout --relaxng .relaxng.org/relaxng.rng ${schemas}; } ); } #after_script: #after_success: after_failure: - lsb_release -a - sudo cat /etc/apt/sources.list - whoami - env | sort - cat include/config.h notifications: irc: "irc.freenode.org#pcmk" # email: # recipients: # - developers@clusterlabs.org # whitelist branches: only: - master - "1.1" - "2.0" diff --git a/GNUmakefile b/GNUmakefile index 4ecc7b2802..a1c36dfd36 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -1,395 +1,395 @@ # # Copyright 2008-2019 the Pacemaker project contributors # # The version control history for this file may have further details. # # This source code is licensed under the GNU General Public License version 2 # or later (GPLv2+) WITHOUT ANY WARRANTY. # default: $(shell test ! -e configure && echo init) $(shell test -e configure && echo core) -include Makefile PACKAGE ?= pacemaker # Force 'make dist' to be consistent with 'make export' distdir = $(PACKAGE)-$(TAG) TARFILE = $(PACKAGE)-$(SHORTTAG).tar.gz DIST_ARCHIVES = $(TARFILE) RPM_ROOT = $(shell pwd) RPM_OPTS = --define "_sourcedir $(RPM_ROOT)" \ --define "_specdir $(RPM_ROOT)" \ --define "_srcrpmdir $(RPM_ROOT)" \ MOCK_OPTIONS ?= --resultdir=$(RPM_ROOT)/mock --no-cleanup-after # Default to building Fedora-compliant spec files # SLES: /etc/SuSE-release # openSUSE: /etc/SuSE-release # RHEL: /etc/redhat-release, /etc/system-release # Fedora: /etc/fedora-release, /etc/redhat-release, /etc/system-release # CentOS: /etc/centos-release, /etc/redhat-release, /etc/system-release F ?= $(shell test ! -e /etc/fedora-release && echo 0; test -e /etc/fedora-release && rpm --eval %{fedora}) ARCH ?= $(shell test -e /etc/fedora-release && rpm --eval %{_arch}) MOCK_CFG ?= $(shell test -e /etc/fedora-release && echo fedora-$(F)-$(ARCH)) DISTRO ?= $(shell test -e /etc/SuSE-release && echo suse; echo fedora) COMMIT ?= HEAD -TAG ?= $(shell T=$$(git describe --all '$(COMMIT)' | sed -n 's|tags/\(.*\)|\1|p'); \ +TAG ?= $(shell T=$$(git describe --all '$(COMMIT)' 2>/dev/null | sed -n 's|tags/\(.*\)|\1|p'); \ test -n "$${T}" && echo "$${T}" \ - || git log --pretty=format:%H -n 1 '$(COMMIT)') + || git log --pretty=format:%H -n 1 '$(COMMIT)' 2>/dev/null || echo DIST) lparen = ( rparen = ) -SHORTTAG ?= $(shell case $(TAG) in Pacemaker-*$(rparen) echo '$(TAG)' | cut -c11-;; \ +SHORTTAG ?= $(shell case $(TAG) in Pacemaker-*|DIST$(rparen) echo '$(TAG)' | cut -c11-;; \ *$(rparen) git log --pretty=format:%h -n 1 '$(TAG)';; esac) SHORTTAG_ABBREV = $(shell printf %s '$(SHORTTAG)' | wc -c) WITH ?= --without doc #WITH ?= --without=doc --with=gcov LAST_RC ?= $(shell test -e /Volumes || git tag -l | grep Pacemaker | sort -Vr | grep rc | head -n 1) ifneq ($(origin VERSION), undefined) LAST_RELEASE ?= Pacemaker-$(VERSION) else LAST_RELEASE ?= $(shell git tag -l | grep Pacemaker | sort -Vr | grep -v rc | head -n 1) endif NEXT_RELEASE ?= $(shell echo $(LAST_RELEASE) | awk -F. '/[0-9]+\./{$$3+=1;OFS=".";print $$1,$$2,$$3}') BUILD_COUNTER ?= build.counter LAST_COUNT = $(shell test ! -e $(BUILD_COUNTER) && echo 0; test -e $(BUILD_COUNTER) && cat $(BUILD_COUNTER)) COUNT = $(shell expr 1 + $(LAST_COUNT)) SPECVERSION ?= $(COUNT) # rpmbuild wrapper that translates "--with[out] FEATURE" into RPM macros # # Unfortunately, at least recent versions of rpm do not support mentioned # switch. To work this around, we can emulate mechanism that rpm uses # internally: unfold the flags into respective macro definitions: # # --with[out] FOO -> --define "_with[out]_FOO --with[out]-FOO" # # $(1) ... WITH string (e.g., --with pre_release --without doc) # $(2) ... options following the initial "rpmbuild" in the command # $(3) ... final arguments determined with $2 (e.g., pacemaker.spec) # # Note that if $(3) is a specfile, extra case is taken so as to reflect # pcmkversion correctly (using in-place modification). # # Also note that both ways to specify long option with an argument # (i.e., what getopt and, importantly, rpm itself support) can be used: # # --with FOO # --with=FOO rpmbuild-with = \ WITH=$$(getopt -o "" -l with:,without: -- $(1)) || exit 1; \ CMD='rpmbuild $(2)'; PREREL=0; \ eval set -- "$${WITH}"; \ while true; do \ case "$$1" in \ --with) CMD="$${CMD} --define \"_with_$$2 --with-$$2\""; \ [ "$$2" != pre_release ] || PREREL=1; shift 2;; \ --without) CMD="$${CMD} --define \"_without_$$2 --without-$$2\""; \ [ "$$2" != pre_release ] || PREREL=0; shift 2;; \ --) shift ; break ;; \ *) echo "cannot parse WITH: $$1"; exit 1;; \ esac; \ done; \ case "$(3)" in \ *.spec) { [ $${PREREL} -eq 0 ] || [ $(LAST_RELEASE) = $(TAG) ]; } \ && sed -i "s/^\(%global pcmkversion \).*/\1$$(echo $(LAST_RELEASE) | sed -e s:Pacemaker-:: -e s:-.*::)/" $(3) \ || sed -i "s/^\(%global pcmkversion \).*/\1$$(echo $(NEXT_RELEASE) | sed -e s:Pacemaker-:: -e s:-.*::)/" $(3);; \ esac; \ CMD="$${CMD} $(3)"; \ eval "$${CMD}" init: ./autogen.sh # @TODO This should probably be what init does .PHONY: init-if-needed init-if-needed: test -e configure || ./autogen.sh test -e Makefile || ./configure export: rm -f $(PACKAGE)-dirty.tar.* $(PACKAGE)-tip.tar.* $(PACKAGE)-HEAD.tar.* if [ ! -f $(TARFILE) ]; then \ rm -f $(PACKAGE).tar.*; \ if [ $(TAG) = dirty ]; then \ git commit -m "DO-NOT-PUSH" -a; \ git archive --prefix=$(distdir)/ -o "$(TARFILE)" HEAD^{tree}; \ git reset --mixed HEAD^; \ else \ git archive --prefix=$(distdir)/ -o "$(TARFILE)" $(TAG)^{tree}; \ fi; \ echo `date`: Rebuilt $(TARFILE); \ else \ echo `date`: Using existing tarball: $(TARFILE); \ fi $(PACKAGE)-opensuse.spec: $(PACKAGE)-suse.spec cp $^ $@ @echo Rebuilt $@ $(PACKAGE)-suse.spec: $(PACKAGE).spec.in GNUmakefile rm -f $@ if [ x != x"`git ls-files -m | grep pacemaker.spec.in`" ]; then \ cp $(PACKAGE).spec.in $@; \ echo "Rebuilt $@ (local modifications)"; \ elif [ x = x"`git show $(TAG):pacemaker.spec.in 2>/dev/null`" ]; then \ cp $(PACKAGE).spec.in $@; \ echo "Rebuilt $@"; \ else \ git show $(TAG):$(PACKAGE).spec.in >> $@; \ echo "Rebuilt $@ from $(TAG)"; \ fi sed -i \ -e 's:%{_docdir}/%{name}:%{_docdir}/%{name}-%{version}:g' \ -e 's:%{name}-libs:lib%{name}3:g' \ -e 's: libtool-ltdl-devel\(%{?_isa}\)\?::g' \ -e 's:bzip2-devel:libbz2-devel:g' \ -e 's:docbook-style-xsl:docbook-xsl-stylesheets:g' \ -e 's: byacc::g' \ -e 's:gnutls-devel:libgnutls-devel:g' \ -e 's:corosynclib:libcorosync:g' \ -e 's:cluster-glue-libs:libglue:g' \ -e 's:shadow-utils:shadow:g' \ -e 's: publican::g' \ -e 's: 189: 90:g' \ -e 's:%{_libexecdir}/lcrso:%{_libdir}/lcrso:g' \ -e 's:procps-ng:procps:g' \ $@ @echo "Applied SUSE-specific modifications" # Works for all fedora based distros $(PACKAGE)-%.spec: $(PACKAGE).spec.in rm -f $@ if [ x != x"`git ls-files -m | grep pacemaker.spec.in`" ]; then \ cp $(PACKAGE).spec.in $(PACKAGE)-$*.spec; \ echo "Rebuilt $@ (local modifications)"; \ elif [ x = x"`git show $(TAG):pacemaker.spec.in 2>/dev/null`" ]; then \ cp $(PACKAGE).spec.in $(PACKAGE)-$*.spec; \ echo "Rebuilt $@"; \ else \ git show $(TAG):$(PACKAGE).spec.in >> $(PACKAGE)-$*.spec; \ echo "Rebuilt $@ from $(TAG)"; \ fi srpm-%: export $(PACKAGE)-%.spec rm -f *.src.rpm cp $(PACKAGE)-$*.spec $(PACKAGE).spec echo "* $(shell date +"%a %b %d %Y") Andrew Beekhof $(shell git describe --tags $(TAG) | sed -e s:Pacemaker-:: -e s:-.*::)-1" >> $(PACKAGE).spec echo " - See included ChangeLog file or https://raw.github.com/ClusterLabs/pacemaker/master/ChangeLog for full details" >> $(PACKAGE).spec if [ -e $(BUILD_COUNTER) ]; then \ echo $(COUNT) > $(BUILD_COUNTER); \ fi sed -e 's/global\ specversion\ .*/global\ specversion\ $(SPECVERSION)/' \ -e 's/global\ commit\ .*/global\ commit\ $(TAG)/' \ -e 's/global\ commit_abbrev\ .*/global\ commit_abbrev\ $(SHORTTAG_ABBREV)/' \ -i $(PACKAGE).spec $(call rpmbuild-with,$(WITH),-bs --define "dist .$*" $(RPM_OPTS),$(PACKAGE).spec) chroot: mock-$(MOCK_CFG) mock-install-$(MOCK_CFG) mock-sh-$(MOCK_CFG) - echo "Done" + @echo "Done" mock-next: make F=$(shell expr 1 + $(F)) mock mock-rawhide: make F=rawhide mock mock-install-%: - echo "Installing packages" + @echo "Installing packages" mock --root=$* $(MOCK_OPTIONS) --install $(RPM_ROOT)/mock/*.rpm vi sudo valgrind lcov gdb fence-agents psmisc mock-install: mock-install-$(MOCK_CFG) - echo "Done" + @echo "Done" mock-sh: mock-sh-$(MOCK_CFG) - echo "Done" + @echo "Done" mock-sh-%: - echo "Connecting" + @echo "Connecting" mock --root=$* $(MOCK_OPTIONS) --shell - echo "Done" + @echo "Done" # eg. make WITH="--with pre_release" rpm mock-%: make srpm-$(firstword $(shell echo $(@:mock-%=%) | tr '-' ' ')) -rm -rf $(RPM_ROOT)/mock @echo "mock --root=$* --rebuild $(WITH) $(MOCK_OPTIONS) $(RPM_ROOT)/*.src.rpm" mock --root=$* --no-cleanup-after --rebuild $(WITH) $(MOCK_OPTIONS) $(RPM_ROOT)/*.src.rpm srpm: srpm-$(DISTRO) - echo "Done" + @echo "Done" mock: mock-$(MOCK_CFG) - echo "Done" + @echo "Done" rpm-dep: $(PACKAGE)-$(DISTRO).spec if [ x != x`which yum-builddep 2>/dev/null` ]; then \ echo "Installing with yum-builddep"; \ sudo yum-builddep $(PACKAGE)-$(DISTRO).spec; \ elif [ x != x`which yum 2>/dev/null` ]; then \ echo -e "Installing: $(shell grep BuildRequires pacemaker.spec.in | sed -e s/BuildRequires:// -e s:\>.*0:: | tr '\n' ' ')\n\n"; \ sudo yum install $(shell grep BuildRequires pacemaker.spec.in | sed -e s/BuildRequires:// -e s:\>.*0:: | tr '\n' ' '); \ elif [ x != x`which zypper` ]; then \ echo -e "Installing: $(shell grep BuildRequires pacemaker.spec.in | sed -e s/BuildRequires:// -e s:\>.*0:: | tr '\n' ' ')\n\n"; \ sudo zypper install $(shell grep BuildRequires pacemaker.spec.in | sed -e s/BuildRequires:// -e s:\>.*0:: | tr '\n' ' ');\ else \ echo "I don't know how to install $(shell grep BuildRequires pacemaker.spec.in | sed -e s/BuildRequires:// -e s:\>.*0:: | tr '\n' ' ')";\ fi rpm: srpm @echo To create custom builds, edit the flags and options in $(PACKAGE).spec first $(call rpmbuild-with,$(WITH),$(RPM_OPTS),--rebuild $(RPM_ROOT)/*.src.rpm) release: make TAG=$(LAST_RELEASE) rpm rc: make TAG=$(LAST_RC) rpm dirty: make TAG=dirty mock ## Static analysis via coverity # Aggressiveness (low, medium, or high) COVLEVEL ?= low # Generated outputs COVERITY_DIR = $(builddir)/coverity-$(TAG) COVTAR = $(builddir)/$(PACKAGE)-coverity-$(TAG).tgz COVEMACS = $(builddir)/$(TAG).coverity COVHTML = $(COVERITY_DIR)/output/errors # Coverity outputs are phony so they get rebuilt every invocation .PHONY: $(COVERITY_DIR) $(COVERITY_DIR): init-if-needed core-clean coverity-clean $(AM_V_GEN)cov-build --dir "$@" $(MAKE) $(AM_MAKEFLAGS) core # Public coverity instance .PHONY: $(COVTAR) $(COVTAR): $(COVERITY_DIR) $(AM_V_GEN)tar czf "$@" --transform="s@.*$(TAG)@cov-int@" "$<" .PHONY: coverity coverity: $(COVTAR) @echo "Now go to https://scan.coverity.com/users/sign_in and upload:" @echo " $(COVTAR)" @echo "then make core-clean coverity-clean" # Licensed coverity instance # # The prerequisites are a little hacky; rather than actually required, some # of them are designed so that things execute in the proper order (which is # not the same as GNU make's order-only prerequisites). .PHONY: coverity-analyze coverity-analyze: $(COVERITY_DIR) @echo "" @echo "Analyzing (waiting for coverity license if necessary) ..." cov-analyze --dir "$<" --wait-for-license --security \ --aggressiveness-level "$(COVLEVEL)" .PHONY: $(COVEMACS) $(COVEMACS): coverity-analyze $(AM_V_GEN)cov-format-errors --dir "$(COVERITY_DIR)" --emacs-style > "$@" .PHONY: $(COVHTML) $(COVHTML): $(COVEMACS) $(AM_V_GEN)cov-format-errors --dir "$(COVERITY_DIR)" --html-output "$@" .PHONY: coverity-corp coverity-corp: $(COVHTML) $(MAKE) $(AM_MAKEFLAGS) core-clean @echo "Done. See:" @echo " file://$(abs_builddir)/$(COVHTML)/index.html" @echo "When no longer needed, make coverity-clean" # Remove all outputs regardless of tag .PHONY: coverity-clean coverity-clean: -rm -rf "$(builddir)"/coverity-* \ "$(builddir)"/$(PACKAGE)-coverity-*.tgz \ "$(builddir)"/*.coverity ## Change log generation summary: @printf "\n* `date +"%a %b %d %Y"` `git config user.name` <`git config user.email`> $(NEXT_RELEASE)-1" @printf "\n- Changesets: `git log --pretty=oneline $(LAST_RELEASE)..HEAD | wc -l`" @printf "\n- Diff: " @git diff $(LAST_RELEASE)..HEAD --shortstat include lib daemons tools xml rc-changes: @make NEXT_RELEASE=$(shell echo $(LAST_RC) | sed s:-rc.*::) LAST_RELEASE=$(LAST_RC) changes changes: summary @printf "\n- Features added since $(LAST_RELEASE)\n" @git log --pretty=format:' +%s' --abbrev-commit $(LAST_RELEASE)..HEAD | grep -e Feature: | sed -e 's@Feature:@@' | sort -uf @printf "\n- Changes since $(LAST_RELEASE)\n" @git log --pretty=format:' +%s' --no-merges --abbrev-commit $(LAST_RELEASE)..HEAD \ | grep -e High: -e Fix: -e Bug | sed \ -e 's@\(Fix\|High\|Bug\):@@' \ -e 's@\(cib\|pacemaker-based\|based\):@CIB:@' \ -e 's@\(crmd\|pacemaker-controld\|controld\):@controller:@' \ -e 's@\(lrmd\|pacemaker-execd\|execd\):@executor:@' \ -e 's@\(Fencing\|stonithd\|stonith\|pacemaker-fenced\|fenced\):@fencing:@' \ -e 's@\(PE\|pengine\|pacemaker-schedulerd\|schedulerd\):@scheduler:@' \ | sort -uf authors: git log $(LAST_RELEASE)..$(COMMIT) --format='%an' | sort -u changelog: @make changes > ChangeLog @printf "\n">> ChangeLog git show $(LAST_RELEASE):ChangeLog >> ChangeLog DO_NOT_INDENT = lib/gnu daemons/controld/controld_fsa.h indent: find . -name "*.[ch]" -exec ./p-indent \{\} \; git co HEAD $(DO_NOT_INDENT) rel-tags: tags find . -name TAGS -exec sed -i 's:\(.*\)/\(.*\)/TAGS:\2/TAGS:g' \{\} \; CLANG_analyzer = $(shell which scan-build) CLANG_checkers = # Use CPPCHECK_ARGS to pass extra cppcheck options, e.g.: # --enable={warning,style,performance,portability,information,all} # --inconclusive --std=posix CPPCHECK_ARGS ?= cppcheck: cppcheck $(CPPCHECK_ARGS) -I include --max-configs=25 -q replace lib daemons tools clang: test -e $(CLANG_analyzer) scan-build $(CLANG_checkers:%=-enable-checker %) make clean all # V3 = scandir unsetenv alphasort xalloc # V2 = setenv strerror strchrnul strndup # https://www.gnu.org/software/gnulib/manual/html_node/Initial-import.html#Initial-import # previously, this was crypto/md5, but got spoiled with streams/kernel crypto GNU_MODS = crypto/md5-buffer # stdint appears to be surrogate only for C99-lacking environments GNU_MODS_AVOID = stdint # only for plain crypto/md5: we make do without kernel-assisted crypto # GNU_MODS_AVOID += crypto/af_alg gnulib-update: -test -e maint/gnulib \ || git clone https://git.savannah.gnu.org/git/gnulib.git maint/gnulib cd maint/gnulib && git pull maint/gnulib/gnulib-tool \ --source-base=lib/gnu --lgpl=2 --no-vc-files --no-conditional-dependencies \ $(GNU_MODS_AVOID:%=--avoid %) --import $(GNU_MODS) diff --git a/Makefile.am b/Makefile.am index 62eabd5295..de695c0825 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,74 +1,96 @@ # # Copyright 2003-2019 the Pacemaker project contributors # # The version control history for this file may have further details. # # This source code is licensed under the GNU General Public License version 2 # or later (GPLv2+) WITHOUT ANY WARRANTY. # -EXTRA_DIST = autogen.sh m4/gnulib-cache.m4 +EXTRA_DIST = CONTRIBUTING.md \ + GNUmakefile \ + INSTALL.md \ + README.markdown \ + autogen.sh \ + pacemaker.spec.in \ + rpmlintrc \ + m4/gnulib-cache.m4 \ + m4/gnulib-tool.m4 MAINTAINERCLEANFILES = Makefile.in aclocal.m4 configure DRF/config-h.in \ DRF/stamp-h.in libtool.m4 ltdl.m4 +# Disable building Publican documentation when doing "make distcheck", because +# some of our book sources are in the source directory, while others are +# dynamically generated in the build directory, and publican can't handle that. +# +# @TODO To support VPATH builds for Publican, we'd probably have to create +# a separate subtree of the build directory to use as Publican's source +# directory, and copy the static sources into it. +AM_DISTCHECK_CONFIGURE_FLAGS = --with-brand="" + # Only these will get installed with a plain "make install" CORE_INSTALL = replace include lib daemons tools xml # Only these will get built with a plain "make" or "make clean" CORE = $(CORE_INSTALL) cts SUBDIRS = $(CORE) doc extra maint AM_CPPFLAGS = -I$(top_srcdir)/include doc_DATA = README.markdown COPYING licensedir = $(docdir)/licenses/ -license_DATA = $(wildcard licenses/*) +dist_license_DATA = $(wildcard licenses/*) # Scratch file for ad-hoc testing noinst_PROGRAMS = scratch nodist_scratch_SOURCES = scratch.c scratch_LDADD = $(top_builddir)/lib/common/libcrmcommon.la -lm scratch.c: echo 'int main(void){}' >$@ core: @echo "Building only core components and tests: $(CORE)" - list='$(CORE)'; for subdir in $$list; do echo "Building $$subdir"; $(MAKE) -C $$subdir all || exit 1; done + @for subdir in $(CORE); do \ + echo "Building $$subdir"; \ + $(MAKE) -C $$subdir all || exit 1; \ + done core-install: @echo "Installing only core components: $(CORE_INSTALL)" - list='$(CORE_INSTALL)'; \ - for subdir in $$list; do \ + @for subdir in $(CORE_INSTALL); do \ echo "Installing $$subdir"; \ $(MAKE) -C $$subdir install || exit 1; \ done core-clean: @echo "Cleaning only core components and tests: $(CORE)" - list='$(CORE)'; for subdir in $$list; do echo "Cleaning $$subdir"; $(MAKE) -C $$subdir clean || exit 1; done + @for subdir in $(CORE); do \ + echo "Cleaning $$subdir"; \ + $(MAKE) -C $$subdir clean || exit 1; \ + done install-exec-local: $(INSTALL) -d $(DESTDIR)/$(LCRSODIR) $(INSTALL) -d -m 750 $(DESTDIR)/$(PACEMAKER_CONFIG_DIR) $(INSTALL) -d -m 750 $(DESTDIR)/$(CRM_CONFIG_DIR) $(INSTALL) -d -m 750 $(DESTDIR)/$(CRM_CORE_DIR) $(INSTALL) -d -m 750 $(DESTDIR)/$(CRM_BLACKBOX_DIR) $(INSTALL) -d -m 770 $(DESTDIR)/$(CRM_LOG_DIR) $(INSTALL) -d -m 770 $(DESTDIR)/$(CRM_BUNDLE_DIR) -chgrp $(CRM_DAEMON_GROUP) $(DESTDIR)/$(PACEMAKER_CONFIG_DIR) -chown $(CRM_DAEMON_USER):$(CRM_DAEMON_GROUP) $(DESTDIR)/$(CRM_CONFIG_DIR) -chown $(CRM_DAEMON_USER):$(CRM_DAEMON_GROUP) $(DESTDIR)/$(CRM_CORE_DIR) -chown $(CRM_DAEMON_USER):$(CRM_DAEMON_GROUP) $(DESTDIR)/$(CRM_BLACKBOX_DIR) -chown $(CRM_DAEMON_USER):$(CRM_DAEMON_GROUP) $(DESTDIR)/$(CRM_LOG_DIR) -chown $(CRM_DAEMON_USER):$(CRM_DAEMON_GROUP) $(DESTDIR)/$(CRM_BUNDLE_DIR) # Use chown because the user/group may not exist clean-generic: rm -f $(TARFILE) *.tar.bz2 *.sed dist-clean-local: rm -f autoconf automake autoheader diff --git a/Makefile.common b/Makefile.common index 215b26c810..20bde69966 100644 --- a/Makefile.common +++ b/Makefile.common @@ -1,86 +1,101 @@ -# Not all current distros support AM_V_P +# +# Copyright 2014-2019 the Pacemaker project contributors +# +# The version control history for this file may have further details. +# +# This source code is licensed under the GNU General Public License version 2 +# or later (GPLv2+) WITHOUT ANY WARRANTY. +# + +# +# Some variables to help with silent rules # https://www.gnu.org/software/automake/manual/html_node/Automake-silent_002drules-Option.html +# +# We require a minimum automake version of 1.11, which includes AM_V_GEN and +# AM_V_at, but AM_V_P is not available until 1.13. V ?= $(AM_DEFAULT_VERBOSITY) -PCMK_V = $(pcmk__v_$(V)) -pcmk__v_0 = : -pcmk__v_1 = - +# When a make command is prefixed with one of the AM_V_* macros, it may also be +# desirable to suffix the command with this, to silence stdout. PCMK_quiet = $(pcmk_quiet_$(V)) -pcmk_quiet_0 = >/dev/null 2>&1 +pcmk_quiet_0 = >/dev/null pcmk_quiet_1 = -AM_V_XSL = $(am__v_XSL_$(V)) -am__v_XSL_0 = @echo " XSL " $@; -am__v_XSL_1 = - +# AM_V_GEN is intended to be used in custom pattern rules, and replaces echoing +# the command used with a more concise line with "GEN" and the name of the file +# being generated. Our AM_V_* macros are similar but more descriptive. AM_V_MAN = $(am__v_MAN_$(V)) -am__v_MAN_0 = @echo " MAN " $@; +am__v_MAN_0 = @echo " MAN $@"; am__v_MAN_1 = -AM_V_ASCII = $(am__v_ASCII_$(V)) -am__v_ASCII_0 = @echo " ASCII " $@; -am__v_ASCII_1 = +AM_V_SCHEMA = $(am__v_SCHEMA_$(V)) +am__v_SCHEMA_0 = @echo " SCHEMA $@"; +am__v_SCHEMA_1 = AM_V_PUB = $(am__v_PUB_$(V)) am__v_PUB_0 = @echo " PUB $@: $(DOCBOOK_FORMATS)"; am__v_PUB_1 = MAINTAINERCLEANFILES = Makefile.in AM_CPPFLAGS = -I$(top_builddir)/include -I$(top_srcdir)/include \ -I$(top_builddir)/libltdl -I$(top_srcdir)/libltdl +# +# Man page builders +# +# We have three types of man pages: +# - man pages for the tools +# - man pages for OCF agents +# - man pages for cluster properties used by daemons +# +# "BUILD_HELP" actually means "help2man is available", so it only controls the +# tool man pages, which are generated by help2man. The other man pages are +# generated via XSL transforms. +# + if BUILD_HELP man8_MANS = $(sbin_PROGRAMS:%=%.8) $(sbin_SCRIPTS:%=%.8) -endif HELP2MAN_ARGS = -N --section 8 --name "Part of the Pacemaker cluster resource manager" +# Some of our tools' help are just shell script invocations of another tool's +# help. Putting the real tool in MAN8DEPS helps detect when the wrapped help +# needs updating. +# +# If a ".inc" file exists, the tool has been converted to use glib for +# argument parsing, otherwise it still uses the libcrmcommon functions. +# +# @TODO Drop MAN8DEPS once we've converted all tools to libpacemaker API calls +# and all wrappers to C code. %.8: % $(MAN8DEPS) - chmod a+x $(abs_builddir)/$< - if [ -f $(abs_builddir)/$@.inc ]; then \ - $(AM_V_MAN)PATH=$(abs_builddir):$$PATH $(HELP2MAN) $(HELP2MAN_ARGS) -h --help-all -i $(abs_builddir)/$@.inc $(abs_builddir)/$< | sed -e '/.SS "Usage:"/,+3d' > $@ ; \ - else \ - $(AM_V_MAN)PATH=$(abs_builddir):$$PATH $(HELP2MAN) $(HELP2MAN_ARGS) $(abs_builddir)/$< --output $@ ; \ + $(AM_V_at)chmod a+x $(abs_builddir)/$< + $(AM_V_MAN)if [ -f $(abs_builddir)/$@.inc ]; then \ + PATH=$(abs_builddir):$$PATH $(HELP2MAN) $(HELP2MAN_ARGS) \ + -h --help-all \ + -i $(abs_builddir)/$@.inc $(abs_builddir)/$< \ + | sed -e '/.SS "Usage:"/,+3d' > $@ ; \ + else \ + PATH=$(abs_builddir):$$PATH $(HELP2MAN) $(HELP2MAN_ARGS) \ + $(abs_builddir)/$< --output $@ ; \ fi +endif +# Save raw XML meta-data from daemon executables, for later conversion into man +# pages. (Note that more specific rules may override this for creating other +# types of XML files.) %.xml: % - $(AM_V_GEN)$(abs_builddir)/$< metadata > $@ + $(AM_V_at)$(abs_builddir)/$< metadata > $@ +# Process the raw daemon and OCF agent meta-data output using our +# meta-data-to-docbook-XML tranform. %.dbook: %.xml - $(AM_V_XSL)$(XSLTPROC) --nonet --novalid --stringparam man.name $* $(DBOOK_OPTS) $(top_srcdir)/xml/ocf-meta2man.xsl $(abs_builddir)/$< > $(abs_builddir)/$@ + $(AM_V_at)$(XSLTPROC) --nonet --novalid --stringparam man.name $* \ + $(DBOOK_OPTS) $(top_srcdir)/xml/ocf-meta2man.xsl \ + $(abs_builddir)/$< > $(abs_builddir)/$@ +# Generate the actual man page for an OCF resource agent from the intermediate +# docbook XML. %.7: %.dbook - $(AM_V_XSL)$(XSLTPROC) $(MANPAGE_XSLT) $(abs_builddir)/$< $(PCMK_quiet) - -# Build docbook from asciidoc because XML is a PITA to edit -# -# Build each chapter as a book (since the numbering isn't right for -# articles and only books can have appendices) and then strip out the -# bits we don't want/need -# -# XXX Sequence of tr/sed commands should be replaced with a single XSLT -# -%.xml: %.txt -if IS_ASCIIDOC - $(AM_V_ASCII)$(ASCIIDOC_CONV) -b docbook -d book -o $@-tt $< -else - $(AM_V_ASCII)$(ASCIIDOC_CONV) -b docbook45 -d book -o $@-tt $< -endif - $(AM_V_at)tr -d '\036\r' <$@-tt >$@-t; rm -f $@-tt # Fix line endings - $(AM_V_at)sed -i 's/\ lang="en"//' $@-t # Never specify a language in the chapters - $(AM_V_at)sed -i 's/simpara/para/g' $@-t # publican doesn't correctly render footnotes with simpara - $(AM_V_at)sed -i 's/.*.*//g' $@-t # Remove dangling tag - $(AM_V_at)sed -i 's/.*preface>//g' $@-t # Remove preface elements - $(AM_V_at)sed -i 's:::g' $@-t # Remove empty title - $(AM_V_at)sed -i 's/chapter/section/g' $@-t # Chapters become sections, so that books can become chapters - $(AM_V_at)sed -i 's/<.*bookinfo.*>//g' $@-t # Strip out bookinfo, we don't need it - $(AM_V_at)! grep -q "//;tb;bf;:b;N;s/.*.*<\/title>.*//;tb;/<appendix/{:i;n;/<\/appendix/{p;d};bi};bb;:f;p;d' \ - $@-t # We just want the appendix tag (asciidoctor adds non-empty book-level title) - $(AM_V_at)sed -i 's/book>/chapter>/g' $@-t # Rename to chapter (won't trigger if previous sed did) - $(AM_V_GEN)mv $@-t $@ - -# echo Rebuilt $@ from $< + $(AM_V_MAN)$(XSLTPROC) $(MANPAGE_XSLT) $(abs_builddir)/$< $(PCMK_quiet) diff --git a/cts/Makefile.am b/cts/Makefile.am index bc4cedbf2b..4b4fc3243f 100644 --- a/cts/Makefile.am +++ b/cts/Makefile.am @@ -1,96 +1,100 @@ # # Copyright 2001-2019 the Pacemaker project contributors # # The version control history for this file may have further details. # # This source code is licensed under the GNU General Public License version 2 # or later (GPLv2+) WITHOUT ANY WARRANTY. # MAINTAINERCLEANFILES = Makefile.in -EXTRA_DIST = $(cts_SCRIPTS) $(cts_DATA) +noinst_SCRIPTS = cluster_test \ + OCFIPraTest.py -halibdir = $(CRM_DAEMON_DIR) -halib_SCRIPTS = cts-log-watcher cts-support +# Commands intended to be run only via other commands +halibdir = $(CRM_DAEMON_DIR) +dist_halib_SCRIPTS = cts-log-watcher \ + cts-support -# # Test commands and globally applicable test files should be in $(testdir), # and command-specific test data should be in a command-specific subdirectory. -# -testdir = $(datadir)/$(PACKAGE)/tests -test_SCRIPTS = cts-coverage cts-regression cts-cli cts-exec cts-scheduler \ - cts-fencing -test_DATA = README.md valgrind-pcmk.suppressions - -ctslibdir = $(pythondir)/cts -ctslib_PYTHON = __init__.py \ - CTSvars.py \ - CM_common.py \ - CM_corosync.py \ - CTS.py \ - CTSaudits.py \ - CTStests.py \ - CTSscenarios.py \ - CIB.py \ - cib_xml.py \ - environment.py \ - logging.py \ - patterns.py \ - remote.py \ - watcher.py +testdir = $(datadir)/$(PACKAGE)/tests +test_SCRIPTS = cts-cli \ + cts-coverage \ + cts-exec \ + cts-fencing \ + cts-regression \ + cts-scheduler +dist_test_DATA = README.md \ + valgrind-pcmk.suppressions + +ctslibdir = $(pythondir)/cts +ctslib_PYTHON = __init__.py \ + CIB.py \ + cib_xml.py \ + CM_common.py \ + CM_corosync.py \ + CTSaudits.py \ + CTSscenarios.py \ + CTStests.py \ + environment.py \ + logging.py \ + patterns.py \ + remote.py \ + watcher.py +nodist_ctslib_PYTHON = CTS.py \ + CTSvars.py ctsdir = $(testdir)/cts cts_DATA = pacemaker-cts-dummyd@.service - if BUILD_UPSTART -cts_DATA += pacemaker-cts-dummyd.conf +dist_cts_DATA = pacemaker-cts-dummyd.conf endif - -cts_SCRIPTS = cts \ - CTSlab.py \ - lxc_autogen.sh \ - LSBDummy \ - fence_dummy \ - pacemaker-cts-dummyd +dist_cts_SCRIPTS = cts +cts_SCRIPTS = CTSlab.py \ + fence_dummy \ + LSBDummy \ + lxc_autogen.sh \ + pacemaker-cts-dummyd clidir = $(testdir)/cli -cli_DATA = cli/regression.dates.exp \ - cli/regression.tools.exp \ +dist_cli_DATA = cli/crm_diff_new.xml \ + cli/crm_diff_old.xml \ cli/regression.acls.exp \ - cli/regression.validity.exp \ - cli/regression.upgrade.exp \ + cli/regression.dates.exp \ cli/regression.rules.exp \ - cli/crm_diff_new.xml \ - cli/crm_diff_old.xml + cli/regression.tools.exp \ + cli/regression.upgrade.exp \ + cli/regression.validity.exp PE_TESTS = $(wildcard scheduler/*.scores) pedir = $(testdir)/scheduler -pe_DATA = $(PE_TESTS) \ +dist_pe_DATA = $(PE_TESTS) \ $(PE_TESTS:%.scores=%.xml) \ $(PE_TESTS:%.scores=%.exp) \ $(PE_TESTS:%.scores=%.dot) \ $(PE_TESTS:%.scores=%.summary) \ $(wildcard scheduler/*.stderr) # For "make check", run a single scheduler test TESTS = scheduler/bug-rh-1097457.xml TEST_EXTENSIONS = .xml XML_LOG_COMPILER = ./cts-scheduler AM_XML_LOG_FLAGS = -V --run scheduler-list: @for T in "$(srcdir)"/scheduler/*.xml; do \ echo $$(basename $$T .xml); \ done clean-local: rm -f scheduler/*.pe.* SUBDIRS = benchmark cts-support-install: cts-support ./cts-support install cts-support-uninstall: cts-support ./cts-support uninstall diff --git a/cts/benchmark/Makefile.am b/cts/benchmark/Makefile.am index efc4cba282..532abd2c4e 100644 --- a/cts/benchmark/Makefile.am +++ b/cts/benchmark/Makefile.am @@ -1,28 +1,13 @@ # # Copyright 2001-2017 the Pacemaker project contributors # # The version control history for this file may have further details. # -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# This source code is licensed under the GNU General Public License version 2 +# or later (GPLv2+) WITHOUT ANY WARRANTY. # MAINTAINERCLEANFILES = Makefile.in -EXTRA_DIST = $(bench_SCRIPTS) $(bench_DATA) - -benchdir = $(datadir)/$(PACKAGE)/tests/cts/benchmark - -bench_DATA = README.benchmark control - -bench_SCRIPTS = clubench +benchdir = $(datadir)/$(PACKAGE)/tests/cts/benchmark +dist_bench_DATA = README.benchmark control +bench_SCRIPTS = clubench diff --git a/daemons/controld/Makefile.am b/daemons/controld/Makefile.am index 858e1bb390..b3e5587b6f 100644 --- a/daemons/controld/Makefile.am +++ b/daemons/controld/Makefile.am @@ -1,80 +1,81 @@ # # Copyright 2018-2019 the Pacemaker project contributors # # The version control history for this file may have further details. # # This source code is licensed under the GNU General Public License version 2 # or later (GPLv2+) WITHOUT ANY WARRANTY. # include $(top_srcdir)/Makefile.common halibdir = $(CRM_DAEMON_DIR) halib_PROGRAMS = pacemaker-controld noinst_HEADERS = controld_alerts.h \ controld_callbacks.h \ + controld_fencing.h \ controld_fsa.h \ controld_lrm.h \ controld_matrix.h \ controld_membership.h \ controld_messages.h \ controld_metadata.h \ controld_throttle.h \ controld_transition.h \ controld_utils.h \ pacemaker-controld.h pacemaker_controld_CFLAGS = $(CFLAGS_HARDENED_EXE) pacemaker_controld_LDFLAGS = $(LDFLAGS_HARDENED_EXE) pacemaker_controld_LDADD = $(top_builddir)/lib/fencing/libstonithd.la \ $(top_builddir)/lib/pacemaker/libpacemaker.la \ $(top_builddir)/lib/pengine/libpe_rules.la \ $(top_builddir)/lib/cib/libcib.la \ $(top_builddir)/lib/cluster/libcrmcluster.la \ $(top_builddir)/lib/common/libcrmcommon.la \ $(top_builddir)/lib/services/libcrmservice.la \ $(top_builddir)/lib/lrmd/liblrmd.la \ $(CLUSTERLIBS) pacemaker_controld_SOURCES = pacemaker-controld.c \ controld_attrd.c \ controld_callbacks.c \ controld_based.c \ controld_control.c \ controld_corosync.c \ controld_election.c \ controld_execd.c \ controld_execd_state.c \ controld_fencing.c \ controld_fsa.c \ controld_join_client.c \ controld_join_dc.c \ controld_membership.c \ controld_messages.c \ controld_metadata.c \ controld_remote_ra.c \ controld_schedulerd.c \ controld_te_actions.c \ controld_te_callbacks.c \ controld_te_events.c \ controld_te_utils.c \ controld_throttle.c \ controld_transition.c \ controld_utils.c if BUILD_XML_HELP man7_MANS = pacemaker-controld.7 endif CLEANFILES = $(man7_MANS) if BUILD_LEGACY_LINKS install-exec-hook: cd $(DESTDIR)$(CRM_DAEMON_DIR) && rm -f crmd && $(LN_S) pacemaker-controld crmd uninstall-hook: cd $(DESTDIR)$(CRM_DAEMON_DIR) && rm -f crmd endif diff --git a/daemons/fenced/Makefile.am b/daemons/fenced/Makefile.am index c38f357e13..26993d8d22 100644 --- a/daemons/fenced/Makefile.am +++ b/daemons/fenced/Makefile.am @@ -1,52 +1,54 @@ # # Original Author: Sun Jiang Dong <sunjd@cn.ibm.com> # Copyright 2004 International Business Machines # # with later changes copyright 2004-2019 the Pacemaker project contributors. # The version control history for this file may have further details. # # This source code is licensed under the GNU General Public License version 2 # or later (GPLv2+) WITHOUT ANY WARRANTY. # include $(top_srcdir)/Makefile.common halibdir = $(CRM_DAEMON_DIR) halib_PROGRAMS = pacemaker-fenced cts-fence-helper sbin_SCRIPTS = fence_legacy noinst_HEADERS = pacemaker-fenced.h if BUILD_XML_HELP man7_MANS = pacemaker-fenced.7 endif +EXTRA_DIST = README.md + cts_fence_helper_SOURCES = cts-fence-helper.c cts_fence_helper_LDADD = $(top_builddir)/lib/common/libcrmcommon.la \ $(top_builddir)/lib/fencing/libstonithd.la pacemaker_fenced_YFLAGS = -d pacemaker_fenced_CFLAGS = $(CFLAGS_HARDENED_EXE) pacemaker_fenced_LDFLAGS = $(LDFLAGS_HARDENED_EXE) pacemaker_fenced_LDADD = $(top_builddir)/lib/common/libcrmcommon.la \ $(top_builddir)/lib/cluster/libcrmcluster.la \ $(top_builddir)/lib/fencing/libstonithd.la \ $(top_builddir)/lib/pengine/libpe_status.la \ $(top_builddir)/lib/pacemaker/libpacemaker.la \ $(CLUSTERLIBS) pacemaker_fenced_SOURCES = pacemaker-fenced.c \ fenced_commands.c \ fenced_remote.c \ fenced_history.c CLEANFILES = $(man7_MANS) $(man8_MANS) if BUILD_LEGACY_LINKS install-exec-hook: cd $(DESTDIR)$(CRM_DAEMON_DIR) && rm -f stonithd && $(LN_S) pacemaker-fenced stonithd uninstall-hook: cd $(DESTDIR)$(CRM_DAEMON_DIR) && rm -f stonithd endif diff --git a/daemons/pacemakerd/Makefile.am b/daemons/pacemakerd/Makefile.am index 8a6f8e69fd..ae37ab4481 100644 --- a/daemons/pacemakerd/Makefile.am +++ b/daemons/pacemakerd/Makefile.am @@ -1,35 +1,37 @@ # # Copyright 2004-2018 the Pacemaker project contributors # # The version control history for this file may have further details. # # This source code is licensed under the GNU General Public License version 2 # or later (GPLv2+) WITHOUT ANY WARRANTY. # include $(top_srcdir)/Makefile.common if BUILD_CS_SUPPORT initdir = $(INITDIR) init_SCRIPTS = pacemaker sbin_PROGRAMS = pacemakerd if BUILD_SYSTEMD systemdunit_DATA = pacemaker.service endif +EXTRA_DIST = pacemaker.sysconfig + ## SOURCES noinst_HEADERS = pacemakerd.h pacemakerd_CFLAGS = $(CFLAGS_HARDENED_EXE) pacemakerd_LDFLAGS = $(LDFLAGS_HARDENED_EXE) pacemakerd_LDADD = $(top_builddir)/lib/cluster/libcrmcluster.la $(top_builddir)/lib/common/libcrmcommon.la pacemakerd_LDADD += $(CLUSTERLIBS) pacemakerd_SOURCES = pacemakerd.c pcmkd_corosync.c endif CLEANFILES = $(man8_MANS) diff --git a/doc/Makefile.am b/doc/Makefile.am index 18747cfcaa..9cdeb45240 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -1,400 +1,438 @@ # # Copyright 2003-2019 the Pacemaker project contributors # # The version control history for this file may have further details. # # This source code is licensed under the GNU General Public License version 2 # or later (GPLv2+) WITHOUT ANY WARRANTY. # include $(top_srcdir)/Makefile.common -helpdir = $(datadir)/$(PACKAGE) +# Deprecated plaintext documents (also dynamically converted to HTML) +ascii = acls.txt \ + crm_fencing.txt +generated_docs = +if BUILD_ASCIIDOC +generated_docs += $(ascii:%.txt=%.html) +endif -ascii = crm_fencing.txt acls.txt -docbook = Clusters_from_Scratch \ - Pacemaker_Administration \ - Pacemaker_Development \ - Pacemaker_Explained \ - Pacemaker_Remote -doc_DATA = $(ascii) $(generated_docs) +# Current Publican/docbook-based documentation +docbook = Clusters_from_Scratch \ + Pacemaker_Administration \ + Pacemaker_Development \ + Pacemaker_Explained \ + Pacemaker_Remote +docbook_build = $(docbook:%=%.build) + +doc_DATA = $(ascii) $(generated_docs) +noinst_SCRIPTS = abi-check + +EXTRA_DIST = $(ascii) $(SHARED_TXT) $(PNGS_ORIGINAL) $(DOTS) $(SVGS) +EXTRA_DIST += $(CFS_TXT) $(CFS_XML_ONLY) +EXTRA_DIST += $(PA_TXT) $(PA_XML_ONLY) +EXTRA_DIST += $(PD_TXT) $(PD_XML_ONLY) +EXTRA_DIST += $(PE_TXT) $(PE_XML_ONLY) +EXTRA_DIST += $(PR_TXT) $(PR_XML_ONLY) +EXTRA_DIST += pcs-crmsh-quick-ref.md # toplevel rsync destination for www targets (without trailing slash) RSYNC_DEST ?= root@www.clusterlabs.org:/var/www/html # recursive, preserve symlinks/permissions/times, verbose, compress, # don't cross filesystems, sparse, show progress RSYNC_OPTS = -rlptvzxS --progress LAST_RELEASE ?= Pacemaker-$(VERSION) TAG ?= $(shell git log --pretty=format:%H -n 1 HEAD) -publican_docs = -generated_docs = -generated_mans = - -# What formats to build: pdf,html,html-single,html-desktop,epub +# What formats to build by default: pdf,html,html-single,html-desktop,epub DOCBOOK_FORMATS := html-desktop -# What languages to build +# What languages to build and upload to website by default +# (currently only en-US because translations are out of date) DOCBOOK_LANGS := en-US -# What languages to build for uploading to website -# (currently only en-US because translations aren't up-to-date) -UPLOAD_LANGS = en-US - -noinst_SCRIPTS = abi-check - # @TODO We could simplify this (and .gitignore) by establishing a convention # that original image source begins with an uppercase letter and generated # files with lowercase. # Scheduler transition graphs # @TODO Add original XML, and generate DOTs via crm_simulate DOTS = $(wildcard shared/en-US/images/*.dot) # Vector sources for images # @TODO Generate transition SVGs from DOTs via dot SVGS = $(wildcard shared/en-US/images/pcmk-*.svg) \ $(DOTS:%.dot=%.svg) -# Final images +# Final images (some originally in PNG, others generated from SVG) PNGS_ORIGINAL = Pacemaker_Remote/en-US/images/pcmk-ha-cluster-stack.png \ Pacemaker_Remote/en-US/images/pcmk-ha-remote-stack.png \ shared/en-US/images/Console.png \ shared/en-US/images/Editing-eth0.png \ shared/en-US/images/Installer.png \ shared/en-US/images/Network.png \ shared/en-US/images/Partitioning.png \ shared/en-US/images/Welcome.png \ shared/en-US/images/resource-set.png \ shared/en-US/images/three-sets.png \ shared/en-US/images/two-sets.png PNGS_GENERATED = $(SVGS:%.svg=%-small.png) \ $(SVGS:%.svg=%.png) \ $(SVGS:%.svg=%-large.png) PNGS = $(PNGS_ORIGINAL) $(PNGS_GENERATED) graphics: $(PNGS) %.png: %.svg - $(AM_V_IMG)$(INKSCAPE) --file=$< --export-dpi=90 -C --export-png=$@ + $(AM_V_GEN)$(INKSCAPE) --file=$< --export-dpi=90 -C --export-png=$@ $(PCMK_quiet) %-small.png: %.svg - $(AM_V_IMG)$(INKSCAPE) --file=$< --export-dpi=45 -C --export-png=$@ + $(AM_V_GEN)$(INKSCAPE) --file=$< --export-dpi=45 -C --export-png=$@ $(PCMK_quiet) %-large.png: %.svg - $(AM_V_IMG)$(INKSCAPE) --file=$< --export-dpi=180 -C --export-png=$@ - -if BUILD_ASCIIDOC -generated_docs += $(ascii:%.txt=%.html) - -if BUILD_DOCBOOK -publican_docs += $(docbook) -endif -endif - -EXTRA_DIST = $(ascii) $(SHARED_TXT) $(PNGS_ORIGINAL) $(SVGS) -EXTRA_DIST += $(CFS_TXT) $(CFS_XML_ONLY) -EXTRA_DIST += $(PA_TXT) $(PA_XML_ONLY) -EXTRA_DIST += $(PD_TXT) $(PD_XML_ONLY) -EXTRA_DIST += $(PE_TXT) $(PE_XML_ONLY) -EXTRA_DIST += $(PR_TXT) $(PR_XML_ONLY) + $(AM_V_GEN)$(INKSCAPE) --file=$< --export-dpi=180 -C --export-png=$@ $(PCMK_quiet) -%.html: %.txt if IS_ASCIIDOC - $(AM_V_ASCII)$(ASCIIDOC_CONV) --unsafe --backend=xhtml11 $< +ASCIIDOC_HTML_ARGS = --unsafe --backend=xhtml11 +ASCIIDOC_DBOOK_ARGS = -b docbook -d book else - $(AM_V_ASCII)$(ASCIIDOC_CONV) --backend=html5 $< +ASCIIDOC_HTML_ARGS = --backend=html5 +ASCIIDOC_DBOOK_ARGS = -b docbook45 -d book endif +%.html: %.txt + $(AM_V_GEN)$(ASCIIDOC_CONV) $(ASCIIDOC_HTML_ARGS) --out-file=$@ $< $(PCMK_quiet) + +# +# Generate DocBook XML from asciidoc text. +# +# Build each chapter as a book (since the numbering isn't right for +# articles and only books can have appendices) and then strip out the +# bits we don't want or need. +# +# XXX Sequence of tr/sed commands should be replaced with a single XSLT +# +%.xml: %.txt + $(AM_V_at)$(MKDIR_P) $(shell dirname $@) # might not exist in VPATH build + $(AM_V_at)$(ASCIIDOC_CONV) $(ASCIIDOC_DBOOK_ARGS) -o - $< | tr -d '\036\r' >$@-t # Convert, fix line endings + $(AM_V_at)sed -i 's/\ lang="en"//' $@-t # Never specify a language in the chapters + $(AM_V_at)sed -i 's/simpara/para/g' $@-t # publican doesn't correctly render footnotes with simpara + $(AM_V_at)sed -i 's/.*<date>.*//g' $@-t # Remove dangling tag + $(AM_V_at)sed -i 's/.*preface>//g' $@-t # Remove preface elements + $(AM_V_at)sed -i 's:<title>::g' $@-t # Remove empty title + $(AM_V_at)sed -i 's/chapter/section/g' $@-t # Chapters become sections, so that books can become chapters + $(AM_V_at)sed -i 's/<.*bookinfo.*>//g' $@-t # Strip out bookinfo, we don't need it + $(AM_V_at)! grep -q "//;tb;bf;:b;N;s/.*.*<\/title>.*//;tb;/<appendix/{:i;n;/<\/appendix/{p;d};bi};bb;:f;p;d' \ + $@-t # We just want the appendix tag (asciidoctor adds non-empty book-level title) + $(AM_V_at)sed -i 's/book>/chapter>/g' $@-t # Rename to chapter (won't trigger if previous sed did) + $(AM_V_GEN)mv $@-t $@ + # publican-clusterlabs/xsl/{html,html-single,pdf}.xsl refer to URIs # requiring Internet access, hence we shadow that with a XML catalog-based # redirect to local files brought with Publican installation; # this is what newer Publican normally does with the system-wide catalog # upon its installation, but let's provide a compatibility for older # or badly installed instances (via adding the created file into # XML_CATALOG_FILES for libxml2 backing Publican as a fallback); # note that nextCatalog arrangement needed so as to overcome # https://rt.cpan.org/Public/Bug/Display.html?id=113781 publican-catalog-fallback: @exec >$@-t \ && echo '<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">' \ && echo '<rewriteURI uriStartString="https://fedorahosted.org/released/publican/xsl/docbook4/" rewritePrefix="file:///usr/share/publican/xsl/"/>' \ && echo '</catalog>' $(AM_V_GEN)mv $@-t $@ publican-catalog: publican-catalog-fallback @exec >$@-t \ && echo '<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">' \ && echo '<nextCatalog catalog="file:///etc/xml/catalog"/>' \ && echo '<nextCatalog catalog="file://$(CURDIR)/$<"/>' \ && echo '</catalog>' $(AM_V_GEN)mv $@-t $@ COMMON_XML = Author_Group.xml Book_Info.xml Revision_History.xml SHARED_TXT=$(wildcard shared/en-US/*.txt) SHARED_XML=$(SHARED_TXT:%.txt=%.xml) +if PUBLICAN_INTREE_BRAND +PUBLICAN_INTREE_DEPS = publican-catalog +PUBLICAN_INTREE_ENV = XML_CATALOG_FILES="$(CURDIR)/publican-catalog" +PUBLICAN_INTREE_OPT = --brand_dir="$(top_srcdir)/publican-clusterlabs" +else +PUBLICAN_INTREE_DEPS = +PUBLICAN_INTREE_ENV = +PUBLICAN_INTREE_OPT = +endif -CFS_SHARED_TXT=$(addprefix shared/en-US/,pacemaker-intro.txt) -CFS_SHARED_XML=$(CFS_SHARED_TXT:%.txt=%.xml) -CFS_TXT=$(wildcard Clusters_from_Scratch/en-US/*.txt) -CFS_XML=$(CFS_TXT:%.txt=%.xml) -CFS_XML_ONLY=$(addprefix Clusters_from_Scratch/en-US/,$(COMMON_XML) \ - Clusters_from_Scratch.ent Clusters_from_Scratch.xml Preface.xml) -$(CFS_XML): $(CFS_SHARED_XML) +# Clusters From Scratch -PUBLICAN_INTREE_DEPS = -if PUBLICAN_INTREE_BRAND -PUBLICAN_INTREE_DEPS += publican-catalog -endif +CFS_SHARED_TXT = $(addprefix shared/en-US/,pacemaker-intro.txt) +CFS_SHARED_XML = $(CFS_SHARED_TXT:%.txt=%.xml) +CFS_TXT = $(wildcard Clusters_from_Scratch/en-US/*.txt) +CFS_XML_GEN = $(CFS_TXT:%.txt=%.xml) +CFS_XML_ONLY = $(addprefix $(srcdir)/Clusters_from_Scratch/en-US/,$(COMMON_XML) \ + Clusters_from_Scratch.ent \ + Clusters_from_Scratch.xml \ + Preface.xml) +CFS_DEPS = $(PNGS) $(CFS_SHARED_XML) $(CFS_XML_ONLY) $(CFS_XML_GEN) # We have to hardcode the book name # With '%' the test for 'newness' fails -Clusters_from_Scratch.build: $(PNGS) $(CFS_XML_ONLY) $(CFS_XML) $(CFS_SHARED_XML) $(PUBLICAN_INTREE_DEPS) - $(PCMK_V) @echo Building $(@:%.build=%) because of $? +Clusters_from_Scratch.build: $(CFS_DEPS) $(PUBLICAN_INTREE_DEPS) + @echo Building $(@:%.build=%) because of $? rm -rf $(@:%.build=%)/publish/* $(@:%.build=%)/tmp -if PUBLICAN_INTREE_BRAND - $(AM_V_PUB)cd $(@:%.build=%) \ - && RPM_BUILD_DIR="" XML_CATALOG_FILES="$(CURDIR)/publican-catalog" \ - $(PUBLICAN) build --publish --langs=$(DOCBOOK_LANGS) --formats=$(DOCBOOK_FORMATS) --brand_dir=../publican-clusterlabs \ - $(PCMK_quiet) -else - $(AM_V_PUB)cd $(@:%.build=%) \ - && RPM_BUILD_DIR="" \ - $(PUBLICAN) build --publish --langs=$(DOCBOOK_LANGS) --formats=$(DOCBOOK_FORMATS) \ - $(PCMK_quiet) -endif + $(AM_V_PUB)cd $(@:%.build=%) && RPM_BUILD_DIR="" $(PUBLICAN_INTREE_ENV) \ + $(PUBLICAN) build --src_dir="$(srcdir)" --publish \ + --langs="$(DOCBOOK_LANGS)" --formats="$(DOCBOOK_FORMATS)" \ + $(PUBLICAN_INTREE_OPT) $(PCMK_quiet) rm -rf $(@:%.build=%)/tmp touch $@ -PA_TXT=$(wildcard Pacemaker_Administration/en-US/*.txt) -PA_XML=$(PA_TXT:%.txt=%.xml) -PA_XML_ONLY=$(addprefix Pacemaker_Administration/en-US/,$(COMMON_XML) \ - Pacemaker_Administration.ent Pacemaker_Administration.xml Preface.xml) +# Pacemaker Administration + +PA_TXT = $(wildcard Pacemaker_Administration/en-US/*.txt) +PA_XML_GEN = $(PA_TXT:%.txt=%.xml) +PA_XML_ONLY = $(addprefix $(srcdir)/Pacemaker_Administration/en-US/,$(COMMON_XML) \ + Pacemaker_Administration.ent \ + Pacemaker_Administration.xml \ + Preface.xml) +PA_DEPS = $(PA_XML_ONLY) $(PA_XML_GEN) # We have to hardcode the book name # With '%' the test for 'newness' fails -Pacemaker_Administration.build: $(PA_XML_ONLY) $(PA_XML) $(PUBLICAN_INTREE_DEPS) - $(PCMK_V) @echo Building $(@:%.build=%) because of $? +Pacemaker_Administration.build: $(PA_DEPS) $(PUBLICAN_INTREE_DEPS) + @echo Building $(@:%.build=%) because of $? rm -rf $(@:%.build=%)/publish/* -if PUBLICAN_INTREE_BRAND - $(AM_V_PUB)cd $(@:%.build=%) \ - && RPM_BUILD_DIR="" XML_CATALOG_FILES="$(CURDIR)/publican-catalog" \ - $(PUBLICAN) build --publish --langs=$(DOCBOOK_LANGS) --formats=$(DOCBOOK_FORMATS) --brand_dir=../publican-clusterlabs \ - $(PCMK_quiet) -else - $(AM_V_PUB)cd $(@:%.build=%) \ - && RPM_BUILD_DIR="" \ - $(PUBLICAN) build --publish --langs=$(DOCBOOK_LANGS) --formats=$(DOCBOOK_FORMATS) \ - $(PCMK_quiet) -endif + $(AM_V_PUB)cd $(@:%.build=%) && RPM_BUILD_DIR="" $(PUBLICAN_INTREE_ENV) \ + $(PUBLICAN) build --src_dir="$(srcdir)" --publish \ + --langs="$(DOCBOOK_LANGS)" --formats="$(DOCBOOK_FORMATS)" \ + $(PUBLICAN_INTREE_OPT) $(PCMK_quiet) rm -rf $(@:%.build=%)/tmp touch $@ -PD_TXT=$(wildcard Pacemaker_Development/en-US/*.txt) -PD_XML=$(PD_TXT:%.txt=%.xml) -PD_XML_ONLY=$(addprefix Pacemaker_Development/en-US/,$(COMMON_XML) \ - Pacemaker_Development.ent Pacemaker_Development.xml) +# Pacemaker Development + +PD_TXT = $(wildcard Pacemaker_Development/en-US/*.txt) +PD_XML_GEN = $(PD_TXT:%.txt=%.xml) +PD_XML_ONLY = $(addprefix $(srcdir)/Pacemaker_Development/en-US/,$(COMMON_XML) \ + Pacemaker_Development.ent \ + Pacemaker_Development.xml) +PD_DEPS = $(PD_XML_ONLY) $(PD_XML_GEN) # We have to hardcode the book name # With '%' the test for 'newness' fails -Pacemaker_Development.build: $(PD_XML_ONLY) $(PD_XML) $(PUBLICAN_INTREE_DEPS) - $(PCMK_V) @echo Building $(@:%.build=%) because of $? +Pacemaker_Development.build: $(PD_DEPS) $(PUBLICAN_INTREE_DEPS) + @echo Building $(@:%.build=%) because of $? rm -rf $(@:%.build=%)/publish/* $(@:%.build=%)/tmp -if PUBLICAN_INTREE_BRAND - $(AM_V_PUB)cd $(@:%.build=%) \ - && RPM_BUILD_DIR="" XML_CATALOG_FILES="$(CURDIR)/publican-catalog" \ - $(PUBLICAN) build --publish --langs=$(DOCBOOK_LANGS) --formats=$(DOCBOOK_FORMATS) --brand_dir=../publican-clusterlabs \ - $(PCMK_quiet) -else - $(AM_V_PUB)cd $(@:%.build=%) \ - && RPM_BUILD_DIR="" \ - $(PUBLICAN) build --publish --langs=$(DOCBOOK_LANGS) --formats=$(DOCBOOK_FORMATS) \ - $(PCMK_quiet) -endif + $(AM_V_PUB)cd $(@:%.build=%) && RPM_BUILD_DIR="" $(PUBLICAN_INTREE_ENV) \ + $(PUBLICAN) build --src_dir="$(srcdir)" --publish \ + --langs="$(DOCBOOK_LANGS)" --formats="$(DOCBOOK_FORMATS)" \ + $(PUBLICAN_INTREE_OPT) $(PCMK_quiet) rm -rf $(@:%.build=%)/tmp touch $@ -PE_SHARED_TXT=$(addprefix shared/en-US/,pacemaker-intro.txt) -PE_SHARED_XML=$(PE_SHARED_TXT:%.txt=%.xml) -PE_TXT=$(wildcard Pacemaker_Explained/en-US/*.txt) -PE_XML=$(PE_TXT:%.txt=%.xml) -PE_XML_ONLY=$(addprefix Pacemaker_Explained/en-US/,$(COMMON_XML) \ - Pacemaker_Explained.ent Pacemaker_Explained.xml Preface.xml) +# Pacemaker Explained -$(PE_XML): $(PE_SHARED_XML) +PE_SHARED_TXT = $(addprefix shared/en-US/,pacemaker-intro.txt) +PE_SHARED_XML = $(PE_SHARED_TXT:%.txt=%.xml) +PE_TXT = $(wildcard Pacemaker_Explained/en-US/*.txt) +PE_XML_GEN = $(PE_TXT:%.txt=%.xml) +PE_XML_ONLY = $(addprefix $(srcdir)/Pacemaker_Explained/en-US/,$(COMMON_XML) \ + Pacemaker_Explained.ent \ + Pacemaker_Explained.xml \ + Preface.xml) +PE_DEPS = $(PNGS) $(PE_SHARED_XML) $(PE_XML_ONLY) $(PE_XML_GEN) # We have to hardcode the book name # With '%' the test for 'newness' fails -Pacemaker_Explained.build: $(PNGS) $(PE_XML_ONLY) $(PE_XML) $(PE_SHARED_XML) $(PUBLICAN_INTREE_DEPS) - $(PCMK_V) @echo Building $(@:%.build=%) because of $? +Pacemaker_Explained.build: $(PE_DEPS) $(PUBLICAN_INTREE_DEPS) + @echo Building $(@:%.build=%) because of $? rm -rf $(@:%.build=%)/publish/* $(@:%.build=%)/tmp -if PUBLICAN_INTREE_BRAND - $(AM_V_PUB)cd $(@:%.build=%) \ - && RPM_BUILD_DIR="" XML_CATALOG_FILES="$(CURDIR)/publican-catalog" \ - $(PUBLICAN) build --publish --langs=$(DOCBOOK_LANGS) --formats=$(DOCBOOK_FORMATS) --brand_dir=../publican-clusterlabs \ - $(PCMK_quiet) -else - $(AM_V_PUB)cd $(@:%.build=%) \ - && RPM_BUILD_DIR="" \ - $(PUBLICAN) build --publish --langs=$(DOCBOOK_LANGS) --formats=$(DOCBOOK_FORMATS) \ - $(PCMK_quiet) -endif + $(AM_V_PUB)cd $(@:%.build=%) && RPM_BUILD_DIR="" $(PUBLICAN_INTREE_ENV) \ + $(PUBLICAN) build --src_dir="$(srcdir)" --publish \ + --langs="$(DOCBOOK_LANGS)" --formats="$(DOCBOOK_FORMATS)" \ + $(PUBLICAN_INTREE_OPT) $(PCMK_quiet) rm -rf $(@:%.build=%)/tmp touch $@ -PR_TXT=$(wildcard Pacemaker_Remote/en-US/*.txt) -PR_XML=$(PR_TXT:%.txt=%.xml) -PR_XML_ONLY=$(addprefix Pacemaker_Remote/en-US/,$(COMMON_XML) \ - Pacemaker_Remote.ent Pacemaker_Remote.xml) +# Pacemaker Remote + +PR_TXT = $(wildcard Pacemaker_Remote/en-US/*.txt) +PR_XML_GEN = $(PR_TXT:%.txt=%.xml) +PR_XML_ONLY = $(addprefix $(srcdir)/Pacemaker_Remote/en-US/,$(COMMON_XML) \ + Pacemaker_Remote.ent \ + Pacemaker_Remote.xml) +PR_DEPS = $(PR_XML_ONLY) $(PR_XML_GEN) # We have to hardcode the book name # With '%' the test for 'newness' fails -Pacemaker_Remote.build: $(PNGS) $(PR_XML_ONLY) $(PR_XML) $(PUBLICAN_INTREE_DEPS) - $(PCMK_V) @echo Building $(@:%.build=%) because of $? +Pacemaker_Remote.build: $(PNGS) $(PR_DEPS) $(PUBLICAN_INTREE_DEPS) + @echo Building $(@:%.build=%) because of $? rm -rf $(@:%.build=%)/publish/* $(@:%.build=%)/tmp -if PUBLICAN_INTREE_BRAND - $(AM_V_PUB)cd $(@:%.build=%) \ - && RPM_BUILD_DIR="" XML_CATALOG_FILES="$(CURDIR)/publican-catalog" \ - $(PUBLICAN) build --publish --langs=$(DOCBOOK_LANGS) --formats=$(DOCBOOK_FORMATS) --brand_dir=../publican-clusterlabs \ - $(PCMK_quiet) -else - $(AM_V_PUB)cd $(@:%.build=%) \ - && RPM_BUILD_DIR="" \ - $(PUBLICAN) build --publish --langs=$(DOCBOOK_LANGS) --formats=$(DOCBOOK_FORMATS) \ - $(PCMK_quiet) -endif + $(AM_V_PUB)cd $(@:%.build=%) && RPM_BUILD_DIR="" $(PUBLICAN_INTREE_ENV) \ + $(PUBLICAN) build --src_dir="$(srcdir)" --publish \ + --langs="$(DOCBOOK_LANGS)" --formats="$(DOCBOOK_FORMATS)" \ + $(PUBLICAN_INTREE_OPT) $(PCMK_quiet) rm -rf $(@:%.build=%)/tmp touch $@ + # Update the translation template pot: - for book in $(docbook); do \ - echo "Updating translation templates in: $$book"; \ - ( cd $$book && RPM_BUILD_DIR="" $(PUBLICAN) update_pot ); \ + @for book in $(docbook); do \ + echo "Updating translation templates in: $$book"; \ + ( cd $$book && RPM_BUILD_DIR="" \ + $(PUBLICAN) --src_dir="$(srcdir)" update_pot ); \ done # Update the actual translations po: pot - for book in $(docbook); do \ - echo "Updating translations in: $$book"; \ - ( cd $$book && RPM_BUILD_DIR="" $(PUBLICAN) update_po --langs=all );\ + @for book in $(docbook); do \ + echo "Updating translations in: $$book"; \ + ( cd $$book && RPM_BUILD_DIR="" \ + $(PUBLICAN) --src_dir="$(srcdir)" update_po \ + --langs=all ); \ done if BUILD_DOCBOOK -docbook_build = $(docbook:%=%.build) - all-local: $(docbook_build) */publican.cfg install-data-local: all-local for book in $(docbook); do \ filelist=`find $$book/publish/* -print`; \ for f in $$filelist; do \ p=`echo $$f | sed s:publish/:: | sed s:Pacemaker/::`; \ if [ -d $$f ]; then \ $(INSTALL) -d -m 775 $(DESTDIR)$(docdir)/$$p; \ else \ $(INSTALL) -m 644 $$f $(DESTDIR)$(docdir)/$$p; \ fi \ done; \ done endif BRAND_DEPS = $(wildcard publican-clusterlabs/en-US/*.png) \ $(wildcard publican-clusterlabs/en-US/*.xml) brand-build: $(BRAND_DEPS) cd publican-clusterlabs && publican build --formats=xml --langs=all --publish brand: brand-build - echo "Installing..." + @echo "Installing branded content..." cd publican-clusterlabs && sudo publican install_brand --path=$(datadir)/publican/Common_Content brand-rpm-clean: - find publican-clusterlabs -name "*.noarch.rpm" -exec rm -f \{\} \; + -find publican-clusterlabs -name "*.noarch.rpm" -exec rm -f \{\} \; brand-rpm-build: brand-rpm-clean brand-build - cd publican-clusterlabs && $(PUBLICAN) package --binary + cd publican-clusterlabs && \ + $(PUBLICAN) --src_dir="$(srcdir)" package --binary brand-rpm-install: brand-rpm-build find publican-clusterlabs -name "*.noarch.rpm" -exec sudo rpm -Uvh --force \{\} \; pdf: $(MAKE) DOCBOOK_FORMATS="pdf" all-local # Annotated source code as HTML global: $(MAKE) -C .. clean-generic cd .. && gtags -q && htags -sanhIT doc global-upload: global rsync $(RSYNC_OPTS) HTML/ "$(RSYNC_DEST)/$(PACKAGE)/global/$(TAG)/" +global-clean: + -rm -rf HTML + # Man pages as HTML %.8.html: %.8 groff -mandoc `man -w ./$<` -T html > $@ %.7.html: %.7 groff -mandoc `man -w ./$<` -T html > $@ manhtml: $(MAKE) -C .. all find .. -name "[a-z]*.[78]" -exec $(MAKE) \{\}.html \; manhtml-upload: manhtml find .. -name "[a-z]*.[78].html" -exec \ rsync $(RSYNC_OPTS) \{\} "$(RSYNC_DEST)/$(PACKAGE)/man/" \; +manhtml-clean: + -find .. -name "[a-z]*.[78].html" -exec rm \{\} \; + # API documentation as HTML doxygen: Doxyfile doxygen Doxyfile doxygen-upload: doxygen rsync $(RSYNC_OPTS) api/html/ "$(RSYNC_DEST)/$(PACKAGE)/doxygen/$(TAG)/" +doxygen-clean: + -rm -rf api + # ABI compatibility report as HTML abi: abi-check ./abi-check $(PACKAGE) $(LAST_RELEASE) $(TAG) abi-www: export RSYNC_DEST=$(RSYNC_DEST); ./abi-check -u $(PACKAGE) $(LAST_RELEASE) $(TAG) +abi-clean: + -rm -rf abi_dumps compat_reports + # All HTML documentation (except ABI compatibility, which is run separately) -www: clean-local $(generated_docs) $(ascii) manhtml-upload global-upload doxygen-upload +www: clean-local $(doc_DATA) manhtml-upload global-upload doxygen-upload +if BUILD_DOCBOOK for book in $(docbook); do \ sed -i.sed 's@^brand:.*@brand: clusterlabs@' $$book/publican.cfg; \ done - $(MAKE) DOCBOOK_FORMATS="pdf,html,html-single,epub" DOCBOOK_LANGS="$(UPLOAD_LANGS)" all-local - echo Uploading current $(PACKAGE_SERIES) documentation set to clusterlabs.org +endif + $(MAKE) DOCBOOK_FORMATS="pdf,html,html-single,epub" DOCBOOK_LANGS="$(DOCBOOK_LANGS)" all-local + @echo Uploading current $(PACKAGE_SERIES) documentation set to clusterlabs.org if BUILD_DOCBOOK - for book in $(docbook); do \ + @for book in $(docbook); do \ echo Uploading $$book...; \ echo "Generated on `date` from version: $(shell git log --pretty="format:%h %d" -n 1)" >> $$book/publish/build-$(PACKAGE_SERIES).txt; \ rsync $(RSYNC_OPTS) $$book/publish/* "$(RSYNC_DEST)/$(PACKAGE)/doc/"; \ done endif - rsync $(RSYNC_OPTS) $(generated_docs) $(ascii) "$(RSYNC_DEST)/$(PACKAGE)/doc/" - - -clean-local: - -rm -f $(PNGS_GENERATED) - -rm -rf $(generated_docs) $(generated_mans) $(docbook_build) - -rm -rf $(SHARED_XML) $(CFS_XML) $(PE_XML) $(PR_XML) - -rm -rf publican-catalog-fallback publican-catalog - for book in $(docbook); do rm -rf $$book/tmp $$book/publish; done + rsync $(RSYNC_OPTS) $(doc_DATA) "$(RSYNC_DEST)/$(PACKAGE)/doc/" + +ALL_GEN = $(generated_docs) \ + $(docbook_build) \ + $(PNGS_GENERATED) \ + $(SHARED_XML) \ + $(CFS_XML_GEN) \ + $(PA_XML_GEN) \ + $(PD_XML_GEN) \ + $(PE_XML_GEN) \ + $(PR_XML_GEN) \ + publican-catalog-fallback \ + publican-catalog + +clean-local: brand-rpm-clean global-clean manhtml-clean doxygen-clean abi-clean + -rm -f $(ALL_GEN) + -for book in $(docbook); do \ + rm -rf $$book/tmp $$book/publish; \ + done diff --git a/extra/Makefile.am b/extra/Makefile.am index fdbd383038..fb23caf1bc 100644 --- a/extra/Makefile.am +++ b/extra/Makefile.am @@ -1,26 +1,15 @@ # -# Copyright 2004-2016 the Pacemaker project contributors +# Copyright 2004-2019 the Pacemaker project contributors # # The version control history for this file may have further details. # -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# This source code is licensed under the GNU General Public License version 2 +# or later (GPLv2+) WITHOUT ANY WARRANTY. # MAINTAINERCLEANFILES = Makefile.in -SUBDIRS = alerts resources logrotate +SUBDIRS = alerts resources logrotate -mibdir = $(datadir)/snmp/mibs -mib_DATA = PCMK-MIB.txt +mibdir = $(datadir)/snmp/mibs +dist_mib_DATA = PCMK-MIB.txt diff --git a/extra/alerts/Makefile.am b/extra/alerts/Makefile.am index 333e099772..e798ae9d54 100644 --- a/extra/alerts/Makefile.am +++ b/extra/alerts/Makefile.am @@ -1,24 +1,15 @@ # -# Copyright 2016 the Pacemaker project contributors +# Copyright 2016-2019 the Pacemaker project contributors # # The version control history for this file may have further details. # -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# This source code is licensed under the GNU General Public License version 2 +# or later (GPLv2+) WITHOUT ANY WARRANTY. # MAINTAINERCLEANFILES = Makefile.in -samplesdir = $(datadir)/$(PACKAGE)/alerts/ -samples_DATA = alert_file.sh.sample alert_smtp.sh.sample alert_snmp.sh.sample +samplesdir = $(datadir)/$(PACKAGE)/alerts/ +dist_samples_DATA = alert_file.sh.sample \ + alert_smtp.sh.sample \ + alert_snmp.sh.sample diff --git a/extra/logrotate/Makefile.am b/extra/logrotate/Makefile.am index 521f253724..cafd0d54cb 100644 --- a/extra/logrotate/Makefile.am +++ b/extra/logrotate/Makefile.am @@ -1,24 +1,13 @@ # -# Copyright 2014 the Pacemaker project contributors +# Copyright 2014-2019 the Pacemaker project contributors # # The version control history for this file may have further details. # -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# This source code is licensed under the GNU General Public License version 2 +# or later (GPLv2+) WITHOUT ANY WARRANTY. # MAINTAINERCLEANFILES = Makefile.in -logrotatedir = $(sysconfdir)/logrotate.d -logrotate_DATA = pacemaker +logrotatedir = $(sysconfdir)/logrotate.d +logrotate_DATA = pacemaker diff --git a/extra/resources/Makefile.am b/extra/resources/Makefile.am index 8c31d2cb56..fcfa61b64a 100644 --- a/extra/resources/Makefile.am +++ b/extra/resources/Makefile.am @@ -1,57 +1,43 @@ -# Makefile.am for OCF RAs # -# Author: Andrew Beekhof -# Copyright 2008-2018 the Pacemaker project contributors +# Copyright 2008-2019 the Pacemaker project contributors # # The version control history for this file may have further details. # -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# This source code is licensed under the GNU General Public License version 2 +# or later (GPLv2+) WITHOUT ANY WARRANTY. # + include $(top_srcdir)/Makefile.common EXTRA_DIST = $(ocf_SCRIPTS) -ocfdir = @OCF_RA_DIR@/pacemaker - -ocf_SCRIPTS = ClusterMon \ - controld \ - Dummy \ - HealthCPU \ - HealthIOWait \ - HealthSMART \ - ifspeed \ - o2cb \ - ping \ - pingd \ - Stateful \ - SysInfo \ - SystemHealth \ - attribute \ - remote +ocfdir = @OCF_RA_DIR@/pacemaker +dist_ocf_SCRIPTS = attribute \ + controld \ + Dummy \ + HealthCPU \ + HealthIOWait \ + ping \ + pingd \ + remote \ + Stateful \ + SystemHealth +ocf_SCRIPTS = ClusterMon \ + HealthSMART \ + ifspeed \ + o2cb \ + SysInfo if BUILD_XML_HELP -man7_MANS = $(ocf_SCRIPTS:%=ocf_pacemaker_%.7) +man7_MANS = $(ocf_SCRIPTS:%=ocf_pacemaker_%.7) $(dist_ocf_SCRIPTS:%=ocf_pacemaker_%.7) DBOOK_OPTS = --stringparam command.prefix ocf_pacemaker_ --stringparam variable.prefix OCF_RESKEY_ --param man.vol 7 ocf_pacemaker_%.xml: % $(AM_V_GEN)OCF_FUNCTIONS=/dev/null OCF_ROOT=$(OCF_ROOT_DIR) $(abs_builddir)/$< meta-data > $@ endif clean-generic: - rm -f $(man7_MANS) $(ocf_SCRIPTS:%=%.xml) *~ - + rm -f $(man7_MANS) $(ocf_SCRIPTS:%=%.xml) $(dist_ocf_SCRIPTS:%=%.xml) *~ diff --git a/include/Makefile.am b/include/Makefile.am index 97688a80e1..e2bd4bc987 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -1,28 +1,21 @@ # # Copyright 2003-2019 the Pacemaker project contributors # # The version control history for this file may have further details. # -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# This source code is licensed under the GNU General Public License version 2 +# or later (GPLv2+) WITHOUT ANY WARRANTY. # MAINTAINERCLEANFILES = Makefile.in config.h.in -noinst_HEADERS = portability.h config.h crm_internal.h pacemaker-internal.h +noinst_HEADERS = config.h \ + crm_internal.h \ + doxygen.h \ + pacemaker-internal.h \ + portability.h pkginclude_HEADERS = crm_config.h SUBDIRS = crm pcmki .PHONY: $(ARCHIVE_VERSION) diff --git a/include/crm/Makefile.am b/include/crm/Makefile.am index bc939ebc53..9d57dd9053 100644 --- a/include/crm/Makefile.am +++ b/include/crm/Makefile.am @@ -1,27 +1,19 @@ # # Copyright 2004-2019 the Pacemaker project contributors # # The version control history for this file may have further details. # -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# This source code is licensed under the GNU General Public License version 2 +# or later (GPLv2+) WITHOUT ANY WARRANTY. # + MAINTAINERCLEANFILES = Makefile.in headerdir=$(pkgincludedir)/crm header_HEADERS = attrd.h cib.h cluster.h compatibility.h crm.h \ lrmd.h msg_xml.h services.h stonith-ng.h +noinst_HEADERS = lrmd_alerts_internal.h + SUBDIRS = common pengine cib fencing cluster diff --git a/lib/Makefile.am b/lib/Makefile.am index 4c3378c279..e3e927c780 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -1,46 +1,34 @@ # # Copyright 2003-2019 the Pacemaker project contributors # # The version control history for this file may have further details. # -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# This source code is licensed under the GNU General Public License version 2 +# or later (GPLv2+) WITHOUT ANY WARRANTY. # MAINTAINERCLEANFILES = Makefile.in -EXTRA_DIST = pacemaker.pc.in pacemaker-pe_rules.pc.in pacemaker-pe_status.pc.in libpacemaker.pc.in $(target_LIBS:%=%.in) - LIBS = cib lrmd service fencing cluster -target_LIBS = $(LIBS:%=pacemaker-%.pc) libpacemaker.pc +PC_FILES = $(LIBS:%=pacemaker-%.pc) \ + libpacemaker.pc \ + pacemaker.pc \ + pacemaker-pe_rules.pc \ + pacemaker-pe_status.pc -target_PACKAGE = pacemaker.pc +EXTRA_DIST = $(PC_FILES:%=%.in) -all-local: $(target_LIBS) $(target_PACKAGE) pacemaker-pe_rules.pc pacemaker-pe_status.pc +all-local: $(PC_FILES) -install-exec-local: $(target_LIBS) $(target_PACKAGE) pacemaker-pe_rules.pc pacemaker-pe_status.pc +install-exec-local: $(PC_FILES) $(INSTALL) -d $(DESTDIR)/$(libdir)/pkgconfig - $(INSTALL) -m 644 $(target_LIBS) $(target_PACKAGE) $(DESTDIR)/$(libdir)/pkgconfig - $(INSTALL) -m 644 pacemaker-pe_rules.pc pacemaker-pe_status.pc $(DESTDIR)/$(libdir)/pkgconfig + $(INSTALL) -m 644 $(PC_FILES) $(DESTDIR)/$(libdir)/pkgconfig uninstall-local: - cd $(DESTDIR)/$(libdir)/pkgconfig && rm -f $(target_LIBS) $(target_PACKAGE) - rmdir $(DESTDIR)/$(libdir)/pkgconfig 2> /dev/null || : + -cd $(DESTDIR)/$(libdir)/pkgconfig && rm -f $(PC_FILES) + -rmdir $(DESTDIR)/$(libdir)/pkgconfig 2> /dev/null clean-local: - rm -f *.pc + -rm -f $(PC_FILES) -## Subdirectories... SUBDIRS = gnu common pengine cib services fencing lrmd cluster pacemaker -DIST_SUBDIRS = $(SUBDIRS) diff --git a/maint/Makefile.am b/maint/Makefile.am index d2e53d9963..87d37bf230 100644 --- a/maint/Makefile.am +++ b/maint/Makefile.am @@ -1,16 +1,17 @@ # # Copyright 2019 the Pacemaker project contributors # # The version control history for this file may have further details. # # This source code is licensed under the GNU General Public License version 2 # or later (GPLv2+) WITHOUT ANY WARRANTY. # CLEANFILES = testcc EXTRA_SCRIPTS = bumplibs.sh \ travisci_build_coverity_scan.sh EXTRA_PROGRAMS = testcc +EXTRA_DIST = README nodist_testcc_SOURCES = testcc.cc diff --git a/tools/Makefile.am b/tools/Makefile.am index 655e5c7816..477adeb77b 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -1,151 +1,156 @@ # # Copyright 2004-2019 the Pacemaker project contributors # # The version control history for this file may have further details. # # This source code is licensed under the GNU General Public License version 2 # or later (GPLv2+) WITHOUT ANY WARRANTY. # include $(top_srcdir)/Makefile.common if BUILD_SYSTEMD systemdunit_DATA = crm_mon.service endif noinst_HEADERS = crm_mon.h crm_resource.h pcmkdir = $(datadir)/$(PACKAGE) pcmk_DATA = report.common report.collector sbin_SCRIPTS = crm_report crm_standby crm_master crm_failcount if BUILD_CIBSECRETS sbin_SCRIPTS += cibsecret endif -EXTRA_DIST = $(sbin_SCRIPTS) stonith_admin.8.inc + +EXTRA_DIST = crm_mon.sysconfig \ + crm_mon.8.inc \ + stonith_admin.8.inc sbin_PROGRAMS = attrd_updater \ cibadmin \ crmadmin \ crm_simulate \ crm_attribute \ crm_diff \ crm_error \ crm_mon \ crm_node \ crm_resource \ crm_rule \ crm_shadow \ crm_verify \ crm_ticket \ iso8601 \ stonith_admin if BUILD_SERVICELOG sbin_PROGRAMS += notifyServicelogEvent endif if BUILD_OPENIPMI_SERVICELOG sbin_PROGRAMS += ipmiservicelogd endif ## SOURCES -MAN8DEPS = crm_attribute crm_node +# A few tools are just thin wrappers around crm_attribute. +# This makes their help get updated when crm_attribute changes +# (see Makefile.common). +MAN8DEPS = crm_attribute crmadmin_SOURCES = crmadmin.c crmadmin_LDADD = $(top_builddir)/lib/pengine/libpe_status.la \ $(top_builddir)/lib/cib/libcib.la \ $(top_builddir)/lib/common/libcrmcommon.la crm_error_SOURCES = crm_error.c crm_error_LDADD = $(top_builddir)/lib/common/libcrmcommon.la cibadmin_SOURCES = cibadmin.c cibadmin_LDADD = $(top_builddir)/lib/cib/libcib.la \ $(top_builddir)/lib/common/libcrmcommon.la crm_shadow_SOURCES = crm_shadow.c crm_shadow_LDADD = $(top_builddir)/lib/cib/libcib.la \ $(top_builddir)/lib/common/libcrmcommon.la crm_node_SOURCES = crm_node.c crm_node_LDADD = $(top_builddir)/lib/cib/libcib.la \ $(top_builddir)/lib/common/libcrmcommon.la crm_simulate_SOURCES = crm_simulate.c crm_simulate_LDADD = $(top_builddir)/lib/pengine/libpe_status.la \ $(top_builddir)/lib/pacemaker/libpacemaker.la \ $(top_builddir)/lib/cib/libcib.la \ $(top_builddir)/lib/common/libcrmcommon.la crm_diff_SOURCES = crm_diff.c crm_diff_LDADD = $(top_builddir)/lib/common/libcrmcommon.la crm_mon_SOURCES = crm_mon.c crm_mon_curses.c crm_mon_print.c crm_mon_runtime.c crm_mon_LDADD = $(top_builddir)/lib/pengine/libpe_status.la \ $(top_builddir)/lib/fencing/libstonithd.la \ $(top_builddir)/lib/pacemaker/libpacemaker.la \ $(top_builddir)/lib/cib/libcib.la \ $(top_builddir)/lib/common/libcrmcommon.la \ $(CURSESLIBS) -# Arguments could be made that this should live in crm/pengine crm_verify_SOURCES = crm_verify.c crm_verify_LDADD = $(top_builddir)/lib/pengine/libpe_status.la \ $(top_builddir)/lib/pacemaker/libpacemaker.la \ $(top_builddir)/lib/cib/libcib.la \ $(top_builddir)/lib/common/libcrmcommon.la crm_attribute_SOURCES = crm_attribute.c crm_attribute_LDADD = $(top_builddir)/lib/cluster/libcrmcluster.la \ $(top_builddir)/lib/cib/libcib.la \ $(top_builddir)/lib/common/libcrmcommon.la crm_resource_SOURCES = crm_resource.c crm_resource_ban.c crm_resource_runtime.c crm_resource_print.c crm_resource_LDADD = $(top_builddir)/lib/pengine/libpe_rules.la \ $(top_builddir)/lib/fencing/libstonithd.la \ $(top_builddir)/lib/lrmd/liblrmd.la \ $(top_builddir)/lib/services/libcrmservice.la \ $(top_builddir)/lib/pengine/libpe_status.la \ $(top_builddir)/lib/pacemaker/libpacemaker.la \ $(top_builddir)/lib/cib/libcib.la \ $(top_builddir)/lib/common/libcrmcommon.la crm_rule_SOURCES = crm_rule.c crm_rule_LDADD = $(top_builddir)/lib/cib/libcib.la \ $(top_builddir)/lib/pengine/libpe_rules.la \ $(top_builddir)/lib/pengine/libpe_status.la \ $(top_builddir)/lib/common/libcrmcommon.la iso8601_SOURCES = iso8601.c iso8601_LDADD = $(top_builddir)/lib/common/libcrmcommon.la attrd_updater_SOURCES = attrd_updater.c attrd_updater_LDADD = $(top_builddir)/lib/common/libcrmcommon.la crm_ticket_SOURCES = crm_ticket.c crm_ticket_LDADD = $(top_builddir)/lib/pengine/libpe_rules.la \ $(top_builddir)/lib/pengine/libpe_status.la \ $(top_builddir)/lib/pacemaker/libpacemaker.la \ $(top_builddir)/lib/cib/libcib.la \ $(top_builddir)/lib/common/libcrmcommon.la stonith_admin_SOURCES = stonith_admin.c stonith_admin_LDADD = $(top_builddir)/lib/common/libcrmcommon.la \ $(top_builddir)/lib/cib/libcib.la \ $(top_builddir)/lib/pengine/libpe_status.la \ $(top_builddir)/lib/fencing/libstonithd.la if BUILD_SERVICELOG notifyServicelogEvent_SOURCES = notifyServicelogEvent.c notifyServicelogEvent_CFLAGS = $(SERVICELOG_CFLAGS) notifyServicelogEvent_LDADD = $(top_builddir)/lib/common/libcrmcommon.la $(SERVICELOG_LIBS) endif if BUILD_OPENIPMI_SERVICELOG ipmiservicelogd_SOURCES = ipmiservicelogd.c ipmiservicelogd_CFLAGS = $(OPENIPMI_SERVICELOG_CFLAGS) $(SERVICELOG_CFLAGS) ipmiservicelogd_LDFLAGS = $(top_builddir)/lib/common/libcrmcommon.la $(OPENIPMI_SERVICELOG_LIBS) $(SERVICELOG_LIBS) endif CLEANFILES = $(man8_MANS) diff --git a/xml/Makefile.am b/xml/Makefile.am index 4ae2d67af4..8ad5bd06ac 100644 --- a/xml/Makefile.am +++ b/xml/Makefile.am @@ -1,217 +1,231 @@ # # Copyright 2004-2019 the Pacemaker project contributors # # The version control history for this file may have further details. # -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# This source code is licensed under the GNU General Public License version 2 +# or later (GPLv2+) WITHOUT ANY WARRANTY. # -MAINTAINERCLEANFILES = Makefile.in -APIdir = $(CRM_SCHEMA_DIRECTORY)/api -RNGdir = $(CRM_SCHEMA_DIRECTORY) +include $(top_srcdir)/Makefile.common -xsltdir = $(RNGdir) -dist_xslt_DATA = $(top_srcdir)/xml/upgrade-1.3.xsl \ - $(top_srcdir)/xml/upgrade-2.10.xsl \ - $(top_srcdir)/xml/upgrade-*enter.xsl \ - $(top_srcdir)/xml/upgrade-*leave.xsl - -noinst_DATA = context-of.xsl +# Pacemaker has 3 schemas: the CIB schema, the API schema (for command-line +# tool XML output), and a legacy schema for crm_mon --as-xml. +# +# See Readme.md for details on updating CIB schema files (API is similar) -# See Readme.md for details on updating schema files +# The CIB and crm_mon schemas are installed directly in CRM_SCHEMA_DIRECTORY +# for historical reasons, while the API schema is installed in a subdirectory. +APIdir = $(CRM_SCHEMA_DIRECTORY)/api +CIBdir = $(CRM_SCHEMA_DIRECTORY) +MONdir = $(CRM_SCHEMA_DIRECTORY) -# Sorted list of available numeric RNG versions, -# extracted from filenames like NAME-MAJOR[.MINOR][.MINOR-MINOR].rng +# Extract a sorted list of available numeric schema versions +# from filenames like NAME-MAJOR[.MINOR][.MINOR-MINOR].rng numeric_versions = $(shell ls -1 $(1) \ | sed -n -e 's/^.*-\([0-9][0-9.]*\).rng$$/\1/p' \ | sort -u -t. -k 1,1n -k 2,2n -k 3,3n) version_pairs = $(join \ $(1),$(addprefix \ -,$(wordlist \ 2,$(words $(1)),$(1) \ ) next \ ) \ ) version_pairs_last = $(wordlist \ $(words \ $(wordlist \ 2,$(1),$(2) \ ) \ ),$(1),$(2) \ ) -API_numeric_versions = $(call numeric_versions,${API_files}) -RNG_numeric_versions = $(call numeric_versions,${RNG_files}) +# Names of API schemas that form the choices for pacemaker-result content +API_request_base = command-output stonith_admin version -# The highest numeric version -API_max ?= $(lastword $(API_numeric_versions)) -RNG_max ?= $(lastword $(RNG_numeric_versions)) +# Names of CIB schemas that form the choices for cib/configuration content +CIB_cfg_base = options nodes resources constraints fencing acls tags alerts -# A sorted list of all API and RNG versions (numeric and "next") -API_versions = next $(API_numeric_versions) -API_request_base = command-output stonith_admin version +# Names of all schemas (including top level and those included by others) API_base = $(API_request_base) item status -API_files = $(foreach base,$(API_base),$(wildcard api/$(base)*.rng)) - -RNG_versions = next $(RNG_numeric_versions) -RNG_version_pairs = $(call version_pairs,${RNG_numeric_versions}) -RNG_version_pairs_cnt = $(words ${RNG_version_pairs}) -RNG_version_pairs_last = $(call version_pairs_last,${RNG_version_pairs_cnt},${RNG_version_pairs}) - -API_generated = api/api-result.rng $(foreach base,$(API_versions),api/api-result-$(base).rng) -RNG_generated = pacemaker.rng $(foreach base,$(RNG_versions),pacemaker-$(base).rng) versions.rng - -RNG_cfg_base = options nodes resources constraints fencing acls tags alerts -RNG_base = cib $(RNG_cfg_base) status score rule nvset -RNG_files = $(foreach base,$(RNG_base),$(wildcard $(base).rng $(base)-*.rng)) - -# List of non-Pacemaker RNGs -RNG_extra = crm_mon.rng - -dist_API_DATA = $(API_files) -dist_RNG_DATA = $(RNG_files) $(RNG_extra) -nodist_API_DATA = $(API_generated) -nodist_RNG_DATA = $(RNG_generated) - -EXTRA_DIST = best-match.sh - -versions: - echo "Max: $(RNG_max)" - echo "Available: $(RNG_versions)" +CIB_base = cib $(CIB_cfg_base) status score rule nvset + +# All static schema files +API_files = $(foreach base,$(API_base),$(wildcard $(srcdir)/api/$(base)*.rng)) +CIB_files = $(foreach base,$(CIB_base),$(wildcard $(srcdir)/$(base).rng $(srcdir)/$(base)-*.rng)) +MON_files = crm_mon.rng + +# Sorted lists of all numeric schema versions +API_numeric_versions = $(call numeric_versions,${API_files}) +CIB_numeric_versions = $(call numeric_versions,${CIB_files}) + +# The highest numeric schema version +API_max ?= $(lastword $(API_numeric_versions)) +CIB_max ?= $(lastword $(CIB_numeric_versions)) + +# Sorted lists of all schema versions (including "next") +API_versions = next $(API_numeric_versions) +CIB_versions = next $(CIB_numeric_versions) + +# Dynamically generated schema files +API_generated = api/api-result.rng $(foreach base,$(API_versions),api/api-result-$(base).rng) +CIB_generated = pacemaker.rng $(foreach base,$(CIB_versions),pacemaker-$(base).rng) versions.rng + +CIB_version_pairs = $(call version_pairs,${CIB_numeric_versions}) +CIB_version_pairs_cnt = $(words ${CIB_version_pairs}) +CIB_version_pairs_last = $(call version_pairs_last,${CIB_version_pairs_cnt},${CIB_version_pairs}) + +dist_API_DATA = $(API_files) +dist_CIB_DATA = $(CIB_files) \ + upgrade-1.3.xsl \ + upgrade-2.10.xsl \ + $(wildcard $(srcdir)/upgrade-*enter.xsl) \ + $(wildcard $(srcdir)/upgrade-*leave.xsl) +dist_MON_DATA = $(MON_files) + +nodist_API_DATA = $(API_generated) +nodist_CIB_DATA = $(CIB_generated) + +EXTRA_DIST = Readme.md \ + best-match.sh \ + cibtr-2.rng \ + context-of.xsl \ + ocf-meta2man.xsl \ + regression.sh \ + upgrade-2.10-roundtrip.xsl \ + upgrade-detail.xsl \ + xslt_cibtr-2.rng \ + assets \ + test-2 \ + test-2-enter \ + test-2-leave \ + test-2-roundtrip + +cib-versions: + @echo "Max: $(CIB_max)" + @echo "Available: $(CIB_versions)" api-versions: - echo "Max: $(API_max)" - echo "Available: $(API_versions)" - -versions.rng: Makefile.am - echo " RNG $@" - echo '<?xml version="1.0" encoding="UTF-8"?>' > $@ - echo '<grammar xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">' >> $@ - echo ' <start>' >> $@ - echo ' <interleave>' >> $@ - echo ' <optional>' >> $@ - echo ' <attribute name="validate-with">' >> $@ - echo ' <choice>' >> $@ - echo ' <value>none</value>' >> $@ - echo ' <value>pacemaker-0.6</value>' >> $@ - echo ' <value>transitional-0.6</value>' >> $@ - echo ' <value>pacemaker-0.7</value>' >> $@ - echo ' <value>pacemaker-1.1</value>' >> $@ - for rng in $(RNG_versions); do echo " <value>pacemaker-$$rng</value>" >> $@; done - echo ' </choice>' >> $@ - echo ' </attribute>' >> $@ - echo ' </optional>' >> $@ - echo ' <attribute name="admin_epoch"><data type="nonNegativeInteger"/></attribute>' >> $@ - echo ' <attribute name="epoch"><data type="nonNegativeInteger"/></attribute>' >> $@ - echo ' <attribute name="num_updates"><data type="nonNegativeInteger"/></attribute>' >> $@ - echo ' </interleave>' >> $@ - echo ' </start>' >> $@ - echo '</grammar>' >> $@ + @echo "Max: $(API_max)" + @echo "Available: $(API_versions)" +# Dynamically generated top-level API schema api/api-result.rng: api/api-result-$(API_max).rng - echo " RNG $@" - cp $(top_builddir)/xml/$< $@ - -pacemaker.rng: pacemaker-$(RNG_max).rng - echo " RNG $@" - cp $(top_builddir)/xml/$< $@ - -api/api-result-%.rng: $(API_files) Makefile.am - echo " RNG $@" - echo '<?xml version="1.0" encoding="UTF-8"?>' > $@ - echo '<grammar xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">' >> $@ - echo ' <start>' >> $@ - echo ' <element name="pacemaker-result">' >> $@ - echo ' <attribute name="api-version"> <text /> </attribute>' >> $@ - echo ' <attribute name="request"> <text /> </attribute>' >> $@ - echo ' <optional>' >> $@ - echo ' <choice>' >> $@ - for rng in $(API_request_base); do $(top_srcdir)/xml/best-match.sh api/$$rng $(*) $(@) " " || :; done - echo ' </choice>' >> $@ - echo ' </optional>' >> $@ - $(top_srcdir)/xml/best-match.sh api/status $(*) $(@) " " || : - echo ' </element>' >> $@ - echo ' </start>' >> $@ - echo '</grammar>' >> $@ - -pacemaker-%.rng: $(RNG_files) best-match.sh Makefile.am - echo " RNG $@" - echo '<?xml version="1.0" encoding="UTF-8"?>' > $@ - echo '<grammar xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">' >> $@ - echo ' <start>' >> $@ - echo ' <element name="cib">' >> $@ - $(top_srcdir)/xml/best-match.sh cib $(*) $(@) " " - echo ' <element name="configuration">' >> $@ - echo ' <interleave>' >> $@ - for rng in $(RNG_cfg_base); do $(top_srcdir)/xml/best-match.sh $$rng $(*) $(@) " " || :; done - echo ' </interleave>' >> $@ - echo ' </element>' >> $@ - echo ' <optional>' >> $@ - echo ' <element name="status">' >> $@ - $(top_srcdir)/xml/best-match.sh status $(*) $(@) " " - echo ' </element>' >> $@ - echo ' </optional>' >> $@ - echo ' </element>' >> $@ - echo ' </start>' >> $@ - echo '</grammar>' >> $@ + $(AM_V_at)$(MKDIR_P) api # might not exist in VPATH build + $(AM_V_SCHEMA)cp $(top_builddir)/xml/$< $@ + +api/api-result-%.rng: $(API_files) best-match.sh Makefile.am + $(AM_V_at)$(MKDIR_P) api # might not exist in VPATH build + $(AM_V_at)echo '<?xml version="1.0" encoding="UTF-8"?>' > $@ + $(AM_V_at)echo '<grammar xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">' >> $@ + $(AM_V_at)echo ' <start>' >> $@ + $(AM_V_at)echo ' <element name="pacemaker-result">' >> $@ + $(AM_V_at)echo ' <attribute name="api-version"> <text /> </attribute>' >> $@ + $(AM_V_at)echo ' <attribute name="request"> <text /> </attribute>' >> $@ + $(AM_V_at)echo ' <optional>' >> $@ + $(AM_V_at)echo ' <choice>' >> $@ + $(AM_V_at)for rng in $(API_request_base); do $(srcdir)/best-match.sh api/$$rng $(*) $(@) " " || :; done + $(AM_V_at)echo ' </choice>' >> $@ + $(AM_V_at)echo ' </optional>' >> $@ + $(AM_V_at)$(srcdir)/best-match.sh api/status $(*) $(@) " " || : + $(AM_V_at)echo ' </element>' >> $@ + $(AM_V_at)echo ' </start>' >> $@ + $(AM_V_SCHEMA)echo '</grammar>' >> $@ + +# Dynamically generated top-level CIB schema +pacemaker.rng: pacemaker-$(CIB_max).rng + $(AM_V_SCHEMA)cp $(top_builddir)/xml/$< $@ + +pacemaker-%.rng: $(CIB_files) best-match.sh Makefile.am + $(AM_V_at)echo '<?xml version="1.0" encoding="UTF-8"?>' > $@ + $(AM_V_at)echo '<grammar xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">' >> $@ + $(AM_V_at)echo ' <start>' >> $@ + $(AM_V_at)echo ' <element name="cib">' >> $@ + $(AM_V_at)$(srcdir)/best-match.sh cib $(*) $(@) " " + $(AM_V_at)echo ' <element name="configuration">' >> $@ + $(AM_V_at)echo ' <interleave>' >> $@ + $(AM_V_at)for rng in $(CIB_cfg_base); do $(srcdir)/best-match.sh $$rng $(*) $(@) " " || :; done + $(AM_V_at)echo ' </interleave>' >> $@ + $(AM_V_at)echo ' </element>' >> $@ + $(AM_V_at)echo ' <optional>' >> $@ + $(AM_V_at)echo ' <element name="status">' >> $@ + $(AM_V_at)$(srcdir)/best-match.sh status $(*) $(@) " " + $(AM_V_at)echo ' </element>' >> $@ + $(AM_V_at)echo ' </optional>' >> $@ + $(AM_V_at)echo ' </element>' >> $@ + $(AM_V_at)echo ' </start>' >> $@ + $(AM_V_SCHEMA)echo '</grammar>' >> $@ + +# Dynamically generated CIB schema listing all pacemaker versions +versions.rng: Makefile.am + $(AM_V_at)echo '<?xml version="1.0" encoding="UTF-8"?>' > $@ + $(AM_V_at)echo '<grammar xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">' >> $@ + $(AM_V_at)echo ' <start>' >> $@ + $(AM_V_at)echo ' <interleave>' >> $@ + $(AM_V_at)echo ' <optional>' >> $@ + $(AM_V_at)echo ' <attribute name="validate-with">' >> $@ + $(AM_V_at)echo ' <choice>' >> $@ + $(AM_V_at)echo ' <value>none</value>' >> $@ + $(AM_V_at)echo ' <value>pacemaker-0.6</value>' >> $@ + $(AM_V_at)echo ' <value>transitional-0.6</value>' >> $@ + $(AM_V_at)echo ' <value>pacemaker-0.7</value>' >> $@ + $(AM_V_at)echo ' <value>pacemaker-1.1</value>' >> $@ + $(AM_V_at)for rng in $(CIB_versions); do echo " <value>pacemaker-$$rng</value>" >> $@; done + $(AM_V_at)echo ' </choice>' >> $@ + $(AM_V_at)echo ' </attribute>' >> $@ + $(AM_V_at)echo ' </optional>' >> $@ + $(AM_V_at)echo ' <attribute name="admin_epoch"><data type="nonNegativeInteger"/></attribute>' >> $@ + $(AM_V_at)echo ' <attribute name="epoch"><data type="nonNegativeInteger"/></attribute>' >> $@ + $(AM_V_at)echo ' <attribute name="num_updates"><data type="nonNegativeInteger"/></attribute>' >> $@ + $(AM_V_at)echo ' </interleave>' >> $@ + $(AM_V_at)echo ' </start>' >> $@ + $(AM_V_SCHEMA)echo '</grammar>' >> $@ # diff fails with ec=2 if no predecessor is found; # this uses '=' GNU extension to sed, if that's not available, # one can use: hline=`echo "$${p}" | grep -Fn "$${hunk}" | cut -d: -f1`; # XXX: use line information from hunk to avoid "not detected" for ambiguity version_diff = \ @for p in $(1); do \ set `echo "$${p}" | tr '-' ' '`; \ echo "\#\#\# *-$$2.rng vs. predecessor"; \ for v in *-$$2.rng; do \ echo "\#\#\#\# $${v} vs. predecessor"; b=`echo "$${v}" | cut -d- -f1`; \ old=`./best-match.sh $${b} $$1`; \ p=`diff -u "$${old}" "$${v}" 2>/dev/null`; \ case $$? in \ 1) echo "$${p}" | sed -n -e '/^@@ /!d;=;p' \ -e ':l;n;/^\([- ]\|+.*<[^ />]\+\([^/>]\+="ID\|>$$\)\)/bl;s/^[+ ]\(.*\)/\1/p' \ | while read hline; do \ read h && read i || break; \ iline=`grep -Fn "$${i}" "$${v}" | cut -d: -f1`; \ ctxt="(not detected)"; \ if test `echo "$${iline}" | wc -l` -eq 1; then \ ctxt=`{ sed -n -e "1,$$(($${iline}-1))p" "$${v}"; \ echo "<inject id=\"GOAL\"/>$${i}"; \ sed -n -e "$$(($${iline}+1)),$$ p" "$${v}"; \ } | $(XSLTPROC) --param skip 1 context-of.xsl -`; \ fi; \ echo "$${p}" | sed -n -e "$$(($${hline}-2)),$${hline}!d" \ -e '/^\(+++\|---\)/p'; \ echo "$${h} context: $${ctxt}"; \ echo "$${p}" | sed -n -e "1,$${hline}d" \ -e '/^\(---\|@@ \)/be;p;d;:e;n;be'; \ done; \ ;; \ 2) echo "\#\#\#\#\# $${v} has no predecessor";; \ esac; \ done; \ done diff: best-match.sh - @echo "# Comparing changes in + since $(RNG_max)" - $(call version_diff,${RNG_version_pairs_last}) + @echo "# Comparing changes in + since $(CIB_max)" + $(call version_diff,${CIB_version_pairs_last}) fulldiff: best-match.sh @echo "# Comparing all changes across all the subsequent increments" - $(call version_diff,${RNG_version_pairs}) + $(call version_diff,${CIB_version_pairs}) -CLEANFILES = $(API_generated) $(RNG_generated) +CLEANFILES = $(API_generated) $(CIB_generated)