4e351bb8e66db3fba973f386343238bfae36221e
[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 if test -d deb-src; then
15         echo "deb-src exist. You might remove it"
16         exit 1
17 fi
18 l=`head -1 $DEBCHANGELOG`
19 PROD=`echo $l|sed 's/ .*//g'`
20 VERSION=`echo $l|sed 's/.*(//g'|sed 's/).*//g'`
21 echo "VERSION=$VERSION"
22 MAJOR=`echo $VERSION|sed 's/-.*//g'`
23 echo "MAJOR=$MAJOR"
24 MINOR=`echo $VERSION|sed 's/.*-//g'`
25 echo "MINOR=$MINOR"
26 TAR=${PROD}-${MAJOR}.tar.gz
27 if test ! -f ${TAR}; then
28         echo "$0: ${TAR} missing"
29         exit 1
30 fi
31 set -e
32 mkdir deb-src
33 ORIG=${PROD}_${MAJOR}.orig.tar.gz
34 echo "TAR=$TAR"
35 echo "ORIG=$ORIG"
36 cp ${TAR} deb-src/${ORIG}
37 cd deb-src
38 tar xf ${ORIG}
39 cp -r ../debian ${PROD}-${MAJOR}
40 dpkg-source -b ${PROD}-${MAJOR}
41 # Local Variables:
42 # mode:shell-script
43 # sh-indentation: 2
44 # sh-basic-offset: 8
45 # End: