Skip to content
Permalink
Browse files

Try to unbreak demo builds

Change-Id: Ic23344310ade8cee37efd3bfe31a24900a75d61b
  • Loading branch information...
LarsMichelsen committed Sep 4, 2019
1 parent 0285f9d commit 2425863c358fa3f80713546ffc50b72419cc24e7
Showing with 21 additions and 10 deletions.
  1. +1 −1 buildscripts/scripts/nightly-build.jenkins
  2. +3 −1 defines.make
  3. +2 −7 omd/Makefile
  4. +15 −1 tests/packaging/test_files.py
@@ -128,7 +128,7 @@ node {
break
}
if (DEMO == 'yes') {
sh '''sed -ri 's/^(DEMO_SUFFIX[[:space:]]*:?= *).*/\\1'".demo/" defines.make'''
sh '''sed -ri 's/^(DEMO_SUFFIX[[:space:]]*:?= *).*/\\1'" .demo/" defines.make'''
sh 'mv omd/packages/nagios/{9999-demo-version.dif,patches/9999-demo-version.dif}'
sh '''sed -i 's/#ifdef DEMOVERSION/#if 1/g' enterprise/core/src/{Core,State}.cc'''
}
@@ -48,7 +48,9 @@ VERSION := 1.7.0i1
# Will be set to ".demo" by cmk build system when building a demo package
DEMO_SUFFIX :=
OMD_VERSION := $(VERSION).$(EDITION_SHORT)$(DEMO_SUFFIX)
PKG_VERSION := $(VERSION)$(DEMO_SUFFIX)
# Do not use the the ".c?e" EDITION_SHORT suffix, the edition is part of the package name
# But keep the ".demo" suffix. Somehow inconsistent, but this is our scheme.
PKG_VERSION := $(VERSION)$(DEMO_SUFFIX)

SHELL := /bin/bash
# TODO: Be more strict - Add this:
@@ -240,7 +240,6 @@ $(BIN_TGZ): $(DESTDIR)$(OMD_ROOT)/share/omd/skel.permissions $(FIX_SKEL)
tar czf $@ --owner=root --group=root -C $(DESTDIR) .

rpm:
PKG_VERSION=$(OMD_VERSION) ; \
sed -e 's/^Requires:.*/Requires: $(OS_PACKAGES)/' \
-e 's/%{version}/$(OMD_VERSION)/g' \
-e "s/%{pkg_version}/$(PKG_VERSION)/g" \
@@ -277,11 +276,7 @@ debian/changelog:
fi
# this is a hack!
rm -f debian/changelog
PKG_VERSION=$(OMD_VERSION) ; \
PKG_VERSION=$${PKG_VERSION/.cee/} ; \
PKG_VERSION=$${PKG_VERSION/.cre/} ; \
PKG_VERSION=$${PKG_VERSION/.cme/} ; \
dch --create --package check-mk-$(EDITION)-$$PKG_VERSION \
dch --create --package check-mk-$(EDITION)-$(PKG_VERSION) \
--newversion 0.$(DISTRO_CODE) "`cat debian/changelog.tmpl`"
dch --release "releasing ...."

@@ -340,7 +335,7 @@ $(CMA_PACKAGE): $(CMA_INSTALL) $(APPLIANCE_INSTALL_CMA) $(APPLIANCE_SKEL_CMA) $(
echo -e "MIN_VERSION=$${MIN_VERSION}\n" > $(DESTDIR)/opt/omd/versions/$(OMD_VERSION)/cma.info

# Mark demo builds in cma.info file
@if [ -f packages/nagios/patches/9999-demo-version.dif ]; then \
@if [ -n "$(DEMO_SUFFIX)" ]; then \
echo -e "DEMO=1\n" >> $(DESTDIR)/opt/omd/versions/$(OMD_VERSION)/cma.info ; \
fi

@@ -28,7 +28,13 @@ def _get_package_paths(version_path, what):
def _get_omd_version(cmk_version, pkg_path):
# Extract the files edition
edition_short = _edition_short_from_pkg_path(pkg_path)
return "%s.%s" % (cmk_version, edition_short)
demo_suffix = ".demo" if _is_demo(pkg_path) else ""
return "%s.%s%s" % (cmk_version, edition_short, demo_suffix)


def _is_demo(pkg_path):
# Is this a demo package?
return ".demo" in os.path.basename(pkg_path)


def _edition_short_from_pkg_path(pkg_path):
@@ -122,6 +128,8 @@ def test_files_not_in_version_path(version_path, cmk_version, what):
paths = []
for line in subprocess.check_output(["dpkg", "-c", pkg]).splitlines():
paths.append(line.split()[5].lstrip("."))
else:
raise NotImplementedError()

omd_version = _get_omd_version(cmk_version, pkg)
print("Checking OMD version: %s" % omd_version)
@@ -154,6 +162,12 @@ def test_cma_specific_files(version_path, cmk_version):
assert "%s/skel/etc/apache/conf.d/cma.conf" % omd_version in files
assert "%s/lib/cma/post-install" % omd_version in files

cma_info = subprocess.check_output(["tar", "xOvzf", pkg, "%s/cma.info" % omd_version])
if _is_demo(pkg):
assert "DEMO=1" in cma_info
else:
assert "DEMO=1" not in cma_info


def test_src_only_contains_relative_version_paths(version_path):
for pkg in _get_package_paths(version_path, "tar.gz"):

0 comments on commit 2425863

Please sign in to comment.
You can’t perform that action at this time.