Skip to content

Commit

Permalink
make deb build from a local tarball
Browse files Browse the repository at this point in the history
  • Loading branch information
rumengb committed Jan 24, 2021
1 parent daebe25 commit 369e9ee
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 24 deletions.
2 changes: 2 additions & 0 deletions scripts/build_all_arch_debs_docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ fi

VERSION=$1
echo "Building version $VERSION"
sh scripts/make_source_tarball.sh $VERSION
sh scripts/build_in_docker.sh "i386/debian:stretch-slim" $VERSION "i386"
sh scripts/build_in_docker.sh "amd64/debian:stretch-slim" $VERSION "amd64"
sh scripts/build_in_docker.sh "arm32v7/debian:buster-slim" $VERSION "armhf"
sh scripts/build_in_docker.sh "arm64v8/debian:stretch-slim" $VERSION "arm64"
rm ain-imager-$VERSION.tar.gz

8 changes: 5 additions & 3 deletions scripts/build_in_docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,11 @@ LABEL maintainer="[email protected]"
RUN apt-get -y update && apt-get -y install wget unzip build-essential autoconf autotools-dev libtool cmake libudev-dev libavahi-compat-libdnssd-dev libusb-1.0-0-dev fxload libcurl4-gnutls-dev libgphoto2-dev libz-dev git curl bsdmainutils qt5-default devscripts cdbs apt-transport-https
RUN echo 'deb [trusted=yes] https://indigo-astronomy.github.io/indigo_ppa/ppa indigo main' >>/etc/apt/sources.list
RUN apt-get update
RUN apt-get install indigo
RUN git clone https://github.com/indigo-astronomy/indigo_imager.git
WORKDIR indigo_imager
RUN apt-get -y install indigo
COPY ain-imager-$2.tar.gz .
RUN tar -zxf ain-imager-$2.tar.gz
RUN rm ain-imager-$2.tar.gz
WORKDIR ain-imager-$2
RUN qmake
RUN scripts/builddeb.sh $2
EOF
Expand Down
24 changes: 3 additions & 21 deletions scripts/builddeb.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#!/bin/sh

GIT_VERSION=""
DEB_VERSION=""
VERSION=${1}

DEBFULLNAME="Rumen Bogdanovski"
EMAIL="[email protected]"
Expand All @@ -21,34 +20,17 @@ rm -f debian/changelog
[ ! $(which dpkg-buildpackage) ] && { echo "executable 'dpkg-buildpackage' not found install package: 'dpkg-dev'"; exit 1; }
[ ! $(which cdbs-edit-patch) ] && { echo "executable 'cdbs' not found install package: 'cdbs'"; exit 1; }

# Read GIT TAG version via command git describe
GIT_VERSION=$(git describe --tags)
[ $? -ne 0 ] && { echo "GIT tag version cannot be read"; exit 1; }

# If parameter is provided, try this tag to checkout and build package.
[ "$#" -eq 1 ] && GIT_VERSION=${1}

# Get current branch
CURRENT_BRANCH=$(git branch | grep \* | cut -d ' ' -f2);

# Checkout the desired tag/version we want to build packages.
git checkout ${GIT_VERSION} >/dev/null 2>&1
[ $? -ne 0 ] && { echo "version '${1}' does not exists in git"; exit 1; }

# Build dependencies
./build_libs.sh

# Create entry in debian/changelog.
dch --create --package "ain-imager" --newversion ${GIT_VERSION} --distribution unstable --nomultimaint -t "Build from official upstream."
dch --create --package "ain-imager" --newversion ${VERSION} --distribution unstable --nomultimaint -t "Build from official upstream."

# Update version.h.
sed -i "s/\(AIN_VERSION \).*/\1\"${GIT_VERSION}\"/g" version.h
sed -i "s/\(AIN_VERSION \).*/\1\"${VERSION}\"/g" version.h

# Finally build the package.
dpkg-buildpackage \-us \-uc \-I.git \-I\*.out[0-9]\* \-I\*.swp

# Cleanup debian/changelog.
rm -f debian/changelog

# Return to current branch
git checkout $CURRENT_BRANCH
17 changes: 17 additions & 0 deletions scripts/make_source_tarball.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash

if [ -z $1 ]
then
echo "Please specify git tag"
exit 1
fi

if [ -z `git tag | grep -w $1` ]
then
echo "Specified tag not found, building tarball from HEAD"
git archive --format=tar --prefix=ain-imager-$1/ HEAD | gzip >ain-imager-$1.tar.gz
exit 0
fi

echo "Building tarball from tag $1"
git archive --format=tar --prefix=ain-imager-$1/ $1 | gzip >ain-imager-$1.tar.gz

0 comments on commit 369e9ee

Please sign in to comment.