automate/020_esy.sh

86 lines
2.2 KiB
Bash
Executable File

#!/usr/bin/env bash
set -x
sudo apt install -y \
dh-autoreconf \
dh-make \
check
USER="esy"
PROJECT="esy"
LICENSE="mit"
SECTION="admin"
HOMEPAGE="http://www.bluez.org"
BUILD_HOME="/var/tmp/${PROJECT}-git_build"
#VERSION="2.1.0"
PACKAGE="esy"
VERSION=$(curl "https://api.github.com/repos/${USER}/${PROJECT}/tags?per_page=5" | jq -r '.[0] | .name')
VERSION=${VERSION:1} # strip the preceding 'v'
DEBEMAIL="person@company.tld"
DEBFULLNAME="Testy McTester"
DESCRIPTION="Package management for native Reason and OCaml"
LONG_DESCRIPTION=" esy is a rapid workflow for developing Reason/OCaml projects. It supports native packages hosted on opam and npm."
RSS_FEED="https://github.com/${USER}/${PROJECT}/releases.atom"
#xdg-open ${RSS_FEED}
echo ${RSS_FEED}
# Make the BUILD_HOME directory and clone upstream
mkdir -p ${BUILD_HOME}
cd ${BUILD_HOME} || exit
git clone http://github.com/${USER}/${PROJECT}.git ${PACKAGE}-${VERSION}
cd ${PACKAGE}-${VERSION} || exit
mkdir -p m4
cat <<EOF >.git/gbp.conf
[DEFAULT]
# this is the upstream-branch:
upstream-branch=master
EOF
# debianize the BUILD_HOME directory
echo ${DEBFULLNAME}
dh_make \
--createorig \
--single \
--native \
--copyright ${LICENSE} \
--yes
# Customize the debian directory values
#sed -i 's,^\(Description: \).*,\1'${DESCRIPTION}',' debian/control
sed -i "s,^\(Description: \).*,\1${DESCRIPTION}," debian/control
sed -i 's,^\(Section: \).*,\1'${SECTION}',' debian/control
sed -i "s,^\(Maintainer: \).*,\1'${DEBFULLNAME}\ \<${DEBEMAIL}\>'," debian/control
sed -i 's,^\(Homepage: \).*,\1'${HOMEPAGE}',' debian/control
sed -i "s/.*insert\ long.*/${LONG_DESCRIPTION}/" debian/control
echo ****************
cat debian/control
echo ****************
#BUILD_OPTIONS="--enable-aac --enable-ofono --enable-debug"
#
#cat <<EOF > debian/rules
##!/usr/bin/make -f
#%:
# dh \$@
#
#override_dh_auto_configure:
# dh_auto_configure -- ${BUILD_OPTIONS}
#EOF
cat <<EOF >debian/watch
version=4
opts=filenamemangle=s/.+\/v?(\d\S+)\.tar\.gz/${PROJECT}-$1\.tar\.gz/ \
http://github.com/${USER}/${PROJECT}/tags .*/v?(\d\S+)\.tar\.gz
EOF
dpkg-buildpackage -us -uc -b
echo ${PACKAGE}_${VERSION}_amd64.deb
sudo dpkg -i ../${PACKAGE}_${VERSION}_amd64.deb