From 9d1261b74d2ddaa442d33b4a90b4b2c745f195f5 Mon Sep 17 00:00:00 2001 From: 2ndbeam <2ndbeam@disroot.org> Date: Fri, 19 Dec 2025 16:22:02 +0300 Subject: [PATCH] build: Preparing stuff to create debian package - Added deb binary target to generate incomplete control file - Added CLI init option to insert impl_path in config --- Cargo.toml | 2 ++ cli/src/cli/mod.rs | 2 ++ cli/src/main.rs | 1 + src/bin/deb.rs | 24 ++++++++++++++++++++++++ 4 files changed, 29 insertions(+) create mode 100644 src/bin/deb.rs diff --git a/Cargo.toml b/Cargo.toml index 5f06182..e55b3ab 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,6 +5,7 @@ members = ["cli", "discord"] version = "0.10.0" edition = "2024" repository = "https://2ndbeam.ru/git/2ndbeam/squad-quest" +homepage = "https://2ndbeam.ru/git/2ndbeam/squad-quest" license = "MIT" [package] @@ -13,6 +14,7 @@ edition.workspace = true version.workspace = true repository.workspace = true license.workspace = true +homepage.workspace = true [dependencies] serde = { version = "1.0.228", features = ["derive"] } diff --git a/cli/src/cli/mod.rs b/cli/src/cli/mod.rs index db78d60..5ff05fa 100644 --- a/cli/src/cli/mod.rs +++ b/cli/src/cli/mod.rs @@ -40,4 +40,6 @@ pub enum Objects { pub struct InitArgs { #[arg(long,short)] pub path: Option, + #[arg(long,short)] + pub implpath: Option, } diff --git a/cli/src/main.rs b/cli/src/main.rs index d120a9d..c1c75d5 100644 --- a/cli/src/main.rs +++ b/cli/src/main.rs @@ -71,6 +71,7 @@ fn main() { let config = Config { path: path.clone(), + impl_path: args.implpath.clone(), ..Default::default() }; diff --git a/src/bin/deb.rs b/src/bin/deb.rs new file mode 100644 index 0000000..b4938d7 --- /dev/null +++ b/src/bin/deb.rs @@ -0,0 +1,24 @@ +//! This binary generates DEBIAN/control text for use in debian package +use std::process::Command; + +fn main() { + let version = env!("CARGO_PKG_VERSION"); + let homepage = env!("CARGO_PKG_HOMEPAGE"); + let dpkg_arch = { + let output = match Command::new("dpkg") + .arg("--print-architecture") + .output() { + Ok(out) => out, + Err(error) => panic!("error running dpkg: {error}"), + }; + String::from_utf8(output.stdout).expect("dpkg returned ill UTF-8") + }; + println!("Package: squad-quest\n\ + Version: {version}-1\n\ + Architecture: {dpkg_arch}\ + Section: misc\n\ + Priority: optional\n\ + Homepage: {homepage}\n\ + Description: Simple RPG-like system for hosting events\n\ + Maintainer: Alexey Mirenkov <2ndbeam@disroot.org>"); +}