fix: compile with selected V version

dev
Jef Roosens 2023-02-15 20:07:07 +01:00
parent 4dc82515f4
commit 455f3b5f41
5 changed files with 14 additions and 14 deletions

View File

@ -6,7 +6,7 @@ import os
import build
// build locally builds the target with the given id.
fn build(conf Config, target_id int, force bool) ! {
fn build_target(conf Config, target_id int, force bool) ! {
c := client.new(conf.address, conf.api_key)
target := c.get_target(target_id)!

View File

@ -251,7 +251,7 @@ pub fn cmd() cli.Command {
c := client.new(conf_.address, conf_.api_key)
c.queue_job(target_id, arch, force)!
} else {
build(conf_, target_id, force)!
build_target(conf_, target_id, force)!
}
}
},

View File

@ -5,7 +5,7 @@ import os
// remove_pkg_from_arch_repo removes a package from an arch-repo's database. It
// returns false if the package wasn't present in the database. It also
// optionally re-syncs the repo archives.
pub fn (r &RepoGroupManager) remove_pkg_from_arch_repo(repo string, arch string, pkg_name string, sync bool) !bool {
pub fn (r &RepoGroupManager) remove_pkg_from_arch_repo(repo string, arch string, pkg_name string, perform_sync bool) !bool {
repo_dir := os.join_path(r.repos_dir, repo, arch)
// If the repository doesn't exist yet, the result is automatically false
@ -39,7 +39,7 @@ pub fn (r &RepoGroupManager) remove_pkg_from_arch_repo(repo string, arch string,
}
// Sync the db archives if requested
if sync {
if perform_sync {
r.sync(repo, arch)!
}

View File

@ -19,15 +19,15 @@ pub fn (mut app App) healthcheck() web.Result {
// repository's archives, but also package archives or the contents of a
// package's desc file.
['/:repo/:arch/:filename'; get; head; markused]
fn (mut app App) get_repo_file(repo string, arch string, filename string) web.Result {
fn (mut app App) get_repo_file(repo_ string, arch string, filename string) web.Result {
mut full_path := ''
db_exts := ['.db', '.files', '.db.tar.gz', '.files.tar.gz']
// There's no point in having the ability to serve db archives with wrong
// filenames
if db_exts.any(filename == '${repo}${it}') {
full_path = os.join_path(app.repo.repos_dir, repo, arch, filename)
if db_exts.any(filename == '${repo_}${it}') {
full_path = os.join_path(app.repo.repos_dir, repo_, arch, filename)
// repo-add does this using symlinks, but we just change the requested
// path
@ -35,13 +35,13 @@ fn (mut app App) get_repo_file(repo string, arch string, filename string) web.Re
full_path += '.tar.gz'
}
} else if filename.contains('.pkg') {
full_path = os.join_path(app.repo.pkg_dir, repo, arch, filename)
full_path = os.join_path(app.repo.pkg_dir, repo_, arch, filename)
}
// Default behavior is to return the desc file for the package, if present.
// This can then also be used by the build system to properly check whether
// a package is present in an arch-repo.
else {
full_path = os.join_path(app.repo.repos_dir, repo, arch, filename, 'desc')
full_path = os.join_path(app.repo.repos_dir, repo_, arch, filename, 'desc')
}
return app.file(full_path)
@ -49,10 +49,10 @@ fn (mut app App) get_repo_file(repo string, arch string, filename string) web.Re
// put_package handles publishing a package to a repository.
['/:repo/publish'; auth; markused; post]
fn (mut app App) put_package(repo string) web.Result {
fn (mut app App) put_package(repo_ string) web.Result {
// api is a reserved keyword for api routes & should never be allowed to be
// a repository.
if repo.to_lower() == 'api' {
if repo_.to_lower() == 'api' {
return app.json(.bad_request, new_response("'api' is a reserved keyword & cannot be used as a repository name."))
}
@ -82,7 +82,7 @@ fn (mut app App) put_package(repo string) web.Result {
return app.status(.length_required)
}
res := app.repo.add_pkg_from_path(repo, pkg_path) or {
res := app.repo.add_pkg_from_path(repo_, pkg_path) or {
app.lerror('Error while adding package: ${err.msg()}')
os.rm(pkg_path) or { app.lerror("Failed to remove download '${pkg_path}': ${err.msg()}") }
@ -90,7 +90,7 @@ fn (mut app App) put_package(repo string) web.Result {
return app.status(.internal_server_error)
}
app.linfo("Added '${res.name}-${res.version}' to '${repo} (${res.archs.join(',')})'.")
app.linfo("Added '${res.name}-${res.version}' to '${repo_} (${res.archs.join(',')})'.")
return app.json(.ok, new_data_response(res))
}

View File

@ -44,7 +44,7 @@ pub mut:
// Files from multipart-form.
files map[string][]http.FileData
// Allows reading the request body
reader io.BufferedReader
reader &io.BufferedReader = unsafe { nil }
// RESPONSE
status http.Status = http.Status.ok
content_type string = 'text/plain'