From 2ada9881ff4a923d4041fe26e9259ce43170b30d Mon Sep 17 00:00:00 2001 From: robur Date: Tue, 29 Jun 2021 09:34:58 +0000 Subject: [PATCH] debian packaging --- LICENSE.md | 3 +++ builder-web.opam | 1 + packaging/debian/builder-web.service | 12 ++++++++++ packaging/debian/changelog | 5 ++++ packaging/debian/control | 13 ++++++++++ packaging/debian/copyright | 8 +++++++ packaging/debian/create_package.sh | 36 ++++++++++++++++++++++++++++ 7 files changed, 78 insertions(+) create mode 100644 LICENSE.md create mode 100644 packaging/debian/builder-web.service create mode 100644 packaging/debian/changelog create mode 100644 packaging/debian/control create mode 100644 packaging/debian/copyright create mode 100755 packaging/debian/create_package.sh diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 0000000..1489b83 --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,3 @@ +Permission to use, copy, modify, and distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/builder-web.opam b/builder-web.opam index d5c1f0d..ed62c6c 100644 --- a/builder-web.opam +++ b/builder-web.opam @@ -11,6 +11,7 @@ build: [ ["dune" "build" "-p" name "-j" jobs] ["dune" "runtest" "-p" name "-j" jobs] {with-test} ["sh" "packaging/FreeBSD/create_package.sh"] {os = "freebsd"} + ["sh" "packaging/debian/create_package.sh"] {os-family = "debian"} ] depends: [ diff --git a/packaging/debian/builder-web.service b/packaging/debian/builder-web.service new file mode 100644 index 0000000..b33a1c3 --- /dev/null +++ b/packaging/debian/builder-web.service @@ -0,0 +1,12 @@ +[Unit] +Description=Builder web daemon +After=syslog.target network.target + +[Service] +Type=simple +User=builder +Group=builder +ExecStart=/usr/bin/builder-web --data-dir /var/lib/builder/ + +[Install] +WantedBy=multi-user.target diff --git a/packaging/debian/changelog b/packaging/debian/changelog new file mode 100644 index 0000000..4433c8e --- /dev/null +++ b/packaging/debian/changelog @@ -0,0 +1,5 @@ +builder-web (%%VERSION_NUM%%) unstable; urgency=medium + + * Initial release + + -- Robur team diff --git a/packaging/debian/control b/packaging/debian/control new file mode 100644 index 0000000..b2aa97c --- /dev/null +++ b/packaging/debian/control @@ -0,0 +1,13 @@ +Package: builder-web +Version: 0.0.1-%%VERSION_NUM%% +Section: unknown +Priority: optional +Maintainer: Robur Team +Standards-Version: 4.4.1 +Homepage: https://git.robur.io/robur/builder-web +Vcs-Browser: https://git.robur.io/robur/builder-web +Vcs-Git: https://git.robur.io/robur/builder-web.git +Architecture: all +Depends: libgmp10, libsqlite3, libev4 +Description: Web service for storing and presenting builds. + Builder-web stores builds in a sqlite database and serves them via HTTP. diff --git a/packaging/debian/copyright b/packaging/debian/copyright new file mode 100644 index 0000000..537e5a5 --- /dev/null +++ b/packaging/debian/copyright @@ -0,0 +1,8 @@ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: builder-web +Upstream-Contact: Robur Team +Source: https://git.robur.io/robur/builder-web + +Files: * +Copyright: "Reynir Björnsson " +License: ISC diff --git a/packaging/debian/create_package.sh b/packaging/debian/create_package.sh new file mode 100755 index 0000000..bcff5c2 --- /dev/null +++ b/packaging/debian/create_package.sh @@ -0,0 +1,36 @@ +#!/bin/sh -e + +# only execute anything if either +# - running under orb with package = builder-web +# - not running under opam at all +if [ "$ORB_BUILDING_PACKAGE" != "builder-web" -a "$OPAM_PACKAGE_NAME" != "" ]; then + exit 0; +fi + +basedir=$(realpath "$(dirname "$0")"/../..) +bdir=$basedir/_build/install/default/bin +tmpd=$basedir/_build/stage +rootdir=$tmpd/rootdir +bindir=$rootdir/usr/bin +systemddir=$rootdir/usr/lib/systemd/system +debiandir=$rootdir/DEBIAN + +trap 'rm -rf $tmpd' 0 INT EXIT + +mkdir -p "$bindir" "$debiandir" "$systemddir" + +# stage app binaries +install $bdir/builder-web $bindir/builder-web +install $bdir/builder-migrations $bindir/builder-migrations +install $bdir/builder-db $bindir/builder-db + +# service script +install $basedir/packaging/debian/builder-web.service $systemddir/builder-web.service + +# install debian metadata +install $basedir/packaging/debian/control $debiandir/control +install $basedir/packaging/debian/changelog $debiandir/changelog +install $basedir/packaging/debian/copyright $debiandir/copyright + +dpkg-deb --build $rootdir $basedir/builder-web.deb +echo 'bin: [ "builder-web.deb" ]' > $basedir/builder-web.install