summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2020-04-26 09:55:47 +0200
committerDaniel Friesel <derf@finalrewind.org>2020-04-26 09:55:47 +0200
commit3cd26ca9d67b7ad3ffce01398230ae5ebf799361 (patch)
tree3668a2206f7b23cfcb7853334a629fb45536bc00
initial commit
-rw-r--r--.gitignore1
-rw-r--r--Dockerfile10
-rw-r--r--README.md9
-rwxr-xr-xscripts/makedeb-docker16
-rwxr-xr-xscripts/makedeb-docker-helper11
5 files changed, 47 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..e2e7327
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+/out
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000..d9dd9e2
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,10 @@
+FROM debian:buster
+
+ARG DEBIAN_FRONTEND=noninteractive
+
+WORKDIR /src/app
+
+RUN apt-get update \
+ && apt-get -y install apt-file dh-make-perl libmodule-build-perl \
+ && apt-file update \
+ && apt-cache dumpavail | dpkg --merge-avail
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..8fea14e
--- /dev/null
+++ b/README.md
@@ -0,0 +1,9 @@
+Usage:
+
+```
+export DEBFULLNAME="Jane Doe"
+export DEBEMAIL="jane@example.org"
+scripts/makedeb-docker Some::Module::name
+```
+
+See [Packaging Perl Modules for Debian in Docker](https://finalrewind.org/interblag/entry/packaging-perl-modules-for-debian-in-docker) for details.
diff --git a/scripts/makedeb-docker b/scripts/makedeb-docker
new file mode 100755
index 0000000..6e85470
--- /dev/null
+++ b/scripts/makedeb-docker
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+set -e
+
+mkdir -p out
+
+docker build -t dh-make-perl .
+
+docker run --rm -v "${PWD}/scripts:/scripts:ro" \
+ -v "${PWD}/out:/out" -e USER=$(id -u) -e GROUP=$(id -g) \
+ -e "CPANMODULE=$1" \
+ -e "DEBEMAIL=${DEBEMAIL}" -e "DEBFULLNAME=${DEBFULLNAME}" \
+ -e "LOGNAME=${LOGNAME}" \
+ dh-make-perl /scripts/makedeb-docker-helper
+
+echo "Debian package has been written to $(pwd)/out"
diff --git a/scripts/makedeb-docker-helper b/scripts/makedeb-docker-helper
new file mode 100755
index 0000000..fb90439
--- /dev/null
+++ b/scripts/makedeb-docker-helper
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+set -e
+
+mkdir -p /src/app
+cd /src/app
+
+cpan2deb --install-deps --install-build-deps "${CPANMODULE}"
+
+chown ${USER}:${GROUP} *.deb
+mv -v *.deb /out