feat: add debian packaging

fuck this is complicated. Why'd you make it so insane, debian
maintainers?
Please fix this.

It's working now, but Makefile must be modified... I dont like that.
Let's find another way
This commit is contained in:
Asger Gitz-Johansen 2024-08-18 20:22:06 +02:00
parent ccd07141f5
commit d02eb34285
13 changed files with 197 additions and 60 deletions

View File

@ -6,7 +6,7 @@
NAME=sci
DESCRIPTION=$(NAME) is a simple contiuous integration system.
VERSION = 1.0.0
PREFIX = /usr/local
PREFIX ?= /usr/local
MANPREFIX = $(PREFIX)/share/man
CC = gcc
@ -38,7 +38,7 @@ OBJ += out/obj/pipeline.o
OBJ += out/obj/threadlist.o
OBJ += out/obj/threadpool.o
out/bin/sci: $(OBJ) | $(BINDIR)
$(CC) -o $@ $(CFLAGS) $^
$(CC) -o $@ $^ $(CFLAGS)
clean:
rm -rf $(OUTDIR)

View File

@ -41,6 +41,7 @@ docker is super easy, just make a dockerfile - only concern is the trigger files
or maybe the scripts themselves would upload artifacts?
- [ ] I am deliberately not using `Restart=on-failure` in the `scid.service` file because we are using `Type=exec`
and not `Type=notify` (yet) - which would require a `sd_notify` call of `READY=1` (see `man systemd.service`)
- [ ] Custom environment variables passed to the pipelines on invokation should be possible.
### Note Regarding `inotify` usage
From the manpage:

View File

@ -1,6 +1,13 @@
FROM debian:latest
# TODO: Remove busybox from this list once you're done experimenting (you only need vi)
RUN apt-get update ; apt-get install -y build-essential devscripts dh-make busybox
RUN apt-get update && apt-get install -y \
build-essential \
devscripts \
busybox \
dh-make \
uuid-dev \
uuid \
util-linux
ARG DOCKER_USER=deb
# Set user and group
@ -14,5 +21,3 @@ ENV USER=${user}
# Switch to user
USER ${uid}:${gid}
ENTRYPOINT ["bash", "--login"]

5
debian/changelog vendored Normal file
View File

@ -0,0 +1,5 @@
sci (1.0.0-1) UNRELEASED; urgency=medium
* Initial release.
-- Asger Gitz-Johansen <asger.gitz@hotmail.com> Sun, 18 Aug 2024 11:43:07 +0000

20
debian/control vendored Normal file
View File

@ -0,0 +1,20 @@
Source: sci
Section: utils
Priority: optional
Maintainer: Asger Gitz-Johansen <asger.gitz@hotmail.com>
Rules-Requires-Root: no
Build-Depends:
debhelper-compat (= 13),
uuid-dev,
uuid,
Standards-Version: 4.6.2
Homepage: https://git.gtz.dk/agj/sci
Package: sci
Architecture: any
Depends:
libuuid,
${shlibs:Depends},
${misc:Depends},
Description: simple continuous integration (ci) system
sci provides a triggering system where touching tmp files runs pipelines

20
debian/copyright vendored Normal file
View File

@ -0,0 +1,20 @@
Files:
debian/*
Copyright:
2024 Asger Gitz-Johansen <asger.gitz@hotmail.com>
License: GPL-3+
This package is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
.
This package is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>
Comment:
On Debian systems, the complete text of the GNU General
Public License version 3 can be found in "/usr/share/common-licenses/GPL-3".

3
debian/rules vendored Executable file
View File

@ -0,0 +1,3 @@
#!/usr/bin/make -f
%:
PREFIX=/usr dh $@

1
debian/source/format vendored Normal file
View File

@ -0,0 +1 @@
3.0 (quilt)

10
debian/upstream/metadata vendored Normal file
View File

@ -0,0 +1,10 @@
# Example file for upstream/metadata.
# See https://wiki.debian.org/UpstreamMetadata for more info/fields.
# Below an example based on a github project.
Bug-Database: https://git.gtz.dk/agj/sci/issues
Bug-Submit: https://git.gtz.dk/agj/sci/issues/new
# Changelog: https://git.gtz.dk/agj/sci/blob/master/CHANGES
# Documentation: https://git.gtz.dk/agj/sci/wiki
Repository-Browse: https://git.gtz.dk/agj/sci
Repository: https://git.gtz.dk/agj/sci.git

6
debian/watch vendored Normal file
View File

@ -0,0 +1,6 @@
# Compulsory line, this is a version 4 file.
version=4
# Direct Git.
opts="mode=git" http://gitea.gtz.dk/sci.git \
refs/tags/v([\d\.]+)

0
scripts/build.sh → scripts/build-cpp-cmake.sh Normal file → Executable file
View File

31
scripts/package-sci-deb.sh Executable file
View File

@ -0,0 +1,31 @@
#!/bin/bash
# TODO: SCI_VERSION env var
debbuilder_image=$(docker images | grep debbuilder)
set -e
if [ -z $debbuilder_image ]; then
echo "building debbuilder image..."
docker build -t debbuilder -f deb-builder.dockerfile .
fi
echo "building source dist..."
make dist
echo "building .deb in debbuilder docker image..."
docker run --rm -it -v .:/src debbuilder sh -c '\
cd && \
mkdir -p artifacts && \
cp /src/sci-1.0.0.tar.gz . && \
mv sci-1.0.0.tar.gz sci_1.0.0.orig.tar.gz && \
tar xf sci_1.0.0.orig.tar.gz && \
cd sci-1.0.0 && \
cp -r /src/debian . && \
debuild && \
cp ../*.deb ~/artifacts && \
cp ../*.dsc ~/artifacts && \
cp ../*.build ~/artifacts && \
cp ../*.buildinfo ~/artifacts && \
cp ../*.changes ~/artifacts && \
cp ../*.tar.xz ~/artifacts && \
cp ../*.tar.gz ~/artifacts && \
tar czf /src/artifacts.tar.gz ~/artifacts
'

145
src/sci.1
View File

@ -1,57 +1,92 @@
.\" Hey, EMACS: -*- nroff -*-
.\" (C) Copyright 2024 unknown <asger.gitz@hotmail.com>,
.\"
.\" First parameter, NAME, should be all caps
.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
.\" other parameters are allowed: see man(7), man(1)
.TH Sci SECTION "August 18 2024"
.\" Please adjust this date whenever revising the manpage.
.\"
.\" Some roff macros, for reference:
.\" .nh disable hyphenation
.\" .hy enable hyphenation
.\" .ad l left justify
.\" .ad b justify to both left and right margins
.\" .nf disable filling
.\" .fi enable filling
.\" .br insert line break
.\" .sp <n> insert n+1 empty lines
.\" for manpage-specific macros, see man(7)
.SH NAME
sci \- program to do something
.SH SYNOPSIS
.B sci
.RI [ options ] " files" ...
.br
.B bar
.RI [ options ] " files" ...
.SH DESCRIPTION
This manual page documents briefly the
.B sci
and
.B bar
commands.
.PP
.\" TeX users may be more comfortable with the \fB<whatever>\fP and
.\" \fI<whatever>\fP escape sequences to invode bold face and italics,
.\" respectively.
\fBsci\fP is a program that...
.SH OPTIONS
These programs follow the usual GNU command line syntax, with long
options starting with two dashes ('\-').
A summary of options is included below.
For a complete description, see the Info files.
\" cli argument
.de AR
.B \\$1
.I \\$2
..
\" cli option
.de OP
[
.B \\$1
.I \\$2
\\$3
]
..
.de op
.TP
.B \-h, \-\-help
Show summary of options.
.TP
.B \-v, \-\-version
Show version of program.
.SH SEE ALSO
.BR bar (1),
.BR baz (1).
.br
The programs are documented fully by
.IR "The Rise and Fall of a Fooish Bar" ,
available via the Info system.
.BR \\$1 ", " \\$2 " " \fI\\$3
..
.TH sci 1 2024-08-17 "VERSION" "Simple CI manual"
.SH
NAME
sci - a simple continuous integration system
.SH
SYNOPSIS
.B sci
.AR -f /path/to/pipelines.conf
.br
.B sci
.AR -f /path/to/pipelines.conf
.AR -v 4
.AR -L /path/to/logs/
.br
.B sci
.AR -h
.SH
DESCRIPTION
This program provides a simple triggering system for your CI (Continuous Integration) server.
The operation of
.B sci
is configured through a
.I pipelines.conf
configuration file (see
.I sci(7)
for configuration language details)
and each pipeline will have an associated pipeline trigger file that can be
By default, pipeline triggers are placed in /tmp/sci but this can be overridden with the
.OP -x.
.SH EXAMPLES
A simple example configuration file could look something like the following:
"cool-horse" "example.com/cool" "on-cool" "/path/to/pipeline-scripts/cool.sh"
.br
"rad-horse" "example.com/rad" "on-rad" "/path/to/pipeline-scripts/rad.sh"
Each line represents a pipeline, and each argument is space-separated.
This example file creates two pipelines, one called "cool-horse" and another called "rad-horse".
Also note that arguments can, but are not required to be "-enclosed.
.SH OPTIONS
.op -f --input path
(required) add a TTA model path to parse.
.op -m --no-warn
disable all warnings.
.SH AUTHOR
Asger Gitz\-Johansen <asger.gitz@hotmail.com>.
\" TODO: decide on license
.SH COPYRIGHT
Copyright (C) 2024 Asger Gitz-Johansen
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
.SH SEE ALSO
\" TODO: write sci(7)