-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathbuild-jenkins.sh
executable file
·54 lines (39 loc) · 1.25 KB
/
build-jenkins.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
#!/bin/bash
set -e
# Global jenkins building script for buddycloud projects.
# It is called by a jenkins github hook.
# Build variables
DEBFULLNAME="Abmar Barros (buddycloud Packaging)"
DEBEMAIL="[email protected]"
DIR_NAME="$(dirname $0)"
CURRENT_DIR="$(cd $DIR_NAME; pwd)"
DATE=$(date +%Y%m%d)
DATE_REPR=$(date -R)
PACKAGE=$1
echo "Processing project $PACKAGE"
# Changelog
GIT_PATH=git
cd $GIT_PATH
REV="$(git log -1 --pretty=format:%h)"
if [ ! -f ../prev.rev ]; then
git log --max-parents=0 HEAD --pretty=format:%h > ../prev.rev
fi
REV_PREV="$(cat ../prev.rev)"
# Check contrib in
cp -r $CURRENT_DIR/projects/$PACKAGE/debian .
# Convert svn changelog into deb changelog.
# Strip duplicate blank lines too
CHANGELOG="$(git log $REV_PREV..$REV --pretty=format:'[ %an ]%n>%s' | $CURRENT_DIR/gitcl2deb.sh)"
BUILD_VERSION="${DATE}.git.${REV}"
DIST_REVISION="${BUILD_VERSION}-1"
DIST=all
echo -e "${PACKAGE} (${DIST_REVISION}) ${DIST}; urgency=low\n\n\
${CHANGELOG}\n\n\
-- ${DEBFULLNAME} <${DEBEMAIL}> ${DATE_REPR}\n"\
> debian/changelog
SOURCE="${PACKAGE}-${BUILD_VERSION}"
ORIG_TGZ="${PACKAGE}_${BUILD_VERSION}.orig.tar.gz"
echo "Building orig.tar.gz ..."
git archive --format=tar "--prefix=${SOURCE}/" "${REV}" | gzip >"../${ORIG_TGZ}"
# Build deb
debuild