-
Notifications
You must be signed in to change notification settings - Fork 1
/
debmake
executable file
·45 lines (35 loc) · 1.25 KB
/
debmake
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/sh
CURDIR=`pwd`
if [ ! -d .git ] ; then
echo This script only works with git repos >&2
exit 1
fi
PKGNAME=$(basename `pwd`)
VERSION_FULL=`dpkg-parsechangelog -c1 | grep Version | cut "-d " -f 2`
TMP="echo $VERSION_FULL | tr '-' '\\n'"
if [ "`eval $TMP | wc -l`" = "1" ] ; then
REVISION=""
VERSION=$VERSION_FULL
else
REVISION=`eval $TMP | tail -1`
VERSION=`eval $TMP | head -n -1 | tr '\n' '-'`
VERSION=${VERSION%?} # get rid of extra dash at end
fi
unset TMP
BUILDDIR="$CURDIR/build"
NEWSRCDIR="$BUILDDIR/$PKGNAME"
if [ -d "$BUILDDIR" ] ; then
rm -rf "$BUILDDIR" #debian wants to do a completely clean build anyway
#maybe should do some checking to see if we actually need to regen
#everything, but for this package it doesn't take that much time anyway
fi
mkdir -p "$NEWSRCDIR" #will also create BUILDDIR if necessary
#perhaps I should do something here that would include changes in the working
#copy as opposed to only the last commit, but not necessary now. I guess
#workflow for now is use git commit --amend and not worry about it.
git archive master | tar -x -C "$NEWSRCDIR"
cd "$BUILDDIR"
tar -cf "${PKGNAME}_$VERSION.orig.tar" `basename "$NEWSRCDIR"`
gzip "${PKGNAME}_$VERSION.orig.tar"
cd "$NEWSRCDIR"
debuild