1#!/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 <https://www.gnu.org/licenses/>. 17# 18set -xe 19 20# Create dir for build 21base=${1:-/tmp/release} 22distro=unstable 23releasedir=$base/$(lsb_release -si)/liburing 24rm -rf $releasedir 25mkdir -p $releasedir 26HEAD=$(which head) 27DCH=$(which dch) 28 29src_dir=$(readlink -e `basename $0`) 30liburing_dir=$(dirname $src_dir) 31basename=$(basename $liburing_dir) 32dirname=$(dirname $liburing_dir) 33version=$(git describe --match "lib*" | cut -d '-' -f 2) 34outfile="liburing-$version" 35orgfile=$(echo $outfile | tr '-' '_') 36 37# Prepare source code 38cp -arf ${dirname}/${basename} ${releasedir}/${outfile} 39cd ${releasedir}/${outfile} 40git clean -dxf 41 42# Change changelog if it's needed 43cur_ver=`$HEAD < debian/changelog | sed -n -e 's/.* (\(.*\)) .*/\1/p'` 44if [ "$cur_ver" != "$version-1" ]; then 45 $DCH -D $distro --force-distribution -b -v "$version-1" "new version" 46fi 47 48# Create tar archive 49cd ../ 50tar cvzf ${outfile}.tar.gz ${outfile} 51ln -s ${outfile}.tar.gz ${orgfile}.orig.tar.gz 52 53# Build debian package 54cd - 55debuild 56