File: make-slp-dist

package info (click to toggle)
solarpowerlog 0.26-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,724 kB
  • sloc: cpp: 11,856; ansic: 1,044; php: 728; sh: 188; xml: 166; makefile: 166
file content (88 lines) | stat: -rwxr-xr-x 3,522 bytes parent folder | download
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
78
79
80
81
82
83
84
85
86
87
88
#!/bin/bash

# script to automate the process to uilds solarpowerlog release tars and debian packages.
# this ensures that this process is always the same and it also makes some saftety-checks
# on the package.

# This script needs to be excuted in the root directory of solarpowerlog sources

# It also needs the git repository present.

# note, this relies on e.g that the git repo is present
# and it will always build the currently selected branch!

set -e

# checks....
[[ ! -d .git ]] && ( echo ".git not present. Are you cd'ed to the right directory and have the repository present?"; exit 1)
[[ ! -e src/solarpowerlog.cpp ]] && (echo "Are you sure that you are in the solarpowerlog directory?"; exit 1)
# store current dir
SLP_ROOTDIR=$(pwd)

CURRENT_BRANCH=$(git symbolic-ref -q HEAD | cut -d/ -f 3-)
[[ "x$CURRENT_BRANCH" == "x" ]] && (echo "Cannot determin git branch to preserve branch." ; exit 1)

echo "######## Stage 1: generate release tar (make dist, make distcheck.)"
# As side, generates the changelog from the git repository and we automatically retrieve the version from the configure script.
[[ -e debian/rules ]] && (fakeroot make -f debian/rules clean || /bin/true)
[ ! -e Makefile ] && ./bootstrap.sh ; ./configure --cache-file=/tmp/cc;
VERSION=$(grep "PACKAGE_VERSION=" configure | cut -d"=" -f 2- | tr --delete "\'")
if [[ "x$VERSION" == "x" ]]
then
	echo "Retrieving version failed"
	exit 1
fi
echo "########		Building Version $VERSION"
make dist -j3
make distcheck -j3

echo "######## Stage #2: prepare staging directory for debian package build"

echo "########  2a) prepare orig.tar"
[[ ! -e ../stagedir_debbuild ]] && mkdir ../stagedir_debbuild
# this archive could be uploaded to sf.net:
cp solarpowerlog-$VERSION.tar.gz ../stagedir_debbuild/solarpowerlog-$VERSION.tar.gz
# this is needed for the debian build
mv solarpowerlog-$VERSION.tar.gz ../stagedir_debbuild/solarpowerlog_$VERSION.orig.tar.gz
git status >>../stagedir_debbuild/build-time-branch.txt


echo "########  2b) get the debian directory ready"
# merge the debian directory, but be sure to switch to that branch before...
# note that this will fail if you have uncommited changes and you were not on the debian branch before.
cd ../stagedir_debbuild/
rm -rf solarpowerlog-$VERSION
tar xzf solarpowerlog_$VERSION.orig.tar.gz

# integrate debian dir
cd $SLP_ROOTDIR
GIT_DESCRIBE=$(git describe)
git checkout debian
cp -r debian ../stagedir_debbuild/solarpowerlog-$VERSION
# returb ti previous branch
git checkout $CURRENT_BRANCH


echo "########  2c) check if we need to tweak the debian changelog"
cd ../stagedir_debbuild/solarpowerlog-$VERSION
# retrieve debian version, but stip of the upload path (the last -x)
DEB_VERSION=$(head -n1 debian/changelog | cut -d\( -f 2 | cut -d\) -f -1 | rev | cut -d- -f 2- | rev)
[[ "x$DEB_VERSION" == "x" ]] && ( echo "cannot determine existing debian version"; exit 1)
echo "DEB_VERSION = $DEB_VERSION"
if [[ "$DEB_VERSION" != "$VERSION" ]]
then
   dch --newversion $VERSION-1 "New upstream version $VERSION (automated build with make-slp-disp)"
   dch -a "upstream git reference: $GIT_DESCRIBE"
else
   dch -a "upstream git reference: $GIT_DESCRIBE"
fi

echo "######## Stage #3 Check packaging using pdebuilder (ensuring correct dependencies)"
pdebuild --debbuildopts "-I -i -j3"
echo "######## Stage #4 dpkg-buildpackage "
dpkg-buildpackage

echo "######## Stage #5 Linitian check of generated package"
lintian -I -E --pedantic ../solarpowerlog_$VERSION-*_i386.changes

cd $SLP_ROOTDIR