Permalink
Browse files

Add hooks and packaging scripts

Include missing files in package
  • Loading branch information...
1 parent fffcbd2 commit 85b6ae63295138ae94691aeea494e9ecee85dae8 @philwhineray philwhineray committed Jan 21, 2016
View
@@ -25,3 +25,5 @@ stamp-h1
netdata
apps.plugin
netdata.spec
+
+*.tar.*
View
@@ -0,0 +1,3 @@
+netdata (1.0.0-rc.1) - 2015-11-28
+
+ - initial packaging
View
@@ -1,7 +1,7 @@
#
# Copyright (C) 2015 Alon Bar-Lev <alon.barlev@gmail.com>
#
-AUTOMAKE_OPTIONS=foreign dist-bzip2 1.10
+AUTOMAKE_OPTIONS=foreign dist-bzip2 dist-xz 1.10
ACLOCAL_AMFLAGS = -I m4
MAINTAINERCLEANFILES= \
@@ -18,9 +18,12 @@ MAINTAINERCLEANFILES= \
EXTRA_DIST = \
.gitignore \
+ autogen.sh \
README.md \
LICENSE.md \
+ autogen.sh \
netdata-9999.ebuild \
+ tests/stress.sh \
$(NULL)
SUBDIRS = \
@@ -15,6 +15,7 @@ dist_charts_SCRIPTS = \
load_average.chart.sh \
mem_apps.chart.sh \
mysql.chart.sh \
+ nginx.chart.sh \
nut.chart.sh \
opensips.chart.sh \
postfix.chart.sh \
View
@@ -5,4 +5,5 @@ MAINTAINERCLEANFILES= $(srcdir)/Makefile.in
dist_config_DATA = \
apps_groups.conf \
+ charts.d.conf \
$(NULL)
View
@@ -9,9 +9,18 @@ define([VERSION_FIX], [0])
define([VERSION_NUMBER], VERSION_MAJOR[.]VERSION_MINOR[.]VERSION_FIX)
define([VERSION_SUFFIX], [_master])
+dnl Set to "1" for a first RPM release of a new version
+PACKAGE_RPM_RELEASE="0.0.$(echo VERSION_SUFFIX | sed 's/^_//')"
+
AC_INIT([netdata], VERSION_NUMBER[]VERSION_SUFFIX)
+
+AM_MAINTAINER_MODE([disable])
+if test x"$USE_MAINTAINER_MODE" = xyes; then
+AC_MSG_NOTICE(***************** MAINTAINER MODE *****************)
+PACKAGE_BUILT_DATE=$(date '+%d %b %Y')
+fi
+
PACKAGE_RPM_VERSION="VERSION_NUMBER"
-PACKAGE_RPM_RELEASE="0.0.$(echo VERSION_SUFFIX | sed 's/^_//')"
AC_SUBST([PACKAGE_RPM_VERSION])
AC_SUBST([PACKAGE_RPM_RELEASE])
View
@@ -0,0 +1,5 @@
+#!/bin/sh
+if [ -x ./packaging/update-tags ]
+then
+ exec git diff HEAD^ | ./packaging/update-tags -
+fi
View
@@ -0,0 +1,5 @@
+#!/bin/sh
+if [ -x ./packaging/check-files ]
+then
+ exec git diff --cached | ./packaging/check-files -
+fi
@@ -0,0 +1,2 @@
+#!/bin/sh
+test -x ./packaging/release-msg && exec ./packaging/release-msg "$@"
View
@@ -0,0 +1,53 @@
+Packaging Tools
+===============
+
+The programs in this folder are used when packaging from within git
+and are not included in source or binary packages.
+
+For the most part they are used from the git commit hooks (copy
+`../hooks/*` to `../.git/hooks` to automate checking and the release
+process.
+
+The check-files script pulls in `*.functions` and `*/*.functions` to
+do the actual work.
+
+`packaging.functions` contains generic checks on e.g `ChangeLog`
+and `configure.ac` and automates release version, checking, tagging
+and post-release update.
+
+Programs and packages with specific needs should create extra
+`whatever.functions` and supporting scripts in a subdirectory.
+
+Making a release
+----------------
+`
+Just update ChangeLog and configure.ac to specify a suitable version
+suffix:
+
+ empty - final release
+ pre.# - pre-release candidate
+ rc.# - pre-release candidate
+
+If it is a final release and there is a package.spec.in, add a new
+entry to the top of the %changelog section and update:
+ PACKAGE_RPM_RELEASE="1"
+
+The hooks will take over and if everything is OK will tag the release
+(you will be asked to sign the tag) and then update the files ready
+for further development.
+
+The release is not pushed out automatically, so if you want to undo
+it, run:
+
+~~~~
+git reset --hard HEAD^^
+git tag -d vx.y.z
+~~~~
+
+Otherwise you can just push the results; the script outputs the required
+instructions upon success.
+
+Once pushed the infrastructure will build a set of tar-files on the server.
+For information on how to verify, sign and make these available, see:
+
+ https://github.com/firehol/infrastructure/raw/master/doc/release.txt
View
@@ -0,0 +1,126 @@
+#!/bin/bash
+
+#
+# check-files
+#
+scriptname=check-files
+if ! MYTMP=$(mktemp -d -t $scriptname-XXXXXX)
+then
+ echo >&2
+ echo >&2
+ echo >&2 "Cannot create temporary directory."
+ echo >&2
+ exit 1
+fi
+
+cleanup() {
+ status=$?
+ rm -rf "${MYTMP}"
+ exit $status
+}
+
+# clean up if we get stopped by Crtl-C or forced logout or normal exit
+trap cleanup INT
+trap cleanup HUP
+trap cleanup 0
+
+set -e
+if [ "$1" = "--debug" ]
+then
+ set -x
+ shift
+fi
+
+if [ $# -lt 1 ]
+then
+ echo "check-files [--debug] -|filenames"
+ echo "e.g."
+ echo " git diff | ./packaging/check-files -"
+ echo "or in .git/hooks/pre-commit:"
+ echo " exec git diff --cached | ./packaging/check-files -"
+ exit 1
+fi
+
+if [ ! -x packaging/check-files ]
+then
+ echo "Must be run from base directory"
+ exit 1
+fi
+
+if [ "$1" = "-" ]
+then
+ from_cache=Y
+ f=""
+else
+ from_cache=
+ for f in "$@"
+ do
+ if [ ! -f "$f" ]
+ then
+ echo "$f: no such file"
+ exit 1
+ fi
+ done
+
+ git status --porcelain "$@" | grep "^?" | cut -c4- > $MYTMP/missing.lst
+
+ while read missing
+ do
+ git update-index --add --cacheinfo \
+ 100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 $missing
+ done < $MYTMP/missing.lst
+
+ empty_tree=4b825dc642cb6eb9a060e54bf8d69288fbee4904
+ git diff $empty_tree -- "$@" > $MYTMP/diff.full
+ f=$MYTMP/diff.full
+
+ while read missing
+ do
+ git update-index --force-remove $missing
+ done < $MYTMP/missing.lst
+fi
+
+> $MYTMP/diff.lst sed -e "/^+++ b/{p;s:^+++ b/::;w $MYTMP/files.lst" -e "d;}" $f
+
+#cat $MYTMP/diff.lst
+#cat $MYTMP/files.lst
+
+dirname="${0%/*}"
+if [ "$dirname" = "$0" ]; then dirname="."; fi
+
+for i in $dirname/*.functions $dirname/*/*.functions
+do
+ if [ -f "$i" ]
+ then
+ source $i
+ echo $i | sed -e 's:.*/::' -e 's/\.functions$//' -e 's/\./_/g' >> $MYTMP/fns
+ fi
+done
+
+status=0
+while read fn
+do
+ "${fn}_check_init" $filename || status=1
+done < $MYTMP/fns
+
+while read filename
+do
+ #echo Checking $filename
+ while read fn
+ do
+ if [ $status -eq 0 ]
+ then
+ "${fn}_check_file" $filename || status=1
+ fi
+ done < $MYTMP/fns
+done < $MYTMP/files.lst
+
+if [ $status -eq 0 ]
+then
+ while read fn
+ do
+ "${fn}_check_fin" $filename || status=1
+ done < $MYTMP/fns
+fi
+
+exit $status
View
@@ -0,0 +1,40 @@
+#!/bin/sh
+
+# When run from the top-level repository, performs a complete clean
+# and maintainer-mode rebuild of the FireHOL package.
+
+if [ ! -f .gitignore -o ! -f configure.ac -o ! -x autogen.sh ]
+then
+ echo "Run as ./packaging/git-build from an autotools git repository"
+ exit 1
+fi
+
+# If we are genuinely in a git repo, try to clean it up, otherwise
+# just make the assumption
+if [ -d .git ]
+then
+ clean=$(git status -s | grep "^?")
+
+ if [ "$clean" ]
+ then
+ if [ "$1" != "-ok" ]
+ then
+ echo "Warning: this script runs: git clean -d -f -x"
+ echo " ensure all required ?? files are added, then re-run with '-ok'"
+ git status -s | grep '^?'
+ exit 1
+ fi
+ fi
+
+ set -e
+ git clean -d -f -x
+ set +e
+fi
+
+set -e
+./autogen.sh
+./configure --enable-maintainer-mode
+set +e
+make dist
+status=$?
+exit $status
Oops, something went wrong.

0 comments on commit 85b6ae6

Please sign in to comment.