summaryrefslogtreecommitdiffstats
path: root/.travis/package_management
diff options
context:
space:
mode:
Diffstat (limited to '.travis/package_management')
-rw-r--r--.travis/package_management/build.sh4
-rwxr-xr-x.travis/package_management/build_judy.sh36
-rwxr-xr-x.travis/package_management/build_libuv.sh36
-rwxr-xr-x.travis/package_management/common.py37
-rwxr-xr-x.travis/package_management/trigger_deb_lxc_build.py9
5 files changed, 106 insertions, 16 deletions
diff --git a/.travis/package_management/build.sh b/.travis/package_management/build.sh
index a5217715f..bafaecc5a 100644
--- a/.travis/package_management/build.sh
+++ b/.travis/package_management/build.sh
@@ -24,9 +24,9 @@ ln -sf contrib/debian debian
echo "Executing dpkg-buildpackage"
# pre/post options are after 1.18.8, is simpler to just check help for their existence than parsing version
if dpkg-buildpackage --help | grep "\-\-post\-clean" 2> /dev/null > /dev/null; then
- dpkg-buildpackage --post-clean --pre-clean --build=binary
+ dpkg-buildpackage --post-clean --pre-clean --build=binary -us -uc
else
- dpkg-buildpackage -b
+ dpkg-buildpackage -b -us -uc
fi
echo "DEB build script completed!"
diff --git a/.travis/package_management/build_judy.sh b/.travis/package_management/build_judy.sh
new file mode 100755
index 000000000..202ea0449
--- /dev/null
+++ b/.travis/package_management/build_judy.sh
@@ -0,0 +1,36 @@
+#!/usr/bin/env bash
+#
+# Build Judy from source, you need to run this script as root.
+#
+# Copyright: SPDX-License-Identifier: GPL-3.0-or-later
+#
+# Author : Pavlos Emm. Katsoulakis (paul@netdata.cloud)
+set -e
+JUDY_VER="1.0.5"
+JUDY_DIR="/opt/judy-${JUDY_VER}"
+
+# If we are not in netdata git repo, at the top level directory, fail
+TOP_LEVEL=$(basename "$(git rev-parse --show-toplevel)")
+CWD=$(git rev-parse --show-cdup)
+if [ -n "$CWD" ] || [ ! "${TOP_LEVEL}" == "netdata" ]; then
+ echo "Run as .travis/package_management/$(basename "$0") from top level directory of netdata git repository"
+ echo "Build Judy package from source code failed"
+ exit 1
+fi
+
+echo "Fetching judy source tarball"
+wget -O /opt/judy.tar.gz http://downloads.sourceforge.net/project/judy/judy/Judy-${JUDY_VER}/Judy-${JUDY_VER}.tar.gz
+
+echo "Entering /opt directory and extracting tarball"
+cd /opt && tar -xf judy.tar.gz && rm judy.tar.gz
+
+echo "Entering ${JUDY_DIR}"
+cd "${JUDY_DIR}"
+
+echo "Running configure"
+CFLAGS="-O2 -s" CXXFLAGS="-O2 -s" ./configure
+
+echo "Compiling and installing"
+make && make install
+
+echo "Done, enjoy Judy!"
diff --git a/.travis/package_management/build_libuv.sh b/.travis/package_management/build_libuv.sh
new file mode 100755
index 000000000..c30eede64
--- /dev/null
+++ b/.travis/package_management/build_libuv.sh
@@ -0,0 +1,36 @@
+#!/usr/bin/env bash
+#
+# Build libuv from source, you need to run this script as root.
+#
+# Copyright: SPDX-License-Identifier: GPL-3.0-or-later
+#
+# Author : Pavlos Emm. Katsoulakis <paul@netdata.cloud>
+set -e
+LIBUV_VERSION="v1.32.0"
+# Their folder is libuv-1.32.0 while the tarball version is v1.32.0, so fix that until they fix it...
+LIBUV_DIR="/opt/libuv-${LIBUV_VERSION/v/}"
+
+# If we are not in netdata git repo, at the top level directory, fail
+TOP_LEVEL=$(basename "$(git rev-parse --show-toplevel)")
+CWD=$(git rev-parse --show-cdup)
+if [ -n "$CWD" ] || [ ! "${TOP_LEVEL}" == "netdata" ]; then
+ echo "Run as .travis/package_management/$(basename "$0") from top level directory of netdata git repository"
+ echo "Build libuv package from source code failed"
+ exit 1
+fi
+
+echo "Fetching libuv from github"
+wget -O /opt/libuv.tar.gz "https://github.com/libuv/libuv/archive/${LIBUV_VERSION}.tar.gz"
+
+echo "Entering /opt and extracting source"
+cd /opt && tar -xf libuv.tar.gz && rm libuv.tar.gz
+
+echo "Entering ${LIBUV_DIR}"
+cd "${LIBUV_DIR}"
+
+echo "Compiling and installing"
+sh autogen.sh
+./configure
+make && make check && make install
+
+echo "Done, enjoy libuv!"
diff --git a/.travis/package_management/common.py b/.travis/package_management/common.py
index a72fe4837..8a5106971 100755
--- a/.travis/package_management/common.py
+++ b/.travis/package_management/common.py
@@ -7,6 +7,9 @@
import lxc
import subprocess
import os
+import sys
+import tempfile
+import shutil
def fetch_version(orig_build_version):
tag = None
@@ -53,10 +56,10 @@ def run_command(container, command):
if command_result != 0:
raise Exception("Command failed with exit code %d" % command_result)
-def run_command_in_host(cmd):
- print("Issue command in host: %s" % str(cmd))
+def run_command_in_host(cmd, cwd=None):
+ print("Issue command in host: %s, cwd:%s" % (str(cmd), str(cwd)))
- proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, cwd=cwd)
o, e = proc.communicate()
print('Output: ' + o.decode('ascii'))
print('Error: ' + e.decode('ascii'))
@@ -133,31 +136,41 @@ def prepare_version_source(dest_archive, pkg_friendly_version, tag=None):
print(".0 Preparing local implementation tarball for version %s" % pkg_friendly_version)
tar_file = os.environ['LXC_CONTAINER_ROOT'] + dest_archive
+ print(".0 Copy repo to prepare it for tarball generation")
+ tmp_src = tempfile.mkdtemp(prefix='netdata-source-')
+ run_command_in_host(['cp', '-r', '.', tmp_src])
+
if tag is not None:
print(".1 Checking out tag %s" % tag)
- run_command_in_host(['git', 'fetch', '--all'])
+ run_command_in_host(['git', 'fetch', '--all'], tmp_src)
# TODO: Keep in mind that tricky 'v' there, needs to be removed once we clear our versioning scheme
- run_command_in_host(['git', 'checkout', 'v%s' % pkg_friendly_version])
+ run_command_in_host(['git', 'checkout', 'v%s' % pkg_friendly_version], tmp_src)
print(".2 Tagging the code with version: %s" % pkg_friendly_version)
- run_command_in_host(['git', 'tag', '-a', pkg_friendly_version, '-m', 'Tagging while packaging on %s' % os.environ["CONTAINER_NAME"]])
+ run_command_in_host(['git', 'tag', '-a', pkg_friendly_version, '-m', 'Tagging while packaging on %s' % os.environ["CONTAINER_NAME"]], tmp_src)
print(".3 Run autoreconf -ivf")
- run_command_in_host(['autoreconf', '-ivf'])
+ run_command_in_host(['autoreconf', '-ivf'], tmp_src)
print(".4 Run configure")
- run_command_in_host(['./configure', '--prefix=/usr', '--sysconfdir=/etc', '--localstatedir=/var', '--libdir=/usr/lib', '--libexecdir=/usr/libexec', '--with-math', '--with-zlib', '--with-user=netdata'])
+ run_command_in_host(['./configure', '--prefix=/usr', '--sysconfdir=/etc', '--localstatedir=/var', '--libdir=/usr/lib', '--libexecdir=/usr/libexec', '--with-math', '--with-zlib', '--with-user=netdata'], tmp_src)
print(".5 Run make dist")
- run_command_in_host(['make', 'dist'])
+ run_command_in_host(['make', 'dist'], tmp_src)
print(".6 Copy generated tarbal to desired path")
- if os.path.exists('netdata-%s.tar.gz' % pkg_friendly_version):
- run_command_in_host(['sudo', 'cp', 'netdata-%s.tar.gz' % pkg_friendly_version, tar_file])
+ generated_tarball = '%s/netdata-%s.tar.gz' % (tmp_src, pkg_friendly_version)
+
+ if os.path.exists(generated_tarball):
+ run_command_in_host(['sudo', 'cp', generated_tarball, tar_file])
print(".7 Fixing permissions on tarball")
run_command_in_host(['sudo', 'chmod', '777', tar_file])
+
+ print(".8 Bring over netdata.spec, Remove temp directory");
+ run_command_in_host(['cp', '%s/netdata.spec' % tmp_src, 'netdata.spec'])
+ shutil.rmtree(tmp_src)
else:
- print("I could not find (%s) on the disk, stopping the build. Kindly check the logs and try again" % 'netdata-%s.tar.gz' % pkg_friendly_version)
+ print("I could not find (%s) on the disk, stopping the build. Kindly check the logs and try again" % generated_tarball)
sys.exit(1)
diff --git a/.travis/package_management/trigger_deb_lxc_build.py b/.travis/package_management/trigger_deb_lxc_build.py
index 46b64e6a9..464a7715f 100755
--- a/.travis/package_management/trigger_deb_lxc_build.py
+++ b/.travis/package_management/trigger_deb_lxc_build.py
@@ -57,8 +57,13 @@ print("Checking version consistency")
since_version = os.environ["LATEST_RELEASE_VERSION"]
if str(since_version).replace('v', '') == str(new_version) and str(new_version).count('.') == 2:
s = since_version.split('.')
- prev = str(int(s[1]) - 1)
- since_version = s[0] + '.' + prev + s[2]
+ if int(s[2]) > 0:
+ patch_prev = str(int(s[2]) - 1)
+ since_version = s[0] + '.' + s[1] + '.' + patch_prev
+ else:
+ prev = str(int(s[1]) - 1)
+ since_version = s[0] + '.' + prev + '.' + s[2]
+
print("We seem to be building a new stable release, reduce by one since_version option. New since_version:%s" % since_version)
print("Fixing changelog tags")