initial import

This commit is contained in:
2025-06-22 20:39:04 -05:00
commit f8a70886f0
3428 changed files with 302546 additions and 0 deletions

10
laminar/Chart.min.js vendored Normal file

File diff suppressed because one or more lines are too long

83
laminar/PKGBUILD Normal file
View File

@@ -0,0 +1,83 @@
# Maintainer: Jesus E. <heckyel@riseup.net>
pkgname=laminar
pkgver=1.0
_debver=$pkgver
_debrel=3
pkgrel=1
pkgdesc="Free software, fast and lightweight Continuous Integration server (with Hyperbola-branding)"
arch=('i686' 'x86_64')
url='https://laminar.ohwg.net'
license=('GPL-3' 'Expat')
depends=('capnproto' 'sqlite' 'rapidjson' 'boost-libs')
makedepends=('cmake' 'boost' 'quilt')
options=('strip')
source=("$pkgname-$pkgver.tar.gz::https://github.com/ohwgiles/laminar/archive/$pkgver.tar.gz"
"https://deb.debian.org/debian/pool/main/l/laminar/laminar_$_debver-$_debrel.debian.tar.xz"
"fix-build.patch"
"ansi_up.js"
"Chart.min.js"
"vue.min.js"
"vue-router.min.js"
"icon.png"
"laminard.initd"
"laminard.confd")
sha512sums=('5d9f9c9fe14a90733ab5b2c7f135d2d232e17a8f6bfe054b34f925ed37f589a40e6c2b1ec5fd73cc52f433f1562a6db94c7a4d649631d28b715a0cbbbd184a55'
'f41e881320e08052940cfb891c38ce45c9c74e5576aaf99c98a961b1278ff73899eb7541090dedbdddd3f165fa673c25cba8cf6d6ce2b54301bfc70a5227bb1d'
'94d8b3e428b3223903a0b7d79eca7a70ff56614dd39ac57352696cd5d5385e427f84e4e379574863a6d38a270b82e28731edea6b23d91ff2efa27cd204b18b14'
'b5833288efea1636ce702701ac88a0cca2064f3f281c68a71d7773a411aefdd07a47f29aa17b86e2f7fe11dab154ca5d94eb97622bf2770bca450a5dde99a702'
'1aca85f35d1c3701cc08310b4f08b7620588070298425bc2d564c027a7e4f34aed07accddc859da6842e8c1402b8e30ec575e4b045b01349382eb6fe37cec365'
'04a6d247e71fcb12dd300b04d2768b45e1522e0f3fa636e07f11e1fe4fe4502f361f2eebe87b51e612e1a1b6a59f681c4efce4cb27a1add444763a6c430cb627'
'0e938bf1c6e5854c162036596387239920a7607173860620f069896590468894aedcb2743d8a466d926355081dcee595f530a9adc0d6ebc2ed252763626f11d4'
'8712c82d558d06aa495f5ff2464b1cf83890868fc28dbc74dc7aa917f2de23f7b9c5953c1f5c02ca3a624f2dc167302db280d0929c72bf87fb1e3d8a14800b2d'
'533af672db0154b1dd3b9516a0bdafdadb427c469145bf8f30e2cf4e5a0fbca73c19f7180ea5f70c45a8fffcff0c4cd320a422dbfa37b92e37af600cac516eb0'
'5394447f3ec020d1e41f9ea123d5b68710c5673fc2f3698d35bc11aa6583eb733dcd930016a757788a4d13ea2af53070ffda678943998d12340954b2e2f12933')
prepare() {
cd "$srcdir/$pkgname-$pkgver"
if [[ ${pkgver%.*} = ${_debver%.*} ]]; then
# Debian patches
export QUILT_PATCHES=debian/patches
export QUILT_REFRESH_ARGS='-p ab --no-timestamps --no-index'
export QUILT_DIFF_ARGS='--no-timestamps'
mv "$srcdir"/debian .
# Doesn't apply
rm -v debian/patches/0000-Remove-dependency-on-vue-router.patch || true
rm -v debian/patches/0001-Remove-vue-router-in-the-build-process.patch || true
rm -v debian/patches/0002-Move-ansi-up-to-latest-version.patch || true
rm -v debian/patches/0003-Patch-build-system-to-use-JS-libraries-from-Debian-p.patch || true
rm -v debian/patches/0005-Add-Documentation-links-to-the-systemd-service.patch || true
quilt push -av
fi
patch -Np1 -i ${srcdir}/fix-build.patch
# copy 3rd-party files for compile
mkdir -p ./js
cp "$srcdir"/{ansi_up,Chart.min,vue.min,vue-router.min}.js "$srcdir/$pkgname-$pkgver/js"
# insert branding
rm "$srcdir/$pkgname-$pkgver/src/resources/icon.png"
cp "$srcdir"/icon.png "$srcdir/$pkgname-$pkgver/src/resources"
}
build() {
cd "$srcdir/$pkgname-$pkgver"
cmake \
-DCMAKE_INSTALL_PREFIX=/usr \
-DLAMINAR_VERSION=$pkgver .
make
}
package() {
cd "$srcdir/$pkgname-$pkgver"
make DESTDIR="$pkgdir/" install
install -d "${pkgdir}/var/lib/laminar/cfg/"{jobs,contexts,scripts}
install -Dm644 COPYING -t "${pkgdir}/usr/share/licenses/$pkgname"
# install services
install -Dm755 "${srcdir}/laminard.initd" "${pkgdir}/etc/init.d/laminard"
install -Dm644 "${srcdir}/laminard.confd" "${pkgdir}/etc/conf.d/laminard"
}

327
laminar/ansi_up.js Normal file
View File

@@ -0,0 +1,327 @@
// ansi_up.js
// version : 1.3.0
// author : Dru Nelson
// license : MIT
// http://github.com/drudru/ansi_up
(function (Date, undefined) {
var ansi_up,
VERSION = "1.3.0",
// check for nodeJS
hasModule = (typeof module !== 'undefined'),
// Normal and then Bright
ANSI_COLORS = [
[
{ color: "0, 0, 0", 'class': "ansi-black" },
{ color: "187, 0, 0", 'class': "ansi-red" },
{ color: "0, 187, 0", 'class': "ansi-green" },
{ color: "187, 187, 0", 'class': "ansi-yellow" },
{ color: "0, 0, 187", 'class': "ansi-blue" },
{ color: "187, 0, 187", 'class': "ansi-magenta" },
{ color: "0, 187, 187", 'class': "ansi-cyan" },
{ color: "255,255,255", 'class': "ansi-white" }
],
[
{ color: "85, 85, 85", 'class': "ansi-bright-black" },
{ color: "255, 85, 85", 'class': "ansi-bright-red" },
{ color: "0, 255, 0", 'class': "ansi-bright-green" },
{ color: "255, 255, 85", 'class': "ansi-bright-yellow" },
{ color: "85, 85, 255", 'class': "ansi-bright-blue" },
{ color: "255, 85, 255", 'class': "ansi-bright-magenta" },
{ color: "85, 255, 255", 'class': "ansi-bright-cyan" },
{ color: "255, 255, 255", 'class': "ansi-bright-white" }
]
],
// 256 Colors Palette
PALETTE_COLORS;
function Ansi_Up() {
this.fg = this.bg = this.fg_truecolor = this.bg_truecolor = null;
this.bright = 0;
}
Ansi_Up.prototype.setup_palette = function() {
PALETTE_COLORS = [];
// Index 0..15 : System color
(function() {
var i, j;
for (i = 0; i < 2; ++i) {
for (j = 0; j < 8; ++j) {
PALETTE_COLORS.push(ANSI_COLORS[i][j]['color']);
}
}
})();
// Index 16..231 : RGB 6x6x6
// https://gist.github.com/jasonm23/2868981#file-xterm-256color-yaml
(function() {
var levels = [0, 95, 135, 175, 215, 255];
var format = function (r, g, b) { return levels[r] + ', ' + levels[g] + ', ' + levels[b] };
var r, g, b;
for (r = 0; r < 6; ++r) {
for (g = 0; g < 6; ++g) {
for (b = 0; b < 6; ++b) {
PALETTE_COLORS.push(format.call(this, r, g, b));
}
}
}
})();
// Index 232..255 : Grayscale
(function() {
var level = 8;
var format = function(level) { return level + ', ' + level + ', ' + level };
var i;
for (i = 0; i < 24; ++i, level += 10) {
PALETTE_COLORS.push(format.call(this, level));
}
})();
};
Ansi_Up.prototype.escape_for_html = function (txt) {
return txt.replace(/[&<>]/gm, function(str) {
if (str == "&") return "&amp;";
if (str == "<") return "&lt;";
if (str == ">") return "&gt;";
});
};
Ansi_Up.prototype.linkify = function (txt) {
return txt.replace(/(https?:\/\/[^\s]+)/gm, function(str) {
return "<a href=\"" + str + "\">" + str + "</a>";
});
};
Ansi_Up.prototype.ansi_to_html = function (txt, options) {
return this.process(txt, options, true);
};
Ansi_Up.prototype.ansi_to_text = function (txt) {
var options = {};
return this.process(txt, options, false);
};
Ansi_Up.prototype.process = function (txt, options, markup) {
var self = this;
var raw_text_chunks = txt.split(/\033\[/);
var first_chunk = raw_text_chunks.shift(); // the first chunk is not the result of the split
var color_chunks = raw_text_chunks.map(function (chunk) {
return self.process_chunk(chunk, options, markup);
});
color_chunks.unshift(first_chunk);
return color_chunks.join('');
};
Ansi_Up.prototype.process_chunk = function (text, options, markup) {
// Are we using classes or styles?
options = typeof options == 'undefined' ? {} : options;
var use_classes = typeof options.use_classes != 'undefined' && options.use_classes;
var key = use_classes ? 'class' : 'color';
// Each 'chunk' is the text after the CSI (ESC + '[') and before the next CSI/EOF.
//
// This regex matches four groups within a chunk.
//
// The first and third groups match code type.
// We supported only SGR command. It has empty first group and 'm' in third.
//
// The second group matches all of the number+semicolon command sequences
// before the 'm' (or other trailing) character.
// These are the graphics or SGR commands.
//
// The last group is the text (including newlines) that is colored by
// the other group's commands.
var matches = text.match(/^([!\x3c-\x3f]*)([\d;]*)([\x20-\x2c]*[\x40-\x7e])([\s\S]*)/m);
if (!matches) return text;
var orig_txt = matches[4];
var nums = matches[2].split(';');
// We currently support only "SGR" (Select Graphic Rendition)
// Simply ignore if not a SGR command.
if (matches[1] !== '' || matches[3] !== 'm') {
return orig_txt;
}
if (!markup) {
return orig_txt;
}
var self = this;
while (nums.length > 0) {
var num_str = nums.shift();
var num = parseInt(num_str);
if (isNaN(num) || num === 0) {
self.fg = self.bg = null;
self.bright = 0;
} else if (num === 1) {
self.bright = 1;
} else if (num == 39) {
self.fg = null;
} else if (num == 49) {
self.bg = null;
} else if ((num >= 30) && (num < 38)) {
self.fg = ANSI_COLORS[self.bright][(num % 10)][key];
} else if ((num >= 90) && (num < 98)) {
self.fg = ANSI_COLORS[1][(num % 10)][key];
} else if ((num >= 40) && (num < 48)) {
self.bg = ANSI_COLORS[0][(num % 10)][key];
} else if ((num >= 100) && (num < 108)) {
self.bg = ANSI_COLORS[1][(num % 10)][key];
} else if (num === 38 || num === 48) { // extend color (38=fg, 48=bg)
(function() {
var is_foreground = (num === 38);
if (nums.length >= 1) {
var mode = nums.shift();
if (mode === '5' && nums.length >= 1) { // palette color
var palette_index = parseInt(nums.shift());
if (palette_index >= 0 && palette_index <= 255) {
if (!use_classes) {
if (!PALETTE_COLORS) {
self.setup_palette.call(self);
}
if (is_foreground) {
self.fg = PALETTE_COLORS[palette_index];
} else {
self.bg = PALETTE_COLORS[palette_index];
}
} else {
var klass = (palette_index >= 16)
? ('ansi-palette-' + palette_index)
: ANSI_COLORS[palette_index > 7 ? 1 : 0][palette_index % 8]['class'];
if (is_foreground) {
self.fg = klass;
} else {
self.bg = klass;
}
}
}
} else if(mode === '2' && nums.length >= 3) { // true color
var r = parseInt(nums.shift());
var g = parseInt(nums.shift());
var b = parseInt(nums.shift());
if ((r >= 0 && r <= 255) && (g >= 0 && g <= 255) && (b >= 0 && b <= 255)) {
var color = r + ', ' + g + ', ' + b;
if (!use_classes) {
if (is_foreground) {
self.fg = color;
} else {
self.bg = color;
}
} else {
if (is_foreground) {
self.fg = 'ansi-truecolor';
self.fg_truecolor = color;
} else {
self.bg = 'ansi-truecolor';
self.bg_truecolor = color;
}
}
}
}
}
})();
}
}
if ((self.fg === null) && (self.bg === null)) {
return orig_txt;
} else {
var styles = [];
var classes = [];
var data = {};
var render_data = function (data) {
var fragments = [];
var key;
for (key in data) {
if (data.hasOwnProperty(key)) {
fragments.push('data-' + key + '="' + this.escape_for_html(data[key]) + '"');
}
}
return fragments.length > 0 ? ' ' + fragments.join(' ') : '';
};
if (self.fg) {
if (use_classes) {
classes.push(self.fg + "-fg");
if (self.fg_truecolor !== null) {
data['ansi-truecolor-fg'] = self.fg_truecolor;
self.fg_truecolor = null;
}
} else {
styles.push("color:rgb(" + self.fg + ")");
}
}
if (self.bg) {
if (use_classes) {
classes.push(self.bg + "-bg");
if (self.bg_truecolor !== null) {
data['ansi-truecolor-bg'] = self.bg_truecolor;
self.bg_truecolor = null;
}
} else {
styles.push("background-color:rgb(" + self.bg + ")");
}
}
if (use_classes) {
return '<span class="' + classes.join(' ') + '"' + render_data.call(self, data) + '>' + orig_txt + '</span>';
} else {
return '<span style="' + styles.join(';') + '"' + render_data.call(self, data) + '>' + orig_txt + '</span>';
}
}
};
// Module exports
ansi_up = {
escape_for_html: function (txt) {
var a2h = new Ansi_Up();
return a2h.escape_for_html(txt);
},
linkify: function (txt) {
var a2h = new Ansi_Up();
return a2h.linkify(txt);
},
ansi_to_html: function (txt, options) {
var a2h = new Ansi_Up();
return a2h.ansi_to_html(txt, options);
},
ansi_to_text: function (txt) {
var a2h = new Ansi_Up();
return a2h.ansi_to_text(txt);
},
ansi_to_html_obj: function () {
return new Ansi_Up();
}
};
// CommonJS module is defined
if (hasModule) {
module.exports = ansi_up;
}
/*global ender:false */
if (typeof window !== 'undefined' && typeof ender === 'undefined') {
window.ansi_up = ansi_up;
}
/*global define:false */
if (typeof define === "function" && define.amd) {
define("ansi_up", [], function () {
return ansi_up;
});
}
})(Date);

35
laminar/fix-build.patch Normal file
View File

@@ -0,0 +1,35 @@
--- a/CMakeLists.txt 2020-12-05 01:55:11.000000000 +0100
+++ b/CMakeLists.txt 2022-05-05 00:24:11.786391267 +0200
@@ -82,16 +82,7 @@
COMMAND sh -c '( echo -n "\\#define INDEX_HTML_UNCOMPRESSED_SIZE " && wc -c < "${CMAKE_SOURCE_DIR}/src/resources/index.html" ) > index_html_size.h'
DEPENDS src/resources/index.html)
-# Download 3rd-party frontend JS libs...
-file(DOWNLOAD https://cdnjs.cloudflare.com/ajax/libs/vue/2.6.12/vue.min.js
- js/vue.min.js EXPECTED_MD5 fb192338844efe86ec759a40152fcb8e)
-file(DOWNLOAD https://cdnjs.cloudflare.com/ajax/libs/vue-router/3.4.8/vue-router.min.js
- js/vue-router.min.js EXPECTED_MD5 5f51d4dbbf68fd6725956a5a2b865f3b)
-file(DOWNLOAD https://raw.githubusercontent.com/drudru/ansi_up/v1.3.0/ansi_up.js
- js/ansi_up.js EXPECTED_MD5 158566dc1ff8f2804de972f7e841e2f6)
-file(DOWNLOAD https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.7.2/Chart.min.js
- js/Chart.min.js EXPECTED_MD5 f6c8efa65711e0cbbc99ba72997ecd0e)
-# ...and compile them
+# Compile frontend JS libs
generate_compressed_bins(${CMAKE_BINARY_DIR} js/vue-router.min.js js/vue.min.js
js/ansi_up.js js/Chart.min.js)
# (see resources.cpp where these are fetched)
@@ -141,14 +132,9 @@
target_link_libraries(laminar-tests ${GTEST_LIBRARY} capnp-rpc capnp kj-http kj-async kj pthread sqlite3 z)
endif()
-set(SYSTEMD_UNITDIR /lib/systemd/system CACHE PATH "Path to systemd unit files")
set(BASH_COMPLETIONS_DIR /usr/share/bash-completion/completions CACHE PATH "Path to bash completions directory")
set(ZSH_COMPLETIONS_DIR /usr/share/zsh/site-functions CACHE PATH "Path to zsh completions directory")
install(TARGETS laminard RUNTIME DESTINATION sbin)
install(TARGETS laminarc RUNTIME DESTINATION bin)
-install(FILES etc/laminar.conf DESTINATION /etc)
install(FILES etc/laminarc-completion.bash DESTINATION ${BASH_COMPLETIONS_DIR} RENAME laminarc)
install(FILES etc/laminarc-completion.zsh DESTINATION ${ZSH_COMPLETIONS_DIR} RENAME _laminarc)
-
-configure_file(etc/laminar.service.in laminar.service @ONLY)
-install(FILES ${CMAKE_CURRENT_BINARY_DIR}/laminar.service DESTINATION ${SYSTEMD_UNITDIR})

BIN
laminar/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

64
laminar/laminard.confd Normal file
View File

@@ -0,0 +1,64 @@
###
### LAMINAR_HOME
###
### Root location containing laminar configuration, database,
### build workspaces and archive.
###
### Default: /var/lib/laminar
###
LAMINAR_HOME=/var/lib/laminar
### LAMINAR_BIND_HTTP
###
### Interface on which laminard will bind to serve the Web UI.
### May be of the form IP:PORT, unix:PATH/TO/SOCKET or unix-abstract:NAME
###
### Default: *:8080
###
LAMINAR_BIND_HTTP=*:8080
### LAMINAR_BIND_RPC
###
### Interface on which laminard will bind to accept RPC from laminarc.
### May be of the form IP:PORT, unix:PATH/TO/SOCKET or unix-abstract:NAME
###
### Default: unix-abstract:laminar
LAMINAR_BIND_RPC=unix-abstract:laminar
###
### LAMINAR_TITLE
###
### Page title to show in web frontend
###
LAMINAR_TITLE=
###
### LAMINAR_KEEP_RUNDIRS
###
### Setting this prevents the immediate deletion of job rundirs
### $LAMINAR_HOME/run/$JOB/$RUN. Value should be an integer represeting
### the number of rundirs to keep.
###
### Default: 0
###
LAMINAR_KEEP_RUNDIRS=0
###
### LAMINAR_BASE_URL
###
### Base url for the frontend. This affects the <base href> tag and needs
### to be set if Laminar runs behind a reverse-proxy that hosts Laminar
### within a subfolder (rather than at a subdomain root)
###
LAMINAR_BASE_URL=/
###
### LAMINAR_ARCHIVE_URL
###
### Base url used to request artifacts. Laminar can serve build
### artifacts (and it will if you leave this unset), but it
### uses a very naive and inefficient method. Best to let a real
### webserver handle serving those requests.
###
#LAMINAR_ARCHIVE_URL=http://backbone.example.com/ci/archive/

29
laminar/laminard.initd Normal file
View File

@@ -0,0 +1,29 @@
#!/sbin/openrc-run
# Copyright 2022 Hyperbola Project
# Distributed under the terms of the GNU General Public License v2
export LAMINAR_HOME=${LAMINAR_HOME}
export LAMINAR_BIND_HTTP=${LAMINAR_BIND_HTTP}
export LAMINAR_BIND_RPC=${LAMINAR_BIND_RPC}
export LAMINAR_TITLE=${LAMINAR_TITLE}
export LAMINAR_KEEP_RUNDIRS=${LAMINAR_KEEP_RUNDIRS}
export LAMINAR_BASE_URL=${LAMINAR_BASE_URL}
export LAMINAR_ARCHIVE_URL=${LAMINAR_ARCHIVE_URL}
depend() {
need net localmount
}
start() {
ebegin "Starting Laminar Continuous Integration Server"
start-stop-daemon --start --background --chdir /var/lib/laminar \
--make-pidfile --pidfile /run/laminard.pid \
--exec /usr/sbin/laminard --
eend $?
}
stop() {
ebegin "Stopping Laminar Continuous Integration Server"
start-stop-daemon --stop --quiet --pidfile /run/laminard.pid
eend $?
}

6
laminar/vue-router.min.js vendored Normal file

File diff suppressed because one or more lines are too long

6
laminar/vue.min.js vendored Normal file

File diff suppressed because one or more lines are too long