Skip to content

Commit 64fd063

Browse files
raisjnokaymatteodelabre
authored
Add web build scripts (toltec-dev#88)
Co-authored-by: okay <okay@chalk> Co-authored-by: Mattéo Delabre <[email protected]>
1 parent e1f9ede commit 64fd063

File tree

8 files changed

+142
-11
lines changed

8 files changed

+142
-11
lines changed

package/appmarkable/package

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# vim: set ft=sh:
22
pkgname=appmarkable
3-
pkgdesc="Turn your program into a very simple app for draft similar"
4-
url=https://github.com/LinusCDE/appmarkable
3+
pkgdesc="Turn your program into a very simple app for draft"
4+
url="https://github.com/LinusCDE/appmarkable"
55
pkgver=0.0.0-6
66
timestamp=2020-09-07T00:16Z
77
section=utils

package/harmony/package

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# vim: set ft=sh:
22
pkgname=harmony
3-
pkgdesc="harmony sketching app"
4-
url=https://github.com/rmkit-dev/rmkit
3+
pkgdesc="Procedural sketching app"
4+
url="https://rmkit.dev/apps/harmony"
55
pkgver=0.0.1-14
66
timestamp=2020-09-21T01:41+00:00
77
section=utils

package/mines/package

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# vim: set ft=sh:
22
pkgname=minesweeper
3-
pkgdesc="mine detection game"
4-
url=https://github.com/rmkit-dev/rmkit
3+
pkgdesc="Mine detection game"
4+
url=https://rmkit.dev/apps/minesweeper
55
pkgver=0.0.1-14
66
timestamp=2020-09-21T01:41+00:00
77
section=games

package/nao/package

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# vim: set ft=sh:
22
pkgname=nao
3-
pkgdesc="nao package manager"
4-
url=https://github.com/rmkit-dev/rmkit
3+
pkgdesc="Nao Package Manager: opkg UI built with SAS"
4+
url="https://rmkit.dev/apps/nao"
55
pkgver=0.0.1-15
66
timestamp=2020-09-27T01:41+00:00
77
section=utils

package/remux/package

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# vim: set ft=sh:
22
pkgname=remux
33
pkgdesc="App launcher that supports multi-tasking applications"
4-
url=https://github.com/rmkit-dev/rmkit
4+
url="https://rmkit.dev/apps/remux"
55
pkgver=0.0.1-18
66
timestamp=2020-09-29T01:41+00:00
77
section=launchers

package/simple/package

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# vim: set ft=sh:
22
pkgname=simple
3-
pkgdesc="simple app script"
4-
url=https://github.com/rmkit-dev/rmkit
3+
pkgdesc="Simple app script for writing scripted applications"
4+
url="https://rmkit.dev/apps/sas"
55
pkgver=0.0.1-15
66
timestamp=2020-09-27T01:41+00:00
77
section=utils

scripts/repo-build

+4
Original file line numberDiff line numberDiff line change
@@ -94,4 +94,8 @@ touch --no-dereference --date="@$lastcommitdate" \
9494
"$repodir"/Packages.gz \
9595
"$repodir"/Packages.stamps
9696

97+
98+
section "Making packages web listing"
99+
scripts/repo-build-web "$recipesdir" "$repodir"
100+
97101
section "Done. Result is in $repodir"

scripts/repo-build-web

+127
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
#!/usr/bin/env bash
2+
3+
set -e
4+
source scripts/package-lib
5+
6+
usage="$0 [OPTION]... RECIPESDIR WORKDIR
7+
8+
Builds the package listing as a webpage
9+
10+
The WORKDIR must be a non-existent directory in which the builds are performed.
11+
12+
Options:
13+
14+
-h Show this help message."
15+
16+
helpflag=
17+
18+
while getopts h name; do
19+
case $name in
20+
h) helpflag=1 ;;
21+
*) error "Invalid option. Use the -h flag for more information." ;;
22+
esac
23+
done
24+
25+
shift $((OPTIND - 1))
26+
27+
if [[ -n $helpflag ]]; then
28+
echo "$usage"
29+
exit
30+
fi
31+
32+
if [[ $# -eq 0 ]]; then
33+
error "Missing RECIPESDIR and WORKDIR arguments. Use the -h flag for more information."
34+
fi
35+
36+
if [[ $# -eq 1 ]]; then
37+
error "Missing WORKDIR argument. Use the -h flag for more information."
38+
fi
39+
40+
if [[ $# -gt 2 ]]; then
41+
error "Extraneous arguments. Use the -h flag for more information."
42+
fi
43+
44+
recipesdir="$1"
45+
workdir="$2"
46+
47+
pkgsworkdir="$workdir"/
48+
mkdir -p "$pkgsworkdir"
49+
50+
cat >"${pkgsworkdir}/index.html" <<WEBS
51+
<html>
52+
<head>
53+
<meta charset="utf-8">
54+
<style>
55+
body {
56+
font-family: monospace;
57+
background-color: #f8fcf8;
58+
}
59+
table {
60+
width: 100%;
61+
}
62+
table td {
63+
padding: 0 20px;
64+
}
65+
table tr:nth-child(even) {
66+
background-color: #dcdfdc;
67+
}
68+
69+
table thead {
70+
border-bottom: 1px dotted gray;
71+
}
72+
73+
table th {
74+
text-align: left;
75+
padding-left: 20px;
76+
}
77+
</style>
78+
</head>
79+
80+
<body>
81+
82+
<a href="../">Back to Repository Home Page</a>
83+
84+
<h1>Toltec Package Listing</h1>
85+
<table>
86+
87+
<thead> <tr>
88+
<th>Name</th> <th>Description</th> <th>Version</th> <th>Category</th> <th>License</th>
89+
</tr></thead>
90+
WEBS
91+
92+
# Build packages index
93+
section "Making packages index ${pkgsworkdir}/index.html"
94+
95+
# Build each package or get it from the remote server
96+
for recipedir in "$recipesdir"/*; do
97+
(
98+
load-recipe "$recipedir"
99+
100+
status "Adding table entry for $pkgname $pkgver"
101+
102+
pkgworkdir="$pkgsworkdir"/"$pkgname"
103+
if [[ -z "${url}" ]]; then
104+
href="${url}"
105+
else
106+
href="<a target='_new' href='${url}'>${pkgname}</a>"
107+
fi
108+
109+
cat >>"${workdir}/index.html" <<WEBS
110+
<tr>
111+
<td>${href}</td>
112+
<td>${pkgdesc}</td>
113+
<td>${pkgver}</td>
114+
<td>${section}</td>
115+
<td><a href='https://spdx.org/licenses/$license.html'>${license}</a></td>
116+
</tr>
117+
WEBS
118+
)
119+
120+
done
121+
122+
cat >>"${pkgsworkdir}/index.html" <<WEBS
123+
</table>
124+
</body>
125+
</html>
126+
WEBS
127+
section "Done. Result is in ${pkgsworkdir}"

0 commit comments

Comments
 (0)