Skip to content

Commit

Permalink
Minor fixes + better templating with jinja2
Browse files Browse the repository at this point in the history
  • Loading branch information
dtcooper committed Aug 3, 2017
1 parent 2d02a49 commit f468c6c
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 7 deletions.
5 changes: 4 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,12 @@ RUN apt-get update && apt-get -y upgrade && apt-get install -y \
curl \
git \
gnupg \
python-pip \
reprepro \
&& rm -rf /var/lib/apt/lists/*

RUN pip install jinja2-cli

RUN mkdir /toolchain
WORKDIR /toolchain

Expand All @@ -28,7 +31,7 @@ RUN echo '#!/bin/sh\narm-linux-gnueabihf-gcc --sysroot /toolchain/rpi-tools/arm-
# Install 1.0.x alsa-utils which is needed for compilation
RUN curl -O ftp://ftp.alsa-project.org/pub/lib/alsa-lib-1.0.29.tar.bz2 \
&& tar xvjf alsa-lib-1.0.29.tar.bz2 && cd alsa-lib-1.0.29 \
&& CC=arm-linux-gnueabihf-gcc ./configure --host=arm-linux-gnueabihf \
&& CC=arm-linux-gnueabihf-gcc ./configure --host=arm-linux-gnueabihf --disable-python \
--prefix=/toolchain/rpi-tools/arm-bcm2708/arm-bcm2708hardfp-linux-gnueabi/arm-bcm2708hardfp-linux-gnueabi/sysroot \
&& make -j $(nproc --all) && make install \
&& cd .. && rm -rf alsa-lib-1.0.29.tar.bz2 alsa-lib-1.0.29
Expand Down
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# You'll need my GPG_KEY for signing, which I'm pretty sure you don't have :P
APT_GPG_KEY?=2CC9B80F5AE2B7ACEFF2BA3209146F2F7953A455
APT_GH_PAGES_REPO?[email protected]:dtcooper/raspotify.git
RASPOTIFY_AUTHOR?=David Cooper <[email protected]>

raspotify_*.deb:
docker build -t raspotify .
Expand All @@ -11,13 +12,14 @@ raspotify_*.deb:
--volume "$(CURDIR):/mnt/raspotify" \
--env PERMFIX_UID="$$(id -u)" \
--env PERMFIX_GID="$$(id -g)" \
--env RASPOTIFY_AUTHOR="$(RASPOTIFY_AUTHOR)" \
raspotify /mnt/raspotify/build.sh

clean:
rm -rf *.deb librespot raspotify/usr raspotify/DEBIAN/control apt-repo

distclean: clean
docker rmi raspotify
docker rmi -f raspotify || true

apt: apt-repo

Expand Down
9 changes: 7 additions & 2 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,16 @@ cp -v /build/arm-unknown-linux-gnueabihf/release/librespot raspotify/usr/bin
# Strip dramatically decreases the size
arm-linux-gnueabihf-strip raspotify/usr/bin/librespot

# Compute final package version + filename
# Compute final package version + filename for Debian control file
DEB_PKG_VER="${RASPOTIFY_GIT_VER}~librespot.${LIBRESPOT_DEB_VER}"
DEB_PKG_NAME="raspotify_${DEB_PKG_VER}_armhf.deb"
echo "$DEB_PKG_NAME"
sed "s/<<<VERSION>>>/$DEB_PKG_VER/g" control.debian.tmpl > raspotify/DEBIAN/control

jinja2 \
-D "VERSION=$DEB_PKG_VER" \
-D "RUST_VERSION=$(rustc -V)" \
-D "RASPOTIFY_AUTHOR=$RASPOTIFY_AUTHOR" \
control.debian.tmpl > raspotify/DEBIAN/control

# Copy over copyright
mkdir -p raspotify/usr/share/doc/raspotify
Expand Down
5 changes: 3 additions & 2 deletions control.debian.tmpl
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
Package: raspotify
Version: <<<VERSION>>>
Version: {{ VERSION }}
Section: base
Priority: optional
Architecture: armhf
Depends: libasound2, adduser
Maintainer: David Cooper <[email protected]>
Maintainer: {{ RASPOTIFY_AUTHOR }}
Description: Raspotify
Spotify Connect client + daemon for the Raspberry Pi, based off librespot.
[Built with {{ RUST_VERSION }}]
2 changes: 1 addition & 1 deletion make-apt-repo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ EOF
reprepro includedeb jessie "../$DEB_PKG_NAME"
rm -rf conf db

ln -s "$(find . -name '*.deb' -type f -printf '%P\n' -quit)" raspotify-latest.deb
ln -fs "$(find . -name '*.deb' -type f -printf '%P\n' -quit)" raspotify-latest.deb

# Perm fixup. Not needed on macOS, but is on Linux
chown -R "$PERMFIX_UID:$PERMFIX_GID" /mnt/raspotify/* 2> /dev/null
Expand Down

0 comments on commit f468c6c

Please sign in to comment.