From 455f3b5f4118484b795f36ffa6be2e3c8b9a3017 Mon Sep 17 00:00:00 2001 From: Jef Roosens Date: Wed, 15 Feb 2023 20:07:07 +0100 Subject: [PATCH] fix: compile with selected V version --- src/console/targets/build.v | 2 +- src/console/targets/targets.v | 2 +- src/repo/remove.v | 4 ++-- src/server/repo.v | 18 +++++++++--------- src/web/web.v | 2 +- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/console/targets/build.v b/src/console/targets/build.v index b8cbe7f..a59e6a1 100644 --- a/src/console/targets/build.v +++ b/src/console/targets/build.v @@ -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)! diff --git a/src/console/targets/targets.v b/src/console/targets/targets.v index d1dfbe3..676fa0a 100644 --- a/src/console/targets/targets.v +++ b/src/console/targets/targets.v @@ -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)! } } }, diff --git a/src/repo/remove.v b/src/repo/remove.v index 63866a9..6d949c3 100644 --- a/src/repo/remove.v +++ b/src/repo/remove.v @@ -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)! } diff --git a/src/server/repo.v b/src/server/repo.v index 724d9d0..051a7c2 100644 --- a/src/server/repo.v +++ b/src/server/repo.v @@ -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)) } diff --git a/src/web/web.v b/src/web/web.v index 54801f7..5c612f3 100644 --- a/src/web/web.v +++ b/src/web/web.v @@ -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'