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