/ debian / update-dch-from-git
update-dch-from-git
 1  #!/bin/bash
 2  
 3  if [ ! -d debian -o ! -d src ]; then
 4      echo "this script must be run from the root of the source tree (the directory with debian and src in it)"
 5      exit 1
 6  fi
 7  
 8  
 9  source scripts/githelper.sh
10  githelper $1
11  
12  GIT_VERSION=$(scripts/get-version-from-git $GIT_BRANCH)
13  if [ $? -ne 0 ]; then
14      echo "error determining version!"
15      exit 1
16  fi
17  
18  DEB_VERSION=`git show HEAD:debian/changelog | head -1 | sed 's/.*(\(.*\)).*/\1/'`
19  
20  NEW_DEB_VERSION=$(echo $GIT_VERSION | sed -r 's/-pre/~pre/; s/-/./g')
21  NEW_DEB_VERSION="1:${NEW_DEB_VERSION/v/}"
22  
23  if [ "$NEW_DEB_VERSION" = "$DEB_VERSION" ]; then
24      echo "no changes since the version at the top of the debian/changelog file"
25      echo "not modifying debian/changelog"
26      exit 0
27  fi
28  
29  set -e
30  (
31  echo "linuxcnc ($NEW_DEB_VERSION) $(lsb_release -cs); urgency=low"
32  echo
33  git log --pretty=format:"  * %w(72,0,6)%s" $GIT_TAG..
34  echo
35  echo
36  echo " -- buildbot <buildbot@example.com>  $(date -R)"
37  echo
38  git show HEAD:debian/changelog
39  ) > debian/changelog
40  
41  dch -r --nomultimaint ""