forked from vieter-v/vieter
chore: stop shadowing import names with variables
parent
bff817ccd9
commit
4dc82515f4
|
@ -23,9 +23,9 @@ pub fn cmd() cli.Command {
|
||||||
description: 'Start an agent daemon.'
|
description: 'Start an agent daemon.'
|
||||||
execute: fn (cmd cli.Command) ! {
|
execute: fn (cmd cli.Command) ! {
|
||||||
config_file := cmd.flags.get_string('config-file')!
|
config_file := cmd.flags.get_string('config-file')!
|
||||||
conf := vconf.load[Config](prefix: 'VIETER_', default_path: config_file)!
|
conf_ := vconf.load[Config](prefix: 'VIETER_', default_path: config_file)!
|
||||||
|
|
||||||
agent(conf)!
|
agent(conf_)!
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,12 +36,12 @@ pub fn cmd() cli.Command {
|
||||||
required_args: 2
|
required_args: 2
|
||||||
execute: fn (cmd cli.Command) ! {
|
execute: fn (cmd cli.Command) ! {
|
||||||
config_file := cmd.flags.get_string('config-file')!
|
config_file := cmd.flags.get_string('config-file')!
|
||||||
conf := vconf.load[Config](prefix: 'VIETER_', default_path: config_file)!
|
conf_ := vconf.load[Config](prefix: 'VIETER_', default_path: config_file)!
|
||||||
|
|
||||||
c := aur.new()
|
c := aur.new()
|
||||||
pkgs := c.info(cmd.args[1..])!
|
pkgs := c.info(cmd.args[1..])!
|
||||||
|
|
||||||
vc := client.new(conf.address, conf.api_key)
|
vc := client.new(conf_.address, conf_.api_key)
|
||||||
|
|
||||||
for pkg in pkgs {
|
for pkg in pkgs {
|
||||||
vc.add_target(
|
vc.add_target(
|
||||||
|
|
|
@ -74,7 +74,7 @@ pub fn cmd() cli.Command {
|
||||||
]
|
]
|
||||||
execute: fn (cmd cli.Command) ! {
|
execute: fn (cmd cli.Command) ! {
|
||||||
config_file := cmd.flags.get_string('config-file')!
|
config_file := cmd.flags.get_string('config-file')!
|
||||||
conf := vconf.load[Config](prefix: 'VIETER_', default_path: config_file)!
|
conf_ := vconf.load[Config](prefix: 'VIETER_', default_path: config_file)!
|
||||||
|
|
||||||
mut filter := BuildLogFilter{}
|
mut filter := BuildLogFilter{}
|
||||||
|
|
||||||
|
@ -146,7 +146,7 @@ pub fn cmd() cli.Command {
|
||||||
|
|
||||||
raw := cmd.flags.get_bool('raw')!
|
raw := cmd.flags.get_bool('raw')!
|
||||||
|
|
||||||
list(conf, filter, raw)!
|
list(conf_, filter, raw)!
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
cli.Command{
|
cli.Command{
|
||||||
|
@ -156,9 +156,9 @@ pub fn cmd() cli.Command {
|
||||||
description: 'Remove a build log that matches the given id.'
|
description: 'Remove a build log that matches the given id.'
|
||||||
execute: fn (cmd cli.Command) ! {
|
execute: fn (cmd cli.Command) ! {
|
||||||
config_file := cmd.flags.get_string('config-file')!
|
config_file := cmd.flags.get_string('config-file')!
|
||||||
conf := vconf.load[Config](prefix: 'VIETER_', default_path: config_file)!
|
conf_ := vconf.load[Config](prefix: 'VIETER_', default_path: config_file)!
|
||||||
|
|
||||||
remove(conf, cmd.args[0])!
|
remove(conf_, cmd.args[0])!
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
cli.Command{
|
cli.Command{
|
||||||
|
@ -168,10 +168,10 @@ pub fn cmd() cli.Command {
|
||||||
description: 'Show all info for a specific build log.'
|
description: 'Show all info for a specific build log.'
|
||||||
execute: fn (cmd cli.Command) ! {
|
execute: fn (cmd cli.Command) ! {
|
||||||
config_file := cmd.flags.get_string('config-file')!
|
config_file := cmd.flags.get_string('config-file')!
|
||||||
conf := vconf.load[Config](prefix: 'VIETER_', default_path: config_file)!
|
conf_ := vconf.load[Config](prefix: 'VIETER_', default_path: config_file)!
|
||||||
|
|
||||||
id := cmd.args[0].int()
|
id := cmd.args[0].int()
|
||||||
info(conf, id)!
|
info(conf_, id)!
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
cli.Command{
|
cli.Command{
|
||||||
|
@ -181,10 +181,10 @@ pub fn cmd() cli.Command {
|
||||||
description: 'Output the content of a build log to stdout.'
|
description: 'Output the content of a build log to stdout.'
|
||||||
execute: fn (cmd cli.Command) ! {
|
execute: fn (cmd cli.Command) ! {
|
||||||
config_file := cmd.flags.get_string('config-file')!
|
config_file := cmd.flags.get_string('config-file')!
|
||||||
conf := vconf.load[Config](prefix: 'VIETER_', default_path: config_file)!
|
conf_ := vconf.load[Config](prefix: 'VIETER_', default_path: config_file)!
|
||||||
|
|
||||||
id := cmd.args[0].int()
|
id := cmd.args[0].int()
|
||||||
content(conf, id)!
|
content(conf_, id)!
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
@ -204,16 +204,16 @@ fn print_log_list(logs []BuildLog, raw bool) ! {
|
||||||
}
|
}
|
||||||
|
|
||||||
// list prints a list of all build logs.
|
// list prints a list of all build logs.
|
||||||
fn list(conf Config, filter BuildLogFilter, raw bool) ! {
|
fn list(conf_ Config, filter BuildLogFilter, raw bool) ! {
|
||||||
c := client.new(conf.address, conf.api_key)
|
c := client.new(conf_.address, conf_.api_key)
|
||||||
logs := c.get_build_logs(filter)!
|
logs := c.get_build_logs(filter)!
|
||||||
|
|
||||||
print_log_list(logs, raw)!
|
print_log_list(logs, raw)!
|
||||||
}
|
}
|
||||||
|
|
||||||
// info print the detailed info for a given build log.
|
// info print the detailed info for a given build log.
|
||||||
fn info(conf Config, id int) ! {
|
fn info(conf_ Config, id int) ! {
|
||||||
c := client.new(conf.address, conf.api_key)
|
c := client.new(conf_.address, conf_.api_key)
|
||||||
log := c.get_build_log(id)!
|
log := c.get_build_log(id)!
|
||||||
|
|
||||||
print(log)
|
print(log)
|
||||||
|
@ -221,15 +221,15 @@ fn info(conf Config, id int) ! {
|
||||||
|
|
||||||
// content outputs the contents of the log file for a given build log to
|
// content outputs the contents of the log file for a given build log to
|
||||||
// stdout.
|
// stdout.
|
||||||
fn content(conf Config, id int) ! {
|
fn content(conf_ Config, id int) ! {
|
||||||
c := client.new(conf.address, conf.api_key)
|
c := client.new(conf_.address, conf_.api_key)
|
||||||
content := c.get_build_log_content(id)!
|
content := c.get_build_log_content(id)!
|
||||||
|
|
||||||
println(content)
|
println(content)
|
||||||
}
|
}
|
||||||
|
|
||||||
// remove removes a build log from the server's list.
|
// remove removes a build log from the server's list.
|
||||||
fn remove(conf Config, id string) ! {
|
fn remove(conf_ Config, id string) ! {
|
||||||
c := client.new(conf.address, conf.api_key)
|
c := client.new(conf_.address, conf_.api_key)
|
||||||
c.remove_build_log(id.int())!
|
c.remove_build_log(id.int())!
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@ pub fn cmd() cli.Command {
|
||||||
]
|
]
|
||||||
execute: fn (cmd cli.Command) ! {
|
execute: fn (cmd cli.Command) ! {
|
||||||
config_file := cmd.flags.get_string('config-file')!
|
config_file := cmd.flags.get_string('config-file')!
|
||||||
conf := vconf.load[Config](prefix: 'VIETER_', default_path: config_file)!
|
conf_ := vconf.load[Config](prefix: 'VIETER_', default_path: config_file)!
|
||||||
|
|
||||||
if cmd.args.len < 3 {
|
if cmd.args.len < 3 {
|
||||||
if !cmd.flags.get_bool('force')! {
|
if !cmd.flags.get_bool('force')! {
|
||||||
|
@ -36,14 +36,14 @@ pub fn cmd() cli.Command {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
client := client.new(conf.address, conf.api_key)
|
client_ := client.new(conf_.address, conf_.api_key)
|
||||||
|
|
||||||
if cmd.args.len == 1 {
|
if cmd.args.len == 1 {
|
||||||
client.remove_repo(cmd.args[0])!
|
client_.remove_repo(cmd.args[0])!
|
||||||
} else if cmd.args.len == 2 {
|
} else if cmd.args.len == 2 {
|
||||||
client.remove_arch_repo(cmd.args[0], cmd.args[1])!
|
client_.remove_arch_repo(cmd.args[0], cmd.args[1])!
|
||||||
} else {
|
} else {
|
||||||
client.remove_package(cmd.args[0], cmd.args[1], cmd.args[2])!
|
client_.remove_package(cmd.args[0], cmd.args[1], cmd.args[2])!
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -54,7 +54,7 @@ pub fn cmd() cli.Command {
|
||||||
]
|
]
|
||||||
execute: fn (cmd cli.Command) ! {
|
execute: fn (cmd cli.Command) ! {
|
||||||
config_file := cmd.flags.get_string('config-file')!
|
config_file := cmd.flags.get_string('config-file')!
|
||||||
conf := vconf.load[Config](prefix: 'VIETER_', default_path: config_file)!
|
conf_ := vconf.load[Config](prefix: 'VIETER_', default_path: config_file)!
|
||||||
|
|
||||||
mut filter := TargetFilter{}
|
mut filter := TargetFilter{}
|
||||||
|
|
||||||
|
@ -85,7 +85,7 @@ pub fn cmd() cli.Command {
|
||||||
|
|
||||||
raw := cmd.flags.get_bool('raw')!
|
raw := cmd.flags.get_bool('raw')!
|
||||||
|
|
||||||
list(conf, filter, raw)!
|
list(conf_, filter, raw)!
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
cli.Command{
|
cli.Command{
|
||||||
|
@ -113,7 +113,7 @@ pub fn cmd() cli.Command {
|
||||||
]
|
]
|
||||||
execute: fn (cmd cli.Command) ! {
|
execute: fn (cmd cli.Command) ! {
|
||||||
config_file := cmd.flags.get_string('config-file')!
|
config_file := cmd.flags.get_string('config-file')!
|
||||||
conf := vconf.load[Config](prefix: 'VIETER_', default_path: config_file)!
|
conf_ := vconf.load[Config](prefix: 'VIETER_', default_path: config_file)!
|
||||||
|
|
||||||
t := NewTarget{
|
t := NewTarget{
|
||||||
kind: cmd.flags.get_string('kind')!
|
kind: cmd.flags.get_string('kind')!
|
||||||
|
@ -125,7 +125,7 @@ pub fn cmd() cli.Command {
|
||||||
|
|
||||||
raw := cmd.flags.get_bool('raw')!
|
raw := cmd.flags.get_bool('raw')!
|
||||||
|
|
||||||
add(conf, t, raw)!
|
add(conf_, t, raw)!
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
cli.Command{
|
cli.Command{
|
||||||
|
@ -135,9 +135,9 @@ pub fn cmd() cli.Command {
|
||||||
description: 'Remove a target that matches the given id.'
|
description: 'Remove a target that matches the given id.'
|
||||||
execute: fn (cmd cli.Command) ! {
|
execute: fn (cmd cli.Command) ! {
|
||||||
config_file := cmd.flags.get_string('config-file')!
|
config_file := cmd.flags.get_string('config-file')!
|
||||||
conf := vconf.load[Config](prefix: 'VIETER_', default_path: config_file)!
|
conf_ := vconf.load[Config](prefix: 'VIETER_', default_path: config_file)!
|
||||||
|
|
||||||
remove(conf, cmd.args[0])!
|
remove(conf_, cmd.args[0])!
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
cli.Command{
|
cli.Command{
|
||||||
|
@ -147,9 +147,9 @@ pub fn cmd() cli.Command {
|
||||||
description: 'Show detailed information for the target matching the id.'
|
description: 'Show detailed information for the target matching the id.'
|
||||||
execute: fn (cmd cli.Command) ! {
|
execute: fn (cmd cli.Command) ! {
|
||||||
config_file := cmd.flags.get_string('config-file')!
|
config_file := cmd.flags.get_string('config-file')!
|
||||||
conf := vconf.load[Config](prefix: 'VIETER_', default_path: config_file)!
|
conf_ := vconf.load[Config](prefix: 'VIETER_', default_path: config_file)!
|
||||||
|
|
||||||
info(conf, cmd.args[0])!
|
info(conf_, cmd.args[0])!
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
cli.Command{
|
cli.Command{
|
||||||
|
@ -196,7 +196,7 @@ pub fn cmd() cli.Command {
|
||||||
]
|
]
|
||||||
execute: fn (cmd cli.Command) ! {
|
execute: fn (cmd cli.Command) ! {
|
||||||
config_file := cmd.flags.get_string('config-file')!
|
config_file := cmd.flags.get_string('config-file')!
|
||||||
conf := vconf.load[Config](prefix: 'VIETER_', default_path: config_file)!
|
conf_ := vconf.load[Config](prefix: 'VIETER_', default_path: config_file)!
|
||||||
|
|
||||||
found := cmd.flags.get_all_found()
|
found := cmd.flags.get_all_found()
|
||||||
|
|
||||||
|
@ -208,7 +208,7 @@ pub fn cmd() cli.Command {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
patch(conf, cmd.args[0], params)!
|
patch(conf_, cmd.args[0], params)!
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
cli.Command{
|
cli.Command{
|
||||||
|
@ -235,7 +235,7 @@ pub fn cmd() cli.Command {
|
||||||
]
|
]
|
||||||
execute: fn (cmd cli.Command) ! {
|
execute: fn (cmd cli.Command) ! {
|
||||||
config_file := cmd.flags.get_string('config-file')!
|
config_file := cmd.flags.get_string('config-file')!
|
||||||
conf := vconf.load[Config](prefix: 'VIETER_', default_path: config_file)!
|
conf_ := vconf.load[Config](prefix: 'VIETER_', default_path: config_file)!
|
||||||
|
|
||||||
remote := cmd.flags.get_bool('remote')!
|
remote := cmd.flags.get_bool('remote')!
|
||||||
force := cmd.flags.get_bool('force')!
|
force := cmd.flags.get_bool('force')!
|
||||||
|
@ -248,10 +248,10 @@ pub fn cmd() cli.Command {
|
||||||
return error('When scheduling the build remotely, you have to specify an architecture.')
|
return error('When scheduling the build remotely, you have to specify an architecture.')
|
||||||
}
|
}
|
||||||
|
|
||||||
c := client.new(conf.address, conf.api_key)
|
c := client.new(conf_.address, conf_.api_key)
|
||||||
c.queue_job(target_id, arch, force)!
|
c.queue_job(target_id, arch, force)!
|
||||||
} else {
|
} else {
|
||||||
build(conf, target_id, force)!
|
build(conf_, target_id, force)!
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -260,8 +260,8 @@ pub fn cmd() cli.Command {
|
||||||
}
|
}
|
||||||
|
|
||||||
// list prints out a list of all repositories.
|
// list prints out a list of all repositories.
|
||||||
fn list(conf Config, filter TargetFilter, raw bool) ! {
|
fn list(conf_ Config, filter TargetFilter, raw bool) ! {
|
||||||
c := client.new(conf.address, conf.api_key)
|
c := client.new(conf_.address, conf_.api_key)
|
||||||
targets := c.get_targets(filter)!
|
targets := c.get_targets(filter)!
|
||||||
data := targets.map([it.id.str(), it.kind, it.url, it.repo])
|
data := targets.map([it.id.str(), it.kind, it.url, it.repo])
|
||||||
|
|
||||||
|
@ -273,8 +273,8 @@ fn list(conf Config, filter TargetFilter, raw bool) ! {
|
||||||
}
|
}
|
||||||
|
|
||||||
// add adds a new target to the server's list.
|
// add adds a new target to the server's list.
|
||||||
fn add(conf Config, t &NewTarget, raw bool) ! {
|
fn add(conf_ Config, t &NewTarget, raw bool) ! {
|
||||||
c := client.new(conf.address, conf.api_key)
|
c := client.new(conf_.address, conf_.api_key)
|
||||||
target_id := c.add_target(t)!
|
target_id := c.add_target(t)!
|
||||||
|
|
||||||
if raw {
|
if raw {
|
||||||
|
@ -285,13 +285,13 @@ fn add(conf Config, t &NewTarget, raw bool) ! {
|
||||||
}
|
}
|
||||||
|
|
||||||
// remove removes a target from the server's list.
|
// remove removes a target from the server's list.
|
||||||
fn remove(conf Config, id string) ! {
|
fn remove(conf_ Config, id string) ! {
|
||||||
c := client.new(conf.address, conf.api_key)
|
c := client.new(conf_.address, conf_.api_key)
|
||||||
c.remove_target(id.int())!
|
c.remove_target(id.int())!
|
||||||
}
|
}
|
||||||
|
|
||||||
// patch patches a given target with the provided params.
|
// patch patches a given target with the provided params.
|
||||||
fn patch(conf Config, id string, params map[string]string) ! {
|
fn patch(conf_ Config, id string, params map[string]string) ! {
|
||||||
// We check the cron expression first because it's useless to send an
|
// We check the cron expression first because it's useless to send an
|
||||||
// invalid one to the server.
|
// invalid one to the server.
|
||||||
if 'schedule' in params && params['schedule'] != '' {
|
if 'schedule' in params && params['schedule'] != '' {
|
||||||
|
@ -300,13 +300,13 @@ fn patch(conf Config, id string, params map[string]string) ! {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
c := client.new(conf.address, conf.api_key)
|
c := client.new(conf_.address, conf_.api_key)
|
||||||
c.patch_target(id.int(), params)!
|
c.patch_target(id.int(), params)!
|
||||||
}
|
}
|
||||||
|
|
||||||
// info shows detailed information for a given target.
|
// info shows detailed information for a given target.
|
||||||
fn info(conf Config, id string) ! {
|
fn info(conf_ Config, id string) ! {
|
||||||
c := client.new(conf.address, conf.api_key)
|
c := client.new(conf_.address, conf_.api_key)
|
||||||
target := c.get_target(id.int())!
|
target := c.get_target(id.int())!
|
||||||
println(target)
|
println(target)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
// With V 0.3.3, Vieter fails to compile without this fix, as provided by
|
|
||||||
// spytheman. It will get fixed in V itself, but this temporary fix allows me
|
|
||||||
// to stay on V 0.3.3.
|
|
||||||
[typedef]
|
|
||||||
pub struct C.SSL_CTX{}
|
|
|
@ -25,9 +25,9 @@ pub fn cmd() cli.Command {
|
||||||
description: 'Start the Vieter server.'
|
description: 'Start the Vieter server.'
|
||||||
execute: fn (cmd cli.Command) ! {
|
execute: fn (cmd cli.Command) ! {
|
||||||
config_file := cmd.flags.get_string('config-file')!
|
config_file := cmd.flags.get_string('config-file')!
|
||||||
conf := vconf.load[Config](prefix: 'VIETER_', default_path: config_file)!
|
conf_ := vconf.load[Config](prefix: 'VIETER_', default_path: config_file)!
|
||||||
|
|
||||||
server(conf)!
|
server(conf_)!
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -82,7 +82,7 @@ pub fn server(conf Config) ! {
|
||||||
|
|
||||||
repo_dir := os.join_path_single(conf.data_dir, server.repo_dir_name)
|
repo_dir := os.join_path_single(conf.data_dir, server.repo_dir_name)
|
||||||
// This also creates the directories if needed
|
// This also creates the directories if needed
|
||||||
repo := repo.new(repo_dir, conf.pkg_dir, conf.default_arch) or {
|
repo_ := repo.new(repo_dir, conf.pkg_dir, conf.default_arch) or {
|
||||||
logger.error(err.msg())
|
logger.error(err.msg())
|
||||||
exit(1)
|
exit(1)
|
||||||
}
|
}
|
||||||
|
@ -105,7 +105,7 @@ pub fn server(conf Config) ! {
|
||||||
logger: logger
|
logger: logger
|
||||||
api_key: conf.api_key
|
api_key: conf.api_key
|
||||||
conf: conf
|
conf: conf
|
||||||
repo: repo
|
repo: repo_
|
||||||
db: db
|
db: db
|
||||||
collector: collector
|
collector: collector
|
||||||
job_queue: build.new_job_queue(global_ce, conf.base_image)
|
job_queue: build.new_job_queue(global_ce, conf.base_image)
|
||||||
|
|
Loading…
Reference in New Issue