forked from vieter-v/vieter
chore: ran v fmt for v 0.3.3 changes
This commit is contained in:
parent
e10b450abd
commit
b3a119f221
37 changed files with 179 additions and 175 deletions
|
|
@ -45,7 +45,7 @@ pub fn create_build_image(base_image string) !string {
|
|||
|
||||
c := docker.NewContainer{
|
||||
image: base_image
|
||||
env: ['BUILD_SCRIPT=$cmds_str']
|
||||
env: ['BUILD_SCRIPT=${cmds_str}']
|
||||
entrypoint: ['/bin/sh', '-c']
|
||||
cmd: ['echo \$BUILD_SCRIPT | base64 -d | /bin/sh -e']
|
||||
}
|
||||
|
|
@ -118,10 +118,10 @@ pub fn build_config(address string, api_key string, config BuildConfig) !BuildRe
|
|||
base64_script := base64.encode_str(build_script)
|
||||
|
||||
c := docker.NewContainer{
|
||||
image: '$config.base_image'
|
||||
image: '${config.base_image}'
|
||||
env: [
|
||||
'BUILD_SCRIPT=$base64_script',
|
||||
'API_KEY=$api_key',
|
||||
'BUILD_SCRIPT=${base64_script}',
|
||||
'API_KEY=${api_key}',
|
||||
// `archlinux:base-devel` does not correctly set the path variable,
|
||||
// causing certain builds to fail. This fixes it.
|
||||
'PATH=${build.path_dirs.join(':')}',
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ pub struct BuildJobQueue {
|
|||
mut:
|
||||
mutex shared util.Dummy
|
||||
// For each architecture, a priority queue is tracked
|
||||
queues map[string]MinHeap<BuildJob>
|
||||
queues map[string]MinHeap[BuildJob]
|
||||
// When a target is removed from the server or edited, its previous build
|
||||
// configs will be invalid. This map allows for those to be simply skipped
|
||||
// by ignoring any build configs created before this timestamp.
|
||||
|
|
@ -74,7 +74,7 @@ pub struct InsertConfig {
|
|||
pub fn (mut q BuildJobQueue) insert(input InsertConfig) ! {
|
||||
lock q.mutex {
|
||||
if input.arch !in q.queues {
|
||||
q.queues[input.arch] = MinHeap<BuildJob>{}
|
||||
q.queues[input.arch] = MinHeap[BuildJob]{}
|
||||
}
|
||||
|
||||
mut job := BuildJob{
|
||||
|
|
@ -86,7 +86,7 @@ pub fn (mut q BuildJobQueue) insert(input InsertConfig) ! {
|
|||
if !input.now {
|
||||
ce := if input.target.schedule != '' {
|
||||
cron.parse_expression(input.target.schedule) or {
|
||||
return error("Error while parsing cron expression '$input.target.schedule' (id $input.target.id): $err.msg()")
|
||||
return error("Error while parsing cron expression '${input.target.schedule}' (id ${input.target.id}): ${err.msg()}")
|
||||
}
|
||||
} else {
|
||||
q.default_schedule
|
||||
|
|
|
|||
|
|
@ -24,12 +24,12 @@ pub fn echo_commands(cmds []string) []string {
|
|||
|
||||
// create_build_script generates a shell script that builds a given Target.
|
||||
fn create_build_script(address string, config BuildConfig, build_arch string) string {
|
||||
repo_url := '$address/$config.repo'
|
||||
repo_url := '${address}/${config.repo}'
|
||||
|
||||
mut commands := [
|
||||
// This will later be replaced by a proper setting for changing the
|
||||
// mirrorlist
|
||||
"echo -e '[$config.repo]\\nServer = $address/\$repo/\$arch\\nSigLevel = Optional' >> /etc/pacman.conf"
|
||||
"echo -e '[${config.repo}]\\nServer = ${address}/\$repo/\$arch\\nSigLevel = Optional' >> /etc/pacman.conf"
|
||||
// We need to update the package list of the repo we just added above.
|
||||
// This should however not pull in a lot of packages as long as the
|
||||
// builder image is rebuilt frequently.
|
||||
|
|
@ -42,18 +42,18 @@ fn create_build_script(address string, config BuildConfig, build_arch string) st
|
|||
'git' {
|
||||
if config.branch == '' {
|
||||
[
|
||||
"git clone --single-branch --depth 1 '$config.url' repo",
|
||||
"git clone --single-branch --depth 1 '${config.url}' repo",
|
||||
]
|
||||
} else {
|
||||
[
|
||||
"git clone --single-branch --depth 1 --branch $config.branch '$config.url' repo",
|
||||
"git clone --single-branch --depth 1 --branch ${config.branch} '${config.url}' repo",
|
||||
]
|
||||
}
|
||||
}
|
||||
'url' {
|
||||
[
|
||||
'mkdir repo',
|
||||
"curl -o repo/PKGBUILD -L '$config.url'",
|
||||
"curl -o repo/PKGBUILD -L '${config.url}'",
|
||||
]
|
||||
}
|
||||
else {
|
||||
|
|
@ -62,7 +62,7 @@ fn create_build_script(address string, config BuildConfig, build_arch string) st
|
|||
}
|
||||
|
||||
commands << if config.path != '' {
|
||||
"cd 'repo/$config.path'"
|
||||
"cd 'repo/${config.path}'"
|
||||
} else {
|
||||
'cd repo'
|
||||
}
|
||||
|
|
@ -76,7 +76,7 @@ fn create_build_script(address string, config BuildConfig, build_arch string) st
|
|||
// The build container checks whether the package is already present on
|
||||
// the server.
|
||||
commands << [
|
||||
'curl -s --head --fail $repo_url/$build_arch/\$pkgname-\$pkgver-\$pkgrel && exit 0',
|
||||
'curl -s --head --fail ${repo_url}/${build_arch}/\$pkgname-\$pkgver-\$pkgrel && exit 0',
|
||||
// If the above curl command succeeds, we don't need to rebuild the
|
||||
// package. However, because we're in a su shell, the exit command will
|
||||
// drop us back into the root shell. Therefore, we must check whether
|
||||
|
|
@ -86,7 +86,7 @@ fn create_build_script(address string, config BuildConfig, build_arch string) st
|
|||
}
|
||||
|
||||
commands << [
|
||||
'MAKEFLAGS="-j\$(nproc)" makepkg -s --noconfirm --needed --noextract && for pkg in \$(ls -1 *.pkg*); do curl -XPOST -T "\$pkg" -H "X-API-KEY: \$API_KEY" $repo_url/publish; done',
|
||||
'MAKEFLAGS="-j\$(nproc)" makepkg -s --noconfirm --needed --noextract && for pkg in \$(ls -1 *.pkg*); do curl -XPOST -T "\$pkg" -H "X-API-KEY: \$API_KEY" ${repo_url}/publish; done',
|
||||
]
|
||||
|
||||
return echo_commands(commands).join('\n')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue