Skip to content

Commit 028a697

Browse files
committed
TEMP
1 parent c78f387 commit 028a697

File tree

5 files changed

+108
-73
lines changed

5 files changed

+108
-73
lines changed

services/nomad/build/build-rsyncd.nomad

Lines changed: 27 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ job "build-rsyncd" {
1313
}
1414
}
1515

16-
volume "glibc_hostdir" {
16+
volume "root_mirror" {
1717
type = "host"
18-
source = "glibc_hostdir"
18+
source = "root_mirror"
1919
read_only = false
2020
}
2121

@@ -39,21 +39,20 @@ job "build-rsyncd" {
3939
}
4040

4141
volume_mount {
42-
volume = "glibc_hostdir"
43-
destination = "/hostdir"
42+
volume = "root_mirror"
43+
destination = "/mirror"
4444
}
4545

4646
template {
47-
data = file("xbps-clean-sigs")
48-
destination = "local/xbps-clean-sigs"
47+
data = file("rsync-post-xfer")
48+
destination = "local/rsync-post-xfer"
4949
perms = "0755"
5050
}
5151

5252
template {
5353
data = <<EOF
5454
{{- with nomadVar "nomad/jobs/buildsync" }}
55-
buildsync-aarch64:{{ .aarch64_password }}
56-
buildsync-musl:{{ .musl_password }}
55+
buildsync:{{ .password }}
5756
{{- end }}
5857
EOF
5958
destination = "secrets/buildsync.secrets"
@@ -77,20 +76,29 @@ path = /hostdir/sources
7776
filter = - by_sha256/ - .* - *.part
7877
auth users = buildsync-*:rw
7978
80-
[aarch64]
81-
path = /hostdir/binpkgs/aarch64
82-
auth users = buildsync-aarch64:rw
83-
filter = + */ + *-repodata + otime + *.xbps - *.sig - *.sig2 - *-repodata.* - *-stagedata.* - *.x86_64* - x86_64*-repodata - .*
84-
post-xfer exec = /local/xbps-clean-sigs
85-
86-
[musl]
87-
path = /hostdir/binpkgs/musl
88-
auth users = buildsync-musl:rw
89-
filter = + */ + *-repodata + otime + *.xbps - *.sig - *.sig2 - *-repodata.* - *-stagedata.* - .*
90-
post-xfer exec = /local/xbps-clean-sigs
79+
&merge /local/rsyncd.d
9180
EOF
9281
destination = "local/buildsync.conf"
9382
}
83+
84+
dynamic "template" {
85+
for_each = [
86+
"x86_64", "i686", "armv7l", "armv6l",
87+
"x86_64-musl", "armv7l-musl", "armv6l-musl",
88+
"aarch64", "aarch64-musl",
89+
]
90+
91+
content {
92+
data = <<EOF
93+
[incoming-${template.value}]
94+
path = /incoming/${template.value}
95+
auth users = buildsync:rw
96+
filter = + */ + *.xbps - *.sig - *.sig2 - *-repodata* - .*
97+
post-xfer exec = /local/rsync-post-xfer
98+
EOF
99+
destination = "local/rsyncd.d/${template.value}.conf.inc"
100+
}
101+
}
94102
}
95103
}
96104
}

services/nomad/build/buildbot-worker.nomad

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ job "buildbot-worker" {
1010
// memory_max is ~95% of capacity
1111
{ name = "glibc", jobs = 10, cpu = 38100, mem = 115840, mem_max = 122270 },
1212
{ name = "musl", jobs = 6, cpu = 21700, mem = 57690, mem_max = 60890 },
13-
{ name = "aarch64", jobs = 14, cpu = 16000, mem = 27500, mem_max = 29500 },
13+
{ name = "aarch64", jobs = 12, cpu = 16000, mem = 27500, mem_max = 29500 },
1414
]
1515
labels = [ "buildbot-worker-${group.value.name}" ]
1616

@@ -163,13 +163,19 @@ EOF
163163
// the builders should use local repos
164164
template {
165165
data = <<EOF
166-
repository=/hostdir/binpkgs/bootstrap
167-
repository=/hostdir/binpkgs
168-
repository=/hostdir/binpkgs/nonfree
166+
{{ range service "root-pkgs-internal" }}
169167
{{ if eq "${group.value.name}" "glibc" }}
170-
repository=/hostdir/binpkgs/multilib/bootstrap
171-
repository=/hostdir/binpkgs/multilib
172-
repository=/hostdir/binpkgs/multilib/nonfree
168+
repository=http://{{ .Address }}:{{ .Port }}/bootstrap
169+
repository=http://{{ .Address }}:{{ .Port }}
170+
repository=http://{{ .Address }}:{{ .Port }}/nonfree
171+
repository=http://{{ .Address }}:{{ .Port }}/multilib/bootstrap
172+
repository=http://{{ .Address }}:{{ .Port }}/multilib
173+
repository=http://{{ .Address }}:{{ .Port }}/multilib/nonfree
174+
{{ else }}
175+
repository=http://{{ .Address }}:{{ .Port }}/${group.value.name}/bootstrap
176+
repository=http://{{ .Address }}:{{ .Port }}/${group.value.name}
177+
repository=http://{{ .Address }}:{{ .Port }}/${group.value.name}/nonfree
178+
{{ end }}
173179
{{ end }}
174180
EOF
175181
destination = "local/xbps-repos.conf"
@@ -198,7 +204,7 @@ EOF
198204
template {
199205
data = <<EOF
200206
{{- with nomadVar "nomad/jobs/buildsync" -}}
201-
{{ .${group.value.name}_password }}
207+
{{ .password }}
202208
{{- end -}}
203209
EOF
204210
destination = "secrets/rsync/password"

services/nomad/build/buildbot.cfg

Lines changed: 20 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ from pathlib import Path
1010
from twisted.internet import defer
1111
from twisted.python import log
1212

13-
from buildbot.process.results import SUCCESS, SKIPPED
13+
from buildbot.process.results import SUCCESS
1414
from buildbot.plugins import util, secrets, reporters, worker, schedulers
1515
from buildbot.plugins import steps
1616

@@ -129,13 +129,19 @@ c['schedulers'].append(schedulers.ForceScheduler(
129129

130130
# ###### BUILDERS
131131

132-
distdir = lambda f: util.Interpolate(f'/workdir/%(prop:name)s/void-packages/{f}')
133-
bulkdir = lambda f: util.Interpolate(f'/workdir/%(prop:name)s/xbps-bulk/{f}')
132+
def distdir(f):
133+
return util.Interpolate(f'/workdir/%(prop:name)s/void-packages/{f}')
134+
135+
def bulkdir(f):
136+
return util.Interpolate(f'/workdir/%(prop:name)s/xbps-bulk/{f}')
137+
134138
hostdir = '/hostdir'
135-
buildroot = lambda: util.Interpolate(f'/buildroots/%(prop:name)s/buildroot')
136-
builddir = lambda: util.Interpolate('builddir-%(prop:buildnumber)s')
137-
do_sync = lambda: util.Interpolate('%(prop:sync)s') == "True"
138-
hide_skipped = lambda results, _: results == SKIPPED
139+
140+
def buildroot():
141+
return util.Interpolate('/buildroots/%(prop:name)s/buildroot')
142+
143+
def builddir():
144+
return util.Interpolate('builddir-%(prop:buildnumber)s')
139145

140146

141147
factory = util.BuildFactory()
@@ -229,32 +235,21 @@ def build_packages(props):
229235
return cmds
230236

231237

232-
@util.renderer
233-
def make_prune_cmd(props):
234-
return ['bash', '-c',
235-
util.Interpolate(f"""
236-
export XBPS_TARGET_ARCH="%(prop:target)s"
237-
for repo in / /debug /nonfree /bootstrap; do
238-
xbps-rindex -r "{hostdir}/binpkgs/$repo"
239-
done
240-
if [ "$XBPS_TARGET_ARCH" = i686 ]; then
241-
for repo in /multilib /multilib/nonfree /multilib/bootstrap; do
242-
XBPS_TARGET_ARCH=x86_64 xbps-rindex -r "{hostdir}/binpkgs/$repo"
243-
done
244-
fi
245-
""")]
246-
247238
@util.renderer
248239
def make_rsync_cmd(props):
249-
return ['bash', '-c',
240+
return ['bash', '-e', '-c',
250241
util.Interpolate("""
242+
echo "=> Syncing packages to the shadow repository..."
251243
rsync -vurk --delete-after --delay-updates \
252244
--filter='+ */' --filter='+ %(prop:target)s-repodata' --filter='+ *.%(prop:target)s.xbps' \
253245
--filter='+ otime' --filter='- .*' --filter='- *' \
254246
--password-file=/secrets/rsync/password /hostdir/binpkgs/ \
255247
{{ range nomadService 1 $allocID "build-rsyncd" -}}
256-
rsync://buildsync-%(prop:worker)s@{{ .Address }}:{{ .Port }}/%(prop:worker)s
257-
{{ end -}}""")]
248+
rsync://buildsync@{{ .Address }}:{{ .Port }}/incoming-%(prop:target)s
249+
{{ end -}}
250+
echo "=> Cleaning built packages..."
251+
find /hostdir/binpkgs -name '*.xbps' -o -name '*-repodata' -print -delete
252+
""")]
258253

259254

260255
factory.addStep(GitWithDiff(
@@ -350,18 +345,6 @@ factory.addStep(steps.ShellSequence(
350345
timeout=14400,
351346
))
352347

353-
factory.addStep(steps.ShellCommand(
354-
command=make_prune_cmd,
355-
name='prune_packages',
356-
description='removing obsolete packages',
357-
descriptionDone='removed obsolete packages',
358-
haltOnFailure=True,
359-
logEnviron=False,
360-
usePTY=True,
361-
workdir='.',
362-
timeout=14400,
363-
))
364-
365348
factory.addStep(steps.ShellCommand(
366349
command=make_rsync_cmd,
367350
name='sync_packages',
@@ -371,8 +354,6 @@ factory.addStep(steps.ShellCommand(
371354
logEnviron=False,
372355
usePTY=True,
373356
workdir='.',
374-
doStepIf=do_sync(),
375-
hideStepIf=hide_skipped,
376357
timeout=14400,
377358
decodeRC={
378359
0: SUCCESS,
@@ -393,7 +374,6 @@ for b in builders:
393374
'target': targetarch,
394375
'cross': str(hostarch != targetarch),
395376
'worker': b['worker'],
396-
'sync': str(b['sync']),
397377
'bootstrap_args': b.get('bootstrap_args', '-N'),
398378
}
399379

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
#!/bin/sh
2+
3+
set -e
4+
5+
process_repo() {
6+
repo="$1"
7+
if [ ! -d "$RSYNC_MODULE_PATH/$repo" ] || [ ! -d "/mirror/$TGT/$repo" ]; then
8+
return
9+
fi
10+
# add to repodata
11+
find "$RSYNC_MODULE_PATH"/"$repo" -maxdepth 1 -type f -printf "/mirror/$TGT/$repo/%f\0" | \
12+
xargs -0 xbps-rindex -a
13+
# clean old packages from repodata
14+
xbps-rindex -c "/mirror/$TGT/$repo"
15+
# remove old packages
16+
xbps-rindex -r "/mirror/$TGT/$repo"
17+
# Remove signatures that don't have a corresponding package
18+
find "/mirror/$TGT/$repo" -maxdepth 1 \( -name '*.xbps.sig' -o -name '*.xbps.sig2' \) \
19+
-exec sh -c 'for x in "$@"; do [ -e "${x%.sig*}" ] || rm -- $x; done' _ {} +
20+
}
21+
22+
export XBPS_TARGET_ARCH="${RSYNC_MODULE_NAME#*-}"
23+
24+
case "$XBPS_TARGET_ARCH" in
25+
aarch64*) TGT="aarch64/" ;;
26+
*-musl) TGT="musl/" ;;
27+
*) TGT="" ;;
28+
esac
29+
30+
# copy files to repo
31+
# TODO: args
32+
rsync ... "${RSYNC_MODULE_PATH:?}"/* /mirror/"$TGT"
33+
34+
for repo in / /bootstrap /debug /nonfree; do
35+
process_repo "$repo"
36+
done
37+
38+
if [ "$XBPS_TARGET_ARCH" = 'i686' ]; then
39+
for repo in /multilib /multilib/bootstrap /multilib/nonfree; do
40+
process_repo "$repo"
41+
done
42+
fi
43+
44+
# clean up incoming
45+
rm -r "${RSYNC_MODULE_PATH:?}"/*
46+
47+
exit 0

services/nomad/build/xbps-clean-sigs

Lines changed: 0 additions & 6 deletions
This file was deleted.

0 commit comments

Comments
 (0)