From: Wolfgang Bumiller <w.bumiller@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH perl-rs 3/5] perl-rs: add further apt api calls
Date: Tue, 9 Jul 2024 08:20:24 +0200 [thread overview]
Message-ID: <20240709062026.53271-3-w.bumiller@proxmox.com> (raw)
In-Reply-To: <20240709062026.53271-1-w.bumiller@proxmox.com>
From: Dietmar Maurer <dietmar@proxmox.com>
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
---
common/src/apt/repositories.rs | 49 +++++++++++++++++++++++++++++++++-
pmg-rs/Cargo.toml | 2 +-
pve-rs/Cargo.toml | 2 +-
pve-rs/src/lib.rs | 2 +-
4 files changed, 51 insertions(+), 4 deletions(-)
diff --git a/common/src/apt/repositories.rs b/common/src/apt/repositories.rs
index 61824d7..ccf4f33 100644
--- a/common/src/apt/repositories.rs
+++ b/common/src/apt/repositories.rs
@@ -4,7 +4,8 @@ pub mod export {
use anyhow::Error;
use proxmox_apt_api_types::{
- APTChangeRepositoryOptions, APTRepositoriesResult, APTRepositoryHandle,
+ APTChangeRepositoryOptions, APTGetChangelogOptions, APTRepositoriesResult,
+ APTRepositoryHandle, APTUpdateInfo, APTUpdateOptions,
};
use proxmox_config_digest::ConfigDigest;
@@ -39,4 +40,50 @@ pub mod export {
) -> Result<(), Error> {
proxmox_apt::change_repository(path, index, &options, digest)
}
+
+ /// Retrieve the changelog of the specified package.
+ #[export]
+ pub fn get_changelog(options: APTGetChangelogOptions) -> Result<String, Error> {
+ proxmox_apt::get_changelog(&options)
+ }
+
+ /// List available APT updates
+ ///
+ /// Automatically updates an expired package cache.
+ #[export]
+ pub fn list_available_apt_update(apt_state_file: &str) -> Result<Vec<APTUpdateInfo>, Error> {
+ proxmox_apt::list_available_apt_update(apt_state_file)
+ }
+
+ /// Update the APT database
+ ///
+ /// You should update the APT proxy configuration before running this.
+ #[export]
+ pub fn update_database(apt_state_file: &str, options: APTUpdateOptions) -> Result<(), Error> {
+ proxmox_apt::update_database(
+ apt_state_file,
+ &options,
+ |_updates: &[&APTUpdateInfo]| -> Result<(), Error> {
+ // fixme: howto send notifgications?
+ Ok(())
+ },
+ )
+ }
+
+ /// Get package information for a list of important product packages.
+ #[export]
+ pub fn get_package_versions(
+ product_virtual_package: &str,
+ api_server_package: &str,
+ running_api_server_version: &str,
+ package_list: Vec<String>,
+ ) -> Result<Vec<APTUpdateInfo>, Error> {
+ let package_list: Vec<&str> = package_list.iter().map(|s| s.as_ref()).collect();
+ proxmox_apt::get_package_versions(
+ product_virtual_package,
+ api_server_package,
+ running_api_server_version,
+ &package_list,
+ )
+ }
}
diff --git a/pmg-rs/Cargo.toml b/pmg-rs/Cargo.toml
index ad3a107..2706fcb 100644
--- a/pmg-rs/Cargo.toml
+++ b/pmg-rs/Cargo.toml
@@ -29,7 +29,7 @@ url = "2"
perlmod = { version = "0.13.4", features = ["exporter"] }
proxmox-acme = { version = "0.5", features = ["client", "api-types"] }
-proxmox-apt = "0.11"
+proxmox-apt = { version = "0.11", features = ["cache"] }
proxmox-apt-api-types = "1.0"
proxmox-config-digest = "0.1"
proxmox-http = { version = "0.9", features = ["client-sync", "client-trait"] }
diff --git a/pve-rs/Cargo.toml b/pve-rs/Cargo.toml
index ce7059d..3ba649e 100644
--- a/pve-rs/Cargo.toml
+++ b/pve-rs/Cargo.toml
@@ -31,7 +31,7 @@ url = "2"
perlmod = { version = "0.13", features = ["exporter"] }
-proxmox-apt = "0.11"
+proxmox-apt = { version = "0.11", features = ["cache"] }
proxmox-apt-api-types = "1.0"
proxmox-config-digest = "0.1"
proxmox-http = { version = "0.9", features = ["client-sync", "client-trait"] }
diff --git a/pve-rs/src/lib.rs b/pve-rs/src/lib.rs
index 42be39e..73780f8 100644
--- a/pve-rs/src/lib.rs
+++ b/pve-rs/src/lib.rs
@@ -17,6 +17,6 @@ mod export {
#[export]
pub fn init() {
common::logger::init("PVE_LOG", "info");
- proxmox_notify::context::set_context(&PVE_CONTEXT)
+ proxmox_notify::context::set_context(&PVE_CONTEXT);
}
}
--
2.39.2
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
next prev parent reply other threads:[~2024-07-09 6:20 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-09 6:20 [pve-devel] applied-series: [PATCH perl-rs 1/5] perl-rs: use proxmox-apt-api-types Wolfgang Bumiller
2024-07-09 6:20 ` [pve-devel] [PATCH perl-rs 2/5] perl-rs: use api functions from proxmox-apt Wolfgang Bumiller
2024-07-09 6:20 ` Wolfgang Bumiller [this message]
2024-07-09 6:20 ` [pve-devel] [PATCH perl-rs 4/5] pve-rs: common: send apt update notification via proxmox-notify Wolfgang Bumiller
2024-07-09 6:20 ` [pve-devel] [PATCH perl-rs 5/5] apt: minor parameter cleanup Wolfgang Bumiller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240709062026.53271-3-w.bumiller@proxmox.com \
--to=w.bumiller@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.