From 847a57740b0838bfb1459c579b92e359376e6160 Mon Sep 17 00:00:00 2001 From: Wolfgang Bumiller Date: Thu, 11 Jul 2024 10:14:28 +0200 Subject: [PATCH] new worker-task crate, move WorkerTaskContext from sys Signed-off-by: Wolfgang Bumiller --- Cargo.toml | 2 ++ proxmox-rest-server/Cargo.toml | 1 + proxmox-rest-server/src/worker_task.rs | 3 +-- proxmox-sys/src/lib.rs | 3 --- proxmox-worker-task/Cargo.toml | 13 +++++++++++++ proxmox-worker-task/debian/changelog | 5 +++++ proxmox-worker-task/debian/control | 0 proxmox-worker-task/debian/copyright | 18 ++++++++++++++++++ proxmox-worker-task/debian/debcargo.toml | 7 +++++++ .../src/lib.rs | 0 10 files changed, 47 insertions(+), 5 deletions(-) create mode 100644 proxmox-worker-task/Cargo.toml create mode 100644 proxmox-worker-task/debian/changelog create mode 100644 proxmox-worker-task/debian/control create mode 100644 proxmox-worker-task/debian/copyright create mode 100644 proxmox-worker-task/debian/debcargo.toml rename proxmox-sys/src/worker_task_context.rs => proxmox-worker-task/src/lib.rs (100%) diff --git a/Cargo.toml b/Cargo.toml index e16fe0c0..434a2b76 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -42,6 +42,7 @@ members = [ "proxmox-time", "proxmox-time-api", "proxmox-uuid", + "proxmox-worker-task", ] exclude = [ "build", @@ -141,3 +142,4 @@ proxmox-sys = { version = "0.5.7", path = "proxmox-sys" } proxmox-tfa = { version = "5.0.0", path = "proxmox-tfa" } proxmox-time = { version = "2.0.0", path = "proxmox-time" } proxmox-uuid = { version = "1.0.1", path = "proxmox-uuid" } +proxmox-worker-task = { version = "1.0.0", path = "proxmox-worker-task" } diff --git a/proxmox-rest-server/Cargo.toml b/proxmox-rest-server/Cargo.toml index 69bc6725..6c344874 100644 --- a/proxmox-rest-server/Cargo.toml +++ b/proxmox-rest-server/Cargo.toml @@ -46,6 +46,7 @@ proxmox-router.workspace = true proxmox-schema = { workspace = true, features = [ "api-macro", "upid-api-impl" ] } proxmox-sys = { workspace = true, features = [ "logrotate", "timer" ] } proxmox-time.workspace = true +proxmox-worker-task.workspace = true [features] default = [] diff --git a/proxmox-rest-server/src/worker_task.rs b/proxmox-rest-server/src/worker_task.rs index 4cd3a53d..fdb17dd1 100644 --- a/proxmox-rest-server/src/worker_task.rs +++ b/proxmox-rest-server/src/worker_task.rs @@ -24,9 +24,8 @@ use proxmox_log::{FileLogOptions, FileLogger, LOGGER, WARN_COUNTER}; use proxmox_schema::upid::UPID; use proxmox_sys::fs::{atomic_open_or_create_file, create_path, replace_file, CreateOptions}; use proxmox_sys::linux::procfs; - use proxmox_sys::logrotate::{LogRotate, LogRotateFiles}; -use proxmox_sys::WorkerTaskContext; +use proxmox_worker_task::WorkerTaskContext; use crate::CommandSocket; diff --git a/proxmox-sys/src/lib.rs b/proxmox-sys/src/lib.rs index 28e5d22c..a16b46e3 100644 --- a/proxmox-sys/src/lib.rs +++ b/proxmox-sys/src/lib.rs @@ -18,9 +18,6 @@ pub mod mmap; pub mod process_locker; pub mod systemd; -mod worker_task_context; -pub use worker_task_context::*; - /// Returns the hosts node name (UTS node name) pub fn nodename() -> &'static str { lazy_static::lazy_static! { diff --git a/proxmox-worker-task/Cargo.toml b/proxmox-worker-task/Cargo.toml new file mode 100644 index 00000000..960e797c --- /dev/null +++ b/proxmox-worker-task/Cargo.toml @@ -0,0 +1,13 @@ +[package] +name = "proxmox-worker-task" +version = "1.0.0" +authors.workspace = true +edition.workspace = true +license.workspace = true +repository.workspace = true +description = "Worker task functionality" + +exclude.workspace = true + +[dependencies] +anyhow.workspace = true diff --git a/proxmox-worker-task/debian/changelog b/proxmox-worker-task/debian/changelog new file mode 100644 index 00000000..71dfc060 --- /dev/null +++ b/proxmox-worker-task/debian/changelog @@ -0,0 +1,5 @@ +rust-proxmox-worker-task (0.1.0-1) bookworm; urgency=medium + + * Initial release + + -- Proxmox Support Team Thu, 11 Jul 2024 13:03:45 +0200 diff --git a/proxmox-worker-task/debian/control b/proxmox-worker-task/debian/control new file mode 100644 index 00000000..e69de29b diff --git a/proxmox-worker-task/debian/copyright b/proxmox-worker-task/debian/copyright new file mode 100644 index 00000000..b227c290 --- /dev/null +++ b/proxmox-worker-task/debian/copyright @@ -0,0 +1,18 @@ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ + +Files: + * +Copyright: 2019 - 2024 Proxmox Server Solutions GmbH +License: AGPL-3.0-or-later + This program is free software: you can redistribute it and/or modify it under + the terms of the GNU Affero General Public License as published by the Free + Software Foundation, either version 3 of the License, or (at your option) any + later version. + . + This program is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more + details. + . + You should have received a copy of the GNU Affero General Public License along + with this program. If not, see . diff --git a/proxmox-worker-task/debian/debcargo.toml b/proxmox-worker-task/debian/debcargo.toml new file mode 100644 index 00000000..b7864cdb --- /dev/null +++ b/proxmox-worker-task/debian/debcargo.toml @@ -0,0 +1,7 @@ +overlay = "." +crate_src_path = ".." +maintainer = "Proxmox Support Team " + +[source] +vcs_git = "git://git.proxmox.com/git/proxmox.git" +vcs_browser = "https://git.proxmox.com/?p=proxmox.git" diff --git a/proxmox-sys/src/worker_task_context.rs b/proxmox-worker-task/src/lib.rs similarity index 100% rename from proxmox-sys/src/worker_task_context.rs rename to proxmox-worker-task/src/lib.rs