Move Debian package builder to main repo

This commit is contained in:
Frédéric Guillot 2020-10-18 21:17:54 -07:00 committed by Frédéric Guillot
parent 578cd8b24b
commit 73d73dc61e
10 changed files with 114 additions and 4 deletions

1
.gitignore vendored
View file

@ -1,3 +1,4 @@
miniflux-* miniflux-*
miniflux miniflux
*.rpm *.rpm
*.deb

View file

@ -6,6 +6,7 @@ BUILD_DATE := `date +%FT%T%z`
LD_FLAGS := "-s -w -X 'miniflux.app/version.Version=$(VERSION)' -X 'miniflux.app/version.Commit=$(COMMIT)' -X 'miniflux.app/version.BuildDate=$(BUILD_DATE)'" LD_FLAGS := "-s -w -X 'miniflux.app/version.Version=$(VERSION)' -X 'miniflux.app/version.Commit=$(COMMIT)' -X 'miniflux.app/version.BuildDate=$(BUILD_DATE)'"
PKG_LIST := $(shell go list ./... | grep -v /vendor/) PKG_LIST := $(shell go list ./... | grep -v /vendor/)
DB_URL := postgres://postgres:postgres@localhost/miniflux_test?sslmode=disable DB_URL := postgres://postgres:postgres@localhost/miniflux_test?sslmode=disable
DEB_IMG_ARCH := amd64
export PGPASSWORD := postgres export PGPASSWORD := postgres
@ -35,7 +36,9 @@ export PGPASSWORD := postgres
clean-integration-test \ clean-integration-test \
docker-image \ docker-image \
docker-images \ docker-images \
rpm rpm \
debian \
debian-packages
generate: generate:
@ go generate @ go generate
@ -95,7 +98,7 @@ run: generate
@ LOG_DATE_TIME=1 go run main.go -debug @ LOG_DATE_TIME=1 go run main.go -debug
clean: clean:
@ rm -f $(APP)-* $(APP) $(APP)*.rpm @ rm -f $(APP)-* $(APP) $(APP)*.rpm $(APP)*.deb
test: test:
go test -cover -race -count=1 ./... go test -cover -race -count=1 ./...
@ -135,5 +138,19 @@ rpm: clean
-f packaging/rpm/Dockerfile \ -f packaging/rpm/Dockerfile \
. .
@ docker run --rm \ @ docker run --rm \
-v ${PWD}:/root/rpmbuild/RPMS/x86_64/ miniflux-rpm-builder \ -v ${PWD}:/root/rpmbuild/RPMS/x86_64 miniflux-rpm-builder \
rpmbuild -bb --define "_miniflux_version $(VERSION)" /root/rpmbuild/SPECS/miniflux.spec rpmbuild -bb --define "_miniflux_version $(VERSION)" /root/rpmbuild/SPECS/miniflux.spec
debian:
@ docker build \
--build-arg BASE_IMAGE_ARCH=$(DEB_IMG_ARCH) \
-t $(DEB_IMG_ARCH)/miniflux-deb-builder \
-f packaging/debian/Dockerfile \
.
@ docker run --rm \
-v ${PWD}:/pkg $(DEB_IMG_ARCH)/miniflux-deb-builder
debian-packages: clean
$(MAKE) debian DEB_IMG_ARCH=amd64
$(MAKE) debian DEB_IMG_ARCH=arm64v8
$(MAKE) debian DEB_IMG_ARCH=arm32v7

View file

@ -0,0 +1,13 @@
ARG BASE_IMAGE_ARCH="amd64"
FROM ${BASE_IMAGE_ARCH}/golang:buster AS build
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update -q && \
apt-get install -y -qq build-essential devscripts dh-make dh-systemd && \
mkdir -p /build/debian
ADD . /src
CMD ["/src/packaging/debian/build.sh"]

30
packaging/debian/build.sh Executable file
View file

@ -0,0 +1,30 @@
#!/bin/sh
PKG_ARCH=`dpkg --print-architecture`
PKG_DATE=`date -R`
PKG_VERSION=`cd /src && git describe --abbrev=0`
echo "PKG_VERSION=$PKG_VERSION"
echo "PKG_ARCH=$PKG_ARCH"
echo "PKG_DATE=$PKG_DATE"
cd /src && \
make miniflux && \
mkdir -p /build/debian && \
cd /build && \
cp /src/miniflux /build/ && \
cp /src/miniflux.1 /build/ && \
cp /src/LICENSE /build/ && \
cp /src/packaging/miniflux.conf /build/ && \
cp /src/packaging/systemd/miniflux.service /build/debian/ && \
cp /src/packaging/debian/compat /build/debian/compat && \
cp /src/packaging/debian/copyright /build/debian/copyright && \
cp /src/packaging/debian/miniflux.manpages /build/debian/miniflux.manpages && \
cp /src/packaging/debian/rules /build/debian/rules && \
echo "miniflux ($PKG_VERSION) experimental; urgency=low" > /build/debian/changelog && \
echo " * Miniflux version $PKG_VERSION" >> /build/debian/changelog && \
echo " -- Frédéric Guillot <f@miniflux.net> $PKG_DATE" >> /build/debian/changelog && \
sed "s/__PKG_ARCH__/${PKG_ARCH}/g" /src/packaging/debian/control > /build/debian/control && \
dpkg-buildpackage -us -uc -b && \
lintian --check --color always ../*.deb && \
cp ../*.deb /pkg/

1
packaging/debian/compat Normal file
View file

@ -0,0 +1 @@
9

12
packaging/debian/control Normal file
View file

@ -0,0 +1,12 @@
Source: miniflux
Maintainer: Frédéric Guillot <f@miniflux.net>
Build-Depends: debhelper (>= 9), dh-systemd
Package: miniflux
Architecture: __PKG_ARCH__
Section: web
Priority: optional
Description: Minimalist Feed Reader
Miniflux is a minimalist and opinionated feed reader
Homepage: https://miniflux.app
Depends: ${misc:Depends}, ${shlibs:Depends}, adduser

View file

@ -0,0 +1,3 @@
Files: *
Copyright: 2017-2020 Frédéric Guillot
License: Apache

View file

@ -0,0 +1 @@
miniflux.1

View file

@ -0,0 +1,14 @@
#!/bin/sh
set -e
case "$1" in
configure)
adduser --system --disabled-password --disabled-login --home /var/empty \
--no-create-home --quiet --force-badname --group miniflux
;;
esac
#DEBHELPER#
exit 0

18
packaging/debian/rules Executable file
View file

@ -0,0 +1,18 @@
#!/usr/bin/make -f
DESTDIR=debian/miniflux
%:
dh $@ --with=systemd
override_dh_auto_clean:
override_dh_auto_test:
override_dh_auto_build:
override_dh_auto_install:
mkdir -p $(DESTDIR)/etc
mkdir -p $(DESTDIR)/usr/bin
cp miniflux.conf $(DESTDIR)/etc/miniflux.conf
cp miniflux $(DESTDIR)/usr/bin/miniflux
override_dh_installinit:
dh_installinit --noscripts