From 6074f6cab854bbbf3ff01354368b782d0941bbd2 Mon Sep 17 00:00:00 2001 From: Michal Date: Sat, 23 Jul 2022 00:40:38 +0100 Subject: [PATCH] reworked examples --- .gitignore | 6 ++++-- examples/repository/mlc.toml | 24 ++++++++++++++++++++++++ {example => examples/workspace}/mlc.toml | 0 src/internal/exit_codes.rs | 1 + src/repository/repo.rs | 8 ++++++++ 5 files changed, 37 insertions(+), 2 deletions(-) create mode 100644 examples/repository/mlc.toml rename {example => examples/workspace}/mlc.toml (100%) diff --git a/.gitignore b/.gitignore index a810b72..6d5293e 100755 --- a/.gitignore +++ b/.gitignore @@ -2,5 +2,7 @@ .idea .direnv -example*/* -!example*/mlc.toml \ No newline at end of file +examples/workspace/* +examples/repository/* +!examples/workspace/mlc.toml +!examples/repository/mlc.toml \ No newline at end of file diff --git a/examples/repository/mlc.toml b/examples/repository/mlc.toml new file mode 100644 index 0000000..3e995b2 --- /dev/null +++ b/examples/repository/mlc.toml @@ -0,0 +1,24 @@ +[base] +mode = "repository" +smart_pull = true + +[mode.repository] +name = "repository-test" +build_on_update = true + +[mode.repository.signing] +enabled = true +key = "michal@tar.black" +on_gen = true + +[mode.workspace] + +[repositories] +name = [ + "1::crystal-keyring", + "2::pfetch!", +] +urls = [ + "https://github.com/crystal-linux/%repo%", + "https://github.com/crystal-linux/pkgbuild.%repo%", +] \ No newline at end of file diff --git a/example/mlc.toml b/examples/workspace/mlc.toml similarity index 100% rename from example/mlc.toml rename to examples/workspace/mlc.toml diff --git a/src/internal/exit_codes.rs b/src/internal/exit_codes.rs index 9ff032c..7ed8aff 100644 --- a/src/internal/exit_codes.rs +++ b/src/internal/exit_codes.rs @@ -9,4 +9,5 @@ pub enum AppExitCode { NoPkgs = 8, ConfigParseError = 9, NoPackagesFound = 10, + InvalidRepo = 11, } diff --git a/src/repository/repo.rs b/src/repository/repo.rs index 01d0018..6ff7530 100644 --- a/src/repository/repo.rs +++ b/src/repository/repo.rs @@ -81,6 +81,14 @@ pub fn generate(verbose: bool) { .wait() .unwrap(); + // This should never happen, crash and burn if it does + if zst.success() && xz.success() { + crash!( + AppExitCode::InvalidRepo, + "Both .tar.zst and .tar.xz files found in repository. You've done something wrong. Aborting" + ); + } + // Ensuring aarch64/ALARM support for the future let aarch64_mode = if zst.success() { false