diff --git a/.gitignore b/.gitignore index 05827628a8..cb6bb309a6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,229 +1,217 @@ # Common \#* .\#* GPATH GRTAGS GTAGS TAGS Makefile Makefile.in .deps .dirstamp .libs *.pc *.pyc *.bz2 *.tar.gz -*.tgz +*.rpm *.la *.lo *.o *~ *.gcda *.gcno # Autobuild aclocal.m4 autoconf autoheader autom4te.cache/ automake build.counter compile -/confdefs.h config.guess config.log config.status config.sub configure -/conftest* depcomp install-sh include/stamp-* libtool libtool.m4 ltdl.m4 libltdl ltmain.sh missing py-compile /m4/argz.m4 /m4/ltargz.m4 /m4/ltoptions.m4 /m4/ltsugar.m4 /m4/ltversion.m4 /m4/lt~obsolete.m4 test-driver ylwrap # Configure targets /cts/CTS.py /cts/CTSlab.py /cts/CTSvars.py /cts/LSBDummy /cts/OCFIPraTest.py /cts/benchmark/clubench /cts/cluster_test /cts/cts /cts/cts-cli /cts/cts-coverage /cts/cts-exec /cts/cts-fencing /cts/cts-log-watcher /cts/cts-regression /cts/cts-scheduler /cts/cts-support /cts/fence_dummy /cts/lxc_autogen.sh /cts/pacemaker-cts-dummyd /cts/pacemaker-cts-dummyd@.service /daemons/execd/pacemaker_remote /daemons/execd/pacemaker_remote.service /daemons/fenced/fence_legacy /daemons/pacemakerd/pacemaker /daemons/pacemakerd/pacemaker.combined.upstart /daemons/pacemakerd/pacemaker.service /daemons/pacemakerd/pacemaker.upstart /doc/Doxyfile /extra/logrotate/pacemaker /extra/resources/ClusterMon /extra/resources/HealthSMART /extra/resources/SysInfo /extra/resources/ifspeed /extra/resources/o2cb include/config.h include/config.h.in include/crm_config.h publican.cfg /tools/cibsecret /tools/crm_error /tools/crm_failcount /tools/crm_master /tools/crm_mon.service /tools/crm_mon.upstart /tools/crm_report /tools/crm_rule /tools/crm_standby /tools/report.collector /tools/report.common # Build targets *.7 *.7.xml *.7.html *.8 *.8.xml *.8.html /daemons/attrd/pacemaker-attrd /daemons/based/pacemaker-based /daemons/based/cibmon /daemons/controld/pacemaker-controld /daemons/execd/cts-exec-helper /daemons/execd/pacemaker-execd /daemons/execd/pacemaker-remoted /daemons/fenced/cts-fence-helper /daemons/fenced/pacemaker-fenced /daemons/fenced/pacemaker-fenced.xml /daemons/pacemakerd/pacemakerd /daemons/schedulerd/pacemaker-schedulerd /daemons/schedulerd/pacemaker-schedulerd.xml /doc/*/tmp/** /doc/*/publish /doc/*.build /doc/*/en-US/Ap-*.xml /doc/*/en-US/Ch-*.xml /doc/.ABI-build /doc/HTML /doc/abi_dumps /doc/abi-check /doc/acls.html /doc/api/* /doc/compat_reports /doc/crm_fencing.html /doc/publican-catalog* /doc/shared/en-US/*.xml /doc/shared/en-US/images/pcmk-*.png /doc/shared/en-US/images/Policy-Engine-*.png -/lib/common/md5.c /maint/testcc -/maint/mocked/based scratch /tools/attrd_updater /tools/cibadmin /tools/crmadmin /tools/crm_attribute /tools/crm_diff /tools/crm_mon /tools/crm_node /tools/crm_resource /tools/crm_shadow /tools/crm_simulate /tools/crm_ticket /tools/crm_verify /tools/iso8601 /tools/stonith_admin xml/crm.dtd xml/pacemaker*.rng xml/versions.rng xml/api/api-result*.rng lib/gnu/libgnu.a lib/gnu/stdalign.h *.coverity -# Packager artifacts -*.rpm -/mock -/pacemaker.spec -/rpm/[A-Z]* - -# make dist/export working directory -pacemaker-[a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9] - # Test detritus /cts/.regression.failed.diff /cts/scheduler/*.ref /cts/scheduler/*.up /cts/scheduler/*.up.err /cts/scheduler/bug-rh-1097457.log /cts/scheduler/bug-rh-1097457.trs /cts/scheduler/shadow.* /cts/test-suite.log /xml/test-*/*.up /xml/test-*/*.up.err /xml/assets/*.rng /xml/assets/diffview.js /xml/assets/xmlcatalog # Release maintenance detritus /maint/gnulib # Formerly built files (helps when jumping back and forth in checkout) /.ABI-build /Doxyfile /HTML /abi_dumps /abi-check /compat_reports /attrd /cib /coverage.sh /crmd /cts/HBDummy /doc/Clusters_from_Scratch.txt /doc/Pacemaker_Explained.txt /fencing /lrmd /mcp -/pacemaker-*.spec /pengine #Other +mock +pacemaker*.spec coverity-* logs *.patch *.diff *.sed *.orig *.rej *.swp diff --git a/GNUmakefile b/GNUmakefile index 8f1049a620..f3b2ad3ac6 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -1,417 +1,354 @@ # # 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: build -.PHONY: default +default: $(shell test ! -e configure && echo init) $(shell test -e configure && echo core) -include Makefile -# The main purpose of this GNUmakefile is that its targets can be invoked -# without having to call autogen.sh and configure first. That means automake -# variables may or may not be defined. Here, we use the current working -# directory if a relevant variable hasn't been defined. -# -# The idea is to keep generated artifacts in the build tree, in case a VPATH -# build is in use, but in practice it would be difficult to make the targets -# here usable from a different location than the source tree. -abs_srcdir ?= $(shell pwd) -abs_builddir ?= $(shell pwd) - PACKAGE ?= pacemaker - -# Definitions that specify what various targets will apply to - +# 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)' 2>/dev/null | sed -n 's|tags/\(.*\)|\1|p'); \ +TAG ?= $(shell T=$$(git describe --all '$(COMMIT)' | sed -n 's|tags/\(.*\)|\1|p'); \ test -n "$${T}" && echo "$${T}" \ - || git log --pretty=format:%H -n 1 '$(COMMIT)' 2>/dev/null || echo DIST) + || git log --pretty=format:%H -n 1 '$(COMMIT)') lparen = ( rparen = ) -SHORTTAG ?= $(shell case $(TAG) in Pacemaker-*|DIST$(rparen) echo '$(TAG)' | cut -c11-;; \ +SHORTTAG ?= $(shell case $(TAG) in Pacemaker-*$(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}') - -# This Makefile can create 2 types of distributions: -# -# - "make dist" is automake's native functionality, based on the various -# dist/nodist make variables; it always uses the current sources -# -# - "make export" is a custom target based on git archive and relevant entries -# from .gitattributes; it defaults to current sources but can use any git tag -# -# Both types use the TARFILE name for the result, though they generate -# different contents. -distdir = $(PACKAGE)-$(SHORTTAG) -TARFILE = $(abs_builddir)/$(PACKAGE)-$(SHORTTAG).tar.gz - -.PHONY: init -init: - test -e $(top_srcdir)/configure || ./autogen.sh - test -e $(abs_builddir)/Makefile || $(abs_builddir)/configure - -.PHONY: build -build: init - $(MAKE) $(AM_MAKEFLAGS) core - -export: - if [ ! -f "$(TARFILE)" ]; then \ - 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 - -export-clean: - -rm -f $(abs_builddir)/$(PACKAGE)-*.tar.gz - -## RPM-related targets - -# Where to put RPM artifacts; possible values: -# -# - toplevel (default): RPM sources, spec, and source rpm in top-level build -# directory (everything else uses the usual defaults) -# -# - subtree: RPM sources (i.e. TARFILE) in top-level build directory, -# everything else in dedicated "rpmbuild" subdirectory of build tree -RPMDEST ?= toplevel - -RPM_SPEC_DIR_toplevel = $(abs_builddir) -RPM_SRCRPM_DIR_toplevel = $(abs_builddir) -RPM_OPTS_toplevel = --define "_sourcedir $(abs_builddir)" \ - --define "_specdir $(RPM_SPEC_DIR_toplevel)" \ - --define "_srcrpmdir $(RPM_SRCRPM_DIR_toplevel)" - -RPM_SPEC_DIR_subtree = $(abs_builddir)/rpm/SPECS -RPM_SRCRPM_DIR_subtree = $(abs_builddir)/rpm/SRPMS -RPM_OPTS_subtree = --define "_sourcedir $(abs_builddir)" \ - --define "_topdir $(abs_builddir)/rpm" - -RPM_SPEC_DIR = $(RPM_SPEC_DIR_$(RPMDEST)) -RPM_SRCRPM_DIR = $(RPM_SRCRPM_DIR_$(RPMDEST)) -RPM_OPTS = $(RPM_OPTS_$(RPMDEST)) - -WITH ?= --without doc 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) - -MOCK_DIR = $(abs_builddir)/mock -MOCK_OPTIONS ?= --resultdir=$(MOCK_DIR) --no-cleanup-after -F ?= $(shell test ! -e /etc/fedora-release && echo 0; test -e /etc/fedora-release && rpm --eval %{fedora}) -ARCH ?= $(shell test ! -e /etc/fedora-release && uname -m; test -e /etc/fedora-release && rpm --eval %{_arch}) -MOCK_CFG ?= $(shell test -e /etc/fedora-release && echo fedora-$(F)-$(ARCH)) +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}" -$(RPM_SPEC_DIR)/$(PACKAGE).spec: rpm/pacemaker.spec.in - $(AM_V_at)$(MKDIR_P) $(RPM_SPEC_DIR) # might not exist in VPATH build - $(AM_V_GEN)if [ x != x"`git ls-files -m rpm/pacemaker.spec.in 2>/dev/null`" ]; then \ - cat $(abs_srcdir)/rpm/pacemaker.spec.in; \ - elif git cat-file -e $(TAG):rpm/pacemaker.spec.in 2>/dev/null; then \ - git show $(TAG):rpm/pacemaker.spec.in; \ - elif git cat-file -e $(TAG):pacemaker.spec.in 2>/dev/null; then \ - git show $(TAG):pacemaker.spec.in; \ - else \ - cat $(abs_srcdir)/rpm/pacemaker.spec.in; \ - fi | sed \ - -e 's/global\ specversion\ .*/global\ specversion\ $(SPECVERSION)/' \ - -e 's/global\ commit\ .*/global\ commit\ $(SHORTTAG)/' \ - -e 's/global\ commit_abbrev\ .*/global\ commit_abbrev\ $(SHORTTAG_ABBREV)/' \ - -e "s/PACKAGE_DATE/$$(date +'%a %b %d %Y')/" \ - -e "s/PACKAGE_VERSION/$$(git describe --tags $(TAG) | sed -e s:Pacemaker-:: -e s:-.*::)/" \ - > "$@" +init: + ./autogen.sh init -.PHONY: $(PACKAGE).spec -$(PACKAGE).spec: $(RPM_SPEC_DIR)/$(PACKAGE).spec +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 -.PHONY: spec-clean -spec-clean: - -rm -f $(RPM_SPEC_DIR)/$(PACKAGE).spec +$(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 -.PHONY: srpm -srpm: export srpm-clean $(RPM_SPEC_DIR)/$(PACKAGE).spec +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 - $(call rpmbuild-with,$(WITH),-bs $(RPM_OPTS),$(RPM_SPEC_DIR)/$(PACKAGE).spec) - -.PHONY: srpm-clean -srpm-clean: - -rm -f $(RPM_SRCRPM_DIR)/*.src.rpm + 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) -.PHONY: chroot chroot: mock-$(MOCK_CFG) mock-install-$(MOCK_CFG) mock-sh-$(MOCK_CFG) - @echo "Done" + echo "Done" -.PHONY: mock-next mock-next: - $(MAKE) $(AM_MAKEFLAGS) F=$(shell expr 1 + $(F)) mock + make F=$(shell expr 1 + $(F)) mock -.PHONY: mock-rawhide mock-rawhide: - $(MAKE) $(AM_MAKEFLAGS) F=rawhide mock + make F=rawhide mock mock-install-%: - @echo "Installing packages" - mock --root=$* $(MOCK_OPTIONS) --install $(MOCK_DIR)/*.rpm \ - vi sudo valgrind lcov gdb fence-agents psmisc + echo "Installing packages" + mock --root=$* $(MOCK_OPTIONS) --install $(RPM_ROOT)/mock/*.rpm vi sudo valgrind lcov gdb fence-agents psmisc -.PHONY: mock-install mock-install: mock-install-$(MOCK_CFG) - @echo "Done" + echo "Done" -.PHONY: mock-sh 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" -mock-%: srpm mock-clean - mock $(MOCK_OPTIONS) --root=$* --no-cleanup-after --rebuild \ - $(WITH) $(RPM_SRCRPM_DIR)/*.src.rpm - -.PHONY: mock -mock: mock-$(MOCK_CFG) - @echo "Done" - -.PHONY: dirty -dirty: - $(MAKE) $(AM_MAKEFLAGS) TAG=dirty mock +# 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 -.PHONY: mock-clean -mock-clean: - -rm -rf $(MOCK_DIR) +srpm: srpm-$(DISTRO) + echo "Done" -.PHONY: rpm-dep -rpm-dep: $(RPM_SPEC_DIR)/$(PACKAGE).spec - sudo yum-builddep $(PACKAGE).spec +mock: mock-$(MOCK_CFG) + 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 -# e.g. make WITH="--with pre_release" rpm -.PHONY: rpm rpm: srpm @echo To create custom builds, edit the flags and options in $(PACKAGE).spec first - $(call rpmbuild-with,$(WITH),$(RPM_OPTS),--rebuild $(RPM_SRCRPM_DIR)/*.src.rpm) + $(call rpmbuild-with,$(WITH),$(RPM_OPTS),--rebuild $(RPM_ROOT)/*.src.rpm) -.PHONY: rpmlint -rpmlint: $(RPM_SPEC_DIR)/$(PACKAGE).spec - rpmlint -f rpm/rpmlintrc "$<" - -.PHONY: release release: - $(MAKE) $(AM_MAKEFLAGS) TAG=$(LAST_RELEASE) rpm + make TAG=$(LAST_RELEASE) rpm -.PHONY: rc rc: - $(MAKE) $(AM_MAKEFLAGS) TAG=$(LAST_RC) rpm - - -## Static analysis via coverity - -# Aggressiveness (low, medium, or high) -COVLEVEL ?= low - -# Generated outputs -COVERITY_DIR = $(abs_builddir)/coverity-$(TAG) -COVTAR = $(abs_builddir)/$(PACKAGE)-coverity-$(TAG).tgz -COVEMACS = $(abs_builddir)/$(TAG).coverity -COVHTML = $(COVERITY_DIR)/output/errors - -# Coverity outputs are phony so they get rebuilt every invocation + make TAG=$(LAST_RC) rpm -.PHONY: $(COVERITY_DIR) -$(COVERITY_DIR): init 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 "$(abs_builddir)"/coverity-* \ - "$(abs_builddir)"/$(PACKAGE)-coverity-*.tgz \ - "$(abs_builddir)"/*.coverity - - -## Change log generation +dirty: + make TAG=dirty mock + +COVERITY_DIR = $(shell pwd)/coverity-$(TAG) +COVFILE = $(PACKAGE)-coverity-$(TAG).tgz +COVHOST ?= scan5.coverity.com +COVPASS ?= password + +# Static analysis via coverity + +coverity-common: + test -e configure || ./autogen.sh + test -e Makefile || ./configure + make core-clean + rm -rf $(COVERITY_DIR) + cov-build --dir $(COVERITY_DIR) make core + +coverity: coverity-common + tar czf $(COVFILE) --transform=s@.*$(TAG)@cov-int@ $(COVERITY_DIR) + @echo "Uploading to public Coverity instance..." + curl --form file=@$(COVFILE) --form project=$(PACKAGE) --form password=$(COVPASS) --form email=andrew@beekhof.net http://$(COVHOST)/cgi-bin/upload.py + rm -rf $(COVFILE) $(COVERITY_DIR) + make core-clean + +coverity-corp: coverity-common + test -e configure || ./autogen.sh + test -e Makefile || ./configure + make core-clean + rm -rf $(COVERITY_DIR) + cov-build --dir $(COVERITY_DIR) make core + @echo "Waiting for a corporate Coverity license..." + cov-analyze --dir $(COVERITY_DIR) --wait-for-license + cov-format-errors --dir $(COVERITY_DIR) --emacs-style > $(TAG).coverity + cov-format-errors --dir $(COVERITY_DIR) +# rsync $(RSYNC_OPTS) "$(COVERITY_DIR)/c/output/errors/" "$(RSYNC_DEST)/$(PACKAGE)/coverity/$(TAG)/" + make core-clean +# cov-commit-defects --host $(COVHOST) --dir $(COVERITY_DIR) --stream $(PACKAGE) --user auto --password $(COVPASS) +# rm -rf $(COVERITY_DIR) summary: - @printf "\n* `date +"%a %b %d %Y"` `git config user.name` <`git config user.email`> $(NEXT_RELEASE)" + @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) $(AM_MAKEFLAGS) NEXT_RELEASE=$(shell echo $(LAST_RC) | sed s:-rc.*::) LAST_RELEASE=$(LAST_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) $(AM_MAKEFLAGS) changes > 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) $(AM_MAKEFLAGS) clean all + 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) - -# The toplevel "clean" targets are generated from Makefile.am, not this file. -# We can't use autotools' CLEANFILES, clean-local, etc. here. Instead, we -# define this target, which Makefile.am can call from clean-local. -ancillary-clean: export-clean spec-clean srpm-clean mock-clean coverity-clean - -rm -f $(TARFILE) diff --git a/Makefile.am b/Makefile.am index 51a1651584..62eabd5295 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,109 +1,74 @@ # # 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 = CONTRIBUTING.md \ - GNUmakefile \ - INSTALL.md \ - README.markdown \ - autogen.sh \ - m4/gnulib-cache.m4 \ - m4/gnulib-tool.m4 \ - rpm/rpmlintrc \ - rpm/pacemaker.spec.in - -DISTCLEANFILES = config.status - -MAINTAINERCLEANFILES = Makefile.in \ - aclocal.m4 \ - config.guess \ - config.sub \ - configure \ - depcomp \ - install-sh \ - ltmain.sh \ - missing \ - py-compile \ - test-driver - -# 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="" +EXTRA_DIST = autogen.sh m4/gnulib-cache.m4 + +MAINTAINERCLEANFILES = Makefile.in aclocal.m4 configure DRF/config-h.in \ + DRF/stamp-h.in libtool.m4 ltdl.m4 # 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/ -dist_license_DATA = $(wildcard licenses/*) +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)" - @for subdir in $(CORE); do \ - echo "Building $$subdir"; \ - $(MAKE) $(AM_MAKEFLAGS) -C $$subdir all || exit 1; \ - done + list='$(CORE)'; for subdir in $$list; do echo "Building $$subdir"; $(MAKE) -C $$subdir all || exit 1; done core-install: @echo "Installing only core components: $(CORE_INSTALL)" - @for subdir in $(CORE_INSTALL); do \ + list='$(CORE_INSTALL)'; \ + for subdir in $$list; do \ echo "Installing $$subdir"; \ - $(MAKE) $(AM_MAKEFLAGS) -C $$subdir install || exit 1; \ + $(MAKE) -C $$subdir install || exit 1; \ done core-clean: @echo "Cleaning only core components and tests: $(CORE)" - @for subdir in $(CORE); do \ - echo "Cleaning $$subdir"; \ - $(MAKE) $(AM_MAKEFLAGS) -C $$subdir clean || exit 1; \ - done + list='$(CORE)'; for subdir in $$list; 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 *.tar.bz2 *.sed - -clean-local: - $(MAKE) $(AM_MAKEFLAGS) ancillary-clean + rm -f $(TARFILE) *.tar.bz2 *.sed -distclean-local: - -rm -rf libltdl autom4te.cache +dist-clean-local: + rm -f autoconf automake autoheader diff --git a/rpm/pacemaker.spec.in b/pacemaker.spec.in similarity index 89% rename from rpm/pacemaker.spec.in rename to pacemaker.spec.in index 83d756541d..262fcca6e2 100644 --- a/rpm/pacemaker.spec.in +++ b/pacemaker.spec.in @@ -1,874 +1,839 @@ # Globals and defines to control package behavior (configure these as desired) ## User and group to use for nonprivileged services %global uname hacluster %global gname haclient ## Where to install Pacemaker documentation -%if 0%{?suse_version} > 0 -%global pcmk_docdir %{_docdir}/%{name}-%{version} -%else %global pcmk_docdir %{_docdir}/%{name} -%endif ## GitHub entity that distributes source (for ease of using a fork) %global github_owner ClusterLabs ## Upstream pacemaker version, and its package version (specversion ## can be incremented to build packages reliably considered "newer" ## than previously built packages with the same pcmkversion) %global pcmkversion 2.0.2 %global specversion 1 ## Upstream commit (or git tag, such as "Pacemaker-" plus the ## {pcmkversion} macro for an official release) to use for this package %global commit HEAD ## Since git v2.11, the extent of abbreviation is autoscaled by default ## (used to be constant of 7), so we need to convey it for non-tags, too. %global commit_abbrev 7 ## Python major version to use (2, 3, or 0 for auto-detect) %global python_major 0 # Define globals for convenient use later ## Workaround to use parentheses in other globals %global lparen ( %global rparen ) ## Short version of git commit %define shortcommit %(c=%{commit}; case ${c} in Pacemaker-*%{rparen} echo ${c:10};; *%{rparen} echo ${c:0:%{commit_abbrev}};; esac) ## Whether this is a tagged release %define tag_release %([ %{commit} != Pacemaker-%{shortcommit} ]; echo $?) ## Whether this is a release candidate (in case of a tagged release) %define pre_release %([ "%{tag_release}" -eq 0 ] || { case "%{shortcommit}" in *-rc[[:digit:]]*%{rparen} false;; esac; }; echo $?) ## Heuristic used to infer bleeding-edge deployments that are ## less likely to have working versions of the documentation tools %define bleeding %(test ! -e /etc/yum.repos.d/fedora-rawhide.repo; echo $?) ## Whether this platform defaults to using systemd as an init system ## (needs to be evaluated prior to BuildRequires being enumerated and ## installed as it's intended to conditionally select some of these, and ## for that there are only few indicators with varying reliability: ## - presence of systemd-defined macros (when building in a full-fledged ## environment, which is not the case with ordinary mock-based builds) ## - systemd-aware rpm as manifested with the presence of particular ## macro (rpm itself will trivially always be present when building) ## - existence of /usr/lib/os-release file, which is something heavily ## propagated by systemd project ## - when not good enough, there's always a possibility to check ## particular distro-specific macros (incl. version comparison) %define systemd_native (%{?_unitdir:1}%{!?_unitdir:0}%{nil \ } || %{?__transaction_systemd_inhibit:1}%{!?__transaction_systemd_inhibit:0}%{nil \ } || %(test -f /usr/lib/os-release; test $? -ne 0; echo $?)) %if 0%{?fedora} > 20 || 0%{?rhel} > 7 ## Base GnuTLS cipher priorities (presumably only the initial, required keyword) ## overridable with "rpmbuild --define 'pcmk_gnutls_priorities PRIORITY-SPEC'" %define gnutls_priorities %{?pcmk_gnutls_priorities}%{!?pcmk_gnutls_priorities:@SYSTEM} %endif -## Different distros name certain packages differently -%if 0%{?suse_version} > 0 -%global pkgname_bzip2_devel libbz2-devel -%global pkgname_docbook_xsl docbook-xsl-stylesheets -%global pkgname_gnutls_devel libgnutls-devel -%global pkgname_shadow_utils shadow -%global pkgname_procps procps -%global pkgname_corosync_lib libcorosync -%global pkgname_glue_libs libglue -%global pkgname_pcmk_libs lib%{name}3 -%global hacluster_id 90 -%else -%global pkgname_libtool_devel libtool-ltdl-devel -%global pkgname_libtool_devel_arch libtool-ltdl-devel%{?_isa} -%global pkgname_bzip2_devel bzip2-devel -%global pkgname_docbook_xsl docbook-style-xsl -%global pkgname_gnutls_devel gnutls-devel -%global pkgname_shadow_utils shadow-utils -%global pkgname_procps procps-ng -%global pkgname_publican publican -%global pkgname_corosync_lib corosynclib -%global pkgname_glue_libs cluster-glue-libs -%global pkgname_pcmk_libs %{name}-libs -%global hacluster_id 189 -%endif - # Python-related definitions ## Use Python 3 on certain platforms if major version not specified %if %{?python_major} == 0 %if 0%{?fedora} > 26 || 0%{?rhel} > 7 %global python_major 3 %endif %endif ## Turn off auto-compilation of Python files outside Python specific paths, ## so there's no risk that unexpected "__python" macro gets picked to do the ## RPM-native byte-compiling there (only "{_datadir}/pacemaker/tests" affected) ## -- distro-dependent tricks or automake's fallback to be applied there %if %{defined _python_bytecompile_extra} %global _python_bytecompile_extra 0 %else ### the statement effectively means no RPM-native byte-compiling will occur at ### all, so distro-dependent tricks for Python-specific packages to be applied %global __os_install_post %(echo '%{__os_install_post}' | { sed -e 's!/usr/lib[^[:space:]]*/brp-python-bytecompile[[:space:]].*$!!g'; }) %endif ## Values that differ by Python major version %if 0%{?python_major} > 2 %global python_name python3 %global python_path %{?__python3}%{!?__python3:/usr/bin/python%{?python3_pkgversion}%{!?python3_pkgversion:3}} %define python_site %{?python3_sitelib}%{!?python3_sitelib:%( %{python_path} -c 'from distutils.sysconfig import get_python_lib as gpl; print(gpl(1))' 2>/dev/null)} %else %if 0%{?python_major} > 1 %global python_name python2 %global python_path %{?__python2}%{!?__python2:/usr/bin/python%{?python2_pkgversion}%{!?python2_pkgversion:2}} %define python_site %{?python2_sitelib}%{!?python2_sitelib:%( %{python_path} -c 'from distutils.sysconfig import get_python_lib as gpl; print(gpl(1))' 2>/dev/null)} %else %global python_name python %global python_path %{?__python}%{!?__python:/usr/bin/python%{?python_pkgversion}} %define python_site %{?python_sitelib}%{!?python_sitelib:%( python -c 'from distutils.sysconfig import get_python_lib as gpl; print(gpl(1))' 2>/dev/null)} %endif %endif # Definitions for backward compatibility with older RPM versions ## Ensure the license macro behaves consistently (older RPM will otherwise ## overwrite it once it encounters "License:"). Courtesy Jason Tibbitts: ## https://pkgs.fedoraproject.org/cgit/rpms/epel-rpm-macros.git/tree/macros.zzz-epel?h=el6&id=e1adcb77 %if !%{defined _licensedir} %define description %{lua: rpm.define("license %doc") print("%description") } %endif # Define conditionals so that "rpmbuild --with " and # "rpmbuild --without " can enable and disable specific features ## Add option to enable support for stonith/external fencing agents %bcond_with stonithd ## Add option to create binaries suitable for use with profiling tools %bcond_with profiling ## Add option to create binaries with coverage analysis %bcond_with coverage ## Add option to skip generating documentation ## (the build tools aren't available everywhere) %bcond_without doc ## Add option to prefix package version with "0." ## (so later "official" packages will be considered updates) %bcond_with pre_release ## Add option to ship Upstart job files %bcond_with upstart_job ## Add option to turn off hardening of libraries and daemon executables %bcond_without hardening ## Add option to disable links for legacy daemon names %bcond_without legacy_links # Keep sane profiling data if requested %if %{with profiling} ## Disable -debuginfo package and stripping binaries/libraries %define debug_package %{nil} %endif # Define the release version # (do not look at externally enforced pre-release flag for tagged releases # as only -rc tags, captured with the second condition, implies that then) %if (!%{tag_release} && %{with pre_release}) || 0%{pre_release} %if 0%{pre_release} %define pcmk_release 0.%{specversion}.%(s=%{shortcommit}; echo ${s: -3}) %else %define pcmk_release 0.%{specversion}.%{shortcommit}.git %endif %else %if 0%{tag_release} %define pcmk_release %{specversion} %else %define pcmk_release %{specversion}.%{shortcommit}.git %endif %endif Name: pacemaker Summary: Scalable High-Availability cluster resource manager Version: %{pcmkversion} Release: %{pcmk_release}%{?dist} %if %{defined _unitdir} License: GPLv2+ and LGPLv2+ %else # initscript is Revised BSD License: GPLv2+ and LGPLv2+ and BSD %endif Url: http://www.clusterlabs.org Group: System Environment/Daemons # Hint: use "spectool -s 0 pacemaker.spec" (rpmdevtools) to check the final URL: # https://github.com/ClusterLabs/pacemaker/archive/e91769e5a39f5cb2f7b097d3c612368f0530535e/pacemaker-e91769e.tar.gz Source0: https://github.com/%{github_owner}/%{name}/archive/%{commit}/%{name}-%{shortcommit}.tar.gz Requires: resource-agents -Requires: %{pkgname_pcmk_libs}%{?_isa} = %{version}-%{release} +Requires: %{name}-libs%{?_isa} = %{version}-%{release} Requires: %{name}-cluster-libs%{?_isa} = %{version}-%{release} Requires: %{name}-cli = %{version}-%{release} %if !%{defined _unitdir} -Requires: %{pkgname_procps} +Requires: procps-ng Requires: psmisc %endif %{?systemd_requires} Requires: %{python_path} BuildRequires: %{python_name}-devel # Pacemaker requires a minimum libqb functionality Requires: libqb >= 0.13.0 BuildRequires: libqb-devel >= 0.13.0 # Basics required for the build (even if usually satisfied through other BRs) BuildRequires: coreutils findutils grep sed # Required for core functionality -BuildRequires: automake autoconf gcc libtool pkgconfig %{?pkgname_libtool_devel} +BuildRequires: automake autoconf gcc libtool pkgconfig libtool-ltdl-devel BuildRequires: pkgconfig(glib-2.0) >= 2.16 BuildRequires: libxml2-devel libxslt-devel libuuid-devel -BuildRequires: %{pkgname_bzip2_devel} +BuildRequires: bzip2-devel # Enables optional functionality -BuildRequires: ncurses-devel %{pkgname_docbook_xsl} -BuildRequires: help2man %{pkgname_gnutls_devel} pam-devel pkgconfig(dbus-1) +BuildRequires: ncurses-devel docbook-style-xsl +BuildRequires: help2man gnutls-devel pam-devel pkgconfig(dbus-1) %if %{systemd_native} BuildRequires: pkgconfig(systemd) %endif Requires: corosync >= 2.0.0 -BuildRequires: %{pkgname_corosync_lib}-devel >= 2.0.0 +BuildRequires: corosynclib-devel >= 2.0.0 %if %{with stonithd} -BuildRequires: %{pkgname_glue_libs}-devel +BuildRequires: cluster-glue-libs-devel %endif ## (note no avoiding effect when building through non-customized mock) %if !%{bleeding} %if %{with doc} -BuildRequires: inkscape asciidoc %{?pkgname_publican} +BuildRequires: inkscape asciidoc publican %endif %endif Provides: pcmk-cluster-manager = %{version}-%{release} Provides: pcmk-cluster-manager%{?_isa} = %{version}-%{release} # Bundled bits ## Pacemaker uses the crypto/md5-buffer module from gnulib %if 0%{?fedora} || 0%{?rhel} Provides: bundled(gnulib) %endif %description Pacemaker is an advanced, scalable High-Availability cluster resource manager. It supports more than 16 node clusters with significant capabilities for managing resources and dependencies. It will run scripts at initialization, when machines go up or down, when related resources fail and can be configured to periodically check resource health. Available rpmbuild rebuild options: --with(out) : coverage doc stonithd hardening pre_release profiling upstart_job %package cli License: GPLv2+ and LGPLv2+ Summary: Command line tools for controlling Pacemaker clusters Group: System Environment/Daemons -Requires: %{pkgname_pcmk_libs}%{?_isa} = %{version}-%{release} +Requires: %{name}-libs%{?_isa} = %{version}-%{release} %if 0%{?fedora} > 22 || 0%{?rhel} > 7 Recommends: pcmk-cluster-manager = %{version}-%{release} -# For crm_report -Recommends: tar -Recommends: bzip2 %endif Requires: perl-TimeDate -Requires: %{pkgname_procps} +Requires: procps-ng Requires: psmisc Requires(post):coreutils %description cli Pacemaker is an advanced, scalable High-Availability cluster resource manager. The %{name}-cli package contains command line tools that can be used to query and control the cluster from machines that may, or may not, be part of the cluster. -%package -n %{pkgname_pcmk_libs} +%package libs License: GPLv2+ and LGPLv2+ Summary: Core Pacemaker libraries Group: System Environment/Daemons -Requires(pre): %{pkgname_shadow_utils} +Requires(pre): shadow-utils Requires: %{name}-schemas = %{version}-%{release} # sbd 1.4.0+ supports the libpe_status API for pe_working_set_t Conflicts: sbd < 1.4.0 -%description -n %{pkgname_pcmk_libs} +%description libs Pacemaker is an advanced, scalable High-Availability cluster resource manager. -The %{pkgname_pcmk_libs} package contains shared libraries needed for cluster +The %{name}-libs package contains shared libraries needed for cluster nodes and those just running the CLI tools. %package cluster-libs License: GPLv2+ and LGPLv2+ Summary: Cluster Libraries used by Pacemaker Group: System Environment/Daemons -Requires: %{pkgname_pcmk_libs}%{?_isa} = %{version}-%{release} +Requires: %{name}-libs%{?_isa} = %{version}-%{release} %description cluster-libs Pacemaker is an advanced, scalable High-Availability cluster resource manager. The %{name}-cluster-libs package contains cluster-aware shared libraries needed for nodes that will form part of the cluster nodes. %package remote %if %{defined _unitdir} License: GPLv2+ and LGPLv2+ %else # initscript is Revised BSD License: GPLv2+ and LGPLv2+ and BSD %endif Summary: Pacemaker remote daemon for non-cluster nodes Group: System Environment/Daemons -Requires: %{pkgname_pcmk_libs}%{?_isa} = %{version}-%{release} +Requires: %{name}-libs%{?_isa} = %{version}-%{release} Requires: %{name}-cli = %{version}-%{release} Requires: resource-agents %if !%{defined _unitdir} -Requires: %{pkgname_procps} +Requires: procps-ng %endif # -remote can be fully independent of systemd %{?systemd_ordering}%{!?systemd_ordering:%{?systemd_requires}} Provides: pcmk-cluster-manager = %{version}-%{release} Provides: pcmk-cluster-manager%{?_isa} = %{version}-%{release} %description remote Pacemaker is an advanced, scalable High-Availability cluster resource manager. The %{name}-remote package contains the Pacemaker Remote daemon which is capable of extending pacemaker functionality to remote nodes not running the full corosync/cluster stack. -%package -n %{pkgname_pcmk_libs}-devel +%package libs-devel License: GPLv2+ and LGPLv2+ Summary: Pacemaker development package Group: Development/Libraries -Requires: %{pkgname_pcmk_libs}%{?_isa} = %{version}-%{release} +Requires: %{name}-libs%{?_isa} = %{version}-%{release} Requires: %{name}-cluster-libs%{?_isa} = %{version}-%{release} -Requires: libuuid-devel%{?_isa} %{?pkgname_libtool_devel_arch} +Requires: libuuid-devel%{?_isa} libtool-ltdl-devel%{?_isa} Requires: libxml2-devel%{?_isa} libxslt-devel%{?_isa} -Requires: %{pkgname_bzip2_devel}%{?_isa} glib2-devel%{?_isa} +Requires: bzip2-devel%{?_isa} glib2-devel%{?_isa} Requires: libqb-devel%{?_isa} -Requires: %{pkgname_corosync_lib}-devel%{?_isa} >= 2.0.0 +Requires: corosynclib-devel%{?_isa} >= 2.0.0 -%description -n %{pkgname_pcmk_libs}-devel +%description libs-devel Pacemaker is an advanced, scalable High-Availability cluster resource manager. -The %{pkgname_pcmk_libs}-devel package contains headers and shared libraries +The %{name}-libs-devel package contains headers and shared libraries for developing tools for Pacemaker. %package cts License: GPLv2+ and LGPLv2+ Summary: Test framework for cluster-related technologies like Pacemaker Group: System Environment/Daemons Requires: %{python_path} -Requires: %{pkgname_pcmk_libs} = %{version}-%{release} -Requires: %{pkgname_procps} +Requires: %{name}-libs = %{version}-%{release} +Requires: procps-ng Requires: psmisc BuildArch: noarch # systemd python bindings are separate package in some distros %if %{defined systemd_requires} %if 0%{?fedora} > 22 || 0%{?rhel} > 7 Requires: %{python_name}-systemd %else %if 0%{?fedora} > 20 || 0%{?rhel} > 6 Requires: systemd-python %endif %endif %endif %description cts Test framework for cluster-related technologies like Pacemaker %package doc License: CC-BY-SA-4.0 Summary: Documentation for Pacemaker Group: Documentation BuildArch: noarch %description doc Documentation for Pacemaker. Pacemaker is an advanced, scalable High-Availability cluster resource manager. %package schemas License: GPLv2+ Summary: Schemas and upgrade stylesheets for Pacemaker BuildArch: noarch %description schemas Schemas and upgrade stylesheets for Pacemaker Pacemaker is an advanced, scalable High-Availability cluster resource manager. %prep %setup -q -n %{name}-%{commit} %build # Early versions of autotools (e.g. RHEL <= 5) do not support --docdir export docdir=%{pcmk_docdir} export systemdunitdir=%{?_unitdir}%{!?_unitdir:no} %if %{with hardening} # prefer distro-provided hardening flags in case they are defined # through _hardening_{c,ld}flags macros, configure script will # use its own defaults otherwise; if such hardenings are completely # undesired, rpmbuild using "--without hardening" # (or "--define '_without_hardening 1'") export CFLAGS_HARDENED_EXE="%{?_hardening_cflags}" export CFLAGS_HARDENED_LIB="%{?_hardening_cflags}" export LDFLAGS_HARDENED_EXE="%{?_hardening_ldflags}" export LDFLAGS_HARDENED_LIB="%{?_hardening_ldflags}" %endif ./autogen.sh %{configure} \ PYTHON=%{python_path} \ %{!?with_hardening: --disable-hardening} \ %{!?with_legacy_links: --disable-legacy-links} \ %{?with_profiling: --with-profiling} \ %{?with_coverage: --with-coverage} \ %{!?with_doc: --with-brand=} \ %{?gnutls_priorities: --with-gnutls-priorities="%{gnutls_priorities}"} \ --with-initdir=%{_initrddir} \ --localstatedir=%{_var} \ --with-version=%{version}-%{release} %if 0%{?suse_version} >= 1200 # Fedora handles rpath removal automagically sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool %endif -make %{_smp_mflags} V=1 +make %{_smp_mflags} V=1 all %check { cts/cts-scheduler --run load-stopped-loop \ && cts/cts-cli \ && touch .CHECKED } 2>&1 | sed 's/[fF]ail/faiil/g' # prevent false positives in rpmlint [ -f .CHECKED ] && rm -f -- .CHECKED exit $? # TODO remove when rpm<4.14 compatibility irrelevant %install # skip automake-native Python byte-compilation, since RPM-native one (possibly # distro-confined to Python-specific directories, which is currently the only # relevant place, anyway) assures proper intrinsic alignment with wider system # (such as with py_byte_compile macro, which is concurrent Fedora/EL specific) make install \ DESTDIR=%{buildroot} V=1 docdir=%{pcmk_docdir} \ %{?_python_bytecompile_extra:%{?py_byte_compile:am__py_compile=true}} mkdir -p ${RPM_BUILD_ROOT}%{_sysconfdir}/sysconfig install -m 644 daemons/pacemakerd/pacemaker.sysconfig ${RPM_BUILD_ROOT}%{_sysconfdir}/sysconfig/pacemaker install -m 644 tools/crm_mon.sysconfig ${RPM_BUILD_ROOT}%{_sysconfdir}/sysconfig/crm_mon %if %{with upstart_job} mkdir -p ${RPM_BUILD_ROOT}%{_sysconfdir}/init install -m 644 pacemakerd/pacemaker.upstart ${RPM_BUILD_ROOT}%{_sysconfdir}/init/pacemaker.conf install -m 644 pacemakerd/pacemaker.combined.upstart ${RPM_BUILD_ROOT}%{_sysconfdir}/init/pacemaker.combined.conf install -m 644 tools/crm_mon.upstart ${RPM_BUILD_ROOT}%{_sysconfdir}/init/crm_mon.conf %endif %if %{defined _unitdir} mkdir -p ${RPM_BUILD_ROOT}%{_localstatedir}/lib/rpm-state/%{name} %endif # Don't package static libs find %{buildroot} -name '*.a' -type f -print0 | xargs -0 rm -f find %{buildroot} -name '*.la' -type f -print0 | xargs -0 rm -f # For now, don't package the servicelog-related binaries built only for # ppc64le when certain dependencies are installed. If they get more exercise by # advanced users, we can reconsider. rm -f %{buildroot}/%{_sbindir}/notifyServicelogEvent rm -f %{buildroot}/%{_sbindir}/ipmiservicelogd # Don't ship init scripts for systemd based platforms %if %{defined _unitdir} rm -f %{buildroot}/%{_initrddir}/pacemaker rm -f %{buildroot}/%{_initrddir}/pacemaker_remote %endif # Byte-compile Python sources where suitable and the distro procedures known %if %{defined py_byte_compile} %{py_byte_compile %{python_path} %{buildroot}%{_datadir}/pacemaker/tests} %if !%{defined _python_bytecompile_extra} %{py_byte_compile %{python_path} %{buildroot}%{python_site}/cts} %endif %endif %if %{with coverage} GCOV_BASE=%{buildroot}/%{_var}/lib/pacemaker/gcov mkdir -p $GCOV_BASE find . -name '*.gcno' -type f | while read F ; do D=`dirname $F` mkdir -p ${GCOV_BASE}/$D cp $F ${GCOV_BASE}/$D done %endif %post %if %{defined _unitdir} %systemd_post pacemaker.service %else /sbin/chkconfig --add pacemaker || : %endif %preun %if %{defined _unitdir} %systemd_preun pacemaker.service %else /sbin/service pacemaker stop >/dev/null 2>&1 || : if [ "$1" -eq 0 ]; then # Package removal, not upgrade /sbin/chkconfig --del pacemaker || : fi %endif %postun %if %{defined _unitdir} %systemd_postun_with_restart pacemaker.service %endif %pre remote %if %{defined _unitdir} # Stop the service before anything is touched, and remember to restart # it as one of the last actions (compared to using systemd_postun_with_restart, # this avoids suicide when sbd is in use) systemctl --quiet is-active pacemaker_remote if [ $? -eq 0 ] ; then mkdir -p %{_localstatedir}/lib/rpm-state/%{name} touch %{_localstatedir}/lib/rpm-state/%{name}/restart_pacemaker_remote systemctl stop pacemaker_remote >/dev/null 2>&1 else rm -f %{_localstatedir}/lib/rpm-state/%{name}/restart_pacemaker_remote fi %endif %post remote %if %{defined _unitdir} %systemd_post pacemaker_remote.service %else /sbin/chkconfig --add pacemaker_remote || : %endif %preun remote %if %{defined _unitdir} %systemd_preun pacemaker_remote.service %else /sbin/service pacemaker_remote stop >/dev/null 2>&1 || : if [ "$1" -eq 0 ]; then # Package removal, not upgrade /sbin/chkconfig --del pacemaker_remote || : fi %endif %postun remote %if %{defined _unitdir} # This next line is a no-op, because we stopped the service earlier, but # we leave it here because it allows us to revert to the standard behavior # in the future if desired %systemd_postun_with_restart pacemaker_remote.service # Explicitly take care of removing the flag-file(s) upon final removal if [ "$1" -eq 0 ] ; then rm -f %{_localstatedir}/lib/rpm-state/%{name}/restart_pacemaker_remote fi %endif %posttrans remote %if %{defined _unitdir} if [ -e %{_localstatedir}/lib/rpm-state/%{name}/restart_pacemaker_remote ] ; then systemctl start pacemaker_remote >/dev/null 2>&1 rm -f %{_localstatedir}/lib/rpm-state/%{name}/restart_pacemaker_remote fi %endif %post cli %if %{defined _unitdir} %systemd_post crm_mon.service %endif if [ "$1" -eq 2 ]; then # Package upgrade, not initial install: # Move any pre-2.0 logs to new location to ensure they get rotated { mv -fbS.rpmsave %{_var}/log/pacemaker.log* %{_var}/log/pacemaker \ || mv -f %{_var}/log/pacemaker.log* %{_var}/log/pacemaker } >/dev/null 2>/dev/null || : fi %preun cli %if %{defined _unitdir} %systemd_preun crm_mon.service %endif %postun cli %if %{defined _unitdir} %systemd_postun_with_restart crm_mon.service %endif -%pre -n %{pkgname_pcmk_libs} -getent group %{gname} >/dev/null || groupadd -r %{gname} -g %{hacluster_id} -getent passwd %{uname} >/dev/null || useradd -r -g %{gname} -u %{hacluster_id} -s /sbin/nologin -c "cluster user" %{uname} +%pre libs +getent group %{gname} >/dev/null || groupadd -r %{gname} -g 189 +getent passwd %{uname} >/dev/null || useradd -r -g %{gname} -u 189 -s /sbin/nologin -c "cluster user" %{uname} exit 0 %if %{defined ldconfig_scriptlets} %ldconfig_scriptlets libs %ldconfig_scriptlets cluster-libs %else -%post -n %{pkgname_pcmk_libs} -p /sbin/ldconfig -%postun -n %{pkgname_pcmk_libs} -p /sbin/ldconfig +%post libs -p /sbin/ldconfig +%postun libs -p /sbin/ldconfig %post cluster-libs -p /sbin/ldconfig %postun cluster-libs -p /sbin/ldconfig %endif %files ########################################################### %config(noreplace) %{_sysconfdir}/sysconfig/pacemaker %{_sbindir}/pacemakerd %if %{defined _unitdir} %{_unitdir}/pacemaker.service %else %{_initrddir}/pacemaker %endif %exclude %{_libexecdir}/pacemaker/cts-log-watcher %exclude %{_libexecdir}/pacemaker/cts-support %exclude %{_sbindir}/pacemaker-remoted %if %{with legacy_links} %exclude %{_sbindir}/pacemaker_remoted %endif %{_libexecdir}/pacemaker/* %{_sbindir}/crm_attribute %{_sbindir}/crm_master %{_sbindir}/fence_legacy %doc %{_mandir}/man7/pacemaker-controld.* %doc %{_mandir}/man7/pacemaker-schedulerd.* %doc %{_mandir}/man7/pacemaker-fenced.* %doc %{_mandir}/man7/ocf_pacemaker_controld.* %doc %{_mandir}/man7/ocf_pacemaker_o2cb.* %doc %{_mandir}/man7/ocf_pacemaker_remote.* %doc %{_mandir}/man8/crm_attribute.* %doc %{_mandir}/man8/crm_master.* %doc %{_mandir}/man8/fence_legacy.* %doc %{_mandir}/man8/pacemakerd.* %doc %{_datadir}/pacemaker/alerts %license licenses/GPLv2 %doc COPYING %doc ChangeLog %dir %attr (750, %{uname}, %{gname}) %{_var}/lib/pacemaker/cib %dir %attr (750, %{uname}, %{gname}) %{_var}/lib/pacemaker/pengine /usr/lib/ocf/resource.d/pacemaker/controld /usr/lib/ocf/resource.d/pacemaker/o2cb /usr/lib/ocf/resource.d/pacemaker/remote %if %{with upstart_job} %config(noreplace) %{_sysconfdir}/init/pacemaker.conf %config(noreplace) %{_sysconfdir}/init/pacemaker.combined.conf %endif %files cli %dir %attr (750, root, %{gname}) %{_sysconfdir}/pacemaker %config(noreplace) %{_sysconfdir}/logrotate.d/pacemaker %config(noreplace) %{_sysconfdir}/sysconfig/crm_mon %if %{defined _unitdir} %{_unitdir}/crm_mon.service %endif %if %{with upstart_job} %config(noreplace) %{_sysconfdir}/init/crm_mon.conf %endif %{_sbindir}/attrd_updater %{_sbindir}/cibadmin %{_sbindir}/crm_diff %{_sbindir}/crm_error %{_sbindir}/crm_failcount %{_sbindir}/crm_mon %{_sbindir}/crm_node %{_sbindir}/crm_resource %{_sbindir}/crm_rule %{_sbindir}/crm_standby %{_sbindir}/crm_verify %{_sbindir}/crmadmin %{_sbindir}/iso8601 %{_sbindir}/crm_shadow %{_sbindir}/crm_simulate %{_sbindir}/crm_report %{_sbindir}/crm_ticket %{_sbindir}/stonith_admin # "dirname" is owned by -schemas, which is a prerequisite %{_datadir}/pacemaker/report.collector %{_datadir}/pacemaker/report.common # XXX "dirname" is not owned by any prerequisite %{_datadir}/snmp/mibs/PCMK-MIB.txt %exclude /usr/lib/ocf/resource.d/pacemaker/controld %exclude /usr/lib/ocf/resource.d/pacemaker/o2cb %exclude /usr/lib/ocf/resource.d/pacemaker/remote %dir /usr/lib/ocf %dir /usr/lib/ocf/resource.d /usr/lib/ocf/resource.d/pacemaker %doc %{_mandir}/man7/* %exclude %{_mandir}/man7/pacemaker-controld.* %exclude %{_mandir}/man7/pacemaker-schedulerd.* %exclude %{_mandir}/man7/pacemaker-fenced.* %exclude %{_mandir}/man7/ocf_pacemaker_controld.* %exclude %{_mandir}/man7/ocf_pacemaker_o2cb.* %exclude %{_mandir}/man7/ocf_pacemaker_remote.* %doc %{_mandir}/man8/* %exclude %{_mandir}/man8/crm_attribute.* %exclude %{_mandir}/man8/crm_master.* %exclude %{_mandir}/man8/fence_legacy.* %exclude %{_mandir}/man8/pacemakerd.* %exclude %{_mandir}/man8/pacemaker-remoted.* %license licenses/GPLv2 %doc COPYING %doc ChangeLog %dir %attr (750, %{uname}, %{gname}) %{_var}/lib/pacemaker %dir %attr (750, %{uname}, %{gname}) %{_var}/lib/pacemaker/blackbox %dir %attr (750, %{uname}, %{gname}) %{_var}/lib/pacemaker/cores %dir %attr (770, %{uname}, %{gname}) %{_var}/log/pacemaker %dir %attr (770, %{uname}, %{gname}) %{_var}/log/pacemaker/bundles -%files -n %{pkgname_pcmk_libs} +%files libs %{_libdir}/libcib.so.* %{_libdir}/liblrmd.so.* %{_libdir}/libcrmservice.so.* %{_libdir}/libcrmcommon.so.* %{_libdir}/libpe_status.so.* %{_libdir}/libpe_rules.so.* %{_libdir}/libpacemaker.so.* %{_libdir}/libstonithd.so.* %license licenses/LGPLv2.1 %doc COPYING %doc ChangeLog %files cluster-libs %{_libdir}/libcrmcluster.so.* %license licenses/LGPLv2.1 %doc COPYING %doc ChangeLog %files remote %config(noreplace) %{_sysconfdir}/sysconfig/pacemaker %if %{defined _unitdir} # state directory is shared between the subpackets # let rpm take care of removing it once it isn't # referenced anymore and empty %ghost %dir %{_localstatedir}/lib/rpm-state/%{name} %{_unitdir}/pacemaker_remote.service %else %{_initrddir}/pacemaker_remote %endif %{_sbindir}/pacemaker-remoted %if %{with legacy_links} %{_sbindir}/pacemaker_remoted %endif %{_mandir}/man8/pacemaker-remoted.* %license licenses/GPLv2 %doc COPYING %doc ChangeLog %files doc %doc %{pcmk_docdir} %license licenses/CC-BY-SA-4.0 %files cts %{python_site}/cts %{_datadir}/pacemaker/tests %{_libexecdir}/pacemaker/cts-log-watcher %{_libexecdir}/pacemaker/cts-support %license licenses/GPLv2 %doc COPYING %doc ChangeLog -%files -n %{pkgname_pcmk_libs}-devel +%files libs-devel %{_includedir}/pacemaker %{_libdir}/*.so %if %{with coverage} %{_var}/lib/pacemaker/gcov %endif %{_libdir}/pkgconfig/*.pc %license licenses/LGPLv2.1 %doc COPYING %doc ChangeLog %files schemas %license licenses/GPLv2 %dir %{_datadir}/pacemaker %{_datadir}/pacemaker/*.rng %{_datadir}/pacemaker/*.xsl %{_datadir}/pacemaker/api %changelog -* PACKAGE_DATE ClusterLabs PACKAGE_VERSION-1 - - See included ChangeLog file for details diff --git a/rpm/rpmlintrc b/rpmlintrc similarity index 100% rename from rpm/rpmlintrc rename to rpmlintrc