Compare commits

..

10 Commits

6 changed files with 3 additions and 19 deletions

View File

@ -10,9 +10,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed
* Switched from compiler fork to fully vanilla compiler mirror
* `download_dir`, `repos_file` & `repos_dir` config values have been replaced
with `data_dir`
* Storage of metadata (e.g. Git repositories) is now done using Sqlite
### Added

View File

@ -8,7 +8,7 @@ pub:
log_level string = 'WARN'
api_key string
address string
data_dir string
data_dir string
base_image string = 'archlinux:base-devel'
max_concurrent_builds int = 1
api_update_frequency int = 15

View File

@ -77,10 +77,7 @@ fn (mut d Daemon) run_build(build_index int, sb ScheduledBuild) {
// 0 means success, 1 means failure
mut status := 0
build.build_repo(d.address, d.api_key, d.builder_images.last(), &sb.repo) or {
d.ldebug('build_repo error: $err.msg()')
status = 1
}
build.build_repo(d.address, d.api_key, d.builder_images.last(), &sb.repo) or { status = 1 }
if status == 0 {
d.linfo('finished build: $sb.repo.url $sb.repo.branch')

View File

@ -6,7 +6,6 @@ struct VieterDb {
conn sqlite.DB
}
// init initializes a database & adds the correct tables.
pub fn init(db_path string) ?VieterDb {
conn := sqlite.connect(db_path) ?

View File

@ -7,7 +7,6 @@ pub:
value string [nonull]
}
// str returns a string representation.
pub fn (gra &GitRepoArch) str() string {
return gra.value
}
@ -28,7 +27,6 @@ pub mut:
arch []GitRepoArch [fkey: 'repo_id']
}
// str returns a string representation.
pub fn (gr &GitRepo) str() string {
mut parts := [
'id: $gr.id',
@ -59,7 +57,7 @@ pub fn (mut r GitRepo) patch_from_params(params map[string]string) {
}
}
// git_repo_from_params creates a GitRepo from a map[string]string, usually
// repo_from_params creates a GitRepo from a map[string]string, usually
// provided from a web.App's params
pub fn git_repo_from_params(params map[string]string) ?GitRepo {
mut repo := GitRepo{}
@ -76,7 +74,6 @@ pub fn git_repo_from_params(params map[string]string) ?GitRepo {
return repo
}
// get_git_repos returns all GitRepo's in the database.
pub fn (db &VieterDb) get_git_repos() []GitRepo {
res := sql db.conn {
select from GitRepo order by id
@ -85,7 +82,6 @@ pub fn (db &VieterDb) get_git_repos() []GitRepo {
return res
}
// get_git_repo tries to return a specific GitRepo.
pub fn (db &VieterDb) get_git_repo(repo_id int) ?GitRepo {
res := sql db.conn {
select from GitRepo where id == repo_id
@ -101,14 +97,12 @@ pub fn (db &VieterDb) get_git_repo(repo_id int) ?GitRepo {
return res
}
// add_git_repo inserts the given GitRepo into the database.
pub fn (db &VieterDb) add_git_repo(repo GitRepo) {
sql db.conn {
insert repo into GitRepo
}
}
// delete_git_repo deletes the repo with the given ID from the database.
pub fn (db &VieterDb) delete_git_repo(repo_id int) {
sql db.conn {
delete from GitRepo where id == repo_id
@ -116,7 +110,6 @@ pub fn (db &VieterDb) delete_git_repo(repo_id int) {
}
}
// update_git_repo updates any non-array values for a given GitRepo.
pub fn (db &VieterDb) update_git_repo(repo_id int, params map[string]string) {
// sql db.conn {
// update GitRepo set repo
@ -137,7 +130,6 @@ pub fn (db &VieterDb) update_git_repo(repo_id int, params map[string]string) {
db.conn.exec_none(query)
}
// update_git_repo_archs updates a given GitRepo's arch value.
pub fn (db &VieterDb) update_git_repo_archs(repo_id int, archs []GitRepoArch) {
archs_with_id := archs.map(GitRepoArch{
...it

View File

@ -34,7 +34,6 @@ pub fn get_repos(address string, api_key string) ?[]db.GitRepo {
return data.data
}
// get_repo returns the repo for a specific ID.
pub fn get_repo(address string, api_key string, id int) ?db.GitRepo {
data := send_request<db.GitRepo>(http.Method.get, address, '/api/repos/$id', api_key,
{}) ?