This repository has been archived by the owner on Mar 1, 2021. It is now read-only.
forked from opentraffic/osmlr_packaging
-
Notifications
You must be signed in to change notification settings - Fork 3
/
local.sh
executable file
·77 lines (65 loc) · 3.25 KB
/
local.sh
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#!/bin/bash
set -e
##
## based on https://github.com/kevinkreiser/libprime-server
##
#the main place for info on how to do this is here: http://packaging.ubuntu.com/html/index.html
#section 2. launchpad here: http://packaging.ubuntu.com/html/getting-set-up.html
#section 6. packaging here: http://packaging.ubuntu.com/html/packaging-new-software.html
#massive thanks to @sneetsher for finding and fixing all of my mistakes!
VERSION=$(head debian/changelog -n1 | sed -e "s/.*(//g" -e "s/-[a-zA-Z0-9+~\.]\+).*//;s/).*//")
#get a bunch of stuff we'll need to make the packages
sudo apt-get install -y dh-make dh-autoreconf bzr-builddeb pbuilder ubuntu-dev-tools debootstrap devscripts
#get the stuff we need to build the software
sudo apt-get install -y autoconf automake pkg-config libtool make gcc g++ lcov libcurl4-openssl-dev libzmq3-dev libboost-all-dev libgeos-dev libgeos++-dev lua5.2 liblua5.2-dev libprime-server0.6.3-dev libprotobuf-dev libspatialite-dev libsqlite3-dev protobuf-compiler jq python-all-dev libvalhalla-dev
#tell bzr who we are
export DEBFULLNAME='Matt Amos'
export DEBEMAIL='[email protected]'
bzr whoami "${DEBFULLNAME} <${DEBEMAIL}>"
source /etc/lsb-release
#versioned package name
PACKAGE="$(if [[ "${1}" == "--versioned-name" ]]; then echo osmlr${VERSION}; else echo osmlr; fi)"
######################################################
#SEE IF WE CAN BUILD THE PACKAGE FOR OUR LOCAL RELEASE
rm -rf local_build
mkdir local_build
pushd local_build
#get code into the form bzr likes
git clone --branch "v${VERSION}" --recursive https://github.com/opentraffic/osmlr.git ${PACKAGE}
pushd ${PACKAGE}
if [[ "${1}" == "--versioned-name" ]]; then
echo -e "osmlr${VERSION} (${VERSION}-0ubuntu1~${DISTRIB_CODENAME}1) ${DISTRIB_CODENAME}; urgency=low\n" > ../../debian/changelog
else
echo -e "osmlr (${VERSION}-0ubuntu1~${DISTRIB_CODENAME}1) ${DISTRIB_CODENAME}; urgency=low\n" > ../../debian/changelog
fi
git log --pretty=" * %w(72,0,4)%s" --no-merges $(git tag | grep -FB1 "v${VERSION}" | head -n 1)..v${VERSION} >> ../../debian/changelog
echo -e "\n -- ${DEBFULLNAME} <${DEBEMAIL}> $(date -u +"%a, %d %b %Y %T %z")" >> ../../debian/changelog
find -name .git | xargs rm -rf
popd
tar pczf ${PACKAGE}.tar.gz ${PACKAGE}
rm -rf ${PACKAGE}
#start building the package, choose l(ibrary) for the type
bzr dh-make --bzr-only ${PACKAGE} ${VERSION} ${PACKAGE}.tar.gz
pushd ${PACKAGE}
dh_make --single --yes --packagename "${PACKAGE}_${VERSION}"
popd
#bzr will make you a template to fill out but who wants to do that manually?
rm -rf ${PACKAGE}/debian
cp -rp ../debian ${PACKAGE}
if [[ "${1}" == "--versioned-name" ]]; then
for p in $(grep -F Package ${PACKAGE}/debian/control | sed -e "s/.*: //g"); do
for ext in .dirs .install; do
mv ${PACKAGE}/debian/${p}${ext} ${PACKAGE}/debian/$(echo ${p} | sed -e "s/osmlr/osmlr${VERSION}/g" -e "s/osmlr${VERSION}\([0-9]\+\)/osmlr${VERSION}-\1/g")${ext}
done
done
sed -i -e "s/osmlr/osmlr${VERSION}/g" -e "s/osmlr${VERSION}\([0-9]\+\)/osmlr${VERSION}-\1/g" ${PACKAGE}/debian/control ${PACKAGE}/debian/changelog
fi
#add the stuff to the bzr repository
pushd ${PACKAGE}
bzr add debian
bzr commit -m "Packaging for ${VERSION}-0ubuntu1."
#build the packages
bzr builddeb -- -us -uc -j$(nproc)
popd
popd
######################################################