From 138386682d341bbc3d546665388bf7865f58ea72 Mon Sep 17 00:00:00 2001 From: Jef Roosens Date: Sun, 20 Feb 2022 21:19:31 +0100 Subject: [PATCH] Repos are now read from a json file --- src/build.v | 17 ++++++++--------- src/git.v | 7 +++++++ 2 files changed, 15 insertions(+), 9 deletions(-) create mode 100644 src/git.v diff --git a/src/build.v b/src/build.v index d664c8e..49ec48f 100644 --- a/src/build.v +++ b/src/build.v @@ -5,20 +5,19 @@ import encoding.base64 import rand import time import os +import json +import git const container_build_dir = '/build' -struct GitRepo { - url string [required] - branch string [required] -} - fn build(key string, repo_dir string) ? { server_url := os.getenv_opt('VIETER_ADDRESS') or { exit_with_message(1, 'No Vieter server address was provided.') } - repos := [ - GitRepo{'https://git.rustybever.be/Chewing_Bever/st', 'master'} - GitRepo{'https://aur.archlinux.org/libxft-bgra.git', 'master'} - ] + + // Read in the repos from a json file + filename := os.join_path_single(repo_dir, 'repos.json') + txt := os.read_file(filename) ? + repos := json.decode([]git.GitRepo, txt) ? + mut commands := [ // Update repos & install required packages 'pacman -Syu --needed --noconfirm base-devel git' diff --git a/src/git.v b/src/git.v new file mode 100644 index 0000000..097e2e5 --- /dev/null +++ b/src/git.v @@ -0,0 +1,7 @@ +module git + +pub struct GitRepo { +pub: + url string [required] + branch string [required] +}