summaryrefslogtreecommitdiff
path: root/debian/build-debian-package-from-git.sh
blob: cf92a78714e8bf9e70e8e5c4613bfc91fd49505e (plain)
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
#!/bin/sh
# ad-hoc script for building a debian package from current
# git repo if there's no debian/ dir
#
# otherwise this might be sufficient:
#   debuild -uc -us
#
# Prerequisites:
#
#   apt install build-essential devscripts python-setuptools python-all dh-systemd


#DEBEMAIL="Leap Automatic Deb Builder <deb@leap.se>"
DEBEMAIL="Varac <varac@leap.se>"
DEBIAN_BRANCH='origin/debian/platform-0.9'

gitroot=$(git -C . rev-parse --show-toplevel)
version=$(cd "${gitroot}/client" && python setup.py version | grep Version | sed -e "s/.*: //")

tempdir=${gitroot}/dist
debdir=${tempdir}/debian_branch
branchdir=${tempdir}/current_branch

mkdir -p "${debdir}"
mkdir -p "${branchdir}"

GIT="git -C ${gitroot}"

${GIT} archive --format=tar ${DEBIAN_BRANCH} | tar -C "${debdir}" -x
${GIT} archive --format=tar HEAD | tar -C "${branchdir}" -x

cp -r "${debdir}/debian" "${branchdir}/"

(cd "${branchdir}" && DEBEMAIL="${DEBEMAIL}" dch -b --newversion "${version}" "Automatic build.")
(cd "${branchdir}" && debuild -uc -us)

echo "Packages and build artifacts can be found in: ${tempdir}"
ls ${tempdir}/*.deb