]> arthur.barton.de Git - netdata.git/commitdiff
Add hooks and packaging scripts
authorPhilip Whineray <phil@firehol.org>
Thu, 21 Jan 2016 07:15:56 +0000 (07:15 +0000)
committerPhilip Whineray <phil@firehol.org>
Sun, 24 Jan 2016 10:55:07 +0000 (10:55 +0000)
Include missing files in package

16 files changed:
.gitignore
ChangeLog [new file with mode: 0644]
Makefile.am
charts.d/Makefile.am
conf.d/Makefile.am
configure.ac
hooks/post-commit [new file with mode: 0755]
hooks/pre-commit [new file with mode: 0755]
hooks/prepare-commit-msg [new file with mode: 0755]
packaging/README.md [new file with mode: 0644]
packaging/check-files [new file with mode: 0755]
packaging/git-build [new file with mode: 0755]
packaging/packaging.functions [new file with mode: 0644]
packaging/release-msg [new file with mode: 0755]
packaging/tar-compare [new file with mode: 0755]
packaging/update-tags [new file with mode: 0755]

index 81989e7a2a89c1238b2442795d3b1fa245967079..0a3e8d42fa5ec1d91ae133bed7eec18210b6befd 100644 (file)
@@ -25,3 +25,5 @@ stamp-h1
 netdata
 apps.plugin
 netdata.spec
+
+*.tar.*
diff --git a/ChangeLog b/ChangeLog
new file mode 100644 (file)
index 0000000..5980804
--- /dev/null
+++ b/ChangeLog
@@ -0,0 +1,3 @@
+netdata (1.0.0-rc.1) - 2015-11-28
+
+ - initial packaging
index 9009aac77305eaf0d175fbe3fc9b2aa4bb9cbf76..8e14db9f139270828e6fceb43234f6bd720709e4 100644 (file)
@@ -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 = \
index 0bba09092273e032cd6a1176de72521d4a89f922..6c33ed24db2fbfd35f456770522705a6ff1f1def 100644 (file)
@@ -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 \
index 73e45c1920fafe459c61a254cdc92cbe57b413a1..381b546e3642adf0cc0675e94fe8aa513dcae586 100644 (file)
@@ -5,4 +5,5 @@ MAINTAINERCLEANFILES= $(srcdir)/Makefile.in
 
 dist_config_DATA = \
        apps_groups.conf \
+       charts.d.conf \
        $(NULL)
index 30f5a0cc8a466ecd7a0e2146fed9eec17d599112..49d59918a705204b5cf1c925552d3cf11deb08a2 100644 (file)
@@ -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])
 
diff --git a/hooks/post-commit b/hooks/post-commit
new file mode 100755 (executable)
index 0000000..a1d41c7
--- /dev/null
@@ -0,0 +1,5 @@
+#!/bin/sh
+if [ -x ./packaging/update-tags ]
+then
+  exec git diff HEAD^ | ./packaging/update-tags -
+fi
diff --git a/hooks/pre-commit b/hooks/pre-commit
new file mode 100755 (executable)
index 0000000..fb2209f
--- /dev/null
@@ -0,0 +1,5 @@
+#!/bin/sh
+if [ -x ./packaging/check-files ]
+then
+  exec git diff --cached | ./packaging/check-files -
+fi
diff --git a/hooks/prepare-commit-msg b/hooks/prepare-commit-msg
new file mode 100755 (executable)
index 0000000..530f957
--- /dev/null
@@ -0,0 +1,2 @@
+#!/bin/sh
+test -x ./packaging/release-msg && exec ./packaging/release-msg "$@"
diff --git a/packaging/README.md b/packaging/README.md
new file mode 100644 (file)
index 0000000..664f588
--- /dev/null
@@ -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
diff --git a/packaging/check-files b/packaging/check-files
new file mode 100755 (executable)
index 0000000..4827f56
--- /dev/null
@@ -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
diff --git a/packaging/git-build b/packaging/git-build
new file mode 100755 (executable)
index 0000000..e33d235
--- /dev/null
@@ -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
diff --git a/packaging/packaging.functions b/packaging/packaging.functions
new file mode 100644 (file)
index 0000000..397157f
--- /dev/null
@@ -0,0 +1,316 @@
+#!/bin/bash
+
+packaging_check_init() {
+  version_check=
+}
+
+packaging_check_file() {
+  local filename="$1" status=0
+
+  case $filename in
+    configure.ac)
+      check_versions || status=1
+      version_check=Y
+    ;;
+    *.spec.in)
+      check_versions || status=1
+      version_check=Y
+    ;;
+    ChangeLog)
+      check_versions || status=1
+      version_check=Y
+      if [ $status -eq 0 ]
+      then
+        check_changelog || status=1
+      fi
+    ;;
+    *)
+      #echo "No checks found for $filename"
+      :
+    ;;
+  esac
+  return $status
+}
+
+packaging_check_fin() {
+  if [ "$version_check" ]
+  then
+    version=`get_configure_ac_version`
+    case "$(match_version $version)" in
+      prerelease|candidate|release)
+        try_build || status=1
+        if [ $status -eq 0 ]
+        then
+           cp $MYTMP/build/*.tar.* .
+           echo "Check $(cd $MYTMP/build && ls *.tar.gz) before pushing tags"
+        fi
+      ;;
+    esac
+  fi
+}
+
+get_staged_file() {
+  local optional=0
+  if [ "$1" = "-o" ]
+  then
+    optional=1
+    shift
+  fi
+
+  local dir="${1%/*}"
+  if [ "$dir" = "$1" ]; then dir="."; fi
+  mkdir -p $MYTMP/files/$dir
+
+  test -f $MYTMP/files/$1 && return 0
+
+  if [ "$from_cache" ]
+  then
+    if [ $optional -eq 1 ]
+    then
+      git show :$1 > $MYTMP/files/$1 2> /dev/null || rm -f $MYTMP/files/$1
+    else
+      git show :$1 > $MYTMP/files/$1
+    fi
+  else
+    if [ $optional -eq 0 -o -f $1 ]
+    then
+      cp $1 $MYTMP/files/$1
+    fi
+  fi
+}
+
+try_build() {
+  if [ -f $MYTMP/success ]; then return 0; fi
+  mkdir -p $MYTMP/build
+  git archive HEAD | tar -xf - -C "$MYTMP/build"
+  git diff --staged | patch -p1 -d "$MYTMP/build"
+  (cd $MYTMP/build; ./packaging/git-build || touch $MYTMP/fail)
+  if [ -f $MYTMP/fail ]; then return 1; fi
+  (cd $MYTMP/build; ./packaging/tar-compare . *.tar.gz || touch $MYTMP/fail)
+  if [ -f $MYTMP/fail ]; then return 1; fi
+  touch $MYTMP/success
+  return 0
+}
+
+get_changelog_version() {
+  get_staged_file ChangeLog
+  local v=`sed -ne '1s/.*(\(.*\)).*/\1/p' $MYTMP/files/ChangeLog`
+  if [ ! "$v" ]; then v="No version in ChangeLog!"; fi
+  echo "$v"
+}
+
+get_configure_ac_version() {
+  get_staged_file configure.ac
+  local v=`sed -n \
+         -e '/define(\[VERSION_\(MINOR\|FIX\)/s/.*\[\([^[]*\)\].*/.\1/p' \
+         -e '/define(\[VERSION_\(MAJOR\|SUFFIX\)/s/.*\[\([^[]*\)\].*/\1/p' \
+         $MYTMP/files/configure.ac | tr -d '\n'`
+  if [ ! "$v" ]; then v="No version in configure.ac!"; fi
+  echo "$v"
+}
+
+get_configure_ac_package() {
+  get_staged_file configure.ac
+  local v=`sed -n -e 's/AC_INIT(\[\([^]]*\)\].*/\1/p' configure.ac`
+  if [ ! "$v" ]; then v="noname"; fi
+  echo "$v"
+}
+
+get_configure_ac_rpmrel() {
+  get_staged_file configure.ac
+  local v=`sed -n -e 's/PACKAGE_RPM_RELEASE="\([^"]*\)".*/\1/p' configure.ac`
+  if [ ! "$v" ]; then v="norpmrel"; fi
+  echo "$v"
+}
+
+get_spec_version() {
+  get_staged_file "$1".spec.in
+  test -f $MYTMP/files/"$1".spec.in || return 0 # Spec file is optional
+  sed -n -e '1,/^%changelog/d' -e '/^*/{s/.*- \([0-9].*\)/\1/p;q}' "$1".spec.in
+}
+
+splitver() {
+       local maj min fix sfx IFS=.-_
+
+       maj=$1
+       min=$2
+       fix=$3
+       sfx=$4
+
+       set -- $5
+       eval $maj=\$1 $min=\$2 $fix=\$3 $sfx=\$4
+}
+
+match_version() {
+  case "$1" in
+     [0-9]*.[0-9]*.[0-9]*_*)
+       # x.y.z_ZZZZ = development branch (can be before or after pre/rc)
+       echo "development"
+     ;;
+     [0-9]*.[0-9]*.[0-9]-pre[0-9]*)
+       echo "prerelease"
+     ;;
+     [0-9]*.[0-9]*.[0-9]-rc.[0-9]*)
+       echo "candidate"
+     ;;
+     [0-9]*.[0-9]*.[0-9]*)
+       echo "release"
+     ;;
+     *)
+       # Unknown
+       :
+     ;;
+  esac
+}
+
+check_versions() {
+  local status=0 exact=0 prerelease=0
+
+  if [ -f $MYTMP/version-checked ]
+  then
+    read status < $MYTMP/version-checked
+    return $status
+  fi
+
+  local confver=`get_configure_ac_version`
+  case "$(match_version $confver)" in
+     development)
+       :
+     ;;
+     prerelease|candidate|release)
+       exact=1
+     ;;
+     *)
+       echo "Unrecognised version in configure.ac ($confver)"
+       status=1
+     ;;
+  esac
+
+  local clogver=`get_changelog_version`
+  case "$(match_version $clogver)" in
+     development)
+       echo "Do not include development branch version in ChangeLog ($clogver)"
+       status=1
+     ;;
+     prerelease|candidate)
+       prerelease=1
+     ;;
+     release)
+       :
+     ;;
+     *)
+       echo "Unrecognised version format in ChangeLog ($clogver)"
+       status=1
+     ;;
+  esac
+
+  local package=`get_configure_ac_package`
+  local specver=`get_spec_version $package`
+
+  local clogmaj clogmin clogfix clogsfx
+  local confmaj confmin conffix confsfx
+  local specmaj specmin specfix specsfx
+
+  splitver clogmaj clogmin clogfix clogsfx "$clogver"
+  splitver confmaj confmin conffix confsfx "$confver"
+  splitver specmaj specmin specfix specsfx "$specver"
+
+  if [ "$specver" ]
+  then
+    if [ $specmaj -ne $clogmaj \
+      -o $specmin -ne $clogmin \
+      -o $specfix -ne $clogfix ]
+    then
+      echo "Main version of $package.spec.in ($specver) differs from ChangeLog ($clogver)"
+      status=1
+    fi
+  fi
+
+  if [ $status -eq 0 -a $exact -eq 0 ]
+  then
+
+    if [ $confmaj -gt $clogmaj \
+      -o $confmin -gt $clogmin \
+      -o $conffix -gt $clogfix ]
+    then
+      :
+    elif [ $confmaj -eq $clogmaj \
+        -a $confmin -eq $clogmin \
+        -a $conffix -eq $clogfix \
+        -a $prerelease -eq 1 ]
+    then
+      :
+    else
+      echo "Version in configure.ac ($confver) lesser than ChangeLog ($clogver)"
+      status=1
+    fi
+  fi
+
+  if [ $exact -eq 1 ]
+  then
+    echo "Running additional release checks"
+
+    if [ "$confver" != "$clogver" ]
+    then
+      echo "Version in configure.ac ($confver) differs from ChangeLog ($clogver)"
+      status=1
+    elif [ "$(git tag -l v$confver)" ]
+    then
+      echo "Tag v$confver already exists"
+      status=1
+    fi
+
+    if [ "$specver" ]
+    then
+      local confrpmrel=`get_configure_ac_rpmrel`
+      if [ "$specsfx" != "$confrpmrel" ]
+      then
+        echo "%changelog suffix in $package.spec.in ($specsfx) differs from configure.ac PACKAGE_RPM_RELEASE ($confrpmrel)"
+        status=1
+      fi
+    fi
+
+    if [ "$(git config user.signingkey)" = "" ]
+    then
+      echo "You need to set up a PGP signing key e.g.:"
+      echo "   gpg --list-keys"
+      echo "and"
+      echo "   git config user.signingkey SHORTID"
+      echo "or"
+      echo "   git config --global user.signingkey SHORTID"
+      status=1
+    fi
+
+    git status -s | grep "^?" > $MYTMP/needclean
+    if [ -s $MYTMP/needclean ]
+    then
+      echo "The following files must be dealt with before commit:"
+      cat $MYTMP/needclean
+      echo "e.g. add them to .gitignore or remove with 'git clean -fdx'"
+      status=1
+    fi
+  fi
+
+  echo $status > $MYTMP/version-checked
+  return $status
+}
+
+check_changelog() {
+  local status=0
+
+  if [ -f $MYTMP/changelog-checked ]
+  then
+    read status < $MYTMP/changelog-checked
+    return $status
+  fi
+
+  local version=`sed -ne '1s/.*(\(.*\)).*/\1/p' $filename`
+  if [ "`echo $version | grep '[[:space:]]'`" != "" ]
+  then
+    echo "ChangeLog version contains whitespace! Fix it!"
+    status=1
+  fi
+
+  echo $status > $MYTMP/changelog-checked
+  return $status
+}
diff --git a/packaging/release-msg b/packaging/release-msg
new file mode 100755 (executable)
index 0000000..01ec381
--- /dev/null
@@ -0,0 +1,59 @@
+#!/bin/bash
+
+#
+# release-msg
+#
+scriptname=release-msg
+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 "Use only from .git/hooks/prepare-commit-msg"
+  exit 1
+fi
+
+if [ ! -x packaging/release-msg ]
+then
+  echo "Must be run from base directory"
+  exit 1
+fi
+
+dirname="${0%/*}"
+if [ "$dirname" = "$0" ]; then dirname="."; fi
+source $dirname/packaging.functions
+
+mkdir -p $MYTMP/files
+git show :configure.ac > $MYTMP/files/configure.ac
+version=`get_configure_ac_version`
+case "$(match_version $version)" in
+  prerelease|candidate|release)
+    sed -i -e "1s/.*/Prepare release $version/" "$1"
+  ;;
+esac
+
+exit 0
diff --git a/packaging/tar-compare b/packaging/tar-compare
new file mode 100755 (executable)
index 0000000..02ec3c2
--- /dev/null
@@ -0,0 +1,62 @@
+#!/bin/sh
+
+# When provided with a git repo, which has been used to produce a
+# distribution tar.gz (with make dist) and the resultant tar-file,
+# lists files which appear in one or the other only, to help check
+# for missing EXTRA_DIST entries in Makefile.am files.
+
+scriptname=tar-compare
+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
+
+if [ $# -ne 2 ]
+then
+  echo "tar-compare git-dir tar-gz-file"
+  exit 1
+fi
+
+mkdir $MYTMP/unpack
+tar xfzC "$2" $MYTMP/unpack
+diff -r "$1" $MYTMP/unpack/* | grep "^Only" | sed \
+       -e '/: autom4te\.cache$/d' \
+       -e '/: \.deps$/d' \
+       -e '/: \.git$/d' \
+       -e '/: \.gitattributes$/d' \
+       -e '/: \.gitignore$/d' \
+       -e '/: config\.log$/d' \
+       -e '/: config\.status$/d' \
+       -e '/: config\.h.*$/d' \
+       -e '/: Makefile$/d' \
+       -e '/: hooks$/d' \
+       -e '/: packaging$/d' \
+       -e '/: stamp-h1$/d' \
+       -e '/: README\.md$/d' \
+       -e '/: tmp-anchor-links$/d' \
+       -e '/: tmp-manproc$/d' \
+       -e '/: .*\.tar\.\(gz\|bz2\|xz\)$/d' \
+       -e '/: unittest$/d' \
+       -e '/: iprange$/d' \
+       -e '/: .*\.o$/d' \
+       -e '/sbin: \(firehol\|fireqos\|link-balancer\)$/d' \
+       -e '/sbin: \(update-ipsets\|vnetbuild\|commands.sed\)$/d' > $MYTMP/out
+
+cat $MYTMP/out
+test -s $MYTMP/out && exit 1
+exit 0
diff --git a/packaging/update-tags b/packaging/update-tags
new file mode 100755 (executable)
index 0000000..6823fce
--- /dev/null
@@ -0,0 +1,149 @@
+#!/bin/bash
+
+#
+# update-tags
+#
+scriptname=update-tags
+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=$?
+  if [ $status -ne 0 ]
+  then
+    echo "FAILED."
+    if [ "$TAGVER" ]
+    then
+      git tag -d "$TAGVER"
+    fi
+    echo "To re-run manually:"
+    echo "  git diff HEAD^ | ./packaging/update-tags -"
+    echo "To undo commit:"
+    echo "  git reset HEAD^"
+  fi
+  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 "Use only from .git/hooks/post-commit"
+  exit 1
+fi
+
+if [ ! -x packaging/update-tags ]
+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
+source $dirname/packaging.functions
+
+status=0
+while read filename
+do
+  #echo Checking $filename
+  case $filename in
+    configure.ac|ChangeLog)
+      mkdir -p $MYTMP/files
+      git show HEAD:configure.ac > $MYTMP/files/configure.ac
+      version=`get_configure_ac_version`
+      case "$(match_version $version)" in
+         prerelease|candidate|release)
+           do_release=Y
+         ;;
+      esac
+    ;;
+    *)
+      #echo "No checks found for $filename"
+      :
+    ;;
+  esac
+done < $MYTMP/files.lst
+
+if [ "$do_release" ]
+then
+  echo "Tagging new release with:"
+  echo "   git tag -s \"v$version\" -m \"Release version $version\""
+  git tag -s "v$version" -m "Release version $version"
+  TAGVER="v$version"
+
+  splitver confmaj confmin conffix confsfx "$version"
+  if [ ! "$confsfx" ]
+  then
+    echo "Incrementing version in configure.ac:"
+    conffix=`expr $conffix + 1`
+    sed -i -e "s/define(\[VERSION_FIX\], \[.*])/define([VERSION_FIX], [$conffix])/" configure.ac
+  fi
+
+  echo "Resetting suffix in configure.ac:"
+  sed -i -e 's/define(\[VERSION_SUFFIX\], \[.*])/define([VERSION_SUFFIX], [_master])/' configure.ac
+  sed -i -e 's:^PACKAGE_RPM_RELEASE=.*:PACKAGE_RPM_RELEASE="0.0.$(echo VERSION_SUFFIX | sed s/^_//)":' configure.ac
+
+  echo "Committing new configure.ac:"
+  git commit --no-verify -m "Post release $version" -- configure.ac
+  echo ""
+  echo "Verify, then:"
+  echo "  git push origin"
+  echo "  git push origin tag $TAGVER"
+fi
+
+exit $status