From fbe9859d39044d5022ecc3fdc504a8822821c72b Mon Sep 17 00:00:00 2001
From: nd <nd@cccv.de>
Date: Fri, 23 Jul 2021 17:16:09 +0000
Subject: [PATCH] add debian packaging

---
 .gitlab-ci.yml   | 17 ++++++++++++++++-
 debian/changelog |  5 +++++
 debian/control   | 19 +++++++++++++++++++
 debian/rules     |  7 +++++++
 4 files changed, 47 insertions(+), 1 deletion(-)
 create mode 100644 debian/changelog
 create mode 100644 debian/control
 create mode 100755 debian/rules

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index cfb88e8..736a9ad 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -10,7 +10,7 @@ build-docs:
     - docs/_build/html
     expose_as: 'Documentation'
 
-publish:
+publish-pip:
   stage: deploy
   image: python:3.7
   script:
@@ -19,3 +19,18 @@ publish:
   - python -m twine upload --repository-url ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/pypi dist/*
   rules:
     - if: '$CI_COMMIT_TAG =~ /v[0-9]+[.][0-9]+[.][0-9]+.*/'
+
+publish-apt:
+  image: debian:buster
+  stage: deploy
+  script:
+    - apt update
+    - apt-get install -y python3-all debhelper python3-pip git-buildpackage
+    - gbp dch --ignore-branch --debian-tag=v%\(version\)s
+    - dpkg-buildpackage -us -uc
+    - mkdir build
+    - mv ../*.deb build/
+  artifacts:
+    paths:
+      - build/*
+      - debian/changelog
diff --git a/debian/changelog b/debian/changelog
new file mode 100644
index 0000000..f8ae9c6
--- /dev/null
+++ b/debian/changelog
@@ -0,0 +1,5 @@
+python3-ldapserver (0.0.1.dev0) unstable; urgency=medium
+
+  * Initial release.
+
+ -- Andreas Valder <nd@cccv.de>  Fri, 23 Jul 2021 18:02:31 +0200
diff --git a/debian/control b/debian/control
new file mode 100644
index 0000000..aaab10c
--- /dev/null
+++ b/debian/control
@@ -0,0 +1,19 @@
+Source: python3-ldapserver
+Section: python
+Priority: optional
+Maintainer: Andreas Valder <nd@cccv.de>
+Build-Depends:
+ debhelper-compat (= 12),
+ dh-python,
+ python3-all,
+ python3-setuptools,
+Standards-Version: 4.5.0
+Homepage: https://git.cccv.de/uffd/python-ldapserver
+Vcs-Git: https://git.cccv.de/uffd/python-ldapserver.git
+
+Package: python3-ldapserver
+Architecture: any
+Depends:
+ ${misc:Depends},
+ ${python3:Depends},
+Description: LDAP server request handler
diff --git a/debian/rules b/debian/rules
new file mode 100755
index 0000000..3907ef9
--- /dev/null
+++ b/debian/rules
@@ -0,0 +1,7 @@
+#!/usr/bin/make -f
+#export DH_VERBOSE = 1
+
+export PYBUILD_NAME=ldapserver
+
+%:
+	dh $@ --with python3 --buildsystem pybuild
-- 
GitLab