c63e772297a3d00ca7286cc1782dfb6fb76a0d43
[git-tools-moved-to-github.git] / id-deb-build / id-mk-deb-src.sh
1 #!/bin/sh
2 # Makes Debian source for package in deb-src
3 # The current directory should hold a .tar.gz (dist) for the package
4 # And the current directory should hold a debian and a corresponding changelog
5 DEBCHANGELOG=debian/changelog
6 if test ! -f $DEBCHANGELOG; then
7         echo "$DEBCHANGELOG missing"
8         echo "The current directory should be base source of package"
9         exit 1
10 fi
11 if test -f debian/.gitignore; then
12         cd debian; for i in `cat .gitignore`; do rm -fr $i; done; cd ..
13 fi
14 l=`head -1 $DEBCHANGELOG`
15 PROD=`echo $l|sed 's/ .*//g'`
16 VERSION=`echo $l|sed 's/.*(//g'|sed 's/).*//g'`
17 echo "VERSION=$VERSION"
18 MAJOR=`echo $VERSION|sed 's/-.*//g'`
19 echo "MAJOR=$MAJOR"
20 MINOR=`echo $VERSION|sed 's/.*-//g'`
21 echo "MINOR=$MINOR"
22 TAR=${PROD}-${MAJOR}.tar.gz
23 if test ! -f ${TAR}; then
24         echo "$0: ${TAR} missing"
25         exit 1
26 fi
27 set -e
28 mkdir -p deb-src
29 ORIG=${PROD}_${MAJOR}.orig.tar.gz
30 echo "TAR=$TAR"
31 echo "ORIG=$ORIG"
32 cp ${TAR} deb-src/${ORIG}
33 cd deb-src
34 tar xf ${ORIG}
35 cp -r ../debian ${PROD}-${MAJOR}
36 dpkg-source -b ${PROD}-${MAJOR}
37 # Local Variables:
38 # mode:shell-script
39 # sh-indentation: 2
40 # sh-basic-offset: 8
41 # End: