blob: 01d563cda6dc5bd06f648a305d6fbfeeec9f471e [file] [log] [blame]
Changcheng Liubea6a7c2019-11-14 22:59:40 +08001#!/usr/bin/env bash
2# Copyright (C) 2019 Liu Changcheng <changcheng.liu@aliyun.com>
3# Author: Liu Changcheng <changcheng.liu@aliyun.com>
4#
5# This program is free software; you can redistribute it and/or
6# modify it under the terms of the GNU General Public License
7# as published by the Free Software Foundation; either version 2
8# of the License, or (at your option) any later version.
9#
10# This program is distributed in the hope that it will be useful,
11# but WITHOUT ANY WARRANTY; without even the implied warranty of
12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13# GNU General Public License for more details.
14#
15# You should have received a copy of the GNU General Public License
16# along with this program. If not, see <http://www.gnu.org/licenses/>.
17#
18set -xe
19
20# Create dir for build
21base=${1:-/tmp/release}
22codename=$(lsb_release -sc)
23releasedir=$base/$(lsb_release -si)/liburing
24rm -rf $releasedir
25mkdir -p $releasedir
26
27src_dir=$(readlink -e `basename $0`)
28liburing_dir=$(dirname $src_dir)
29basename=$(basename $liburing_dir)
30dirname=$(dirname $liburing_dir)
31version=$(git describe --match "lib*" | cut -d '-' -f 2)
32outfile="liburing-$version"
33orgfile=$(echo $outfile | tr '-' '_')
34
35# Prepare source code
36cp -arf ${dirname}/${basename} ${releasedir}/${outfile}
37cd ${releasedir}/${outfile}
38git clean -dxf
39
40# Change changelog if it's needed
41cur_ver=`head -l debian/changelog | sed -n -e 's/.* (\(.*\)) .*/\1/p'`
42if [ "$cur_ver" != "$version-1" ]; then
43 dch -D $codename --force-distribution -b -v "$version-1" "new version"
44fi
45
46# Create tar archieve
47cd ../
48tar cvzf ${outfile}.tar.gz ${outfile}
49ln -s ${outfile}.tar.gz ${orgfile}.orig.tar.gz
50
51# Build debian package
52cd -
53debuild