public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Wolfgang Bumiller <w.bumiller@proxmox.com>
To: Filip Schauer <f.schauer@proxmox.com>
Cc: pve-devel@lists.proxmox.com
Subject: Re: [pve-devel] [PATCH proxmox-perl-rs v2 02/11] add Perl mapping for OCI container image parser/extractor
Date: Tue, 24 Jun 2025 14:51:25 +0200	[thread overview]
Message-ID: <kach4fhw746f3ndkjr5li44kqanwooxclvltdrauhiito6f2v5@cabliu7hj5qd> (raw)
In-Reply-To: <20250611144903.200940-3-f.schauer@proxmox.com>

I recently started reorganizing this repository so that bindings are in
the `bindings` submodule and require documentation.

See any of the `update <foo> module to new code convention` commits.

Essentially, the generated docs for the bindings submodule should be
the "perl documentation", and anything else should be rust specific
documentation.

On Wed, Jun 11, 2025 at 04:48:54PM +0200, Filip Schauer wrote:
> Signed-off-by: Filip Schauer <f.schauer@proxmox.com>
> ---
>  pve-rs/Cargo.toml     |  2 ++
>  pve-rs/Makefile       |  1 +
>  pve-rs/debian/control |  2 ++
>  pve-rs/src/lib.rs     |  1 +
>  pve-rs/src/oci.rs     | 20 ++++++++++++++++++++
>  5 files changed, 26 insertions(+)
>  create mode 100644 pve-rs/src/oci.rs
> 
> diff --git a/pve-rs/Cargo.toml b/pve-rs/Cargo.toml
> index c7f11a3..00624c3 100644
> --- a/pve-rs/Cargo.toml
> +++ b/pve-rs/Cargo.toml
> @@ -20,6 +20,7 @@ hex = "0.4"
>  http = "1"
>  libc = "0.2"
>  nix = "0.29"
> +oci-spec = "0.8.1"
>  openssl = "0.10.40"
>  serde = "1.0"
>  serde_bytes = "0.11"
> @@ -37,6 +38,7 @@ proxmox-http = { version = "1", features = ["client-sync", "client-trait"] }
>  proxmox-http-error = "1"
>  proxmox-log = "1"
>  proxmox-notify = { version = "1", features = ["pve-context"] }
> +proxmox-oci = "0.1.0"
>  proxmox-openid = "1"
>  proxmox-resource-scheduling = "1"
>  proxmox-shared-cache = "1"
> diff --git a/pve-rs/Makefile b/pve-rs/Makefile
> index afe792a..d6a667f 100644
> --- a/pve-rs/Makefile
> +++ b/pve-rs/Makefile
> @@ -27,6 +27,7 @@ PERLMOD_GENPACKAGE := /usr/lib/perlmod/genpackage.pl \
>  
>  PERLMOD_PACKAGES := \
>  	  PVE::RS::Firewall::SDN \
> +	  PVE::RS::OCI \
>  	  PVE::RS::OpenId \
>  	  PVE::RS::ResourceScheduling::Static \
>  	  PVE::RS::TFA
> diff --git a/pve-rs/debian/control b/pve-rs/debian/control
> index 9e424ec..243b428 100644
> --- a/pve-rs/debian/control
> +++ b/pve-rs/debian/control
> @@ -10,6 +10,7 @@ Build-Depends: cargo:native <!nocheck>,
>                 librust-http-1+default-dev (>= 0.2.7-~~),
>                 librust-libc-0.2+default-dev,
>                 librust-nix-0.29+default-dev,
> +               librust-oci-spec-0.8+default-dev (>= 0.8.1-~~),
>                 librust-openssl-0.10+default-dev (>= 0.10.40-~~),
>                 librust-perlmod-0.14+default-dev (>= 0.13.5-~~),
>                 librust-perlmod-0.14+exporter-dev (>= 0.13.5-~~),
> @@ -24,6 +25,7 @@ Build-Depends: cargo:native <!nocheck>,
>                 librust-proxmox-log-1+default-dev,
>                 librust-proxmox-notify-1+default-dev (>= 0.5.4),
>                 librust-proxmox-notify-1+pve-context-dev,
> +               librust-proxmox-oci-0.1+default-dev,
>                 librust-proxmox-openid-1+default-dev (>= 0.10.4-~~),
>                 librust-proxmox-resource-scheduling-1+default-dev,
>                 librust-proxmox-shared-cache-1+default-dev,
> diff --git a/pve-rs/src/lib.rs b/pve-rs/src/lib.rs
> index bb979b9..1fe9e77 100644
> --- a/pve-rs/src/lib.rs
> +++ b/pve-rs/src/lib.rs
> @@ -12,6 +12,7 @@ use proxmox_notify::{Config, Notification, Severity};
>  mod common;
>  
>  pub mod firewall;
> +pub mod oci;
>  pub mod openid;
>  
>  pub mod bindings;
> diff --git a/pve-rs/src/oci.rs b/pve-rs/src/oci.rs
> new file mode 100644
> index 0000000..dd556aa
> --- /dev/null
> +++ b/pve-rs/src/oci.rs
> @@ -0,0 +1,20 @@
> +#[perlmod::package(name = "PVE::RS::OCI")]
> +mod export {
> +    use anyhow::{Error, bail};
> +    use oci_spec::image::Config;

I think `proxmox-oci` should re-export this type, then we only need to
depend on the one crate.

> +    use proxmox_oci::{ParseError, ProxmoxOciError};
> +
> +    #[export]
> +    pub fn parse_and_extract_image(
> +        oci_tar_path: &str,
> +        rootfs_path: &str,
> +    ) -> Result<Option<Config>, Error> {
> +        match proxmox_oci::parse_and_extract_image(oci_tar_path, rootfs_path) {
> +            Ok(config) => Ok(Some(config.unwrap_or_default())),
> +            Err(err) => match err {
> +                ProxmoxOciError::ParseError(ParseError::NotAnOciImage(_)) => Ok(None),

^ Why are we doing this?

> +                err => bail!("{err}"),
> +            },
> +        }
> +    }
> +}
> -- 
> 2.39.5


_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


  reply	other threads:[~2025-06-24 12:50 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-11 14:48 [pve-devel] [PATCH container/manager/proxmox{, -perl-rs}/storage v2 00/11] support OCI images as container templates Filip Schauer
2025-06-11 14:48 ` [pve-devel] [PATCH proxmox v2 01/11] add proxmox-oci crate Filip Schauer
2025-06-24 12:42   ` Wolfgang Bumiller
2025-06-25  8:13   ` Wolfgang Bumiller
2025-06-11 14:48 ` [pve-devel] [PATCH proxmox-perl-rs v2 02/11] add Perl mapping for OCI container image parser/extractor Filip Schauer
2025-06-24 12:51   ` Wolfgang Bumiller [this message]
2025-06-25  7:59     ` Filip Schauer
2025-06-25  8:10       ` Wolfgang Bumiller
2025-06-11 14:48 ` [pve-devel] [PATCH container v2 03/11] config: whitelist lxc.init.cwd Filip Schauer
2025-06-25  9:00   ` [pve-devel] applied: " Wolfgang Bumiller
2025-06-11 14:48 ` [pve-devel] [PATCH container v2 04/11] add support for OCI images as container templates Filip Schauer
2025-06-11 14:48 ` [pve-devel] [PATCH container v2 05/11] config: add entrypoint parameter Filip Schauer
2025-06-11 14:48 ` [pve-devel] [PATCH container v2 06/11] configure static IP in LXC config for custom entrypoint Filip Schauer
2025-06-25  8:26   ` Wolfgang Bumiller
2025-06-25  8:30     ` Wolfgang Bumiller
2025-06-25  8:52       ` Stefan Hanreich
2025-07-09 12:45     ` Filip Schauer
2025-06-11 14:48 ` [pve-devel] [PATCH container v2 07/11] setup: debian: create /etc/network path if missing Filip Schauer
2025-06-11 14:49 ` [pve-devel] [PATCH container v2 08/11] setup: recursively mkdir /etc/systemd/{network, system-preset} Filip Schauer
2025-06-11 14:49 ` [pve-devel] [PATCH container v2 09/11] manage DHCP for containers with custom entrypoint Filip Schauer
2025-06-25  8:50   ` Wolfgang Bumiller
2025-07-09 12:43     ` Filip Schauer
2025-07-09 13:00       ` Wolfgang Bumiller
2025-06-11 14:49 ` [pve-devel] [PATCH storage v2 10/11] allow .tar container templates Filip Schauer
2025-06-24 13:11   ` Wolfgang Bumiller
2025-06-11 14:49 ` [pve-devel] [PATCH manager v2 11/11] ui: storage upload: accept *.tar files as vztmpl Filip Schauer
2025-06-17  8:01 ` [pve-devel] [PATCH container/manager/proxmox{, -perl-rs}/storage v2 00/11] support OCI images as container templates Christoph Heiss
2025-07-09 12:50   ` Filip Schauer
2025-07-09 12:40 ` [pve-devel] superseded: " Filip Schauer

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=kach4fhw746f3ndkjr5li44kqanwooxclvltdrauhiito6f2v5@cabliu7hj5qd \
    --to=w.bumiller@proxmox.com \
    --cc=f.schauer@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal