slweb

Једноставни генератор статичких веб страна
git clone https://git.sr.ht/~strahinja/slweb
Дневник | Датотеке | Референце | ПРОЧИТАЈМЕ | ЛИЦЕНЦА

чување 72dab88769120f124df3b396f61e0d71dc0a52f0
родитељ fc09e169003096716bbb59de8eba7053a249ec95
Аутор: Страхиња Радић <sr@strahinja.org>
Датум:   Thu,  5 Feb 2026 11:53:05 +0100

lib: Synchronize build scripts with other projects; update copyright year

Diffstat:
M.gitignore | 18++++++++----------
Mlib/mkpack | 4++--
Mlib/runtests | 71++++++++++++++++++++++++++++++++++++++++++++++++++++-------------------
Mversion.h.in | 2+-
измењених датотека: 4, додавања: 63(+), брисања: 32(-)

diff --git a/.gitignore b/.gitignore @@ -1,29 +1,27 @@ -.cache -.redo +.gdbinit *.session -.do_built -.do_built.dir +.rebuild *~ *.bak +*.err +*.out *.orig *.rej *.o -*.pdf -*.ps *.sig *.swp *.did -cscope.out tags **/tags +cscope.out nohup.out *.gz -*.sig *.xz index.html -slweb -slweb.1 slweb.html +slweb +*.1 +*.pkg.tar.zst slweb.session compile_commands.json examples/*/*.html diff --git a/lib/mkpack b/lib/mkpack @@ -4,7 +4,7 @@ DISTDIR=$(grep '^PROG[[:space:]]\{1,\}=' config.mk | sed -E 's,.*=[[:space:]]+([[:alpha:]]+),\1,')-$(cat version) mkdir "$DISTDIR" if [ -d .got ] && command -v got >/dev/null 2>&1; then - files=$(got tree | sed -e 's,[@/*$]$,,g') + files=$(got tree -R | sed -e 's,[@/*$]$,,g') elif [ -d .git ] && command -v git >/dev/null 2>&1; then files=$(git ls-files) else @@ -14,7 +14,7 @@ fi for f in $files; do d="$DISTDIR"/"$(dirname "$f")" mkdir -p "$d" - cp "$f" "$d"/ + [ -f "$f" ] && cp "$f" "$d"/ done tar -cf - "$DISTDIR" | xz -9v - > "$DISTDIR".tar.xz rm -fr "$DISTDIR" diff --git a/lib/runtests b/lib/runtests @@ -1,24 +1,57 @@ -#!/bin/sh -testdir=tests -cat <<! >&2 +#!/usr/bin/perl +# This program is licensed under the terms of GNU GPL v3 or (at your option) +# any later version. Copyright (C) 2022-2026 Страхиња Радић. +# See the file LICENSE for exact copyright and license details. + + +use 5.010; +use File::Find; + +my $errors = 0; +my @files; +my $maxlen = 60; +my $testdir = 'tests'; + +system("sh -c 'command -v expect' >/dev/null") == 0 || + die "Test suite requires expect"; + +find(sub { + push @files, $File::Find::name if (/\.test$/); +}, $testdir . "/"); + +for (@files) +{ + system $_; + $results{$_} = $?>>8; +} + +# Clear the screen +print "\033[0m\033[2J\033[2K\033[1;1H"; + +print <<"!"; TEST RESULTS -=========================================================== +============================================================ ! -error='' -find "$testdir" -type f \( -perm -100 -o -perm -010 -o -perm -001 \) -exec {} \; | -awk 'BEGIN { FS="\t"; maxlen = 60; status = 0 } + +for (@files) { - printf "%s%*s%s\n", $1, maxlen-5-length($1), " ", $2; - if ($2 == "FAIL") - status = 1 + printf "%s:%*s%s\t%s\n", $_, $maxlen-5-length($_), " ", + $results{$_} == 0 ? " OK" : "FAIL"; + if ($results{$_}) + { + $errors = 1; + } +} + +if ($errors == 1) +{ + printf "Some tests were unsuccessful - please report\n"; } -END { exit status }' >&2 || error=1 -cat <<! >&2 -=========================================================== -! -if [ -n "$error" ]; then - printf "Some tests were unsuccessful - please report\n" >&2 - exit 99 else - printf "All tests passed\n" >&2 -fi +{ + printf "All tests passed\n"; +} + +print <<"!"; +============================================================ +! diff --git a/version.h.in b/version.h.in @@ -1,5 +1,5 @@ /* This program is licensed under the terms of GNU GPL v3 or (at your option) - * any later version. Copyright (C) 2020-2024 Страхиња Радић. + * any later version. Copyright (C) 2020-2026 Страхиња Радић. * See the file LICENSE for exact copyright and license details. */ #define PROGRAMNAME "slweb"