From e8d7759738a0d9d1565e6f04218636120e8cdb44 Mon Sep 17 00:00:00 2001 From: Josef Reidinger Date: Thu, 12 Sep 2024 23:19:52 +0200 Subject: [PATCH 01/30] initial bindings for zyppng --- .gitmodules | 10 + rust/Cargo.lock | 189 +++++++- rust/Cargo.toml | 3 + rust/libzypp/.gitmodules | 4 + rust/libzypp/Cargo.toml | 18 + rust/libzypp/Gir.toml | 18 + rust/libzypp/src/auto/context.rs | 59 +++ rust/libzypp/src/auto/mod.rs | 7 + rust/libzypp/src/auto/versions.txt | 2 + rust/libzypp/src/lib.rs | 4 + rust/libzypp/zypp-sys/Cargo.toml | 35 ++ rust/libzypp/zypp-sys/Gir.toml | 13 + rust/libzypp/zypp-sys/build.rs | 17 + rust/libzypp/zypp-sys/src/auto/versions.txt | 2 + rust/libzypp/zypp-sys/src/lib.rs | 463 ++++++++++++++++++++ rust/libzypp/zypp-sys/tests/abi.rs | 236 ++++++++++ rust/libzypp/zypp-sys/tests/constant.c | 42 ++ rust/libzypp/zypp-sys/tests/layout.c | 23 + rust/libzypp/zypp-sys/tests/manual.h | 3 + 19 files changed, 1138 insertions(+), 10 deletions(-) create mode 100644 .gitmodules create mode 100644 rust/libzypp/.gitmodules create mode 100644 rust/libzypp/Cargo.toml create mode 100644 rust/libzypp/Gir.toml create mode 100644 rust/libzypp/src/auto/context.rs create mode 100644 rust/libzypp/src/auto/mod.rs create mode 100644 rust/libzypp/src/auto/versions.txt create mode 100644 rust/libzypp/src/lib.rs create mode 100644 rust/libzypp/zypp-sys/Cargo.toml create mode 100644 rust/libzypp/zypp-sys/Gir.toml create mode 100644 rust/libzypp/zypp-sys/build.rs create mode 100644 rust/libzypp/zypp-sys/src/auto/versions.txt create mode 100644 rust/libzypp/zypp-sys/src/lib.rs create mode 100644 rust/libzypp/zypp-sys/tests/abi.rs create mode 100644 rust/libzypp/zypp-sys/tests/constant.c create mode 100644 rust/libzypp/zypp-sys/tests/layout.c create mode 100644 rust/libzypp/zypp-sys/tests/manual.h diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000000..eed17fd2f1 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,10 @@ +[submodule "rust/libzypp/gir"] + path = rust/libzypp/gir + url = https://github.com/gtk-rs/gir +[submodule "./gir"] + branch = master +[submodule "rust/libzypp/gir-files"] + path = rust/libzypp/gir-files + url = https://github.com/gtk-rs/gir-files +[submodule "./gir-files"] + branch = master diff --git a/rust/Cargo.lock b/rust/Cargo.lock index 9b1ec100a3..2299968ef4 100644 --- a/rust/Cargo.lock +++ b/rust/Cargo.lock @@ -805,6 +805,16 @@ dependencies = [ "nom", ] +[[package]] +name = "cfg-expr" +version = "0.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "345c78335be0624ed29012dc10c49102196c6882c12dde65d9f35b02da2aada8" +dependencies = [ + "smallvec", + "target-lexicon", +] + [[package]] name = "cfg-if" version = "1.0.0" @@ -1461,6 +1471,17 @@ version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" +[[package]] +name = "futures-executor" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a576fc72ae164fca6b9db127eaa9a9dda0d61316034f33a0a0d4eda41f02b01d" +dependencies = [ + "futures-core", + "futures-task", + "futures-util", +] + [[package]] name = "futures-io" version = "0.3.30" @@ -1601,6 +1622,72 @@ version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "40ecd4077b5ae9fd2e9e169b102c6c330d0605168eb0e8bf79952b256dbefffd" +[[package]] +name = "gio-sys" +version = "0.20.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5237611e97e9b86ab5768adc3eef853ae713ea797aa3835404acdfacffc9fb38" +dependencies = [ + "glib-sys 0.20.2", + "gobject-sys 0.20.1", + "libc", + "system-deps", + "windows-sys 0.52.0", +] + +[[package]] +name = "glib" +version = "0.20.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95648aac01b75503000bb3bcaa5ec7a7a2dd61e43636b8b1814854de94dd80e4" +dependencies = [ + "bitflags 2.6.0", + "futures-channel", + "futures-core", + "futures-executor", + "futures-task", + "futures-util", + "gio-sys", + "glib-macros", + "glib-sys 0.20.2", + "gobject-sys 0.20.1", + "libc", + "memchr", + "smallvec", +] + +[[package]] +name = "glib-macros" +version = "0.20.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "302f1d633c9cdef4350330e7b68fd8016e2834bb106c93fdf9789fcde753c1ab" +dependencies = [ + "heck", + "proc-macro-crate 3.2.0", + "proc-macro2", + "quote", + "syn 2.0.72", +] + +[[package]] +name = "glib-sys" +version = "0.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92eee4531c1c9abba945d19378b205031b5890e1f99c319ba0503b6e0c06a163" +dependencies = [ + "libc", + "system-deps", +] + +[[package]] +name = "glib-sys" +version = "0.21.0" +source = "git+https://github.com/gtk-rs/gtk-rs-core#d34db6baf53bda50c65af02d9493d536087d2cf4" +dependencies = [ + "libc", + "system-deps", +] + [[package]] name = "glob" version = "0.3.1" @@ -1619,6 +1706,27 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "gobject-sys" +version = "0.20.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa3d1dcd8a1eb2e7c22be3d5e792b14b186f3524f79b25631730f9a8c169d49a" +dependencies = [ + "glib-sys 0.20.2", + "libc", + "system-deps", +] + +[[package]] +name = "gobject-sys" +version = "0.21.0" +source = "git+https://github.com/gtk-rs/gtk-rs-core#d34db6baf53bda50c65af02d9493d536087d2cf4" +dependencies = [ + "glib-sys 0.21.0", + "libc", + "system-deps", +] + [[package]] name = "h2" version = "0.3.26" @@ -2291,6 +2399,15 @@ dependencies = [ "vcpkg", ] +[[package]] +name = "libzypp" +version = "0.1.0" +dependencies = [ + "glib", + "libc", + "zypp-sys", +] + [[package]] name = "linked-hash-map" version = "0.5.6" @@ -3041,6 +3158,15 @@ dependencies = [ "toml_edit 0.19.15", ] +[[package]] +name = "proc-macro-crate" +version = "3.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ecf48c7ca261d60b74ab1a7b20da18bede46776b2e55535cb958eb595c5fa7b" +dependencies = [ + "toml_edit 0.22.20", +] + [[package]] name = "proc-macro-error" version = "1.0.4" @@ -3621,6 +3747,12 @@ dependencies = [ "lazy_static", ] +[[package]] +name = "shell-words" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24188a676b6ae68c3b2cb3a01be17fbf7240ce009799bb56d5b1409051e78fde" + [[package]] name = "shlex" version = "1.3.0" @@ -3818,6 +3950,25 @@ dependencies = [ "libc", ] +[[package]] +name = "system-deps" +version = "7.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "070a0a5e7da2d24be457809c4b3baa57a835fd2829ad8b86f9a049052fe71031" +dependencies = [ + "cfg-expr", + "heck", + "pkg-config", + "toml", + "version-compare", +] + +[[package]] +name = "target-lexicon" +version = "0.12.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1" + [[package]] name = "temp-dir" version = "0.1.13" @@ -4062,14 +4213,14 @@ dependencies = [ "serde", "serde_spanned", "toml_datetime", - "toml_edit 0.22.17", + "toml_edit 0.22.20", ] [[package]] name = "toml_datetime" -version = "0.6.7" +version = "0.6.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8fb9f64314842840f1d940ac544da178732128f1c78c21772e876579e0da1db" +checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41" dependencies = [ "serde", ] @@ -4087,15 +4238,15 @@ dependencies = [ [[package]] name = "toml_edit" -version = "0.22.17" +version = "0.22.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d9f8729f5aea9562aac1cc0441f5d6de3cff1ee0c5d67293eeca5eb36ee7c16" +checksum = "583c44c02ad26b0c3f3066fe629275e50627026c51ac2e595cca4c230ce1ce1d" dependencies = [ "indexmap 2.2.6", "serde", "serde_spanned", "toml_datetime", - "winnow 0.6.16", + "winnow 0.6.18", ] [[package]] @@ -4416,6 +4567,12 @@ version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" +[[package]] +name = "version-compare" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "852e951cb7832cb45cb1169900d19760cfa39b82bc0ea9c0e5a14ae88411c98b" + [[package]] name = "version_check" version = "0.9.5" @@ -4719,9 +4876,9 @@ dependencies = [ [[package]] name = "winnow" -version = "0.6.16" +version = "0.6.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b480ae9340fc261e6be3e95a1ba86d54ae3f9171132a73ce8d4bbaf68339507c" +checksum = "68a9bda4691f099d435ad181000724da8e5899daa10713c2d432552b9ccd3a6f" dependencies = [ "memchr", ] @@ -4807,7 +4964,7 @@ version = "3.15.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7131497b0f887e8061b430c530240063d33bf9455fa34438f388a245da69e0a5" dependencies = [ - "proc-macro-crate", + "proc-macro-crate 1.3.1", "proc-macro2", "quote", "regex", @@ -4872,7 +5029,7 @@ version = "3.15.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "37c24dc0bed72f5f90d1f8bb5b07228cbf63b3c6e9f82d82559d4bae666e7ed9" dependencies = [ - "proc-macro-crate", + "proc-macro-crate 1.3.1", "proc-macro2", "quote", "syn 1.0.109", @@ -4889,3 +5046,15 @@ dependencies = [ "quote", "syn 1.0.109", ] + +[[package]] +name = "zypp-sys" +version = "0.0.1" +dependencies = [ + "glib-sys 0.21.0", + "gobject-sys 0.21.0", + "libc", + "shell-words", + "system-deps", + "tempfile", +] diff --git a/rust/Cargo.toml b/rust/Cargo.toml index 991ffaae7f..dd99e94e9a 100644 --- a/rust/Cargo.toml +++ b/rust/Cargo.toml @@ -4,7 +4,10 @@ members = [ "agama-server", "agama-lib", "agama-locale-data", + "libzypp", + "libzypp/zypp-sys", ] + resolver = "2" [workspace.package] diff --git a/rust/libzypp/.gitmodules b/rust/libzypp/.gitmodules new file mode 100644 index 0000000000..579072ee38 --- /dev/null +++ b/rust/libzypp/.gitmodules @@ -0,0 +1,4 @@ +[submodule "gir"] + update = none +[submodule "gir-files"] + update = none diff --git a/rust/libzypp/Cargo.toml b/rust/libzypp/Cargo.toml new file mode 100644 index 0000000000..e54778e54f --- /dev/null +++ b/rust/libzypp/Cargo.toml @@ -0,0 +1,18 @@ +[package] +name = "libzypp" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[package.metadata.docs.rs] +all-features = true +# For build.rs scripts +rustc-args = ["--cfg", "docsrs"] +# For rustdoc +rustdoc-args = ["--cfg", "docsrs"] + +[dependencies] +libc = "0.2" +glib = "0.20.3" +ffi = { package = "zypp-sys", path = "./zypp-sys" } diff --git a/rust/libzypp/Gir.toml b/rust/libzypp/Gir.toml new file mode 100644 index 0000000000..7cbc8a6488 --- /dev/null +++ b/rust/libzypp/Gir.toml @@ -0,0 +1,18 @@ +[options] +library = "Zypp" +version = "1.0" +min_cfg_version = "1.0" +target_path = "." +girs_directories = ["gir-files"] +work_mode = "normal" +single_version_file = true +generate_safety_asserts = true +deprecate_by_min_version = true + +generate = [ + "Zypp.Context" +] + +manual = [ + "GLib.Error" +] diff --git a/rust/libzypp/src/auto/context.rs b/rust/libzypp/src/auto/context.rs new file mode 100644 index 0000000000..a98263b122 --- /dev/null +++ b/rust/libzypp/src/auto/context.rs @@ -0,0 +1,59 @@ +// This file was generated by gir (https://github.com/gtk-rs/gir) +// from gir-files +// DO NOT EDIT + +use crate::{ffi}; +use glib::{prelude::*,signal::{connect_raw, SignalHandlerId},translate::*}; +use std::{boxed::Box as Box_}; + +glib::wrapper! { + #[doc(alias = "ZyppContext")] + pub struct Context(Object); + + match fn { + type_ => || ffi::zypp_context_get_type(), + } +} + +impl Context { + #[doc(alias = "zypp_context_load_system")] + pub fn load_system(&self, sysRoot: Option<&str>) -> Result<(), glib::Error> { + unsafe { + let mut error = std::ptr::null_mut(); + let is_ok = ffi::zypp_context_load_system(self.to_glib_none().0, sysRoot.to_glib_none().0, &mut error); + debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } + } + } + + #[doc(alias = "zypp_context_sysroot")] + pub fn sysroot(&self) -> Option { + unsafe { + from_glib_full(ffi::zypp_context_sysroot(self.to_glib_none().0)) + } + } + + #[doc(alias = "zypp_context_version")] + pub fn version(&self) -> Option { + unsafe { + from_glib_none(ffi::zypp_context_version(self.to_glib_none().0)) + } + } + + pub fn versionprop(&self) -> Option { + ObjectExt::property(self, "versionprop") + } + + #[doc(alias = "versionprop")] + pub fn connect_versionprop_notify(&self, f: F) -> SignalHandlerId { + unsafe extern "C" fn notify_versionprop_trampoline(this: *mut ffi::ZyppContext, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) { + let f: &F = &*(f as *const F); + f(&from_glib_borrow(this)) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw(self.as_ptr() as *mut _, b"notify::versionprop\0".as_ptr() as *const _, + Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_versionprop_trampoline:: as *const ())), Box_::into_raw(f)) + } + } +} diff --git a/rust/libzypp/src/auto/mod.rs b/rust/libzypp/src/auto/mod.rs new file mode 100644 index 0000000000..926d31e748 --- /dev/null +++ b/rust/libzypp/src/auto/mod.rs @@ -0,0 +1,7 @@ +// This file was generated by gir (https://github.com/gtk-rs/gir) +// from gir-files +// DO NOT EDIT + +mod context; +pub use self::context::Context; + diff --git a/rust/libzypp/src/auto/versions.txt b/rust/libzypp/src/auto/versions.txt new file mode 100644 index 0000000000..c88a14e0ac --- /dev/null +++ b/rust/libzypp/src/auto/versions.txt @@ -0,0 +1,2 @@ +Generated by gir (https://github.com/gtk-rs/gir @ 06c4f1963c55+) +from gir-files (@ ???) diff --git a/rust/libzypp/src/lib.rs b/rust/libzypp/src/lib.rs new file mode 100644 index 0000000000..ed12f4a20f --- /dev/null +++ b/rust/libzypp/src/lib.rs @@ -0,0 +1,4 @@ +#![cfg_attr(docsrs, feature(doc_cfg))] + +pub use auto::*; +mod auto; diff --git a/rust/libzypp/zypp-sys/Cargo.toml b/rust/libzypp/zypp-sys/Cargo.toml new file mode 100644 index 0000000000..d9e752b881 --- /dev/null +++ b/rust/libzypp/zypp-sys/Cargo.toml @@ -0,0 +1,35 @@ +[package] +name = "zypp-sys" +version = "0.0.1" +edition = "2021" +build = "build.rs" + +[package.metadata.system-deps.glib_2_0] +name = "glib-2.0" +version = "1" + +[package.metadata.docs.rs] +rustc-args = ["--cfg", "docsrs"] +rustdoc-args = ["--cfg", "docsrs", "--generate-link-to-definition"] +all-features = true + +[lib] +name = "zypp_sys" + +[dependencies] +libc = "0.2" + +[dependencies.glib-sys] +git = "https://github.com/gtk-rs/gtk-rs-core" + +[dependencies.gobject-sys] +git = "https://github.com/gtk-rs/gtk-rs-core" + +[build-dependencies] +system-deps = "7" + +[dev-dependencies] +shell-words = "1.0.0" +tempfile = "3" + +[features] diff --git a/rust/libzypp/zypp-sys/Gir.toml b/rust/libzypp/zypp-sys/Gir.toml new file mode 100644 index 0000000000..8e127cac17 --- /dev/null +++ b/rust/libzypp/zypp-sys/Gir.toml @@ -0,0 +1,13 @@ +[options] +library = "Zypp" +version = "1.0" +min_cfg_version = "1.0" +target_path = "." +girs_directories = ["../gir-files/"] +work_mode = "sys" +single_version_file = true + +external_libraries = [ + "GLib", + "GObject", +] diff --git a/rust/libzypp/zypp-sys/build.rs b/rust/libzypp/zypp-sys/build.rs new file mode 100644 index 0000000000..94a39d86f3 --- /dev/null +++ b/rust/libzypp/zypp-sys/build.rs @@ -0,0 +1,17 @@ +// This file was generated by gir (https://github.com/gtk-rs/gir) +// from ../gir-files +// DO NOT EDIT + +#[cfg(not(docsrs))] +use std::process; + +#[cfg(docsrs)] +fn main() {} // prevent linking libraries to avoid documentation failure + +#[cfg(not(docsrs))] +fn main() { + if let Err(s) = system_deps::Config::new().probe() { + println!("cargo:warning={s}"); + process::exit(1); + } +} diff --git a/rust/libzypp/zypp-sys/src/auto/versions.txt b/rust/libzypp/zypp-sys/src/auto/versions.txt new file mode 100644 index 0000000000..b934242094 --- /dev/null +++ b/rust/libzypp/zypp-sys/src/auto/versions.txt @@ -0,0 +1,2 @@ +Generated by gir (https://github.com/gtk-rs/gir @ 06c4f1963c55+) +from ../gir-files (@ 62da9eb7c4bd) diff --git a/rust/libzypp/zypp-sys/src/lib.rs b/rust/libzypp/zypp-sys/src/lib.rs new file mode 100644 index 0000000000..53b7e9b367 --- /dev/null +++ b/rust/libzypp/zypp-sys/src/lib.rs @@ -0,0 +1,463 @@ +// This file was generated by gir (https://github.com/gtk-rs/gir) +// from ../gir-files +// DO NOT EDIT + +#![allow(non_camel_case_types, non_upper_case_globals, non_snake_case)] +#![allow(clippy::approx_constant, clippy::type_complexity, clippy::unreadable_literal, clippy::upper_case_acronyms)] +#![cfg_attr(docsrs, feature(doc_cfg))] + +use glib_sys as glib; +use gobject_sys as gobject; + +#[allow(unused_imports)] +use libc::{c_int, c_char, c_uchar, c_float, c_uint, c_double, + c_short, c_ushort, c_long, c_ulong, + c_void, size_t, ssize_t, time_t, off_t, intptr_t, uintptr_t, FILE}; +#[cfg(unix)] +#[allow(unused_imports)] +use libc::{dev_t, gid_t, pid_t, socklen_t, uid_t}; + +#[allow(unused_imports)] +use glib::{gboolean, gconstpointer, gpointer, GType}; + +// Enums +pub type ZyppException = c_int; +pub const ZYPP_ERROR: ZyppException = 0; + +pub type ZyppRepoInfoType = c_int; +pub const ZYPP_REPO_NONE: ZyppRepoInfoType = 0; +pub const ZYPP_REPO_RPMMD: ZyppRepoInfoType = 1; +pub const ZYPP_REPO_YAST2: ZyppRepoInfoType = 2; +pub const ZYPP_REPO_RPMPLAINDIR: ZyppRepoInfoType = 3; + +pub type ZyppRepoManagerError = c_int; +pub const ZYPP_REPO_MANAGER_ERROR_REF_FAILED: ZyppRepoManagerError = 0; +pub const ZYPP_REPO_MANAGER_ERROR_REF_SKIPPED: ZyppRepoManagerError = 1; +pub const ZYPP_REPO_MANAGER_ERROR_REF_ABORTED: ZyppRepoManagerError = 2; + +pub type ZyppRepoRefreshResult = c_int; +pub const ZYPP_REPO_MANAGER_UP_TO_DATE: ZyppRepoRefreshResult = 0; +pub const ZYPP_REPO_MANAGER_REFRESHED: ZyppRepoRefreshResult = 1; + +// Records +#[derive(Copy, Clone)] +#[repr(C)] +pub struct ZyppContextClass { + pub parent_class: gobject::GObjectClass, +} + +impl ::std::fmt::Debug for ZyppContextClass { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + f.debug_struct(&format!("ZyppContextClass @ {self:p}")) + .field("parent_class", &self.parent_class) + .finish() + } +} + +#[derive(Copy, Clone)] +#[repr(C)] +pub struct ZyppExpectedClass { + pub parent_class: gobject::GObjectClass, +} + +impl ::std::fmt::Debug for ZyppExpectedClass { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + f.debug_struct(&format!("ZyppExpectedClass @ {self:p}")) + .field("parent_class", &self.parent_class) + .finish() + } +} + +#[derive(Copy, Clone)] +#[repr(C)] +pub struct ZyppInfoBaseInterface { + pub parent_iface: gobject::GTypeInterface, + pub alias: Option *mut c_char>, + pub escaped_alias: Option *mut c_char>, + pub name: Option *mut c_char>, + pub raw_name: Option *mut c_char>, + pub label: Option *mut c_char>, + pub as_user_string: Option *mut c_char>, + pub enabled: Option gboolean>, + pub autorefresh: Option gboolean>, + pub filepath: Option *mut c_char>, + pub set_alias: Option, + pub set_name: Option, + pub set_enabled: Option, + pub set_autorefresh: Option, + pub set_filepath: Option, +} + +impl ::std::fmt::Debug for ZyppInfoBaseInterface { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + f.debug_struct(&format!("ZyppInfoBaseInterface @ {self:p}")) + .field("parent_iface", &self.parent_iface) + .field("alias", &self.alias) + .field("escaped_alias", &self.escaped_alias) + .field("name", &self.name) + .field("raw_name", &self.raw_name) + .field("label", &self.label) + .field("as_user_string", &self.as_user_string) + .field("enabled", &self.enabled) + .field("autorefresh", &self.autorefresh) + .field("filepath", &self.filepath) + .field("set_alias", &self.set_alias) + .field("set_name", &self.set_name) + .field("set_enabled", &self.set_enabled) + .field("set_autorefresh", &self.set_autorefresh) + .field("set_filepath", &self.set_filepath) + .finish() + } +} + +#[repr(C)] +#[allow(dead_code)] +pub struct ZyppManagedFile { + _data: [u8; 0], + _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>, +} + +impl ::std::fmt::Debug for ZyppManagedFile { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + f.debug_struct(&format!("ZyppManagedFile @ {self:p}")) + .finish() + } +} + +#[derive(Copy, Clone)] +#[repr(C)] +pub struct ZyppProgressObserverClass { + pub parent_class: gobject::GObjectClass, +} + +impl ::std::fmt::Debug for ZyppProgressObserverClass { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + f.debug_struct(&format!("ZyppProgressObserverClass @ {self:p}")) + .field("parent_class", &self.parent_class) + .finish() + } +} + +#[derive(Copy, Clone)] +#[repr(C)] +pub struct ZyppRepoInfoClass { + pub parent_class: gobject::GObjectClass, +} + +impl ::std::fmt::Debug for ZyppRepoInfoClass { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + f.debug_struct(&format!("ZyppRepoInfoClass @ {self:p}")) + .field("parent_class", &self.parent_class) + .finish() + } +} + +#[derive(Copy, Clone)] +#[repr(C)] +pub struct ZyppRepoManagerClass { + pub parent_class: gobject::GObjectClass, +} + +impl ::std::fmt::Debug for ZyppRepoManagerClass { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + f.debug_struct(&format!("ZyppRepoManagerClass @ {self:p}")) + .field("parent_class", &self.parent_class) + .finish() + } +} + +#[repr(C)] +#[allow(dead_code)] +pub struct ZyppRepoManagerOptions { + _data: [u8; 0], + _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>, +} + +impl ::std::fmt::Debug for ZyppRepoManagerOptions { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + f.debug_struct(&format!("ZyppRepoManagerOptions @ {self:p}")) + .finish() + } +} + +#[derive(Copy, Clone)] +#[repr(C)] +pub struct ZyppRepositoryClass { + pub parent_class: gobject::GObjectClass, +} + +impl ::std::fmt::Debug for ZyppRepositoryClass { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + f.debug_struct(&format!("ZyppRepositoryClass @ {self:p}")) + .field("parent_class", &self.parent_class) + .finish() + } +} + +#[derive(Copy, Clone)] +#[repr(C)] +pub struct ZyppServiceInfoClass { + pub parent_class: gobject::GObjectClass, +} + +impl ::std::fmt::Debug for ZyppServiceInfoClass { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + f.debug_struct(&format!("ZyppServiceInfoClass @ {self:p}")) + .field("parent_class", &self.parent_class) + .finish() + } +} + +#[repr(C)] +#[allow(dead_code)] +pub struct _ZyppTaskStatus { + _data: [u8; 0], + _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>, +} + +pub type ZyppTaskStatus = _ZyppTaskStatus; + +// Classes +#[repr(C)] +#[allow(dead_code)] +pub struct ZyppContext { + _data: [u8; 0], + _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>, +} + +impl ::std::fmt::Debug for ZyppContext { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + f.debug_struct(&format!("ZyppContext @ {self:p}")) + .finish() + } +} + +#[repr(C)] +#[allow(dead_code)] +pub struct ZyppExpected { + _data: [u8; 0], + _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>, +} + +impl ::std::fmt::Debug for ZyppExpected { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + f.debug_struct(&format!("ZyppExpected @ {self:p}")) + .finish() + } +} + +#[repr(C)] +#[allow(dead_code)] +pub struct ZyppProgressObserver { + _data: [u8; 0], + _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>, +} + +impl ::std::fmt::Debug for ZyppProgressObserver { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + f.debug_struct(&format!("ZyppProgressObserver @ {self:p}")) + .finish() + } +} + +#[repr(C)] +#[allow(dead_code)] +pub struct ZyppRepoInfo { + _data: [u8; 0], + _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>, +} + +impl ::std::fmt::Debug for ZyppRepoInfo { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + f.debug_struct(&format!("ZyppRepoInfo @ {self:p}")) + .finish() + } +} + +#[repr(C)] +#[allow(dead_code)] +pub struct ZyppRepoManager { + _data: [u8; 0], + _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>, +} + +impl ::std::fmt::Debug for ZyppRepoManager { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + f.debug_struct(&format!("ZyppRepoManager @ {self:p}")) + .finish() + } +} + +#[repr(C)] +#[allow(dead_code)] +pub struct ZyppRepository { + _data: [u8; 0], + _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>, +} + +impl ::std::fmt::Debug for ZyppRepository { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + f.debug_struct(&format!("ZyppRepository @ {self:p}")) + .finish() + } +} + +#[repr(C)] +#[allow(dead_code)] +pub struct ZyppServiceInfo { + _data: [u8; 0], + _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>, +} + +impl ::std::fmt::Debug for ZyppServiceInfo { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + f.debug_struct(&format!("ZyppServiceInfo @ {self:p}")) + .finish() + } +} + +// Interfaces +#[repr(C)] +#[allow(dead_code)] +pub struct ZyppInfoBase { + _data: [u8; 0], + _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>, +} + +impl ::std::fmt::Debug for ZyppInfoBase { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + write!(f, "ZyppInfoBase @ {self:p}") + } +} + + +#[link(name = "zypp-glib")] +extern "C" { + + //========================================================================= + // ZyppException + //========================================================================= + pub fn zypp_exception_get_type() -> GType; + pub fn zypp_exception_quark() -> glib::GQuark; + + //========================================================================= + // ZyppRepoInfoType + //========================================================================= + pub fn zypp_repo_info_type_get_type() -> GType; + + //========================================================================= + // ZyppRepoManagerError + //========================================================================= + pub fn zypp_repo_manager_error_get_type() -> GType; + pub fn zypp_repo_manager_error_quark() -> glib::GQuark; + + //========================================================================= + // ZyppRepoRefreshResult + //========================================================================= + pub fn zypp_repo_refresh_result_get_type() -> GType; + + //========================================================================= + // ZyppManagedFile + //========================================================================= + pub fn zypp_managed_file_get_type() -> GType; + pub fn zypp_managed_file_new(path: *const c_char, dispose: gboolean) -> *mut ZyppManagedFile; + pub fn zypp_managed_file_copy(r: *mut ZyppManagedFile) -> *mut ZyppManagedFile; + pub fn zypp_managed_file_free(r: *mut ZyppManagedFile); + pub fn zypp_managed_file_get_path(self_: *mut ZyppManagedFile) -> *mut c_char; + pub fn zypp_managed_file_set_dispose_enabled(self_: *mut ZyppManagedFile, enabled: gboolean); + + //========================================================================= + // ZyppRepoManagerOptions + //========================================================================= + pub fn zypp_repo_manager_options_get_type() -> GType; + pub fn zypp_repo_manager_options_new(root: *const c_char) -> *mut ZyppRepoManagerOptions; + pub fn zypp_repo_manager_options_copy(self_: *mut ZyppRepoManagerOptions) -> *mut ZyppRepoManagerOptions; + pub fn zypp_repo_manager_options_free(self_: *mut ZyppRepoManagerOptions); + pub fn zypp_repo_manager_options_get_root(self_: *mut ZyppRepoManagerOptions) -> *mut c_char; + + //========================================================================= + // ZyppContext + //========================================================================= + pub fn zypp_context_get_type() -> GType; + pub fn zypp_context_load_system(self_: *mut ZyppContext, sysRoot: *const c_char, error: *mut *mut glib::GError) -> gboolean; + pub fn zypp_context_sysroot(self_: *mut ZyppContext) -> *mut c_char; + pub fn zypp_context_version(self_: *mut ZyppContext) -> *const c_char; + + //========================================================================= + // ZyppExpected + //========================================================================= + pub fn zypp_expected_get_type() -> GType; + pub fn zypp_expected_new_error(error: *mut glib::GError) -> *mut ZyppExpected; + pub fn zypp_expected_new_value(value: *const gobject::GValue) -> *mut ZyppExpected; + pub fn zypp_expected_get_error(self_: *mut ZyppExpected) -> *const glib::GError; + pub fn zypp_expected_get_value(self_: *mut ZyppExpected, error: *mut *mut glib::GError) -> *const gobject::GValue; + pub fn zypp_expected_has_error(self_: *mut ZyppExpected) -> gboolean; + pub fn zypp_expected_has_value(self_: *mut ZyppExpected) -> gboolean; + + //========================================================================= + // ZyppProgressObserver + //========================================================================= + pub fn zypp_progress_observer_get_type() -> GType; + pub fn zypp_progress_observer_add_subtask(self_: *mut ZyppProgressObserver, newChild: *mut ZyppProgressObserver, weight: c_float); + pub fn zypp_progress_observer_get_base_steps(self_: *mut ZyppProgressObserver) -> c_int; + pub fn zypp_progress_observer_get_children(self_: *mut ZyppProgressObserver) -> *const glib::GList; + pub fn zypp_progress_observer_get_current(self_: *mut ZyppProgressObserver) -> c_double; + pub fn zypp_progress_observer_get_label(self_: *mut ZyppProgressObserver) -> *const c_char; + pub fn zypp_progress_observer_get_progress(self_: *mut ZyppProgressObserver) -> c_double; + pub fn zypp_progress_observer_get_steps(self_: *mut ZyppProgressObserver) -> c_double; + pub fn zypp_progress_observer_inc(self_: *mut ZyppProgressObserver, increase: c_int); + pub fn zypp_progress_observer_set_base_steps(self_: *mut ZyppProgressObserver, stepCount: c_int); + pub fn zypp_progress_observer_set_current(self_: *mut ZyppProgressObserver, value: c_double); + pub fn zypp_progress_observer_set_finished(self_: *mut ZyppProgressObserver); + pub fn zypp_progress_observer_set_label(self_: *mut ZyppProgressObserver, label: *const c_char); + + //========================================================================= + // ZyppRepoInfo + //========================================================================= + pub fn zypp_repo_info_get_type() -> GType; + pub fn zypp_repo_info_new(context: *mut ZyppContext) -> *mut ZyppRepoInfo; + pub fn zypp_repo_info_get_repo_type(self_: *mut ZyppRepoInfo) -> ZyppRepoInfoType; + + //========================================================================= + // ZyppRepoManager + //========================================================================= + pub fn zypp_repo_manager_get_type() -> GType; + pub fn zypp_repo_manager_new(ctx: *mut ZyppContext) -> *mut ZyppRepoManager; + pub fn zypp_repo_manager_get_known_repos(self_: *mut ZyppRepoManager) -> *mut glib::GList; + pub fn zypp_repo_manager_get_known_services(self_: *mut ZyppRepoManager) -> *mut glib::GList; + pub fn zypp_repo_manager_initialize(self_: *mut ZyppRepoManager, error: *mut *mut glib::GError) -> gboolean; + pub fn zypp_repo_manager_refresh_repos(self_: *mut ZyppRepoManager, repos: *mut glib::GList, forceDownload: gboolean, statusTracker: *mut ZyppTaskStatus) -> *mut glib::GList; + + //========================================================================= + // ZyppRepository + //========================================================================= + pub fn zypp_repository_get_type() -> GType; + pub fn zypp_repository_get_name(self_: *mut ZyppRepository) -> *mut c_char; + pub fn zypp_repository_get_repoinfo(self_: *mut ZyppRepository) -> *mut ZyppRepoInfo; + + //========================================================================= + // ZyppServiceInfo + //========================================================================= + pub fn zypp_service_info_get_type() -> GType; + pub fn zypp_service_info_new(context: *mut ZyppContext) -> *mut ZyppServiceInfo; + + //========================================================================= + // ZyppInfoBase + //========================================================================= + pub fn zypp_info_base_get_type() -> GType; + pub fn zypp_info_base_alias(self_: *mut ZyppInfoBase) -> *mut c_char; + pub fn zypp_info_base_as_user_string(self_: *mut ZyppInfoBase) -> *mut c_char; + pub fn zypp_info_base_autorefresh(self_: *mut ZyppInfoBase) -> gboolean; + pub fn zypp_info_base_enabled(self_: *mut ZyppInfoBase) -> gboolean; + pub fn zypp_info_base_escaped_alias(self_: *mut ZyppInfoBase) -> *mut c_char; + pub fn zypp_info_base_filepath(self_: *mut ZyppInfoBase) -> *mut c_char; + pub fn zypp_info_base_label(self_: *mut ZyppInfoBase) -> *mut c_char; + pub fn zypp_info_base_name(self_: *mut ZyppInfoBase) -> *mut c_char; + pub fn zypp_info_base_raw_name(self_: *mut ZyppInfoBase) -> *mut c_char; + pub fn zypp_info_base_set_alias(self_: *mut ZyppInfoBase, alias: *const c_char); + pub fn zypp_info_base_set_autorefresh(self_: *mut ZyppInfoBase, enabled: gboolean); + pub fn zypp_info_base_set_enabled(self_: *mut ZyppInfoBase, enabled: gboolean); + pub fn zypp_info_base_set_filepath(self_: *mut ZyppInfoBase, filepath: *const c_char); + pub fn zypp_info_base_set_name(self_: *mut ZyppInfoBase, name: *const c_char); + +} diff --git a/rust/libzypp/zypp-sys/tests/abi.rs b/rust/libzypp/zypp-sys/tests/abi.rs new file mode 100644 index 0000000000..87665b7630 --- /dev/null +++ b/rust/libzypp/zypp-sys/tests/abi.rs @@ -0,0 +1,236 @@ +// This file was generated by gir (https://github.com/gtk-rs/gir) +// from ../gir-files +// DO NOT EDIT + +#![cfg(unix)] + +use zypp_sys::*; +use std::mem::{align_of, size_of}; +use std::env; +use std::error::Error; +use std::ffi::OsString; +use std::path::Path; +use std::process::{Command, Stdio}; +use std::str; +use tempfile::Builder; + +static PACKAGES: &[&str] = &["glib-2.0", "gobject-2.0"]; + +#[derive(Clone, Debug)] +struct Compiler { + pub args: Vec, +} + +impl Compiler { + pub fn new() -> Result> { + let mut args = get_var("CC", "cc")?; + args.push("-Wno-deprecated-declarations".to_owned()); + // For _Generic + args.push("-std=c11".to_owned()); + // For %z support in printf when using MinGW. + args.push("-D__USE_MINGW_ANSI_STDIO".to_owned()); + args.extend(get_var("CFLAGS", "")?); + args.extend(get_var("CPPFLAGS", "")?); + args.extend(pkg_config_cflags(PACKAGES)?); + Ok(Self { args }) + } + + pub fn compile(&self, src: &Path, out: &Path) -> Result<(), Box> { + let mut cmd = self.to_command(); + cmd.arg(src); + cmd.arg("-o"); + cmd.arg(out); + let status = cmd.spawn()?.wait()?; + if !status.success() { + return Err(format!("compilation command {cmd:?} failed, {status}").into()); + } + Ok(()) + } + + fn to_command(&self) -> Command { + let mut cmd = Command::new(&self.args[0]); + cmd.args(&self.args[1..]); + cmd + } +} + +fn get_var(name: &str, default: &str) -> Result, Box> { + match env::var(name) { + Ok(value) => Ok(shell_words::split(&value)?), + Err(env::VarError::NotPresent) => Ok(shell_words::split(default)?), + Err(err) => Err(format!("{name} {err}").into()), + } +} + +fn pkg_config_cflags(packages: &[&str]) -> Result, Box> { + if packages.is_empty() { + return Ok(Vec::new()); + } + let pkg_config = env::var_os("PKG_CONFIG") + .unwrap_or_else(|| OsString::from("pkg-config")); + let mut cmd = Command::new(pkg_config); + cmd.arg("--cflags"); + cmd.args(packages); + cmd.stderr(Stdio::inherit()); + let out = cmd.output()?; + if !out.status.success() { + let (status, stdout) = (out.status, String::from_utf8_lossy(&out.stdout)); + return Err(format!("command {cmd:?} failed, {status:?}\nstdout: {stdout}").into()); + } + let stdout = str::from_utf8(&out.stdout)?; + Ok(shell_words::split(stdout.trim())?) +} + + +#[derive(Copy, Clone, Debug, Eq, PartialEq)] +struct Layout { + size: usize, + alignment: usize, +} + +#[derive(Copy, Clone, Debug, Default, Eq, PartialEq)] +struct Results { + /// Number of successfully completed tests. + passed: usize, + /// Total number of failed tests (including those that failed to compile). + failed: usize, +} + +impl Results { + fn record_passed(&mut self) { + self.passed += 1; + } + fn record_failed(&mut self) { + self.failed += 1; + } + fn summary(&self) -> String { + format!("{} passed; {} failed", self.passed, self.failed) + } + fn expect_total_success(&self) { + if self.failed == 0 { + println!("OK: {}", self.summary()); + } else { + panic!("FAILED: {}", self.summary()); + }; + } +} + +#[test] +fn cross_validate_constants_with_c() { + let mut c_constants: Vec<(String, String)> = Vec::new(); + + for l in get_c_output("constant").unwrap().lines() { + let (name, value) = l.split_once(';').expect("Missing ';' separator"); + c_constants.push((name.to_owned(), value.to_owned())); + } + + let mut results = Results::default(); + + for ((rust_name, rust_value), (c_name, c_value)) in + RUST_CONSTANTS.iter().zip(c_constants.iter()) + { + if rust_name != c_name { + results.record_failed(); + eprintln!("Name mismatch:\nRust: {rust_name:?}\nC: {c_name:?}"); + continue; + } + + if rust_value != c_value { + results.record_failed(); + eprintln!( + "Constant value mismatch for {rust_name}\nRust: {rust_value:?}\nC: {c_value:?}", + ); + continue; + } + + results.record_passed(); + } + + results.expect_total_success(); +} + +#[test] +fn cross_validate_layout_with_c() { + let mut c_layouts = Vec::new(); + + for l in get_c_output("layout").unwrap().lines() { + let (name, value) = l.split_once(';').expect("Missing first ';' separator"); + let (size, alignment) = value.split_once(';').expect("Missing second ';' separator"); + let size = size.parse().expect("Failed to parse size"); + let alignment = alignment.parse().expect("Failed to parse alignment"); + c_layouts.push((name.to_owned(), Layout { size, alignment })); + } + + let mut results = Results::default(); + + for ((rust_name, rust_layout), (c_name, c_layout)) in + RUST_LAYOUTS.iter().zip(c_layouts.iter()) + { + if rust_name != c_name { + results.record_failed(); + eprintln!("Name mismatch:\nRust: {rust_name:?}\nC: {c_name:?}"); + continue; + } + + if rust_layout != c_layout { + results.record_failed(); + eprintln!( + "Layout mismatch for {rust_name}\nRust: {rust_layout:?}\nC: {c_layout:?}", + ); + continue; + } + + results.record_passed(); + } + + results.expect_total_success(); +} + +fn get_c_output(name: &str) -> Result> { + let tmpdir = Builder::new().prefix("abi").tempdir()?; + let exe = tmpdir.path().join(name); + let c_file = Path::new("tests").join(name).with_extension("c"); + + let cc = Compiler::new().expect("configured compiler"); + cc.compile(&c_file, &exe)?; + + let mut cmd = Command::new(exe); + cmd.stderr(Stdio::inherit()); + let out = cmd.output()?; + if !out.status.success() { + let (status, stdout) = (out.status, String::from_utf8_lossy(&out.stdout)); + return Err(format!("command {cmd:?} failed, {status:?}\nstdout: {stdout}").into()); + } + + Ok(String::from_utf8(out.stdout)?) +} + +const RUST_LAYOUTS: &[(&str, Layout)] = &[ + ("ZyppContextClass", Layout {size: size_of::(), alignment: align_of::()}), + ("ZyppException", Layout {size: size_of::(), alignment: align_of::()}), + ("ZyppExpectedClass", Layout {size: size_of::(), alignment: align_of::()}), + ("ZyppInfoBaseInterface", Layout {size: size_of::(), alignment: align_of::()}), + ("ZyppProgressObserverClass", Layout {size: size_of::(), alignment: align_of::()}), + ("ZyppRepoInfoClass", Layout {size: size_of::(), alignment: align_of::()}), + ("ZyppRepoInfoType", Layout {size: size_of::(), alignment: align_of::()}), + ("ZyppRepoManagerClass", Layout {size: size_of::(), alignment: align_of::()}), + ("ZyppRepoManagerError", Layout {size: size_of::(), alignment: align_of::()}), + ("ZyppRepoRefreshResult", Layout {size: size_of::(), alignment: align_of::()}), + ("ZyppRepositoryClass", Layout {size: size_of::(), alignment: align_of::()}), + ("ZyppServiceInfoClass", Layout {size: size_of::(), alignment: align_of::()}), +]; + +const RUST_CONSTANTS: &[(&str, &str)] = &[ + ("(gint) ZYPP_ERROR", "0"), + ("(gint) ZYPP_REPO_MANAGER_ERROR_REF_ABORTED", "2"), + ("(gint) ZYPP_REPO_MANAGER_ERROR_REF_FAILED", "0"), + ("(gint) ZYPP_REPO_MANAGER_ERROR_REF_SKIPPED", "1"), + ("(gint) ZYPP_REPO_MANAGER_REFRESHED", "1"), + ("(gint) ZYPP_REPO_MANAGER_UP_TO_DATE", "0"), + ("(gint) ZYPP_REPO_NONE", "0"), + ("(gint) ZYPP_REPO_RPMMD", "1"), + ("(gint) ZYPP_REPO_RPMPLAINDIR", "3"), + ("(gint) ZYPP_REPO_YAST2", "2"), +]; + + diff --git a/rust/libzypp/zypp-sys/tests/constant.c b/rust/libzypp/zypp-sys/tests/constant.c new file mode 100644 index 0000000000..9dc0dafaaa --- /dev/null +++ b/rust/libzypp/zypp-sys/tests/constant.c @@ -0,0 +1,42 @@ +// This file was generated by gir (https://github.com/gtk-rs/gir) +// from ../gir-files +// DO NOT EDIT + +#include "manual.h" +#include + +#define PRINT_CONSTANT(CONSTANT_NAME) \ + printf("%s;", #CONSTANT_NAME); \ + printf(_Generic((CONSTANT_NAME), \ + char *: "%s", \ + const char *: "%s", \ + char: "%c", \ + signed char: "%hhd", \ + unsigned char: "%hhu", \ + short int: "%hd", \ + unsigned short int: "%hu", \ + int: "%d", \ + unsigned int: "%u", \ + long: "%ld", \ + unsigned long: "%lu", \ + long long: "%lld", \ + unsigned long long: "%llu", \ + float: "%f", \ + double: "%f", \ + long double: "%ld"), \ + CONSTANT_NAME); \ + printf("\n"); + +int main() { + PRINT_CONSTANT((gint) ZYPP_ERROR); + PRINT_CONSTANT((gint) ZYPP_REPO_MANAGER_ERROR_REF_ABORTED); + PRINT_CONSTANT((gint) ZYPP_REPO_MANAGER_ERROR_REF_FAILED); + PRINT_CONSTANT((gint) ZYPP_REPO_MANAGER_ERROR_REF_SKIPPED); + PRINT_CONSTANT((gint) ZYPP_REPO_MANAGER_REFRESHED); + PRINT_CONSTANT((gint) ZYPP_REPO_MANAGER_UP_TO_DATE); + PRINT_CONSTANT((gint) ZYPP_REPO_NONE); + PRINT_CONSTANT((gint) ZYPP_REPO_RPMMD); + PRINT_CONSTANT((gint) ZYPP_REPO_RPMPLAINDIR); + PRINT_CONSTANT((gint) ZYPP_REPO_YAST2); + return 0; +} diff --git a/rust/libzypp/zypp-sys/tests/layout.c b/rust/libzypp/zypp-sys/tests/layout.c new file mode 100644 index 0000000000..f966a709ce --- /dev/null +++ b/rust/libzypp/zypp-sys/tests/layout.c @@ -0,0 +1,23 @@ +// This file was generated by gir (https://github.com/gtk-rs/gir) +// from ../gir-files +// DO NOT EDIT + +#include "manual.h" +#include +#include + +int main() { + printf("%s;%zu;%zu\n", "ZyppContextClass", sizeof(ZyppContextClass), alignof(ZyppContextClass)); + printf("%s;%zu;%zu\n", "ZyppException", sizeof(ZyppException), alignof(ZyppException)); + printf("%s;%zu;%zu\n", "ZyppExpectedClass", sizeof(ZyppExpectedClass), alignof(ZyppExpectedClass)); + printf("%s;%zu;%zu\n", "ZyppInfoBaseInterface", sizeof(ZyppInfoBaseInterface), alignof(ZyppInfoBaseInterface)); + printf("%s;%zu;%zu\n", "ZyppProgressObserverClass", sizeof(ZyppProgressObserverClass), alignof(ZyppProgressObserverClass)); + printf("%s;%zu;%zu\n", "ZyppRepoInfoClass", sizeof(ZyppRepoInfoClass), alignof(ZyppRepoInfoClass)); + printf("%s;%zu;%zu\n", "ZyppRepoInfoType", sizeof(ZyppRepoInfoType), alignof(ZyppRepoInfoType)); + printf("%s;%zu;%zu\n", "ZyppRepoManagerClass", sizeof(ZyppRepoManagerClass), alignof(ZyppRepoManagerClass)); + printf("%s;%zu;%zu\n", "ZyppRepoManagerError", sizeof(ZyppRepoManagerError), alignof(ZyppRepoManagerError)); + printf("%s;%zu;%zu\n", "ZyppRepoRefreshResult", sizeof(ZyppRepoRefreshResult), alignof(ZyppRepoRefreshResult)); + printf("%s;%zu;%zu\n", "ZyppRepositoryClass", sizeof(ZyppRepositoryClass), alignof(ZyppRepositoryClass)); + printf("%s;%zu;%zu\n", "ZyppServiceInfoClass", sizeof(ZyppServiceInfoClass), alignof(ZyppServiceInfoClass)); + return 0; +} diff --git a/rust/libzypp/zypp-sys/tests/manual.h b/rust/libzypp/zypp-sys/tests/manual.h new file mode 100644 index 0000000000..58483535e0 --- /dev/null +++ b/rust/libzypp/zypp-sys/tests/manual.h @@ -0,0 +1,3 @@ +// Feel free to edit this file, it won't be regenerated by gir generator unless removed. + +#include From 5e0fd0ea3cc98ffe4754c5f2cb55a11153e27790 Mon Sep 17 00:00:00 2001 From: Josef Reidinger Date: Fri, 13 Sep 2024 08:33:49 +0200 Subject: [PATCH 02/30] fix build of Context --- rust/Cargo.lock | 596 ++++++++++++++++++++++------------------ rust/libzypp/Cargo.toml | 2 +- rust/libzypp/src/lib.rs | 2 + 3 files changed, 330 insertions(+), 270 deletions(-) diff --git a/rust/Cargo.lock b/rust/Cargo.lock index 2299968ef4..cab7e1162d 100644 --- a/rust/Cargo.lock +++ b/rust/Cargo.lock @@ -4,18 +4,18 @@ version = 3 [[package]] name = "addr2line" -version = "0.22.0" +version = "0.24.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e4503c46a5c0c7844e948c9a4d6acd9f50cccb4de1c48eb9e291ea17470c678" +checksum = "f5fb1d8e4442bd405fdfd1dacb42792696b0cf9cb15882e5d097b742a676d375" dependencies = [ "gimli", ] [[package]] -name = "adler" -version = "1.0.2" +name = "adler2" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" +checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627" [[package]] name = "agama-cli" @@ -59,7 +59,7 @@ dependencies = [ "jsonschema", "jsonwebtoken", "log", - "reqwest 0.12.5", + "reqwest 0.12.7", "serde", "serde_json", "serde_repr", @@ -241,9 +241,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.86" +version = "1.0.88" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" +checksum = "4e1496f8fb1fbf272686b8d37f523dab3e4a7443300055e74cdaa449f3114356" [[package]] name = "ascii-canvas" @@ -322,13 +322,13 @@ dependencies = [ [[package]] name = "async-executor" -version = "1.13.0" +version = "1.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7ebdfa2ebdab6b1760375fa7d6f382b9f486eac35fc994625a00e89280bdbb7" +checksum = "30ca9a001c1e8ba5149f91a74362376cc6bc5b919d92d988668657bd570bdcec" dependencies = [ "async-task", "concurrent-queue", - "fastrand 2.1.0", + "fastrand 2.1.1", "futures-lite 2.3.0", "slab", ] @@ -341,7 +341,7 @@ checksum = "05b1b633a2115cd122d73b955eadd9916c18c8f510ec9cd1686404c60ad1c29c" dependencies = [ "async-channel 2.3.1", "async-executor", - "async-io 2.3.3", + "async-io 2.3.4", "async-lock 3.4.0", "blocking", "futures-lite 2.3.0", @@ -370,9 +370,9 @@ dependencies = [ [[package]] name = "async-io" -version = "2.3.3" +version = "2.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d6baa8f0178795da0e71bc42c9e5d13261aac7ee549853162e66a241ba17964" +checksum = "444b0228950ee6501b3568d3c93bf1176a1fdbc3b758dcd9475046d30f4dc7e8" dependencies = [ "async-lock 3.4.0", "cfg-if", @@ -380,11 +380,11 @@ dependencies = [ "futures-io", "futures-lite 2.3.0", "parking", - "polling 3.7.2", - "rustix 0.38.34", + "polling 3.7.3", + "rustix 0.38.37", "slab", "tracing", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -409,9 +409,9 @@ dependencies = [ [[package]] name = "async-object-pool" -version = "0.1.4" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aeb901c30ebc2fc4ab46395bbfbdba9542c16559d853645d75190c3056caf3bc" +checksum = "333c456b97c3f2d50604e8b2624253b7f787208cb72eb75e64b0ad11b221652c" dependencies = [ "async-std", ] @@ -429,10 +429,30 @@ dependencies = [ "cfg-if", "event-listener 3.1.0", "futures-lite 1.13.0", - "rustix 0.38.34", + "rustix 0.38.37", "windows-sys 0.48.0", ] +[[package]] +name = "async-process" +version = "2.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8a07789659a4d385b79b18b9127fc27e1a59e1e89117c78c5ea3b806f016374" +dependencies = [ + "async-channel 2.3.1", + "async-io 2.3.4", + "async-lock 3.4.0", + "async-signal", + "async-task", + "blocking", + "cfg-if", + "event-listener 5.3.1", + "futures-lite 2.3.0", + "rustix 0.38.37", + "tracing", + "windows-sys 0.59.0", +] + [[package]] name = "async-recursion" version = "1.1.1" @@ -441,44 +461,44 @@ checksum = "3b43422f69d8ff38f95f1b2bb76517c91589a924d1559a0e935d7c8ce0274c11" dependencies = [ "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.77", ] [[package]] name = "async-signal" -version = "0.2.9" +version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfb3634b73397aa844481f814fad23bbf07fdb0eabec10f2eb95e58944b1ec32" +checksum = "637e00349800c0bdf8bfc21ebbc0b6524abea702b0da4168ac00d070d0c0b9f3" dependencies = [ - "async-io 2.3.3", + "async-io 2.3.4", "async-lock 3.4.0", "atomic-waker", "cfg-if", "futures-core", "futures-io", - "rustix 0.38.34", + "rustix 0.38.37", "signal-hook-registry", "slab", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] name = "async-std" -version = "1.12.0" +version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62565bb4402e926b29953c785397c6dc0391b7b446e45008b0049eb43cec6f5d" +checksum = "c634475f29802fde2b8f0b505b1bd00dfe4df7d4a000f0b36f7671197d5c3615" dependencies = [ "async-attributes", "async-channel 1.9.0", "async-global-executor", - "async-io 1.13.0", - "async-lock 2.8.0", - "async-process", + "async-io 2.3.4", + "async-lock 3.4.0", + "async-process 2.2.4", "crossbeam-utils", "futures-channel", "futures-core", "futures-io", - "futures-lite 1.13.0", + "futures-lite 2.3.0", "gloo-timers", "kv-log-macro", "log", @@ -509,7 +529,7 @@ checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193" dependencies = [ "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.77", ] [[package]] @@ -520,13 +540,13 @@ checksum = "8b75356056920673b02621b35afd0f7dda9306d03c79a30f5c56c44cf256e3de" [[package]] name = "async-trait" -version = "0.1.81" +version = "0.1.82" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e0c28dcc82d7c8ead5cb13beb15405b57b8546e93215673ff8ca0349a028107" +checksum = "a27b8a3a6e1a44fa4c8baf1f653e4172e81486d4941f2237e20dc2d0cf4ddff1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.77", ] [[package]] @@ -625,17 +645,17 @@ dependencies = [ [[package]] name = "backtrace" -version = "0.3.73" +version = "0.3.74" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cc23269a4f8976d0a4d2e7109211a419fe30e8d88d677cd60b6bc79c5732e0a" +checksum = "8d82cb332cdfaed17ae235a638438ac4d4839913cc2af585c3c6746e8f8bee1a" dependencies = [ "addr2line", - "cc", "cfg-if", "libc", "miniz_oxide", "object", "rustc-demangle", + "windows-targets 0.52.6", ] [[package]] @@ -684,7 +704,7 @@ dependencies = [ "regex", "rustc-hash", "shlex", - "syn 2.0.72", + "syn 2.0.77", ] [[package]] @@ -786,15 +806,18 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" -version = "1.6.1" +version = "1.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a12916984aab3fa6e39d655a33e09c0071eb36d6ab3aea5c2d78551f1df6d952" +checksum = "8318a53db07bb3f8dca91a600466bdb3f2eaadeedfdbcf02e1accbad9271ba50" [[package]] name = "cc" -version = "1.1.7" +version = "1.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26a5c3fd7bfa1ce3897a3a3501d362b2d87b7f2583ebcb4a949ec25911025cbc" +checksum = "b62ac837cdb5cb22e10a256099b4fc502b1dfe560cb282963a974d7abd80e476" +dependencies = [ + "shlex", +] [[package]] name = "cexpr" @@ -877,9 +900,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.11" +version = "4.5.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35723e6a11662c2afb578bcf0b88bf6ea8e21282a953428f240574fcc3a2b5b3" +checksum = "3e5a21b8495e732f1b3c364c9949b201ca7bae518c502c80256c96ad79eaf6ac" dependencies = [ "clap_builder", "clap_derive", @@ -887,9 +910,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.11" +version = "4.5.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49eb96cbfa7cfa35017b7cd548c75b14c3118c98b423041d70562665e07fb0fa" +checksum = "8cf2dd12af7a047ad9d6da2b6b249759a22a7abc0f474c1dae1777afa4b21a73" dependencies = [ "anstream", "anstyle", @@ -900,14 +923,14 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.5.11" +version = "4.5.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d029b67f89d30bbb547c89fd5161293c0aec155fc691d7924b64550662db93e" +checksum = "501d359d5f3dcaf6ecdeee48833ae73ec6e42723a1e52419c79abf9507eec0a0" dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.77", ] [[package]] @@ -1033,15 +1056,15 @@ dependencies = [ [[package]] name = "core-foundation-sys" -version = "0.8.6" +version = "0.8.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" [[package]] name = "cpufeatures" -version = "0.2.12" +version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53fe5e26ff1b7aef8bca9c6080520cfb8d9333c7568e1829cef191a9723e5504" +checksum = "608697df725056feaccfa42cffdaeeec3fccc4ffc38358ecd19b243e716a78e0" dependencies = [ "libc", ] @@ -1119,9 +1142,9 @@ dependencies = [ [[package]] name = "curl-sys" -version = "0.4.73+curl-8.8.0" +version = "0.4.75+curl-8.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "450ab250ecf17227c39afb9a2dd9261dc0035cb80f2612472fc0c4aac2dcb84d" +checksum = "2a4fd752d337342e4314717c0d9b6586b059a120c80029ebe4d49b11fec7875e" dependencies = [ "cc", "libc", @@ -1153,7 +1176,7 @@ dependencies = [ "proc-macro2", "quote", "strsim", - "syn 2.0.72", + "syn 2.0.77", ] [[package]] @@ -1164,7 +1187,7 @@ checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" dependencies = [ "darling_core", "quote", - "syn 2.0.72", + "syn 2.0.77", ] [[package]] @@ -1289,7 +1312,7 @@ checksum = "de0d48a183585823424a4ce1aa132d174a6a81bd540895822eb4c8373a8e49e8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.77", ] [[package]] @@ -1390,9 +1413,9 @@ dependencies = [ [[package]] name = "fastrand" -version = "2.1.0" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fc0510504f03c51ada170672ac806f1f105a88aa97a5281117e1ddc3368e51a" +checksum = "e8c02a5121d4ea3eb16a80748c74f5549a5665e4c21333c6098f283870fbdea6" [[package]] name = "fixedbitset" @@ -1402,9 +1425,9 @@ checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80" [[package]] name = "flate2" -version = "1.0.30" +version = "1.0.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f54427cfd1c7829e2a139fcefea601bf088ebca651d2bf53ebc600eac295dae" +checksum = "324a1be68054ef05ad64b861cc9eaf1d623d2d8cb25b4bf2cb9cdd902b4bf253" dependencies = [ "crc32fast", "miniz_oxide", @@ -1509,7 +1532,7 @@ version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "52527eb5074e35e9339c6b4e8d12600c7128b68fb25dcb9fa9dec18f7c25f3a5" dependencies = [ - "fastrand 2.1.0", + "fastrand 2.1.1", "futures-core", "futures-io", "parking", @@ -1524,7 +1547,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.77", ] [[package]] @@ -1598,9 +1621,9 @@ dependencies = [ [[package]] name = "gettext-rs" -version = "0.7.0" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e49ea8a8fad198aaa1f9655a2524b64b70eb06b2f3ff37da407566c93054f364" +checksum = "4a6716b8a0db461a2720b850ba1623e5b69e4b1aa0224cf5e1fb23a0fe49e65c" dependencies = [ "gettext-sys", "locale_config", @@ -1608,9 +1631,9 @@ dependencies = [ [[package]] name = "gettext-sys" -version = "0.21.3" +version = "0.21.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c63ce2e00f56a206778276704bbe38564c8695249fdc8f354b4ef71c57c3839d" +checksum = "f7b8797f28f2dabfbe2caadb6db4f7fd739e251b5ede0a2ba49e506071edcf67" dependencies = [ "cc", "temp-dir", @@ -1618,28 +1641,26 @@ dependencies = [ [[package]] name = "gimli" -version = "0.29.0" +version = "0.31.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40ecd4077b5ae9fd2e9e169b102c6c330d0605168eb0e8bf79952b256dbefffd" +checksum = "32085ea23f3234fc7846555e85283ba4de91e21016dc0455a16286d87a292d64" [[package]] name = "gio-sys" -version = "0.20.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5237611e97e9b86ab5768adc3eef853ae713ea797aa3835404acdfacffc9fb38" +version = "0.21.0" +source = "git+https://github.com/gtk-rs/gtk-rs-core#d34db6baf53bda50c65af02d9493d536087d2cf4" dependencies = [ - "glib-sys 0.20.2", - "gobject-sys 0.20.1", + "glib-sys", + "gobject-sys", "libc", "system-deps", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] name = "glib" -version = "0.20.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95648aac01b75503000bb3bcaa5ec7a7a2dd61e43636b8b1814854de94dd80e4" +version = "0.21.0" +source = "git+https://github.com/gtk-rs/gtk-rs-core#d34db6baf53bda50c65af02d9493d536087d2cf4" dependencies = [ "bitflags 2.6.0", "futures-channel", @@ -1649,8 +1670,8 @@ dependencies = [ "futures-util", "gio-sys", "glib-macros", - "glib-sys 0.20.2", - "gobject-sys 0.20.1", + "glib-sys", + "gobject-sys", "libc", "memchr", "smallvec", @@ -1658,25 +1679,14 @@ dependencies = [ [[package]] name = "glib-macros" -version = "0.20.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "302f1d633c9cdef4350330e7b68fd8016e2834bb106c93fdf9789fcde753c1ab" +version = "0.21.0" +source = "git+https://github.com/gtk-rs/gtk-rs-core#d34db6baf53bda50c65af02d9493d536087d2cf4" dependencies = [ "heck", "proc-macro-crate 3.2.0", "proc-macro2", "quote", - "syn 2.0.72", -] - -[[package]] -name = "glib-sys" -version = "0.20.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92eee4531c1c9abba945d19378b205031b5890e1f99c319ba0503b6e0c06a163" -dependencies = [ - "libc", - "system-deps", + "syn 2.0.77", ] [[package]] @@ -1696,9 +1706,9 @@ checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" [[package]] name = "gloo-timers" -version = "0.2.6" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b995a66bb87bebce9a0f4a95aed01daca4872c050bfcb21653361c03bc35e5c" +checksum = "bbb143cf96099802033e0d4f4963b19fd2e0b728bcf076cd9cf7f6634f092994" dependencies = [ "futures-channel", "futures-core", @@ -1706,23 +1716,12 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "gobject-sys" -version = "0.20.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa3d1dcd8a1eb2e7c22be3d5e792b14b186f3524f79b25631730f9a8c169d49a" -dependencies = [ - "glib-sys 0.20.2", - "libc", - "system-deps", -] - [[package]] name = "gobject-sys" version = "0.21.0" source = "git+https://github.com/gtk-rs/gtk-rs-core#d34db6baf53bda50c65af02d9493d536087d2cf4" dependencies = [ - "glib-sys 0.21.0", + "glib-sys", "libc", "system-deps", ] @@ -1739,7 +1738,7 @@ dependencies = [ "futures-sink", "futures-util", "http 0.2.12", - "indexmap 2.2.6", + "indexmap 2.5.0", "slab", "tokio", "tokio-util", @@ -1748,9 +1747,9 @@ dependencies = [ [[package]] name = "h2" -version = "0.4.5" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa82e28a107a8cc405f0839610bdc9b15f1e25ec7d696aa5cf173edbcb1486ab" +checksum = "524e8ac6999421f49a846c2d4411f337e53497d8ec55d67753beffa43c5d9205" dependencies = [ "atomic-waker", "bytes", @@ -1758,7 +1757,7 @@ dependencies = [ "futures-core", "futures-sink", "http 1.1.0", - "indexmap 2.2.6", + "indexmap 2.5.0", "slab", "tokio", "tokio-util", @@ -1990,7 +1989,7 @@ dependencies = [ "bytes", "futures-channel", "futures-util", - "h2 0.4.5", + "h2 0.4.6", "http 1.1.0", "http-body 1.0.1", "httparse", @@ -2004,9 +2003,9 @@ dependencies = [ [[package]] name = "hyper-rustls" -version = "0.27.2" +version = "0.27.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ee4be2c948921a1a5320b629c4193916ed787a7f7f293fd3f7f5a6c9de74155" +checksum = "08afdbb5c31130e3034af566421053ab03787c640246a446327f550d11bcb333" dependencies = [ "futures-util", "http 1.1.0", @@ -2050,9 +2049,9 @@ dependencies = [ [[package]] name = "hyper-util" -version = "0.1.6" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ab92f4f49ee4fb4f997c784b7a2e0fa70050211e0b6a287f898c3c9785ca956" +checksum = "da62f120a8a37763efb0cf8fdf264b884c7b8b9ac8660b900c8661030c00e6ba" dependencies = [ "bytes", "futures-channel", @@ -2130,9 +2129,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.2.6" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26" +checksum = "68b900aa2f7301e21c36462b170ee99994de34dff39a4a6a528e80e7376d07e5" dependencies = [ "equivalent", "hashbrown 0.14.5", @@ -2190,9 +2189,9 @@ dependencies = [ [[package]] name = "ipnet" -version = "2.9.0" +version = "2.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3" +checksum = "187674a687eed5fe42285b40c6291f9a01517d415fad1c3cbc6a9f778af7fcd4" [[package]] name = "is_terminal_polyfill" @@ -2235,9 +2234,9 @@ checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" [[package]] name = "js-sys" -version = "0.3.69" +version = "0.3.70" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29c15563dc2726973df627357ce0c9ddddbea194836909d655df6a75d2cf296d" +checksum = "1868808506b929d7b0cfa8f75951347aa71bb21144b7791bae35d9bccfcfe37a" dependencies = [ "wasm-bindgen", ] @@ -2355,9 +2354,9 @@ checksum = "db13adb97ab515a3691f56e4dbab09283d0b86cb45abd991d8634a9d6f501760" [[package]] name = "libc" -version = "0.2.155" +version = "0.2.158" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" +checksum = "d8adc4bb1803a324070e64a98ae98f38934d91957a99cfb3a43dcbc01bc56439" [[package]] name = "libredox" @@ -2389,9 +2388,9 @@ dependencies = [ [[package]] name = "libz-sys" -version = "1.1.18" +version = "1.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c15da26e5af7e25c90b37a2d75cdbf940cf4a55316de9d84c679c9b8bfabf82e" +checksum = "d2d16453e800a8cf6dd2fc3eb4bc99b786a9b90c663b8559a5b1a041bf89e472" dependencies = [ "cc", "libc", @@ -2530,11 +2529,11 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" [[package]] name = "miniz_oxide" -version = "0.7.4" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8a240ddb74feaf34a79a7add65a741f3167852fba007066dcac1ca548d89c08" +checksum = "e2d80299ef12ff69b16a84bb182e3b9df68b5a91574d3d4fa6e41b65deec4df1" dependencies = [ - "adler", + "adler2", ] [[package]] @@ -2551,9 +2550,9 @@ dependencies = [ [[package]] name = "mio" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4569e456d394deccd22ce1c1913e6ea0e54519f577285001215d33557431afe4" +checksum = "80e04d1dcff3aae0704555fe5fee3bcfaf3d1fdf8a7e521d5b9d2b42acb52cec" dependencies = [ "hermit-abi 0.3.9", "libc", @@ -2759,9 +2758,9 @@ dependencies = [ [[package]] name = "object" -version = "0.36.2" +version = "0.36.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f203fa8daa7bb185f760ae12bd8e097f63d17041dcdcaf675ac54cdf863170e" +checksum = "084f1a5821ac4c651660a94a7153d27ac9d8a53736203f58b31945ded098070a" dependencies = [ "memchr", ] @@ -2795,7 +2794,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.77", ] [[package]] @@ -2878,9 +2877,9 @@ dependencies = [ [[package]] name = "parking" -version = "2.2.0" +version = "2.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb813b8af86854136c6922af0598d719255ecb2179515e6e7730d468f05c9cae" +checksum = "f38d5652c16fde515bb1ecef450ab0f6a219d619a7274976324d5e377f7dceba" [[package]] name = "parking_lot" @@ -2938,9 +2937,9 @@ checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" [[package]] name = "pest" -version = "2.7.11" +version = "2.7.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd53dff83f26735fdc1ca837098ccf133605d794cdae66acfc2bfac3ec809d95" +checksum = "9c73c26c01b8c87956cea613c907c9d6ecffd8d18a2a5908e5de0adfaa185cea" dependencies = [ "memchr", "thiserror", @@ -2949,9 +2948,9 @@ dependencies = [ [[package]] name = "pest_derive" -version = "2.7.11" +version = "2.7.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a548d2beca6773b1c244554d36fcf8548a8a58e74156968211567250e48e49a" +checksum = "664d22978e2815783adbdd2c588b455b1bd625299ce36b2a99881ac9627e6d8d" dependencies = [ "pest", "pest_generator", @@ -2959,22 +2958,22 @@ dependencies = [ [[package]] name = "pest_generator" -version = "2.7.11" +version = "2.7.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c93a82e8d145725dcbaf44e5ea887c8a869efdcc28706df2d08c69e17077183" +checksum = "a2d5487022d5d33f4c30d91c22afa240ce2a644e87fe08caad974d4eab6badbe" dependencies = [ "pest", "pest_meta", "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.77", ] [[package]] name = "pest_meta" -version = "2.7.11" +version = "2.7.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a941429fea7e08bedec25e4f6785b6ffaacc6b755da98df5ef3e7dcf4a124c4f" +checksum = "0091754bbd0ea592c4deb3a122ce8ecbb0753b738aa82bc055fcc2eccc8d8174" dependencies = [ "once_cell", "pest", @@ -2988,7 +2987,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b4c5cc86750666a3ed20bdaf5ca2a0344f9c67674cae0515bec2da16fbaa47db" dependencies = [ "fixedbitset", - "indexmap 2.2.6", + "indexmap 2.5.0", ] [[package]] @@ -3061,7 +3060,7 @@ checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" dependencies = [ "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.77", ] [[package]] @@ -3078,12 +3077,12 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "piper" -version = "0.2.3" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae1d5c74c9876f070d3e8fd503d748c7d974c3e48da8f41350fa5222ef9b4391" +checksum = "96c8c490f422ef9a4efd2cb5b42b76c8613d7e7dfc1caf667b8a3350a5acc066" dependencies = [ "atomic-waker", - "fastrand 2.1.0", + "fastrand 2.1.1", "futures-io", ] @@ -3111,17 +3110,17 @@ dependencies = [ [[package]] name = "polling" -version = "3.7.2" +version = "3.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3ed00ed3fbf728b5816498ecd316d1716eecaced9c0c8d2c5a6740ca214985b" +checksum = "cc2790cd301dec6cd3b7a025e4815cf825724a51c98dccfe6a3e55f05ffb6511" dependencies = [ "cfg-if", "concurrent-queue", "hermit-abi 0.4.0", "pin-project-lite", - "rustix 0.38.34", + "rustix 0.38.37", "tracing", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -3138,9 +3137,12 @@ checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" [[package]] name = "ppv-lite86" -version = "0.2.17" +version = "0.2.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" +checksum = "77957b295656769bb8ad2b6a6b09d897d94f05c41b069aede1fcdaa675eaea04" +dependencies = [ + "zerocopy", +] [[package]] name = "precomputed-hash" @@ -3228,9 +3230,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.36" +version = "1.0.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" +checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" dependencies = [ "proc-macro2", ] @@ -3267,18 +3269,18 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.5.3" +version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a908a6e00f1fdd0dfd9c0eb08ce85126f6d8bbda50017e74bc4a4b7d4a926a4" +checksum = "0884ad60e090bf1345b93da0a5de8923c93884cd03f40dfcfddd3b4bee661853" dependencies = [ "bitflags 2.6.0", ] [[package]] name = "redox_users" -version = "0.4.5" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd283d9651eeda4b2a83a43c1c91b266c40fd76ecd39a50a8c630ae69dc72891" +checksum = "ba009ff324d1fc1b900bd1fdb31564febe58a8ccc8a6fdbb93b543d33b13ca43" dependencies = [ "getrandom", "libredox", @@ -3287,9 +3289,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.10.5" +version = "1.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b91213439dad192326a0d7c6ee3955910425f441d7038e0d6933b0aec5c4517f" +checksum = "4219d74c6b67a3654a9fbebc4b419e22126d13d2f3c4a07ee0cb61ff79a79619" dependencies = [ "aho-corasick", "memchr", @@ -3343,7 +3345,7 @@ dependencies = [ "serde_json", "serde_urlencoded", "sync_wrapper 0.1.2", - "system-configuration", + "system-configuration 0.5.1", "tokio", "tokio-native-tls", "tower-service", @@ -3351,14 +3353,14 @@ dependencies = [ "wasm-bindgen", "wasm-bindgen-futures", "web-sys", - "winreg 0.50.0", + "winreg", ] [[package]] name = "reqwest" -version = "0.12.5" +version = "0.12.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7d6d2a27d57148378eb5e111173f4276ad26340ecc5c49a4a2152167a2d6a37" +checksum = "f8f4955649ef5c38cc7f9e8aa41761d48fb9677197daea9984dc54f56aad5e63" dependencies = [ "base64 0.22.1", "bytes", @@ -3367,7 +3369,7 @@ dependencies = [ "encoding_rs", "futures-core", "futures-util", - "h2 0.4.5", + "h2 0.4.6", "http 1.1.0", "http-body 1.0.1", "http-body-util", @@ -3383,12 +3385,12 @@ dependencies = [ "once_cell", "percent-encoding", "pin-project-lite", - "rustls-pemfile 2.1.2", + "rustls-pemfile 2.1.3", "serde", "serde_json", "serde_urlencoded", "sync_wrapper 1.0.1", - "system-configuration", + "system-configuration 0.6.1", "tokio", "tokio-native-tls", "tower-service", @@ -3396,7 +3398,7 @@ dependencies = [ "wasm-bindgen", "wasm-bindgen-futures", "web-sys", - "winreg 0.52.0", + "windows-registry", ] [[package]] @@ -3464,9 +3466,9 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.34" +version = "0.38.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f" +checksum = "8acb788b847c24f28525660c4d7758620a7210875711f79e7f663cc152726811" dependencies = [ "bitflags 2.6.0", "errno", @@ -3477,9 +3479,9 @@ dependencies = [ [[package]] name = "rustls" -version = "0.23.12" +version = "0.23.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c58f8c84392efc0a126acce10fa59ff7b3d2ac06ab451a33f2741989b806b044" +checksum = "f2dabaac7466917e566adb06783a81ca48944c6898a1b08b9374106dd671f4c8" dependencies = [ "once_cell", "rustls-pki-types", @@ -3499,9 +3501,9 @@ dependencies = [ [[package]] name = "rustls-pemfile" -version = "2.1.2" +version = "2.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29993a25686778eb88d4189742cd713c9bce943bc54251a33509dc63cbacf73d" +checksum = "196fe16b00e106300d3e45ecfcb764fa292a535d7326a29a5875c579c7417425" dependencies = [ "base64 0.22.1", "rustls-pki-types", @@ -3509,15 +3511,15 @@ dependencies = [ [[package]] name = "rustls-pki-types" -version = "1.7.0" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "976295e77ce332211c0d24d92c0e83e50f5c5f046d11082cea19f3df13a3562d" +checksum = "fc0a2ce646f8655401bb81e7927b812614bd5d91dbc968696be50603510fcaf0" [[package]] name = "rustls-webpki" -version = "0.102.6" +version = "0.102.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e6b52d4fda176fd835fdc55a835d4a89b8499cad995885a21149d5ad62f852e" +checksum = "64ca1bc8749bd4cf37b5ce386cc146580777b4e8572c7b97baf22c83f444bee9" dependencies = [ "ring", "rustls-pki-types", @@ -3547,11 +3549,11 @@ dependencies = [ [[package]] name = "schannel" -version = "0.1.23" +version = "0.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbc91545643bcf3a0bbb6569265615222618bdf33ce4ffbbd13c4bbd4c093534" +checksum = "e9aaafd5a2b6e3d657ff009d82fbd630b6bd54dd4eb06f21693925cdf80f9b8b" dependencies = [ - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -3591,29 +3593,29 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.204" +version = "1.0.210" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc76f558e0cbb2a839d37354c575f1dc3fdc6546b5be373ba43d95f231bf7c12" +checksum = "c8e3592472072e6e22e0a54d5904d9febf8508f65fb8552499a1abc7d1078c3a" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.204" +version = "1.0.210" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0cd7e117be63d3c3678776753929474f3b04a43a080c744d6b0ae2a8c28e222" +checksum = "243902eda00fad750862fc144cea25caca5e20d615af0a81bee94ca738f1df1f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.77", ] [[package]] name = "serde_json" -version = "1.0.121" +version = "1.0.128" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ab380d7d9f22ef3f21ad3e6c1ebe8e4fc7a2000ccba2e4d71fc96f15b2cb609" +checksum = "6ff5456707a1de34e7e37f2a6fd3d3f808c318259cbd01ab6377795054b483d8" dependencies = [ "itoa", "memchr", @@ -3649,7 +3651,7 @@ checksum = "6c64451ba24fc7a6a2d60fc75dd9c83c90903b19028d4eff35e88fc1e86564e9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.77", ] [[package]] @@ -3683,7 +3685,7 @@ dependencies = [ "chrono", "hex", "indexmap 1.9.3", - "indexmap 2.2.6", + "indexmap 2.5.0", "serde", "serde_derive", "serde_json", @@ -3700,7 +3702,7 @@ dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.77", ] [[package]] @@ -3709,7 +3711,7 @@ version = "0.9.34+deprecated" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6a8b1a1a2ebf674015cc02edccce75287f1a0130d394307b36743c2f5d504b47" dependencies = [ - "indexmap 2.2.6", + "indexmap 2.5.0", "itoa", "ryu", "serde", @@ -3908,9 +3910,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.72" +version = "2.0.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc4b9b9bf2add8093d3f2c0204471e951b2285580335de42f9d2534f3ae7a8af" +checksum = "9f35bcdf61fd8e7be6caf75f429fdca8beb3ed76584befb503b1569faee373ed" dependencies = [ "proc-macro2", "quote", @@ -3928,6 +3930,9 @@ name = "sync_wrapper" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a7065abeca94b6a8a577f9bd45aa0867a2238b74e8eb67cf10d492bc39351394" +dependencies = [ + "futures-core", +] [[package]] name = "system-configuration" @@ -3937,7 +3942,18 @@ checksum = "ba3a3adc5c275d719af8cb4272ea1c4a6d668a777f37e115f6d11ddbc1c8e0e7" dependencies = [ "bitflags 1.3.2", "core-foundation", - "system-configuration-sys", + "system-configuration-sys 0.5.0", +] + +[[package]] +name = "system-configuration" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c879d448e9d986b661742763247d3693ed13609438cf3d006f51f5368a5ba6b" +dependencies = [ + "bitflags 2.6.0", + "core-foundation", + "system-configuration-sys 0.6.0", ] [[package]] @@ -3950,6 +3966,16 @@ dependencies = [ "libc", ] +[[package]] +name = "system-configuration-sys" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e1d1b10ced5ca923a1fcb8d03e96b8d3268065d724548c0211415ff6ac6bac4" +dependencies = [ + "core-foundation-sys", + "libc", +] + [[package]] name = "system-deps" version = "7.0.2" @@ -3977,14 +4003,15 @@ checksum = "1f227968ec00f0e5322f9b8173c7a0cbcff6181a0a5b28e9892491c286277231" [[package]] name = "tempfile" -version = "3.10.1" +version = "3.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85b77fafb263dd9d05cbeac119526425676db3784113aa9295c88498cbf8bff1" +checksum = "04cbcdd0c794ebb0d4cf35e88edd2f7d2c4c3e9a5a6dab322839b321c6a87a64" dependencies = [ "cfg-if", - "fastrand 2.1.0", - "rustix 0.38.34", - "windows-sys 0.52.0", + "fastrand 2.1.1", + "once_cell", + "rustix 0.38.37", + "windows-sys 0.59.0", ] [[package]] @@ -4004,7 +4031,7 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "21bebf2b7c9e0a515f6e0f8c51dc0f8e4696391e6f1ff30379559f8365fb0df7" dependencies = [ - "rustix 0.38.34", + "rustix 0.38.37", "windows-sys 0.48.0", ] @@ -4025,7 +4052,7 @@ checksum = "a4558b58466b9ad7ca0f102865eccc95938dca1a74a856f2b57b6629050da261" dependencies = [ "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.77", ] [[package]] @@ -4095,14 +4122,14 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.39.2" +version = "1.40.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "daa4fb1bc778bd6f04cbfc4bb2d06a7396a8f299dc33ea1900cedaa316f467b1" +checksum = "e2b070231665d27ad9ec9b8df639893f46727666c6767db40317fbe920a5d998" dependencies = [ "backtrace", "bytes", "libc", - "mio 1.0.1", + "mio 1.0.2", "pin-project-lite", "signal-hook-registry", "socket2 0.5.7", @@ -4119,7 +4146,7 @@ checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" dependencies = [ "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.77", ] [[package]] @@ -4157,9 +4184,9 @@ dependencies = [ [[package]] name = "tokio-stream" -version = "0.1.15" +version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "267ac89e0bec6e691e5813911606935d77c476ff49024f98abcea3e7b15e37af" +checksum = "4f4e6ce100d0eb49a2734f8c0812bcd324cf357d21810932c5df6b96ef2b86f1" dependencies = [ "futures-core", "pin-project-lite", @@ -4193,9 +4220,9 @@ dependencies = [ [[package]] name = "tokio-util" -version = "0.7.11" +version = "0.7.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cf6b47b3771c49ac75ad09a6162f53ad4b8088b76ac60e8ec1455b31a189fe1" +checksum = "61e7c3654c13bcd040d4a03abee2c75b1d14a37b423cf5a813ceae1cc903ec6a" dependencies = [ "bytes", "futures-core", @@ -4206,9 +4233,9 @@ dependencies = [ [[package]] name = "toml" -version = "0.8.16" +version = "0.8.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81967dd0dd2c1ab0bc3468bd7caecc32b8a4aa47d0c8c695d8c2b2108168d62c" +checksum = "a1ed1f98e3fdc28d6d910e6737ae6ab1a93bf1985935a1193e68f93eeb68d24e" dependencies = [ "serde", "serde_spanned", @@ -4231,7 +4258,7 @@ version = "0.19.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" dependencies = [ - "indexmap 2.2.6", + "indexmap 2.5.0", "toml_datetime", "winnow 0.5.40", ] @@ -4242,7 +4269,7 @@ version = "0.22.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "583c44c02ad26b0c3f3066fe629275e50627026c51ac2e595cca4c230ce1ce1d" dependencies = [ - "indexmap 2.2.6", + "indexmap 2.5.0", "serde", "serde_spanned", "toml_datetime", @@ -4294,15 +4321,15 @@ dependencies = [ [[package]] name = "tower-layer" -version = "0.3.2" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c20c8dbed6283a09604c3e69b4b7eeb54e298b8a600d4d5ecb5ad39de609f1d0" +checksum = "121c2a6cda46980bb0fcd1647ffaf6cd3fc79a013de288782836f6df9c48780e" [[package]] name = "tower-service" -version = "0.3.2" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" +checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" [[package]] name = "tracing" @@ -4324,7 +4351,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.77", ] [[package]] @@ -4438,9 +4465,9 @@ checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75" [[package]] name = "unicode-ident" -version = "1.0.12" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" +checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" [[package]] name = "unicode-normalization" @@ -4465,9 +4492,9 @@ checksum = "0336d538f7abc86d282a4189614dfaa90810dfc2c6f6427eaf88e16311dd225d" [[package]] name = "unicode-xid" -version = "0.2.4" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" +checksum = "229730647fbc343e3a80e463c1db7f78f3855d3f3739bee0dda773c9a037c90a" [[package]] name = "unsafe-libyaml" @@ -4520,7 +4547,7 @@ version = "4.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c5afb1a60e207dca502682537fefcfd9921e71d0b83e9576060f09abc6efab23" dependencies = [ - "indexmap 2.2.6", + "indexmap 2.5.0", "serde", "serde_json", "utoipa-gen", @@ -4536,7 +4563,7 @@ dependencies = [ "proc-macro2", "quote", "regex", - "syn 2.0.72", + "syn 2.0.77", ] [[package]] @@ -4612,34 +4639,35 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.92" +version = "0.2.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4be2531df63900aeb2bca0daaaddec08491ee64ceecbee5076636a3b026795a8" +checksum = "a82edfc16a6c469f5f44dc7b571814045d60404b55a0ee849f9bcfa2e63dd9b5" dependencies = [ "cfg-if", + "once_cell", "wasm-bindgen-macro", ] [[package]] name = "wasm-bindgen-backend" -version = "0.2.92" +version = "0.2.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "614d787b966d3989fa7bb98a654e369c762374fd3213d212cfc0251257e747da" +checksum = "9de396da306523044d3302746f1208fa71d7532227f15e347e2d93e4145dd77b" dependencies = [ "bumpalo", "log", "once_cell", "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.77", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-futures" -version = "0.4.42" +version = "0.4.43" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76bc14366121efc8dbb487ab05bcc9d346b3b5ec0eaa76e46594cabbe51762c0" +checksum = "61e9300f63a621e96ed275155c108eb6f843b6a26d053f122ab69724559dc8ed" dependencies = [ "cfg-if", "js-sys", @@ -4649,9 +4677,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.92" +version = "0.2.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1f8823de937b71b9460c0c34e25f3da88250760bec0ebac694b49997550d726" +checksum = "585c4c91a46b072c92e908d99cb1dcdf95c5218eeb6f3bf1efa991ee7a68cccf" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -4659,28 +4687,28 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.92" +version = "0.2.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" +checksum = "afc340c74d9005395cf9dd098506f7f44e38f2b4a21c6aaacf9a105ea5e1e836" dependencies = [ "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.77", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.92" +version = "0.2.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96" +checksum = "c62a0a307cb4a311d3a07867860911ca130c3494e8c2719593806c08bc5d0484" [[package]] name = "web-sys" -version = "0.3.69" +version = "0.3.70" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77afa9a11836342370f4817622a2f0f418b134426d91a82dfb48f532d2ec13ef" +checksum = "26fdeaafd9bd129f65e7c031593c24d62186301e0c72c8978fa1678be7d532c0" dependencies = [ "js-sys", "wasm-bindgen", @@ -4704,11 +4732,11 @@ checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" [[package]] name = "winapi-util" -version = "0.1.8" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d4cc384e1e73b93bafa6fb4f1df8c41695c8a91cf9c4c64358067d15a7b6c6b" +checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" dependencies = [ - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -4726,6 +4754,36 @@ dependencies = [ "windows-targets 0.52.6", ] +[[package]] +name = "windows-registry" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e400001bb720a623c1c69032f8e3e4cf09984deec740f007dd2b03ec864804b0" +dependencies = [ + "windows-result", + "windows-strings", + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-result" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d1043d8214f791817bab27572aaa8af63732e11bf84aa21a45a78d6c317ae0e" +dependencies = [ + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-strings" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4cd9b125c486025df0eabcb585e62173c6c9eddcec5d117d3b6e8c30e2ee4d10" +dependencies = [ + "windows-result", + "windows-targets 0.52.6", +] + [[package]] name = "windows-sys" version = "0.48.0" @@ -4744,6 +4802,15 @@ dependencies = [ "windows-targets 0.52.6", ] +[[package]] +name = "windows-sys" +version = "0.59.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" +dependencies = [ + "windows-targets 0.52.6", +] + [[package]] name = "windows-targets" version = "0.48.5" @@ -4893,24 +4960,14 @@ dependencies = [ "windows-sys 0.48.0", ] -[[package]] -name = "winreg" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a277a57398d4bfa075df44f501a17cfdf8542d224f0d36095a2adc7aee4ef0a5" -dependencies = [ - "cfg-if", - "windows-sys 0.48.0", -] - [[package]] name = "xdg-home" -version = "1.2.0" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca91dcf8f93db085f3a0a29358cd0b9d670915468f4290e8b85d118a34211ab8" +checksum = "ec1cdab258fb55c0da61328dc52c8764709b249011b2cad0454c72f0bf10a1f6" dependencies = [ "libc", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -4929,7 +4986,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "675d170b632a6ad49804c8cf2105d7c31eddd3312555cffd4b740e08e97c25e6" dependencies = [ "async-broadcast", - "async-process", + "async-process 1.8.1", "async-recursion", "async-trait", "byteorder", @@ -4989,6 +5046,7 @@ version = "0.7.35" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" dependencies = [ + "byteorder", "zerocopy-derive", ] @@ -5000,7 +5058,7 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.77", ] [[package]] @@ -5051,8 +5109,8 @@ dependencies = [ name = "zypp-sys" version = "0.0.1" dependencies = [ - "glib-sys 0.21.0", - "gobject-sys 0.21.0", + "glib-sys", + "gobject-sys", "libc", "shell-words", "system-deps", diff --git a/rust/libzypp/Cargo.toml b/rust/libzypp/Cargo.toml index e54778e54f..aed7e62ff0 100644 --- a/rust/libzypp/Cargo.toml +++ b/rust/libzypp/Cargo.toml @@ -14,5 +14,5 @@ rustdoc-args = ["--cfg", "docsrs"] [dependencies] libc = "0.2" -glib = "0.20.3" ffi = { package = "zypp-sys", path = "./zypp-sys" } +glib = { git = "https://github.com/gtk-rs/gtk-rs-core" } diff --git a/rust/libzypp/src/lib.rs b/rust/libzypp/src/lib.rs index ed12f4a20f..dc1f8a1f49 100644 --- a/rust/libzypp/src/lib.rs +++ b/rust/libzypp/src/lib.rs @@ -1,4 +1,6 @@ #![cfg_attr(docsrs, feature(doc_cfg))] +pub use ffi; + pub use auto::*; mod auto; From e7e667a2c3f80ef28c7d5d8e8ea7436f016296be Mon Sep 17 00:00:00 2001 From: Josef Reidinger Date: Fri, 13 Sep 2024 09:27:17 +0200 Subject: [PATCH 03/30] add exceptions with TODO for init macro --- rust/libzypp/Gir.toml | 6 +- rust/libzypp/src/auto/enums.rs | 110 +++++++++++++++++++++++++++++++++ rust/libzypp/src/auto/mod.rs | 3 + rust/libzypp/src/lib.rs | 11 ++++ 4 files changed, 128 insertions(+), 2 deletions(-) create mode 100644 rust/libzypp/src/auto/enums.rs diff --git a/rust/libzypp/Gir.toml b/rust/libzypp/Gir.toml index 7cbc8a6488..e585e3296d 100644 --- a/rust/libzypp/Gir.toml +++ b/rust/libzypp/Gir.toml @@ -10,9 +10,11 @@ generate_safety_asserts = true deprecate_by_min_version = true generate = [ - "Zypp.Context" + "Zypp.Context", + "Zypp.Exception" ] manual = [ - "GLib.Error" + "GLib.Error", + "GLib.Quark" ] diff --git a/rust/libzypp/src/auto/enums.rs b/rust/libzypp/src/auto/enums.rs new file mode 100644 index 0000000000..5ed5de4f4a --- /dev/null +++ b/rust/libzypp/src/auto/enums.rs @@ -0,0 +1,110 @@ +// This file was generated by gir (https://github.com/gtk-rs/gir) +// from gir-files +// DO NOT EDIT + +use crate::{ffi}; +use glib::{prelude::*,translate::*}; + +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] +#[derive(Clone, Copy)] +#[non_exhaustive] +#[doc(alias = "ZyppException")] +pub enum Exception { + #[doc(alias = "ZYPP_ERROR")] + Error, +#[doc(hidden)] + __Unknown(i32), +} + +impl Exception { + #[doc(alias = "zypp_exception_quark")] + pub fn quark() -> glib::Quark { + assert_initialized_main_thread!(); + unsafe { + from_glib(ffi::zypp_exception_quark()) + } + } +} + +#[doc(hidden)] +impl IntoGlib for Exception { + type GlibType = ffi::ZyppException; + + #[inline] +fn into_glib(self) -> ffi::ZyppException { +match self { + Self::Error => ffi::ZYPP_ERROR, + Self::__Unknown(value) => value, +} +} +} + +#[doc(hidden)] +impl FromGlib for Exception { + #[inline] +unsafe fn from_glib(value: ffi::ZyppException) -> Self { + skip_assert_initialized!(); + +match value { + ffi::ZYPP_ERROR => Self::Error, + value => Self::__Unknown(value), +} +} +} + +impl StaticType for Exception { + #[inline] + #[doc(alias = "zypp_exception_get_type")] + fn static_type() -> glib::Type { + unsafe { from_glib(ffi::zypp_exception_get_type()) } + } + } + +impl glib::HasParamSpec for Exception { + type ParamSpec = glib::ParamSpecEnum; + type SetValue = Self; + type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder; + + fn param_spec_builder() -> Self::BuilderFn { + Self::ParamSpec::builder_with_default + } +} + +impl glib::value::ValueType for Exception { + type Type = Self; +} + +unsafe impl<'a> glib::value::FromValue<'a> for Exception { + type Checker = glib::value::GenericValueTypeChecker; + + #[inline] + unsafe fn from_value(value: &'a glib::Value) -> Self { + skip_assert_initialized!(); + from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0)) + } +} + +impl ToValue for Exception { + #[inline] + fn to_value(&self) -> glib::Value { + let mut value = glib::Value::for_value_type::(); + unsafe { + glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib()); + } + value + } + + #[inline] + fn value_type(&self) -> glib::Type { + Self::static_type() + } +} + +impl From for glib::Value { + #[inline] + fn from(v: Exception) -> Self { + skip_assert_initialized!(); + ToValue::to_value(&v) + } +} + diff --git a/rust/libzypp/src/auto/mod.rs b/rust/libzypp/src/auto/mod.rs index 926d31e748..9f6c02a410 100644 --- a/rust/libzypp/src/auto/mod.rs +++ b/rust/libzypp/src/auto/mod.rs @@ -5,3 +5,6 @@ mod context; pub use self::context::Context; +mod enums; +pub use self::enums::Exception; + diff --git a/rust/libzypp/src/lib.rs b/rust/libzypp/src/lib.rs index dc1f8a1f49..45400cc69e 100644 --- a/rust/libzypp/src/lib.rs +++ b/rust/libzypp/src/lib.rs @@ -2,5 +2,16 @@ pub use ffi; +/// No-op. +macro_rules! skip_assert_initialized { + () => {}; +} + +macro_rules! assert_initialized_main_thread { + () => { + // TODO: check how to verify that library is initialized + }; +} + pub use auto::*; mod auto; From 4f9f0e119d25a8202c21d927e6f7619c2b9a92b5 Mon Sep 17 00:00:00 2001 From: Josef Reidinger Date: Fri, 13 Sep 2024 12:44:37 +0200 Subject: [PATCH 04/30] add zypp expected --- rust/libzypp/Gir.toml | 6 ++-- rust/libzypp/src/auto/expected.rs | 58 +++++++++++++++++++++++++++++++ rust/libzypp/src/auto/mod.rs | 3 ++ 3 files changed, 65 insertions(+), 2 deletions(-) create mode 100644 rust/libzypp/src/auto/expected.rs diff --git a/rust/libzypp/Gir.toml b/rust/libzypp/Gir.toml index e585e3296d..700e4e3fec 100644 --- a/rust/libzypp/Gir.toml +++ b/rust/libzypp/Gir.toml @@ -11,10 +11,12 @@ deprecate_by_min_version = true generate = [ "Zypp.Context", - "Zypp.Exception" + "Zypp.Exception", + "Zypp.Expected" ] manual = [ "GLib.Error", - "GLib.Quark" + "GLib.Quark", + "GLib.Value" ] diff --git a/rust/libzypp/src/auto/expected.rs b/rust/libzypp/src/auto/expected.rs new file mode 100644 index 0000000000..54624dac2b --- /dev/null +++ b/rust/libzypp/src/auto/expected.rs @@ -0,0 +1,58 @@ +// This file was generated by gir (https://github.com/gtk-rs/gir) +// from gir-files +// DO NOT EDIT + +use crate::{ffi}; +use glib::{translate::*}; + +glib::wrapper! { + #[doc(alias = "ZyppExpected")] + pub struct Expected(Object); + + match fn { + type_ => || ffi::zypp_expected_get_type(), + } +} + +impl Expected { + #[doc(alias = "zypp_expected_new_error")] + pub fn new_error(error: &mut glib::Error) -> Expected { + assert_initialized_main_thread!(); + unsafe { + from_glib_full(ffi::zypp_expected_new_error(error.to_glib_none_mut().0)) + } + } + + //#[doc(alias = "zypp_expected_new_value")] + //pub fn new_value(value: /*Ignored*/&glib::Value) -> Expected { + // unsafe { TODO: call ffi:zypp_expected_new_value() } + //} + + #[doc(alias = "zypp_expected_get_error")] + #[doc(alias = "get_error")] + pub fn error(&self) -> Option { + unsafe { + from_glib_none(ffi::zypp_expected_get_error(self.to_glib_none().0)) + } + } + + //#[doc(alias = "zypp_expected_get_value")] + //#[doc(alias = "get_value")] + //pub fn value(&self) -> Result, glib::Error> { + // unsafe { TODO: call ffi:zypp_expected_get_value() } + //} + + #[doc(alias = "zypp_expected_has_error")] + pub fn has_error(&self) -> bool { + unsafe { + from_glib(ffi::zypp_expected_has_error(self.to_glib_none().0)) + } + } + + #[doc(alias = "zypp_expected_has_value")] + pub fn has_value(&self) -> bool { + unsafe { + from_glib(ffi::zypp_expected_has_value(self.to_glib_none().0)) + } + } +} diff --git a/rust/libzypp/src/auto/mod.rs b/rust/libzypp/src/auto/mod.rs index 9f6c02a410..15e9a333ba 100644 --- a/rust/libzypp/src/auto/mod.rs +++ b/rust/libzypp/src/auto/mod.rs @@ -5,6 +5,9 @@ mod context; pub use self::context::Context; +mod expected; +pub use self::expected::Expected; + mod enums; pub use self::enums::Exception; From d1c6e219798ec48832bb651c5df00f65fbf025e8 Mon Sep 17 00:00:00 2001 From: Josef Reidinger Date: Fri, 13 Sep 2024 12:55:02 +0200 Subject: [PATCH 05/30] fix expected generation --- rust/libzypp/Gir.toml | 5 +++-- rust/libzypp/src/auto/expected.rs | 25 ++++++++++++++++--------- 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/rust/libzypp/Gir.toml b/rust/libzypp/Gir.toml index 700e4e3fec..024066ad78 100644 --- a/rust/libzypp/Gir.toml +++ b/rust/libzypp/Gir.toml @@ -12,11 +12,12 @@ deprecate_by_min_version = true generate = [ "Zypp.Context", "Zypp.Exception", - "Zypp.Expected" + "Zypp.Expected", + "Zypp.*" ] manual = [ "GLib.Error", "GLib.Quark", - "GLib.Value" + "GObject.Value" ] diff --git a/rust/libzypp/src/auto/expected.rs b/rust/libzypp/src/auto/expected.rs index 54624dac2b..365a5a92f2 100644 --- a/rust/libzypp/src/auto/expected.rs +++ b/rust/libzypp/src/auto/expected.rs @@ -23,10 +23,13 @@ impl Expected { } } - //#[doc(alias = "zypp_expected_new_value")] - //pub fn new_value(value: /*Ignored*/&glib::Value) -> Expected { - // unsafe { TODO: call ffi:zypp_expected_new_value() } - //} + #[doc(alias = "zypp_expected_new_value")] + pub fn new_value(value: &glib::Value) -> Expected { + assert_initialized_main_thread!(); + unsafe { + from_glib_full(ffi::zypp_expected_new_value(value.to_glib_none().0)) + } + } #[doc(alias = "zypp_expected_get_error")] #[doc(alias = "get_error")] @@ -36,11 +39,15 @@ impl Expected { } } - //#[doc(alias = "zypp_expected_get_value")] - //#[doc(alias = "get_value")] - //pub fn value(&self) -> Result, glib::Error> { - // unsafe { TODO: call ffi:zypp_expected_get_value() } - //} + #[doc(alias = "zypp_expected_get_value")] + #[doc(alias = "get_value")] + pub fn value(&self) -> Result, glib::Error> { + unsafe { + let mut error = std::ptr::null_mut(); + let ret = ffi::zypp_expected_get_value(self.to_glib_none().0, &mut error); + if error.is_null() { Ok(from_glib_none(ret)) } else { Err(from_glib_full(error)) } + } + } #[doc(alias = "zypp_expected_has_error")] pub fn has_error(&self) -> bool { From 78367f4ab0c98f0c9e223b84cc2991e621bf7a98 Mon Sep 17 00:00:00 2001 From: Josef Reidinger Date: Fri, 13 Sep 2024 13:01:06 +0200 Subject: [PATCH 06/30] add zyp info base --- rust/libzypp/Gir.toml | 1 + rust/libzypp/src/auto/info_base.rs | 127 +++++++++++++++++++++++++++++ rust/libzypp/src/auto/mod.rs | 6 ++ 3 files changed, 134 insertions(+) create mode 100644 rust/libzypp/src/auto/info_base.rs diff --git a/rust/libzypp/Gir.toml b/rust/libzypp/Gir.toml index 024066ad78..ccaf8202b6 100644 --- a/rust/libzypp/Gir.toml +++ b/rust/libzypp/Gir.toml @@ -13,6 +13,7 @@ generate = [ "Zypp.Context", "Zypp.Exception", "Zypp.Expected", + "Zypp.InfoBase", "Zypp.*" ] diff --git a/rust/libzypp/src/auto/info_base.rs b/rust/libzypp/src/auto/info_base.rs new file mode 100644 index 0000000000..ca12b6089c --- /dev/null +++ b/rust/libzypp/src/auto/info_base.rs @@ -0,0 +1,127 @@ +// This file was generated by gir (https://github.com/gtk-rs/gir) +// from gir-files +// DO NOT EDIT + +use crate::{ffi}; +use glib::{prelude::*,translate::*}; + +glib::wrapper! { + #[doc(alias = "ZyppInfoBase")] + pub struct InfoBase(Interface); + + match fn { + type_ => || ffi::zypp_info_base_get_type(), + } +} + +impl InfoBase { + pub const NONE: Option<&'static InfoBase> = None; + +} + +mod sealed { + pub trait Sealed {} + impl> Sealed for T {} +} + +pub trait InfoBaseExt: IsA + sealed::Sealed + 'static { + #[doc(alias = "zypp_info_base_alias")] + fn alias(&self) -> Option { + unsafe { + from_glib_full(ffi::zypp_info_base_alias(self.as_ref().to_glib_none().0)) + } + } + + #[doc(alias = "zypp_info_base_as_user_string")] + fn as_user_string(&self) -> Option { + unsafe { + from_glib_full(ffi::zypp_info_base_as_user_string(self.as_ref().to_glib_none().0)) + } + } + + #[doc(alias = "zypp_info_base_autorefresh")] + fn autorefresh(&self) -> bool { + unsafe { + from_glib(ffi::zypp_info_base_autorefresh(self.as_ref().to_glib_none().0)) + } + } + + #[doc(alias = "zypp_info_base_enabled")] + fn enabled(&self) -> bool { + unsafe { + from_glib(ffi::zypp_info_base_enabled(self.as_ref().to_glib_none().0)) + } + } + + #[doc(alias = "zypp_info_base_escaped_alias")] + fn escaped_alias(&self) -> Option { + unsafe { + from_glib_full(ffi::zypp_info_base_escaped_alias(self.as_ref().to_glib_none().0)) + } + } + + #[doc(alias = "zypp_info_base_filepath")] + fn filepath(&self) -> Option { + unsafe { + from_glib_full(ffi::zypp_info_base_filepath(self.as_ref().to_glib_none().0)) + } + } + + #[doc(alias = "zypp_info_base_label")] + fn label(&self) -> Option { + unsafe { + from_glib_full(ffi::zypp_info_base_label(self.as_ref().to_glib_none().0)) + } + } + + #[doc(alias = "zypp_info_base_name")] + fn name(&self) -> Option { + unsafe { + from_glib_full(ffi::zypp_info_base_name(self.as_ref().to_glib_none().0)) + } + } + + #[doc(alias = "zypp_info_base_raw_name")] + fn raw_name(&self) -> Option { + unsafe { + from_glib_full(ffi::zypp_info_base_raw_name(self.as_ref().to_glib_none().0)) + } + } + + #[doc(alias = "zypp_info_base_set_alias")] + fn set_alias(&self, alias: &str) { + unsafe { + ffi::zypp_info_base_set_alias(self.as_ref().to_glib_none().0, alias.to_glib_none().0); + } + } + + #[doc(alias = "zypp_info_base_set_autorefresh")] + fn set_autorefresh(&self, enabled: bool) { + unsafe { + ffi::zypp_info_base_set_autorefresh(self.as_ref().to_glib_none().0, enabled.into_glib()); + } + } + + #[doc(alias = "zypp_info_base_set_enabled")] + fn set_enabled(&self, enabled: bool) { + unsafe { + ffi::zypp_info_base_set_enabled(self.as_ref().to_glib_none().0, enabled.into_glib()); + } + } + + #[doc(alias = "zypp_info_base_set_filepath")] + fn set_filepath(&self, filepath: &str) { + unsafe { + ffi::zypp_info_base_set_filepath(self.as_ref().to_glib_none().0, filepath.to_glib_none().0); + } + } + + #[doc(alias = "zypp_info_base_set_name")] + fn set_name(&self, name: &str) { + unsafe { + ffi::zypp_info_base_set_name(self.as_ref().to_glib_none().0, name.to_glib_none().0); + } + } +} + +impl> InfoBaseExt for O {} diff --git a/rust/libzypp/src/auto/mod.rs b/rust/libzypp/src/auto/mod.rs index 15e9a333ba..6e06616380 100644 --- a/rust/libzypp/src/auto/mod.rs +++ b/rust/libzypp/src/auto/mod.rs @@ -8,6 +8,12 @@ pub use self::context::Context; mod expected; pub use self::expected::Expected; +mod info_base; +pub use self::info_base::InfoBase; + mod enums; pub use self::enums::Exception; +pub(crate) mod traits { + pub use super::info_base::InfoBaseExt; +} From 2dc91731e94797563421f77b8b9fa9812e06c6d1 Mon Sep 17 00:00:00 2001 From: Josef Reidinger Date: Fri, 13 Sep 2024 18:03:20 +0200 Subject: [PATCH 07/30] generate rest of current structs --- rust/libzypp/Gir.toml | 10 + rust/libzypp/src/auto/enums.rs | 327 ++++++++++++++++++ rust/libzypp/src/auto/managed_file.rs | 42 +++ rust/libzypp/src/auto/mod.rs | 24 ++ rust/libzypp/src/auto/progress_observer.rs | 210 +++++++++++ rust/libzypp/src/auto/repo_info.rs | 73 ++++ rust/libzypp/src/auto/repo_manager.rs | 80 +++++ rust/libzypp/src/auto/repo_manager_options.rs | 35 ++ rust/libzypp/src/auto/repository.rs | 33 ++ rust/libzypp/src/auto/service_info.rs | 25 ++ rust/libzypp/zypp-sys/src/auto/versions.txt | 2 +- rust/libzypp/zypp-sys/src/lib.rs | 11 +- 12 files changed, 861 insertions(+), 11 deletions(-) create mode 100644 rust/libzypp/src/auto/managed_file.rs create mode 100644 rust/libzypp/src/auto/progress_observer.rs create mode 100644 rust/libzypp/src/auto/repo_info.rs create mode 100644 rust/libzypp/src/auto/repo_manager.rs create mode 100644 rust/libzypp/src/auto/repo_manager_options.rs create mode 100644 rust/libzypp/src/auto/repository.rs create mode 100644 rust/libzypp/src/auto/service_info.rs diff --git a/rust/libzypp/Gir.toml b/rust/libzypp/Gir.toml index ccaf8202b6..bb21f69fa0 100644 --- a/rust/libzypp/Gir.toml +++ b/rust/libzypp/Gir.toml @@ -14,6 +14,16 @@ generate = [ "Zypp.Exception", "Zypp.Expected", "Zypp.InfoBase", + "Zypp.ManagedFile", + "Zypp.ProgressObserver", + "Zypp.RepoInfo", + "Zypp.RepoInfoType", + "Zypp.RepoManager", + "Zypp.ServiceInfo", + "Zypp.RepoManagerOptions", + "Zypp.RepoManagerError", + "Zypp.RepoRefreshResult", + "Zypp.Repository", "Zypp.*" ] diff --git a/rust/libzypp/src/auto/enums.rs b/rust/libzypp/src/auto/enums.rs index 5ed5de4f4a..25720cfc72 100644 --- a/rust/libzypp/src/auto/enums.rs +++ b/rust/libzypp/src/auto/enums.rs @@ -108,3 +108,330 @@ impl From for glib::Value { } } +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] +#[derive(Clone, Copy)] +#[non_exhaustive] +#[doc(alias = "ZyppRepoInfoType")] +pub enum RepoInfoType { + #[doc(alias = "ZYPP_REPO_NONE")] + None, + #[doc(alias = "ZYPP_REPO_RPMMD")] + Rpmmd, + #[doc(alias = "ZYPP_REPO_YAST2")] + Yast2, + #[doc(alias = "ZYPP_REPO_RPMPLAINDIR")] + Rpmplaindir, +#[doc(hidden)] + __Unknown(i32), +} + +#[doc(hidden)] +impl IntoGlib for RepoInfoType { + type GlibType = ffi::ZyppRepoInfoType; + + #[inline] +fn into_glib(self) -> ffi::ZyppRepoInfoType { +match self { + Self::None => ffi::ZYPP_REPO_NONE, + Self::Rpmmd => ffi::ZYPP_REPO_RPMMD, + Self::Yast2 => ffi::ZYPP_REPO_YAST2, + Self::Rpmplaindir => ffi::ZYPP_REPO_RPMPLAINDIR, + Self::__Unknown(value) => value, +} +} +} + +#[doc(hidden)] +impl FromGlib for RepoInfoType { + #[inline] +unsafe fn from_glib(value: ffi::ZyppRepoInfoType) -> Self { + skip_assert_initialized!(); + +match value { + ffi::ZYPP_REPO_NONE => Self::None, + ffi::ZYPP_REPO_RPMMD => Self::Rpmmd, + ffi::ZYPP_REPO_YAST2 => Self::Yast2, + ffi::ZYPP_REPO_RPMPLAINDIR => Self::Rpmplaindir, + value => Self::__Unknown(value), +} +} +} + +impl StaticType for RepoInfoType { + #[inline] + #[doc(alias = "zypp_repo_info_type_get_type")] + fn static_type() -> glib::Type { + unsafe { from_glib(ffi::zypp_repo_info_type_get_type()) } + } + } + +impl glib::HasParamSpec for RepoInfoType { + type ParamSpec = glib::ParamSpecEnum; + type SetValue = Self; + type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder; + + fn param_spec_builder() -> Self::BuilderFn { + Self::ParamSpec::builder_with_default + } +} + +impl glib::value::ValueType for RepoInfoType { + type Type = Self; +} + +unsafe impl<'a> glib::value::FromValue<'a> for RepoInfoType { + type Checker = glib::value::GenericValueTypeChecker; + + #[inline] + unsafe fn from_value(value: &'a glib::Value) -> Self { + skip_assert_initialized!(); + from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0)) + } +} + +impl ToValue for RepoInfoType { + #[inline] + fn to_value(&self) -> glib::Value { + let mut value = glib::Value::for_value_type::(); + unsafe { + glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib()); + } + value + } + + #[inline] + fn value_type(&self) -> glib::Type { + Self::static_type() + } +} + +impl From for glib::Value { + #[inline] + fn from(v: RepoInfoType) -> Self { + skip_assert_initialized!(); + ToValue::to_value(&v) + } +} + +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] +#[derive(Clone, Copy)] +#[non_exhaustive] +#[doc(alias = "ZyppRepoManagerError")] +pub enum RepoManagerError { + #[doc(alias = "ZYPP_REPO_MANAGER_ERROR_REF_FAILED")] + Failed, + #[doc(alias = "ZYPP_REPO_MANAGER_ERROR_REF_SKIPPED")] + Skipped, + #[doc(alias = "ZYPP_REPO_MANAGER_ERROR_REF_ABORTED")] + Aborted, +#[doc(hidden)] + __Unknown(i32), +} + +#[doc(hidden)] +impl IntoGlib for RepoManagerError { + type GlibType = ffi::ZyppRepoManagerError; + + #[inline] +fn into_glib(self) -> ffi::ZyppRepoManagerError { +match self { + Self::Failed => ffi::ZYPP_REPO_MANAGER_ERROR_REF_FAILED, + Self::Skipped => ffi::ZYPP_REPO_MANAGER_ERROR_REF_SKIPPED, + Self::Aborted => ffi::ZYPP_REPO_MANAGER_ERROR_REF_ABORTED, + Self::__Unknown(value) => value, +} +} +} + +#[doc(hidden)] +impl FromGlib for RepoManagerError { + #[inline] +unsafe fn from_glib(value: ffi::ZyppRepoManagerError) -> Self { + skip_assert_initialized!(); + +match value { + ffi::ZYPP_REPO_MANAGER_ERROR_REF_FAILED => Self::Failed, + ffi::ZYPP_REPO_MANAGER_ERROR_REF_SKIPPED => Self::Skipped, + ffi::ZYPP_REPO_MANAGER_ERROR_REF_ABORTED => Self::Aborted, + value => Self::__Unknown(value), +} +} +} + +impl glib::error::ErrorDomain for RepoManagerError { + #[inline] + fn domain() -> glib::Quark { + skip_assert_initialized!(); + + unsafe { from_glib(ffi::zypp_repo_manager_error_quark()) } + } + + #[inline] + fn code(self) -> i32 { + self.into_glib() + } + + #[inline] + #[allow(clippy::match_single_binding)] + fn from(code: i32) -> Option { + skip_assert_initialized!(); + match unsafe { from_glib(code) } { + Self::__Unknown(_) => Some(Self::Failed), + value => Some(value), +} + } +} + +impl StaticType for RepoManagerError { + #[inline] + #[doc(alias = "zypp_repo_manager_error_get_type")] + fn static_type() -> glib::Type { + unsafe { from_glib(ffi::zypp_repo_manager_error_get_type()) } + } + } + +impl glib::HasParamSpec for RepoManagerError { + type ParamSpec = glib::ParamSpecEnum; + type SetValue = Self; + type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder; + + fn param_spec_builder() -> Self::BuilderFn { + Self::ParamSpec::builder_with_default + } +} + +impl glib::value::ValueType for RepoManagerError { + type Type = Self; +} + +unsafe impl<'a> glib::value::FromValue<'a> for RepoManagerError { + type Checker = glib::value::GenericValueTypeChecker; + + #[inline] + unsafe fn from_value(value: &'a glib::Value) -> Self { + skip_assert_initialized!(); + from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0)) + } +} + +impl ToValue for RepoManagerError { + #[inline] + fn to_value(&self) -> glib::Value { + let mut value = glib::Value::for_value_type::(); + unsafe { + glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib()); + } + value + } + + #[inline] + fn value_type(&self) -> glib::Type { + Self::static_type() + } +} + +impl From for glib::Value { + #[inline] + fn from(v: RepoManagerError) -> Self { + skip_assert_initialized!(); + ToValue::to_value(&v) + } +} + +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] +#[derive(Clone, Copy)] +#[non_exhaustive] +#[doc(alias = "ZyppRepoRefreshResult")] +pub enum RepoRefreshResult { + #[doc(alias = "ZYPP_REPO_MANAGER_UP_TO_DATE")] + UpToDate, + #[doc(alias = "ZYPP_REPO_MANAGER_REFRESHED")] + Refreshed, +#[doc(hidden)] + __Unknown(i32), +} + +#[doc(hidden)] +impl IntoGlib for RepoRefreshResult { + type GlibType = ffi::ZyppRepoRefreshResult; + + #[inline] +fn into_glib(self) -> ffi::ZyppRepoRefreshResult { +match self { + Self::UpToDate => ffi::ZYPP_REPO_MANAGER_UP_TO_DATE, + Self::Refreshed => ffi::ZYPP_REPO_MANAGER_REFRESHED, + Self::__Unknown(value) => value, +} +} +} + +#[doc(hidden)] +impl FromGlib for RepoRefreshResult { + #[inline] +unsafe fn from_glib(value: ffi::ZyppRepoRefreshResult) -> Self { + skip_assert_initialized!(); + +match value { + ffi::ZYPP_REPO_MANAGER_UP_TO_DATE => Self::UpToDate, + ffi::ZYPP_REPO_MANAGER_REFRESHED => Self::Refreshed, + value => Self::__Unknown(value), +} +} +} + +impl StaticType for RepoRefreshResult { + #[inline] + #[doc(alias = "zypp_repo_refresh_result_get_type")] + fn static_type() -> glib::Type { + unsafe { from_glib(ffi::zypp_repo_refresh_result_get_type()) } + } + } + +impl glib::HasParamSpec for RepoRefreshResult { + type ParamSpec = glib::ParamSpecEnum; + type SetValue = Self; + type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder; + + fn param_spec_builder() -> Self::BuilderFn { + Self::ParamSpec::builder_with_default + } +} + +impl glib::value::ValueType for RepoRefreshResult { + type Type = Self; +} + +unsafe impl<'a> glib::value::FromValue<'a> for RepoRefreshResult { + type Checker = glib::value::GenericValueTypeChecker; + + #[inline] + unsafe fn from_value(value: &'a glib::Value) -> Self { + skip_assert_initialized!(); + from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0)) + } +} + +impl ToValue for RepoRefreshResult { + #[inline] + fn to_value(&self) -> glib::Value { + let mut value = glib::Value::for_value_type::(); + unsafe { + glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib()); + } + value + } + + #[inline] + fn value_type(&self) -> glib::Type { + Self::static_type() + } +} + +impl From for glib::Value { + #[inline] + fn from(v: RepoRefreshResult) -> Self { + skip_assert_initialized!(); + ToValue::to_value(&v) + } +} + diff --git a/rust/libzypp/src/auto/managed_file.rs b/rust/libzypp/src/auto/managed_file.rs new file mode 100644 index 0000000000..3be8730a1d --- /dev/null +++ b/rust/libzypp/src/auto/managed_file.rs @@ -0,0 +1,42 @@ +// This file was generated by gir (https://github.com/gtk-rs/gir) +// from gir-files +// DO NOT EDIT + +use crate::{ffi}; +use glib::{translate::*}; + +glib::wrapper! { + #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] + pub struct ManagedFile(Boxed); + + match fn { + copy => |ptr| ffi::zypp_managed_file_copy(mut_override(ptr)), + free => |ptr| ffi::zypp_managed_file_free(ptr), + type_ => || ffi::zypp_managed_file_get_type(), + } +} + +impl ManagedFile { + #[doc(alias = "zypp_managed_file_new")] + pub fn new(path: &str, dispose: bool) -> ManagedFile { + assert_initialized_main_thread!(); + unsafe { + from_glib_full(ffi::zypp_managed_file_new(path.to_glib_none().0, dispose.into_glib())) + } + } + + #[doc(alias = "zypp_managed_file_get_path")] + #[doc(alias = "get_path")] + pub fn path(&mut self) -> Option { + unsafe { + from_glib_full(ffi::zypp_managed_file_get_path(self.to_glib_none_mut().0)) + } + } + + #[doc(alias = "zypp_managed_file_set_dispose_enabled")] + pub fn set_dispose_enabled(&mut self, enabled: bool) { + unsafe { + ffi::zypp_managed_file_set_dispose_enabled(self.to_glib_none_mut().0, enabled.into_glib()); + } + } +} diff --git a/rust/libzypp/src/auto/mod.rs b/rust/libzypp/src/auto/mod.rs index 6e06616380..87094772f0 100644 --- a/rust/libzypp/src/auto/mod.rs +++ b/rust/libzypp/src/auto/mod.rs @@ -11,8 +11,32 @@ pub use self::expected::Expected; mod info_base; pub use self::info_base::InfoBase; +mod progress_observer; +pub use self::progress_observer::ProgressObserver; + +mod repo_info; +pub use self::repo_info::RepoInfo; + +mod repo_manager; +pub use self::repo_manager::RepoManager; + +mod repository; +pub use self::repository::Repository; + +mod service_info; +pub use self::service_info::ServiceInfo; + +mod managed_file; +pub use self::managed_file::ManagedFile; + +mod repo_manager_options; +pub use self::repo_manager_options::RepoManagerOptions; + mod enums; pub use self::enums::Exception; +pub use self::enums::RepoInfoType; +pub use self::enums::RepoManagerError; +pub use self::enums::RepoRefreshResult; pub(crate) mod traits { pub use super::info_base::InfoBaseExt; diff --git a/rust/libzypp/src/auto/progress_observer.rs b/rust/libzypp/src/auto/progress_observer.rs new file mode 100644 index 0000000000..11ec6dfd75 --- /dev/null +++ b/rust/libzypp/src/auto/progress_observer.rs @@ -0,0 +1,210 @@ +// This file was generated by gir (https://github.com/gtk-rs/gir) +// from gir-files +// DO NOT EDIT + +use crate::{ffi}; +use glib::{prelude::*,signal::{connect_raw, SignalHandlerId},translate::*}; +use std::{boxed::Box as Box_}; + +glib::wrapper! { + #[doc(alias = "ZyppProgressObserver")] + pub struct ProgressObserver(Object); + + match fn { + type_ => || ffi::zypp_progress_observer_get_type(), + } +} + +impl ProgressObserver { + #[doc(alias = "zypp_progress_observer_add_subtask")] + pub fn add_subtask(&self, newChild: &ProgressObserver, weight: f32) { + unsafe { + ffi::zypp_progress_observer_add_subtask(self.to_glib_none().0, newChild.to_glib_none().0, weight); + } + } + + #[doc(alias = "zypp_progress_observer_get_base_steps")] + #[doc(alias = "get_base_steps")] + #[doc(alias = "base-steps")] + pub fn base_steps(&self) -> i32 { + unsafe { + ffi::zypp_progress_observer_get_base_steps(self.to_glib_none().0) + } + } + + #[doc(alias = "zypp_progress_observer_get_children")] + #[doc(alias = "get_children")] + pub fn children(&self) -> Vec { + unsafe { + FromGlibPtrContainer::from_glib_none(ffi::zypp_progress_observer_get_children(self.to_glib_none().0)) + } + } + + #[doc(alias = "zypp_progress_observer_get_current")] + #[doc(alias = "get_current")] + pub fn current(&self) -> f64 { + unsafe { + ffi::zypp_progress_observer_get_current(self.to_glib_none().0) + } + } + + #[doc(alias = "zypp_progress_observer_get_label")] + #[doc(alias = "get_label")] + pub fn label(&self) -> Option { + unsafe { + from_glib_none(ffi::zypp_progress_observer_get_label(self.to_glib_none().0)) + } + } + + #[doc(alias = "zypp_progress_observer_get_progress")] + #[doc(alias = "get_progress")] + pub fn progress(&self) -> f64 { + unsafe { + ffi::zypp_progress_observer_get_progress(self.to_glib_none().0) + } + } + + #[doc(alias = "zypp_progress_observer_get_steps")] + #[doc(alias = "get_steps")] + pub fn steps(&self) -> f64 { + unsafe { + ffi::zypp_progress_observer_get_steps(self.to_glib_none().0) + } + } + + #[doc(alias = "zypp_progress_observer_inc")] + pub fn inc(&self, increase: i32) { + unsafe { + ffi::zypp_progress_observer_inc(self.to_glib_none().0, increase); + } + } + + #[doc(alias = "zypp_progress_observer_set_base_steps")] + #[doc(alias = "base-steps")] + pub fn set_base_steps(&self, stepCount: i32) { + unsafe { + ffi::zypp_progress_observer_set_base_steps(self.to_glib_none().0, stepCount); + } + } + + #[doc(alias = "zypp_progress_observer_set_current")] + pub fn set_current(&self, value: f64) { + unsafe { + ffi::zypp_progress_observer_set_current(self.to_glib_none().0, value); + } + } + + #[doc(alias = "zypp_progress_observer_set_finished")] + pub fn set_finished(&self) { + unsafe { + ffi::zypp_progress_observer_set_finished(self.to_glib_none().0); + } + } + + #[doc(alias = "zypp_progress_observer_set_label")] + #[doc(alias = "label")] + pub fn set_label(&self, label: &str) { + unsafe { + ffi::zypp_progress_observer_set_label(self.to_glib_none().0, label.to_glib_none().0); + } + } + + pub fn value(&self) -> f64 { + ObjectExt::property(self, "value") + } + + pub fn set_value(&self, value: f64) { + ObjectExt::set_property(self,"value", value) + } + + #[doc(alias = "finished")] + pub fn connect_finished(&self, f: F) -> SignalHandlerId { + unsafe extern "C" fn finished_trampoline(this: *mut ffi::ZyppProgressObserver, f: glib::ffi::gpointer) { + let f: &F = &*(f as *const F); + f(&from_glib_borrow(this)) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw(self.as_ptr() as *mut _, b"finished\0".as_ptr() as *const _, + Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(finished_trampoline:: as *const ())), Box_::into_raw(f)) + } + } + + #[doc(alias = "new-subtask")] + pub fn connect_new_subtask(&self, f: F) -> SignalHandlerId { + unsafe extern "C" fn new_subtask_trampoline(this: *mut ffi::ZyppProgressObserver, object: *mut ffi::ZyppProgressObserver, f: glib::ffi::gpointer) { + let f: &F = &*(f as *const F); + f(&from_glib_borrow(this), &from_glib_borrow(object)) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw(self.as_ptr() as *mut _, b"new-subtask\0".as_ptr() as *const _, + Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(new_subtask_trampoline:: as *const ())), Box_::into_raw(f)) + } + } + + #[doc(alias = "base-steps")] + pub fn connect_base_steps_notify(&self, f: F) -> SignalHandlerId { + unsafe extern "C" fn notify_base_steps_trampoline(this: *mut ffi::ZyppProgressObserver, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) { + let f: &F = &*(f as *const F); + f(&from_glib_borrow(this)) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw(self.as_ptr() as *mut _, b"notify::base-steps\0".as_ptr() as *const _, + Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_base_steps_trampoline:: as *const ())), Box_::into_raw(f)) + } + } + + #[doc(alias = "label")] + pub fn connect_label_notify(&self, f: F) -> SignalHandlerId { + unsafe extern "C" fn notify_label_trampoline(this: *mut ffi::ZyppProgressObserver, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) { + let f: &F = &*(f as *const F); + f(&from_glib_borrow(this)) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw(self.as_ptr() as *mut _, b"notify::label\0".as_ptr() as *const _, + Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_label_trampoline:: as *const ())), Box_::into_raw(f)) + } + } + + #[doc(alias = "progress")] + pub fn connect_progress_notify(&self, f: F) -> SignalHandlerId { + unsafe extern "C" fn notify_progress_trampoline(this: *mut ffi::ZyppProgressObserver, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) { + let f: &F = &*(f as *const F); + f(&from_glib_borrow(this)) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw(self.as_ptr() as *mut _, b"notify::progress\0".as_ptr() as *const _, + Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_progress_trampoline:: as *const ())), Box_::into_raw(f)) + } + } + + #[doc(alias = "steps")] + pub fn connect_steps_notify(&self, f: F) -> SignalHandlerId { + unsafe extern "C" fn notify_steps_trampoline(this: *mut ffi::ZyppProgressObserver, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) { + let f: &F = &*(f as *const F); + f(&from_glib_borrow(this)) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw(self.as_ptr() as *mut _, b"notify::steps\0".as_ptr() as *const _, + Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_steps_trampoline:: as *const ())), Box_::into_raw(f)) + } + } + + #[doc(alias = "value")] + pub fn connect_value_notify(&self, f: F) -> SignalHandlerId { + unsafe extern "C" fn notify_value_trampoline(this: *mut ffi::ZyppProgressObserver, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) { + let f: &F = &*(f as *const F); + f(&from_glib_borrow(this)) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw(self.as_ptr() as *mut _, b"notify::value\0".as_ptr() as *const _, + Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_value_trampoline:: as *const ())), Box_::into_raw(f)) + } + } +} diff --git a/rust/libzypp/src/auto/repo_info.rs b/rust/libzypp/src/auto/repo_info.rs new file mode 100644 index 0000000000..75bf9ced30 --- /dev/null +++ b/rust/libzypp/src/auto/repo_info.rs @@ -0,0 +1,73 @@ +// This file was generated by gir (https://github.com/gtk-rs/gir) +// from gir-files +// DO NOT EDIT + +use crate::{ffi,Context,InfoBase,RepoInfoType}; +use glib::{prelude::*,signal::{connect_raw, SignalHandlerId},translate::*}; +use std::{boxed::Box as Box_}; + +glib::wrapper! { + #[doc(alias = "ZyppRepoInfo")] + pub struct RepoInfo(Object) @implements InfoBase; + + match fn { + type_ => || ffi::zypp_repo_info_get_type(), + } +} + +impl RepoInfo { + #[doc(alias = "zypp_repo_info_new")] + pub fn new(context: &Context) -> RepoInfo { + skip_assert_initialized!(); + unsafe { + from_glib_full(ffi::zypp_repo_info_new(context.to_glib_none().0)) + } + } + + #[doc(alias = "zypp_repo_info_get_repo_type")] + #[doc(alias = "get_repo_type")] + pub fn repo_type(&self) -> RepoInfoType { + unsafe { + from_glib(ffi::zypp_repo_info_get_repo_type(self.to_glib_none().0)) + } + } + + #[doc(alias = "alias")] + pub fn connect_alias_notify(&self, f: F) -> SignalHandlerId { + unsafe extern "C" fn notify_alias_trampoline(this: *mut ffi::ZyppRepoInfo, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) { + let f: &F = &*(f as *const F); + f(&from_glib_borrow(this)) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw(self.as_ptr() as *mut _, b"notify::alias\0".as_ptr() as *const _, + Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_alias_trampoline:: as *const ())), Box_::into_raw(f)) + } + } + + #[doc(alias = "enabled")] + pub fn connect_enabled_notify(&self, f: F) -> SignalHandlerId { + unsafe extern "C" fn notify_enabled_trampoline(this: *mut ffi::ZyppRepoInfo, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) { + let f: &F = &*(f as *const F); + f(&from_glib_borrow(this)) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw(self.as_ptr() as *mut _, b"notify::enabled\0".as_ptr() as *const _, + Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_enabled_trampoline:: as *const ())), Box_::into_raw(f)) + } + } + + #[doc(alias = "name")] + pub fn connect_name_notify(&self, f: F) -> SignalHandlerId { + unsafe extern "C" fn notify_name_trampoline(this: *mut ffi::ZyppRepoInfo, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) { + let f: &F = &*(f as *const F); + f(&from_glib_borrow(this)) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw(self.as_ptr() as *mut _, b"notify::name\0".as_ptr() as *const _, + Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_name_trampoline:: as *const ())), Box_::into_raw(f)) + } + } +} diff --git a/rust/libzypp/src/auto/repo_manager.rs b/rust/libzypp/src/auto/repo_manager.rs new file mode 100644 index 0000000000..a7e97a9e03 --- /dev/null +++ b/rust/libzypp/src/auto/repo_manager.rs @@ -0,0 +1,80 @@ +// This file was generated by gir (https://github.com/gtk-rs/gir) +// from gir-files +// DO NOT EDIT + +use crate::{ffi,Context,Expected,ProgressObserver,RepoInfo,RepoManagerOptions,ServiceInfo}; +use glib::{prelude::*,signal::{connect_raw, SignalHandlerId},translate::*}; +use std::{boxed::Box as Box_}; + +glib::wrapper! { + #[doc(alias = "ZyppRepoManager")] + pub struct RepoManager(Object); + + match fn { + type_ => || ffi::zypp_repo_manager_get_type(), + } +} + +impl RepoManager { + #[doc(alias = "zypp_repo_manager_new")] + pub fn new(ctx: &Context) -> RepoManager { + skip_assert_initialized!(); + unsafe { + from_glib_full(ffi::zypp_repo_manager_new(ctx.to_glib_none().0)) + } + } + + #[doc(alias = "zypp_repo_manager_get_known_repos")] + #[doc(alias = "get_known_repos")] + pub fn known_repos(&self) -> Vec { + unsafe { + FromGlibPtrContainer::from_glib_full(ffi::zypp_repo_manager_get_known_repos(self.to_glib_none().0)) + } + } + + #[doc(alias = "zypp_repo_manager_get_known_services")] + #[doc(alias = "get_known_services")] + pub fn known_services(&self) -> Vec { + unsafe { + FromGlibPtrContainer::from_glib_full(ffi::zypp_repo_manager_get_known_services(self.to_glib_none().0)) + } + } + + #[doc(alias = "zypp_repo_manager_initialize")] + pub fn initialize(&self) -> Result<(), glib::Error> { + unsafe { + let mut error = std::ptr::null_mut(); + let is_ok = ffi::zypp_repo_manager_initialize(self.to_glib_none().0, &mut error); + debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } + } + } + + #[doc(alias = "zypp_repo_manager_refresh_repos")] + pub fn refresh_repos(&self, repos: &[RepoInfo], forceDownload: bool, statusTracker: Option) -> Vec { + unsafe { + FromGlibPtrContainer::from_glib_full(ffi::zypp_repo_manager_refresh_repos(self.to_glib_none().0, repos.to_glib_none().0, forceDownload.into_glib(), statusTracker.into_glib_ptr())) + } + } + + pub fn options(&self) -> Option { + ObjectExt::property(self, "options") + } + + pub fn set_options(&self, options: Option<&RepoManagerOptions>) { + ObjectExt::set_property(self,"options", options) + } + + #[doc(alias = "options")] + pub fn connect_options_notify(&self, f: F) -> SignalHandlerId { + unsafe extern "C" fn notify_options_trampoline(this: *mut ffi::ZyppRepoManager, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) { + let f: &F = &*(f as *const F); + f(&from_glib_borrow(this)) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw(self.as_ptr() as *mut _, b"notify::options\0".as_ptr() as *const _, + Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_options_trampoline:: as *const ())), Box_::into_raw(f)) + } + } +} diff --git a/rust/libzypp/src/auto/repo_manager_options.rs b/rust/libzypp/src/auto/repo_manager_options.rs new file mode 100644 index 0000000000..ddb7ad1c72 --- /dev/null +++ b/rust/libzypp/src/auto/repo_manager_options.rs @@ -0,0 +1,35 @@ +// This file was generated by gir (https://github.com/gtk-rs/gir) +// from gir-files +// DO NOT EDIT + +use crate::{ffi}; +use glib::{translate::*}; + +glib::wrapper! { + #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] + pub struct RepoManagerOptions(Boxed); + + match fn { + copy => |ptr| ffi::zypp_repo_manager_options_copy(mut_override(ptr)), + free => |ptr| ffi::zypp_repo_manager_options_free(ptr), + type_ => || ffi::zypp_repo_manager_options_get_type(), + } +} + +impl RepoManagerOptions { + #[doc(alias = "zypp_repo_manager_options_new")] + pub fn new(root: &str) -> RepoManagerOptions { + assert_initialized_main_thread!(); + unsafe { + from_glib_full(ffi::zypp_repo_manager_options_new(root.to_glib_none().0)) + } + } + + #[doc(alias = "zypp_repo_manager_options_get_root")] + #[doc(alias = "get_root")] + pub fn root(&mut self) -> Option { + unsafe { + from_glib_full(ffi::zypp_repo_manager_options_get_root(self.to_glib_none_mut().0)) + } + } +} diff --git a/rust/libzypp/src/auto/repository.rs b/rust/libzypp/src/auto/repository.rs new file mode 100644 index 0000000000..499920e06c --- /dev/null +++ b/rust/libzypp/src/auto/repository.rs @@ -0,0 +1,33 @@ +// This file was generated by gir (https://github.com/gtk-rs/gir) +// from gir-files +// DO NOT EDIT + +use crate::{ffi,RepoInfo}; +use glib::{translate::*}; + +glib::wrapper! { + #[doc(alias = "ZyppRepository")] + pub struct Repository(Object); + + match fn { + type_ => || ffi::zypp_repository_get_type(), + } +} + +impl Repository { + #[doc(alias = "zypp_repository_get_name")] + #[doc(alias = "get_name")] + pub fn name(&self) -> Option { + unsafe { + from_glib_full(ffi::zypp_repository_get_name(self.to_glib_none().0)) + } + } + + #[doc(alias = "zypp_repository_get_repoinfo")] + #[doc(alias = "get_repoinfo")] + pub fn repoinfo(&self) -> Option { + unsafe { + from_glib_full(ffi::zypp_repository_get_repoinfo(self.to_glib_none().0)) + } + } +} diff --git a/rust/libzypp/src/auto/service_info.rs b/rust/libzypp/src/auto/service_info.rs new file mode 100644 index 0000000000..4305cfaa23 --- /dev/null +++ b/rust/libzypp/src/auto/service_info.rs @@ -0,0 +1,25 @@ +// This file was generated by gir (https://github.com/gtk-rs/gir) +// from gir-files +// DO NOT EDIT + +use crate::{ffi,Context,InfoBase}; +use glib::{translate::*}; + +glib::wrapper! { + #[doc(alias = "ZyppServiceInfo")] + pub struct ServiceInfo(Object) @implements InfoBase; + + match fn { + type_ => || ffi::zypp_service_info_get_type(), + } +} + +impl ServiceInfo { + #[doc(alias = "zypp_service_info_new")] + pub fn new(context: &Context) -> ServiceInfo { + skip_assert_initialized!(); + unsafe { + from_glib_full(ffi::zypp_service_info_new(context.to_glib_none().0)) + } + } +} diff --git a/rust/libzypp/zypp-sys/src/auto/versions.txt b/rust/libzypp/zypp-sys/src/auto/versions.txt index b934242094..b396a2ba04 100644 --- a/rust/libzypp/zypp-sys/src/auto/versions.txt +++ b/rust/libzypp/zypp-sys/src/auto/versions.txt @@ -1,2 +1,2 @@ Generated by gir (https://github.com/gtk-rs/gir @ 06c4f1963c55+) -from ../gir-files (@ 62da9eb7c4bd) +from ../gir-files (@ ???) diff --git a/rust/libzypp/zypp-sys/src/lib.rs b/rust/libzypp/zypp-sys/src/lib.rs index 53b7e9b367..8231ca15a6 100644 --- a/rust/libzypp/zypp-sys/src/lib.rs +++ b/rust/libzypp/zypp-sys/src/lib.rs @@ -208,15 +208,6 @@ impl ::std::fmt::Debug for ZyppServiceInfoClass { } } -#[repr(C)] -#[allow(dead_code)] -pub struct _ZyppTaskStatus { - _data: [u8; 0], - _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>, -} - -pub type ZyppTaskStatus = _ZyppTaskStatus; - // Classes #[repr(C)] #[allow(dead_code)] @@ -426,7 +417,7 @@ extern "C" { pub fn zypp_repo_manager_get_known_repos(self_: *mut ZyppRepoManager) -> *mut glib::GList; pub fn zypp_repo_manager_get_known_services(self_: *mut ZyppRepoManager) -> *mut glib::GList; pub fn zypp_repo_manager_initialize(self_: *mut ZyppRepoManager, error: *mut *mut glib::GError) -> gboolean; - pub fn zypp_repo_manager_refresh_repos(self_: *mut ZyppRepoManager, repos: *mut glib::GList, forceDownload: gboolean, statusTracker: *mut ZyppTaskStatus) -> *mut glib::GList; + pub fn zypp_repo_manager_refresh_repos(self_: *mut ZyppRepoManager, repos: *mut glib::GList, forceDownload: gboolean, statusTracker: *mut ZyppProgressObserver) -> *mut glib::GList; //========================================================================= // ZyppRepository From d938aecc2b81cda85b3c330d4a0d1c099aa6c5d8 Mon Sep 17 00:00:00 2001 From: Josef Reidinger Date: Fri, 13 Sep 2024 19:22:34 +0200 Subject: [PATCH 08/30] generate also builders --- rust/libzypp/Gir.toml | 3 +- rust/libzypp/src/auto/context.rs | 34 +++++++++++++ rust/libzypp/src/auto/mod.rs | 6 +++ rust/libzypp/src/auto/progress_observer.rs | 46 ++++++++++++++++++ rust/libzypp/src/auto/repo_info.rs | 56 ++++++++++++++++++++++ rust/libzypp/src/auto/repo_manager.rs | 48 +++++++++++++++++++ 6 files changed, 192 insertions(+), 1 deletion(-) diff --git a/rust/libzypp/Gir.toml b/rust/libzypp/Gir.toml index bb21f69fa0..b5c377abac 100644 --- a/rust/libzypp/Gir.toml +++ b/rust/libzypp/Gir.toml @@ -8,6 +8,7 @@ work_mode = "normal" single_version_file = true generate_safety_asserts = true deprecate_by_min_version = true +generate_builder = true generate = [ "Zypp.Context", @@ -24,7 +25,7 @@ generate = [ "Zypp.RepoManagerError", "Zypp.RepoRefreshResult", "Zypp.Repository", - "Zypp.*" + "Zypp.*", ] manual = [ diff --git a/rust/libzypp/src/auto/context.rs b/rust/libzypp/src/auto/context.rs index a98263b122..0f8cab0141 100644 --- a/rust/libzypp/src/auto/context.rs +++ b/rust/libzypp/src/auto/context.rs @@ -16,6 +16,15 @@ glib::wrapper! { } impl Context { + // rustdoc-stripper-ignore-next + /// Creates a new builder-pattern struct instance to construct [`Context`] objects. + /// + /// This method returns an instance of [`ContextBuilder`](crate::builders::ContextBuilder) which can be used to create [`Context`] objects. + pub fn builder() -> ContextBuilder { + ContextBuilder::new() + } + + #[doc(alias = "zypp_context_load_system")] pub fn load_system(&self, sysRoot: Option<&str>) -> Result<(), glib::Error> { unsafe { @@ -57,3 +66,28 @@ impl Context { } } } + +// rustdoc-stripper-ignore-next + /// A [builder-pattern] type to construct [`Context`] objects. + /// + /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html +#[must_use = "The builder must be built to be used"] +pub struct ContextBuilder { + builder: glib::object::ObjectBuilder<'static, Context>, + } + + impl ContextBuilder { + fn new() -> Self { + Self { builder: glib::object::Object::builder() } + } + + //pub fn zypp_cppObj(self, zypp_cppObj: /*Unimplemented*/Basic: Pointer) -> Self { + // Self { builder: self.builder.property("zypp-cppObj", zypp_cppObj), } + //} + + // rustdoc-stripper-ignore-next + /// Build the [`Context`]. + #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] + pub fn build(self) -> Context { + self.builder.build() } +} diff --git a/rust/libzypp/src/auto/mod.rs b/rust/libzypp/src/auto/mod.rs index 87094772f0..74a8d5d6cb 100644 --- a/rust/libzypp/src/auto/mod.rs +++ b/rust/libzypp/src/auto/mod.rs @@ -41,3 +41,9 @@ pub use self::enums::RepoRefreshResult; pub(crate) mod traits { pub use super::info_base::InfoBaseExt; } +pub(crate) mod builders { + pub use super::context::ContextBuilder; + pub use super::progress_observer::ProgressObserverBuilder; + pub use super::repo_info::RepoInfoBuilder; + pub use super::repo_manager::RepoManagerBuilder; +} diff --git a/rust/libzypp/src/auto/progress_observer.rs b/rust/libzypp/src/auto/progress_observer.rs index 11ec6dfd75..854ffb03db 100644 --- a/rust/libzypp/src/auto/progress_observer.rs +++ b/rust/libzypp/src/auto/progress_observer.rs @@ -16,6 +16,15 @@ glib::wrapper! { } impl ProgressObserver { + // rustdoc-stripper-ignore-next + /// Creates a new builder-pattern struct instance to construct [`ProgressObserver`] objects. + /// + /// This method returns an instance of [`ProgressObserverBuilder`](crate::builders::ProgressObserverBuilder) which can be used to create [`ProgressObserver`] objects. + pub fn builder() -> ProgressObserverBuilder { + ProgressObserverBuilder::new() + } + + #[doc(alias = "zypp_progress_observer_add_subtask")] pub fn add_subtask(&self, newChild: &ProgressObserver, weight: f32) { unsafe { @@ -208,3 +217,40 @@ impl ProgressObserver { } } } + +// rustdoc-stripper-ignore-next + /// A [builder-pattern] type to construct [`ProgressObserver`] objects. + /// + /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html +#[must_use = "The builder must be built to be used"] +pub struct ProgressObserverBuilder { + builder: glib::object::ObjectBuilder<'static, ProgressObserver>, + } + + impl ProgressObserverBuilder { + fn new() -> Self { + Self { builder: glib::object::Object::builder() } + } + + pub fn base_steps(self, base_steps: i32) -> Self { + Self { builder: self.builder.property("base-steps", base_steps), } + } + + pub fn label(self, label: impl Into) -> Self { + Self { builder: self.builder.property("label", label.into()), } + } + + pub fn value(self, value: f64) -> Self { + Self { builder: self.builder.property("value", value), } + } + + //pub fn zypp_cppObj(self, zypp_cppObj: /*Unimplemented*/Basic: Pointer) -> Self { + // Self { builder: self.builder.property("zypp-cppObj", zypp_cppObj), } + //} + + // rustdoc-stripper-ignore-next + /// Build the [`ProgressObserver`]. + #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] + pub fn build(self) -> ProgressObserver { + self.builder.build() } +} diff --git a/rust/libzypp/src/auto/repo_info.rs b/rust/libzypp/src/auto/repo_info.rs index 75bf9ced30..ed2ce501f1 100644 --- a/rust/libzypp/src/auto/repo_info.rs +++ b/rust/libzypp/src/auto/repo_info.rs @@ -24,6 +24,15 @@ impl RepoInfo { } } + // rustdoc-stripper-ignore-next + /// Creates a new builder-pattern struct instance to construct [`RepoInfo`] objects. + /// + /// This method returns an instance of [`RepoInfoBuilder`](crate::builders::RepoInfoBuilder) which can be used to create [`RepoInfo`] objects. + pub fn builder() -> RepoInfoBuilder { + RepoInfoBuilder::new() + } + + #[doc(alias = "zypp_repo_info_get_repo_type")] #[doc(alias = "get_repo_type")] pub fn repo_type(&self) -> RepoInfoType { @@ -71,3 +80,50 @@ impl RepoInfo { } } } + +impl Default for RepoInfo { + fn default() -> Self { + glib::object::Object::new::() + } + } + +// rustdoc-stripper-ignore-next + /// A [builder-pattern] type to construct [`RepoInfo`] objects. + /// + /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html +#[must_use = "The builder must be built to be used"] +pub struct RepoInfoBuilder { + builder: glib::object::ObjectBuilder<'static, RepoInfo>, + } + + impl RepoInfoBuilder { + fn new() -> Self { + Self { builder: glib::object::Object::builder() } + } + + pub fn alias(self, alias: impl Into) -> Self { + Self { builder: self.builder.property("alias", alias.into()), } + } + + pub fn enabled(self, enabled: bool) -> Self { + Self { builder: self.builder.property("enabled", enabled), } + } + + pub fn name(self, name: impl Into) -> Self { + Self { builder: self.builder.property("name", name.into()), } + } + + //pub fn zypp_cppObj(self, zypp_cppObj: /*Unimplemented*/Basic: Pointer) -> Self { + // Self { builder: self.builder.property("zypp-cppObj", zypp_cppObj), } + //} + + pub fn zyppcontext(self, zyppcontext: &Context) -> Self { + Self { builder: self.builder.property("zyppcontext", zyppcontext.clone()), } + } + + // rustdoc-stripper-ignore-next + /// Build the [`RepoInfo`]. + #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] + pub fn build(self) -> RepoInfo { + self.builder.build() } +} diff --git a/rust/libzypp/src/auto/repo_manager.rs b/rust/libzypp/src/auto/repo_manager.rs index a7e97a9e03..6f8bde24b1 100644 --- a/rust/libzypp/src/auto/repo_manager.rs +++ b/rust/libzypp/src/auto/repo_manager.rs @@ -24,6 +24,15 @@ impl RepoManager { } } + // rustdoc-stripper-ignore-next + /// Creates a new builder-pattern struct instance to construct [`RepoManager`] objects. + /// + /// This method returns an instance of [`RepoManagerBuilder`](crate::builders::RepoManagerBuilder) which can be used to create [`RepoManager`] objects. + pub fn builder() -> RepoManagerBuilder { + RepoManagerBuilder::new() + } + + #[doc(alias = "zypp_repo_manager_get_known_repos")] #[doc(alias = "get_known_repos")] pub fn known_repos(&self) -> Vec { @@ -78,3 +87,42 @@ impl RepoManager { } } } + +impl Default for RepoManager { + fn default() -> Self { + glib::object::Object::new::() + } + } + +// rustdoc-stripper-ignore-next + /// A [builder-pattern] type to construct [`RepoManager`] objects. + /// + /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html +#[must_use = "The builder must be built to be used"] +pub struct RepoManagerBuilder { + builder: glib::object::ObjectBuilder<'static, RepoManager>, + } + + impl RepoManagerBuilder { + fn new() -> Self { + Self { builder: glib::object::Object::builder() } + } + + pub fn options(self, options: &RepoManagerOptions) -> Self { + Self { builder: self.builder.property("options", options), } + } + + //pub fn zypp_cppObj(self, zypp_cppObj: /*Unimplemented*/Basic: Pointer) -> Self { + // Self { builder: self.builder.property("zypp-cppObj", zypp_cppObj), } + //} + + pub fn zyppcontext(self, zyppcontext: &Context) -> Self { + Self { builder: self.builder.property("zyppcontext", zyppcontext.clone()), } + } + + // rustdoc-stripper-ignore-next + /// Build the [`RepoManager`]. + #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] + pub fn build(self) -> RepoManager { + self.builder.build() } +} From ac04955990b8ebaab1551d8548cb4484ad4df6c2 Mon Sep 17 00:00:00 2001 From: Josef Reidinger Date: Mon, 16 Sep 2024 22:10:14 +0200 Subject: [PATCH 09/30] add example binary --- rust/libzypp/Cargo.toml | 4 ++++ rust/libzypp/src/bin.rs | 21 +++++++++++++++++++++ rust/libzypp/src/lib.rs | 1 + 3 files changed, 26 insertions(+) create mode 100644 rust/libzypp/src/bin.rs diff --git a/rust/libzypp/Cargo.toml b/rust/libzypp/Cargo.toml index aed7e62ff0..29eb5dbd51 100644 --- a/rust/libzypp/Cargo.toml +++ b/rust/libzypp/Cargo.toml @@ -16,3 +16,7 @@ rustdoc-args = ["--cfg", "docsrs"] libc = "0.2" ffi = { package = "zypp-sys", path = "./zypp-sys" } glib = { git = "https://github.com/gtk-rs/gtk-rs-core" } + +[[bin]] +name = "zypprs" +path = "src/bin.rs" diff --git a/rust/libzypp/src/bin.rs b/rust/libzypp/src/bin.rs new file mode 100644 index 0000000000..09b07b821b --- /dev/null +++ b/rust/libzypp/src/bin.rs @@ -0,0 +1,21 @@ +use std::process::exit; + +use libzypp::InfoBaseExt; + +fn main() -> () { + let zcontext = libzypp::Context::builder().build(); + if let Err(err) = zcontext.load_system(Some("/")) { + println!("Failed to load system: {}", err.to_string()); + exit(1); + } + + let repo_manager = libzypp::RepoManager::new(&zcontext); + if let Err(err) = repo_manager.initialize() { + println!("Failed to load repos: {}", err.to_string()); + exit(1); + } + + for repo in repo_manager.known_repos() { + println!("{:?}", repo.name()); + } +} \ No newline at end of file diff --git a/rust/libzypp/src/lib.rs b/rust/libzypp/src/lib.rs index 45400cc69e..7d0f8954d4 100644 --- a/rust/libzypp/src/lib.rs +++ b/rust/libzypp/src/lib.rs @@ -15,3 +15,4 @@ macro_rules! assert_initialized_main_thread { pub use auto::*; mod auto; +pub use auto::traits::InfoBaseExt; From 4d2404a9a867d9b9a3404f465b00d98e73a640f4 Mon Sep 17 00:00:00 2001 From: Josef Reidinger Date: Tue, 17 Sep 2024 10:08:17 +0200 Subject: [PATCH 10/30] improve example --- rust/libzypp/src/bin.rs | 43 +++++++++++++++++++++++++++++++---------- 1 file changed, 33 insertions(+), 10 deletions(-) diff --git a/rust/libzypp/src/bin.rs b/rust/libzypp/src/bin.rs index 09b07b821b..d7c3c37a95 100644 --- a/rust/libzypp/src/bin.rs +++ b/rust/libzypp/src/bin.rs @@ -1,21 +1,44 @@ use std::process::exit; +use glib::Error; use libzypp::InfoBaseExt; -fn main() -> () { - let zcontext = libzypp::Context::builder().build(); - if let Err(err) = zcontext.load_system(Some("/")) { - println!("Failed to load system: {}", err.to_string()); - exit(1); +fn print_system() -> Result<(), Error> { + println!("System repos:"); + print_with_root("/")?; + println!(""); + Ok(()) +} + +fn print_host() -> Result<(), Error> { + println!("Host repos:"); + print_with_root("/run/host")?; + println!(""); + Ok(()) +} + +fn print_with_root(root: &str) -> Result<(), Error> { + let context = libzypp::Context::builder().build(); + context.load_system(Some(root))?; + + let repo_manager = libzypp::RepoManager::new(&context); + repo_manager.initialize()?; + + for repo in repo_manager.known_repos() { + println!("{:?}", repo.name()); } - let repo_manager = libzypp::RepoManager::new(&zcontext); - if let Err(err) = repo_manager.initialize() { - println!("Failed to load repos: {}", err.to_string()); + Ok(()) +} + +fn main() -> () { + if let Err(err) = print_system() { + println!("Failed to system: {}", err.to_string()); exit(1); } - for repo in repo_manager.known_repos() { - println!("{:?}", repo.name()); + if let Err(err) = print_host() { + println!("Failed to system: {}", err.to_string()); + exit(1); } } \ No newline at end of file From da2487ea4ebda32874e11aba1207cac24e9c6211 Mon Sep 17 00:00:00 2001 From: Josef Reidinger Date: Wed, 18 Sep 2024 13:24:13 +0200 Subject: [PATCH 11/30] first version of setup script and try to improve submodules --- .gitmodules | 8 +++++ rust/libzypp/.gitmodules | 4 --- rust/libzypp/gir | 1 + rust/libzypp/libzypp | 1 + rust/libzypp/setup_env.sh | 75 +++++++++++++++++++++++++++++++++++++++ 5 files changed, 85 insertions(+), 4 deletions(-) delete mode 100644 rust/libzypp/.gitmodules create mode 160000 rust/libzypp/gir create mode 160000 rust/libzypp/libzypp create mode 100644 rust/libzypp/setup_env.sh diff --git a/.gitmodules b/.gitmodules index eed17fd2f1..187e4c755d 100644 --- a/.gitmodules +++ b/.gitmodules @@ -3,8 +3,16 @@ url = https://github.com/gtk-rs/gir [submodule "./gir"] branch = master + update = none [submodule "rust/libzypp/gir-files"] path = rust/libzypp/gir-files url = https://github.com/gtk-rs/gir-files [submodule "./gir-files"] branch = master + update = none +[submodule "rust/libzypp/libzypp"] + path = rust/libzypp/libzypp + url = https://github.com/openSUSE/libzypp +[submodule "./libzypp"] + branch = zyppng-staging + update = none diff --git a/rust/libzypp/.gitmodules b/rust/libzypp/.gitmodules deleted file mode 100644 index 579072ee38..0000000000 --- a/rust/libzypp/.gitmodules +++ /dev/null @@ -1,4 +0,0 @@ -[submodule "gir"] - update = none -[submodule "gir-files"] - update = none diff --git a/rust/libzypp/gir b/rust/libzypp/gir new file mode 160000 index 0000000000..06c4f1963c --- /dev/null +++ b/rust/libzypp/gir @@ -0,0 +1 @@ +Subproject commit 06c4f1963c554d779aab89684d1a04cabec647e0 diff --git a/rust/libzypp/libzypp b/rust/libzypp/libzypp new file mode 160000 index 0000000000..a0300b9517 --- /dev/null +++ b/rust/libzypp/libzypp @@ -0,0 +1 @@ +Subproject commit a0300b95170896ab3b4c6cae302d24cbd7c5d734 diff --git a/rust/libzypp/setup_env.sh b/rust/libzypp/setup_env.sh new file mode 100644 index 0000000000..1d2dacfd61 --- /dev/null +++ b/rust/libzypp/setup_env.sh @@ -0,0 +1,75 @@ +#!/usr/bin/bash + +# Script that do initial setup for libzypp ng bindings development. +# To update git submodules use +# git submodule update --remote + +BASEDIR=$(dirname "$0") + +# install all required packages +sudo zypper --non-interactive install \ + git \ + cmake \ + openssl \ + libudev1 \ + libboost_headers-devel \ + libboost_program_options-devel \ + libboost_test-devel \ + libboost_thread-devel \ + dejagnu \ + doxygen \ + texlive-latex \ + texlive-xcolor \ + texlive-newunicodechar \ + texlive-dvips \ + ghostscript \ + gcc-c++ \ + gettext-devel \ + graphviz \ + libxml2-devel \ + yaml-cpp-devel \ + gobject-introspection-devel \ + libproxy-devel \ + pkg-config \ + libsolv-devel \ + libsolv-tools-base \ + glib2-devel \ + libsigc++2-devel \ + readline-devel \ + nginx \ + vsftpd \ + rpm \ + rpm-devel \ + libgpgme-devel \ + FastCGI-devel \ + libcurl-devel \ + "rubygem(ruby:3.3.0:abstract_method)" \ + libzck-devel \ + libzstd-devel \ + libbz2-devel \ + xz-devel \ + rustup + +cd "$BASEDIR" +# checkout submodules +git submodule update --checkout + +# lets build libzypp +cd libzypp +make -f Makefile.cvs +make +sudo make install +cd - + +# now lets make rust working +rustup install stable +# lets install gir +cd gir +cargo install --path . +cd - + +# to use gir follow https://gtk-rs.org/gir/book/tutorial/sys_library.html + +cargo build + +echo "To test if everything work run `../target/debug/zypprs`" From a3d82ee6808a8ada83850ae936a1d2182912d53a Mon Sep 17 00:00:00 2001 From: Josef Reidinger Date: Wed, 18 Sep 2024 13:26:23 +0200 Subject: [PATCH 12/30] more git module changes --- .gitmodules | 3 --- rust/libzypp/gir-files | 1 + 2 files changed, 1 insertion(+), 3 deletions(-) create mode 160000 rust/libzypp/gir-files diff --git a/.gitmodules b/.gitmodules index 187e4c755d..5c70608d07 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,18 +1,15 @@ [submodule "rust/libzypp/gir"] path = rust/libzypp/gir url = https://github.com/gtk-rs/gir -[submodule "./gir"] branch = master update = none [submodule "rust/libzypp/gir-files"] path = rust/libzypp/gir-files url = https://github.com/gtk-rs/gir-files -[submodule "./gir-files"] branch = master update = none [submodule "rust/libzypp/libzypp"] path = rust/libzypp/libzypp url = https://github.com/openSUSE/libzypp -[submodule "./libzypp"] branch = zyppng-staging update = none diff --git a/rust/libzypp/gir-files b/rust/libzypp/gir-files new file mode 160000 index 0000000000..62da9eb7c4 --- /dev/null +++ b/rust/libzypp/gir-files @@ -0,0 +1 @@ +Subproject commit 62da9eb7c4bd5d6091a0eaab0d5e97a51f59fd6d From e37094fbbae9006b0fae3b4132bbfe81036c04e9 Mon Sep 17 00:00:00 2001 From: Josef Reidinger Date: Wed, 18 Sep 2024 23:31:41 +0200 Subject: [PATCH 13/30] exclude gir from workspace --- rust/Cargo.toml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/rust/Cargo.toml b/rust/Cargo.toml index dd99e94e9a..8cd1abb28c 100644 --- a/rust/Cargo.toml +++ b/rust/Cargo.toml @@ -8,6 +8,10 @@ members = [ "libzypp/zypp-sys", ] +exclude = [ + "libzypp/gir" +] + resolver = "2" [workspace.package] From e1ab38e3bcb55a2e77ea3a4060c7e3f109dc17d3 Mon Sep 17 00:00:00 2001 From: Josef Reidinger Date: Wed, 18 Sep 2024 23:33:12 +0200 Subject: [PATCH 14/30] fix rubygem name --- rust/libzypp/setup_env.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/rust/libzypp/setup_env.sh b/rust/libzypp/setup_env.sh index 1d2dacfd61..dfa81374c8 100644 --- a/rust/libzypp/setup_env.sh +++ b/rust/libzypp/setup_env.sh @@ -6,8 +6,8 @@ BASEDIR=$(dirname "$0") -# install all required packages -sudo zypper --non-interactive install \ +# install all required packages and only required as recommends are really huge +sudo zypper --non-interactive install --no-recommends \ git \ cmake \ openssl \ @@ -43,7 +43,7 @@ sudo zypper --non-interactive install \ libgpgme-devel \ FastCGI-devel \ libcurl-devel \ - "rubygem(ruby:3.3.0:abstract_method)" \ + "rubygem(asciidoctor)" \ libzck-devel \ libzstd-devel \ libbz2-devel \ @@ -52,6 +52,7 @@ sudo zypper --non-interactive install \ cd "$BASEDIR" # checkout submodules +git submodule init git submodule update --checkout # lets build libzypp From 22efa1d6053712157f26814ea2e14944a9383854 Mon Sep 17 00:00:00 2001 From: Josef Reidinger Date: Wed, 18 Sep 2024 23:42:12 +0200 Subject: [PATCH 15/30] workaround issue with gir workspace --- rust/libzypp/setup_env.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/rust/libzypp/setup_env.sh b/rust/libzypp/setup_env.sh index dfa81374c8..f158c2051e 100644 --- a/rust/libzypp/setup_env.sh +++ b/rust/libzypp/setup_env.sh @@ -66,6 +66,8 @@ cd - rustup install stable # lets install gir cd gir +# workaround for badly working exclude in cargo see https://github.com/rust-lang/cargo/issues/6745 +printf '\n[workspace]' >> Cargo.toml cargo install --path . cd - @@ -73,4 +75,4 @@ cd - cargo build -echo "To test if everything work run `../target/debug/zypprs`" +echo 'To test if everything work run `../target/debug/zypprs`' From 9d291decb4fea2377f845551a30f4962172a1b80 Mon Sep 17 00:00:00 2001 From: Josef Reidinger Date: Thu, 19 Sep 2024 10:58:15 +0200 Subject: [PATCH 16/30] make script idempotent --- rust/libzypp/setup_env.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/rust/libzypp/setup_env.sh b/rust/libzypp/setup_env.sh index f158c2051e..a93fd584ef 100644 --- a/rust/libzypp/setup_env.sh +++ b/rust/libzypp/setup_env.sh @@ -67,7 +67,9 @@ rustup install stable # lets install gir cd gir # workaround for badly working exclude in cargo see https://github.com/rust-lang/cargo/issues/6745 -printf '\n[workspace]' >> Cargo.toml +if ! grep -q '\[workspace\]' Cargo.toml; then + printf '\n[workspace]' >> Cargo.toml +fi cargo install --path . cd - From 68cd4d7349885c699fc5ee4a1a3695aa1591879f Mon Sep 17 00:00:00 2001 From: Josef Reidinger Date: Thu, 19 Sep 2024 11:50:11 +0200 Subject: [PATCH 17/30] fix build libzypp with glib --- rust/libzypp/setup_env.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/rust/libzypp/setup_env.sh b/rust/libzypp/setup_env.sh index a93fd584ef..e300e55da5 100644 --- a/rust/libzypp/setup_env.sh +++ b/rust/libzypp/setup_env.sh @@ -58,6 +58,7 @@ git submodule update --checkout # lets build libzypp cd libzypp make -f Makefile.cvs +cmake -D BUILD_GLIB_API=ON make sudo make install cd - From 3fc2029676ed280013e61622ab1051557bd0cae2 Mon Sep 17 00:00:00 2001 From: Josef Reidinger Date: Thu, 19 Sep 2024 14:17:13 +0200 Subject: [PATCH 18/30] update to the fixed version of libzypp --- rust/libzypp/libzypp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust/libzypp/libzypp b/rust/libzypp/libzypp index a0300b9517..9e5ce29270 160000 --- a/rust/libzypp/libzypp +++ b/rust/libzypp/libzypp @@ -1 +1 @@ -Subproject commit a0300b95170896ab3b4c6cae302d24cbd7c5d734 +Subproject commit 9e5ce2927098de2fbc474cacf698d04f94600ca8 From 551ea5cc8e9a6bcc7ca5fff50d85ac1b08bd47bc Mon Sep 17 00:00:00 2001 From: Josef Reidinger Date: Thu, 19 Sep 2024 15:08:22 +0200 Subject: [PATCH 19/30] document how to run script with distrobox --- rust/libzypp/setup_env.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/rust/libzypp/setup_env.sh b/rust/libzypp/setup_env.sh index e300e55da5..86ec5b4e47 100644 --- a/rust/libzypp/setup_env.sh +++ b/rust/libzypp/setup_env.sh @@ -3,6 +3,14 @@ # Script that do initial setup for libzypp ng bindings development. # To update git submodules use # git submodule update --remote +# +# It needs TW as dev env. One of option is to use distrobox as shown: +# ```sh +# distrobox create --image tumbleweed --name zyppng +# distrobox enter zyppng # if stuck see https://github.com/89luca89/distrobox/issues/1530 and kill and run again +# # and now you are inside dev env where you run this script +# # to clean use distrobox stop zyppng and if no longer image is needed use distrobox rm zyppng +# ``` BASEDIR=$(dirname "$0") From 38cce0492987058132cd34de25d4c0e382be3c1e Mon Sep 17 00:00:00 2001 From: Josef Reidinger Date: Thu, 19 Sep 2024 22:12:53 +0200 Subject: [PATCH 20/30] Update gir-files location for zypp and simplify lib.rs --- rust/libzypp/Gir.toml | 2 +- rust/libzypp/gir | 2 +- rust/libzypp/src/lib.rs | 4 ++-- rust/libzypp/zypp-sys/Gir.toml | 2 +- rust/libzypp/zypp-sys/build.rs | 1 + 5 files changed, 6 insertions(+), 5 deletions(-) diff --git a/rust/libzypp/Gir.toml b/rust/libzypp/Gir.toml index b5c377abac..0c1a46d817 100644 --- a/rust/libzypp/Gir.toml +++ b/rust/libzypp/Gir.toml @@ -3,7 +3,7 @@ library = "Zypp" version = "1.0" min_cfg_version = "1.0" target_path = "." -girs_directories = ["gir-files"] +girs_directories = ["gir-files", "libzypp/build/zypp-glib"] work_mode = "normal" single_version_file = true generate_safety_asserts = true diff --git a/rust/libzypp/gir b/rust/libzypp/gir index 06c4f1963c..a11b11f2e4 160000 --- a/rust/libzypp/gir +++ b/rust/libzypp/gir @@ -1 +1 @@ -Subproject commit 06c4f1963c554d779aab89684d1a04cabec647e0 +Subproject commit a11b11f2e403d615edd94497b6fe5b3c5283145b diff --git a/rust/libzypp/src/lib.rs b/rust/libzypp/src/lib.rs index 7d0f8954d4..2913e2b937 100644 --- a/rust/libzypp/src/lib.rs +++ b/rust/libzypp/src/lib.rs @@ -1,6 +1,6 @@ #![cfg_attr(docsrs, feature(doc_cfg))] -pub use ffi; +use ffi; /// No-op. macro_rules! skip_assert_initialized { @@ -15,4 +15,4 @@ macro_rules! assert_initialized_main_thread { pub use auto::*; mod auto; -pub use auto::traits::InfoBaseExt; +pub use auto::traits::*; diff --git a/rust/libzypp/zypp-sys/Gir.toml b/rust/libzypp/zypp-sys/Gir.toml index 8e127cac17..ceddcc47f7 100644 --- a/rust/libzypp/zypp-sys/Gir.toml +++ b/rust/libzypp/zypp-sys/Gir.toml @@ -3,7 +3,7 @@ library = "Zypp" version = "1.0" min_cfg_version = "1.0" target_path = "." -girs_directories = ["../gir-files/"] +girs_directories = ["../gir-files/", "../libzypp/build/zypp-glib"] work_mode = "sys" single_version_file = true diff --git a/rust/libzypp/zypp-sys/build.rs b/rust/libzypp/zypp-sys/build.rs index 94a39d86f3..122c8117c2 100644 --- a/rust/libzypp/zypp-sys/build.rs +++ b/rust/libzypp/zypp-sys/build.rs @@ -1,5 +1,6 @@ // This file was generated by gir (https://github.com/gtk-rs/gir) // from ../gir-files +// from ../libzypp/build/zypp-glib // DO NOT EDIT #[cfg(not(docsrs))] From 3826deceaef2c04637b78a74465b26c4a4a49f2f Mon Sep 17 00:00:00 2001 From: Josef Reidinger Date: Thu, 19 Sep 2024 22:19:31 +0200 Subject: [PATCH 21/30] autogenerate documentaion with help of rustdoc-stripper --- rust/libzypp/src/auto/context.rs | 27 +++++++ rust/libzypp/src/auto/enums.rs | 3 + rust/libzypp/src/auto/expected.rs | 11 +++ rust/libzypp/src/auto/info_base.rs | 5 ++ rust/libzypp/src/auto/managed_file.rs | 9 +++ rust/libzypp/src/auto/progress_observer.rs | 77 +++++++++++++++++++ rust/libzypp/src/auto/repo_info.rs | 31 ++++++++ rust/libzypp/src/auto/repo_manager.rs | 46 +++++++++++ rust/libzypp/src/auto/repo_manager_options.rs | 10 +++ rust/libzypp/src/auto/repository.rs | 9 +++ rust/libzypp/src/auto/service_info.rs | 5 ++ 11 files changed, 233 insertions(+) diff --git a/rust/libzypp/src/auto/context.rs b/rust/libzypp/src/auto/context.rs index 0f8cab0141..d61f5315b6 100644 --- a/rust/libzypp/src/auto/context.rs +++ b/rust/libzypp/src/auto/context.rs @@ -7,6 +7,26 @@ use glib::{prelude::*,signal::{connect_raw, SignalHandlerId},translate::*}; use std::{boxed::Box as Box_}; glib::wrapper! { + /// This class is the basic building block for the zypp glib API. It defines the path of the + /// root filesystem we are operating on. This is usually "/" but to support chroot use cases it + /// can point to any directory in a filesystem where packages should be installed into. If the rootfs + /// is not defined as "/" then zypp will install packages using chroot into the directory. + /// + /// Settings for zypp are loaded from the rootfs directory and locks are also applied relative to it. + /// Meaning that one context can operate on "/" while another one can operate on "/tmp/rootfs". + /// + /// \note Currently only one ZyppContext is supported until we have refactored the underlying code to support + /// having multiple of them. Mixing them atm will not work due to locks and libsolv limitations + /// + /// ## Properties + /// + /// + /// #### `versionprop` + /// Readable + /// + /// + /// #### `zypp-cppObj` + /// Writeable | Construct Only #[doc(alias = "ZyppContext")] pub struct Context(Object); @@ -25,6 +45,9 @@ impl Context { } + /// Loads the system at the given sysroot, returns TRUE on success, otherwise FALSE + /// ## `sysRoot` + /// The system sysroot to load, if a nullptr is given "/" is used #[doc(alias = "zypp_context_load_system")] pub fn load_system(&self, sysRoot: Option<&str>) -> Result<(), glib::Error> { unsafe { @@ -35,6 +58,10 @@ impl Context { } } + /// + /// # Returns + /// + /// The context root as requested when loading the system #[doc(alias = "zypp_context_sysroot")] pub fn sysroot(&self) -> Option { unsafe { diff --git a/rust/libzypp/src/auto/enums.rs b/rust/libzypp/src/auto/enums.rs index 25720cfc72..1ae4341127 100644 --- a/rust/libzypp/src/auto/enums.rs +++ b/rust/libzypp/src/auto/enums.rs @@ -10,6 +10,9 @@ use glib::{prelude::*,translate::*}; #[non_exhaustive] #[doc(alias = "ZyppException")] pub enum Exception { + /// Error domain for the zypp exception handling. Errors in this domain will + /// be from the [`Exception`][crate::Exception] enumeration. See [`glib::Error`][crate::glib::Error] for information + /// on error domains. #[doc(alias = "ZYPP_ERROR")] Error, #[doc(hidden)] diff --git a/rust/libzypp/src/auto/expected.rs b/rust/libzypp/src/auto/expected.rs index 365a5a92f2..c5436a77d9 100644 --- a/rust/libzypp/src/auto/expected.rs +++ b/rust/libzypp/src/auto/expected.rs @@ -6,6 +6,7 @@ use crate::{ffi}; use glib::{translate::*}; glib::wrapper! { + /// #[doc(alias = "ZyppExpected")] pub struct Expected(Object); @@ -15,6 +16,7 @@ glib::wrapper! { } impl Expected { + /// Creates a new ZyppExcpected containing a error #[doc(alias = "zypp_expected_new_error")] pub fn new_error(error: &mut glib::Error) -> Expected { assert_initialized_main_thread!(); @@ -23,6 +25,7 @@ impl Expected { } } + /// Creates a new ZyppExcpected containing a value #[doc(alias = "zypp_expected_new_value")] pub fn new_value(value: &glib::Value) -> Expected { assert_initialized_main_thread!(); @@ -31,6 +34,10 @@ impl Expected { } } + /// + /// # Returns + /// + /// The error or NULL if there is no error #[doc(alias = "zypp_expected_get_error")] #[doc(alias = "get_error")] pub fn error(&self) -> Option { @@ -39,6 +46,10 @@ impl Expected { } } + /// + /// # Returns + /// + /// The value or NULL if there is none or a error #[doc(alias = "zypp_expected_get_value")] #[doc(alias = "get_value")] pub fn value(&self) -> Result, glib::Error> { diff --git a/rust/libzypp/src/auto/info_base.rs b/rust/libzypp/src/auto/info_base.rs index ca12b6089c..1fb93bccfd 100644 --- a/rust/libzypp/src/auto/info_base.rs +++ b/rust/libzypp/src/auto/info_base.rs @@ -24,6 +24,11 @@ mod sealed { impl> Sealed for T {} } +/// Trait containing all [`struct@InfoBase`] methods. +/// +/// # Implementors +/// +/// [`InfoBase`][struct@crate::InfoBase], [`RepoInfo`][struct@crate::RepoInfo], [`ServiceInfo`][struct@crate::ServiceInfo] pub trait InfoBaseExt: IsA + sealed::Sealed + 'static { #[doc(alias = "zypp_info_base_alias")] fn alias(&self) -> Option { diff --git a/rust/libzypp/src/auto/managed_file.rs b/rust/libzypp/src/auto/managed_file.rs index 3be8730a1d..3349bbf421 100644 --- a/rust/libzypp/src/auto/managed_file.rs +++ b/rust/libzypp/src/auto/managed_file.rs @@ -17,6 +17,10 @@ glib::wrapper! { } impl ManagedFile { + /// ## `path` + /// The path of the file we want to manage + /// ## `dispose` + /// If set to true the file is cleaned up when the [`ManagedFile`][crate::ManagedFile] gets out of scope #[doc(alias = "zypp_managed_file_new")] pub fn new(path: &str, dispose: bool) -> ManagedFile { assert_initialized_main_thread!(); @@ -25,6 +29,10 @@ impl ManagedFile { } } + /// + /// # Returns + /// + /// The currently managed path #[doc(alias = "zypp_managed_file_get_path")] #[doc(alias = "get_path")] pub fn path(&mut self) -> Option { @@ -33,6 +41,7 @@ impl ManagedFile { } } + /// Enables or disables dispose for this object #[doc(alias = "zypp_managed_file_set_dispose_enabled")] pub fn set_dispose_enabled(&mut self, enabled: bool) { unsafe { diff --git a/rust/libzypp/src/auto/progress_observer.rs b/rust/libzypp/src/auto/progress_observer.rs index 854ffb03db..7a2eabae21 100644 --- a/rust/libzypp/src/auto/progress_observer.rs +++ b/rust/libzypp/src/auto/progress_observer.rs @@ -7,6 +7,43 @@ use glib::{prelude::*,signal::{connect_raw, SignalHandlerId},translate::*}; use std::{boxed::Box as Box_}; glib::wrapper! { + /// + /// + /// ## Properties + /// + /// + /// #### `base-steps` + /// Readable | Writeable + /// + /// + /// #### `label` + /// Readable | Writeable + /// + /// + /// #### `progress` + /// Readable + /// + /// + /// #### `steps` + /// Readable + /// + /// + /// #### `value` + /// Readable | Writeable + /// + /// + /// #### `zypp-cppObj` + /// Writeable | Construct Only + /// + /// ## Signals + /// + /// + /// #### `finished` + /// + /// + /// + /// #### `new-subtask` + /// #[doc(alias = "ZyppProgressObserver")] pub struct ProgressObserver(Object); @@ -25,6 +62,11 @@ impl ProgressObserver { } + /// Registers a subtask as a child to the current one + /// ## `newChild` + /// A reference to the new subtask, the parent takes a reference to it + /// ## `weight` + /// The weight how the subtasks steps should be calculated into the parents percentage #[doc(alias = "zypp_progress_observer_add_subtask")] pub fn add_subtask(&self, newChild: &ProgressObserver, weight: f32) { unsafe { @@ -32,6 +74,10 @@ impl ProgressObserver { } } + /// + /// # Returns + /// + /// The number of steps for this `ZyppProgressObserver` excluding possible substasks #[doc(alias = "zypp_progress_observer_get_base_steps")] #[doc(alias = "get_base_steps")] #[doc(alias = "base-steps")] @@ -41,6 +87,10 @@ impl ProgressObserver { } } + /// + /// # Returns + /// + /// The direct children of this Task #[doc(alias = "zypp_progress_observer_get_children")] #[doc(alias = "get_children")] pub fn children(&self) -> Vec { @@ -49,6 +99,10 @@ impl ProgressObserver { } } + /// + /// # Returns + /// + /// The current effective value of the task progress including subtasks, by default this is 0 #[doc(alias = "zypp_progress_observer_get_current")] #[doc(alias = "get_current")] pub fn current(&self) -> f64 { @@ -57,6 +111,10 @@ impl ProgressObserver { } } + /// + /// # Returns + /// + /// The task label or NULL if none was set #[doc(alias = "zypp_progress_observer_get_label")] #[doc(alias = "get_label")] pub fn label(&self) -> Option { @@ -65,6 +123,10 @@ impl ProgressObserver { } } + /// + /// # Returns + /// + /// The current percentage value of the task progress including subtasks, by default this is 0 #[doc(alias = "zypp_progress_observer_get_progress")] #[doc(alias = "get_progress")] pub fn progress(&self) -> f64 { @@ -73,6 +135,10 @@ impl ProgressObserver { } } + /// + /// # Returns + /// + /// The effective number of steps for this `ZyppProgressObserver` including possible substasks #[doc(alias = "zypp_progress_observer_get_steps")] #[doc(alias = "get_steps")] pub fn steps(&self) -> f64 { @@ -81,6 +147,9 @@ impl ProgressObserver { } } + /// Increases the current progress value by the number of given steps + /// ## `increase` + /// Number of steps to increase the value #[doc(alias = "zypp_progress_observer_inc")] pub fn inc(&self, increase: i32) { unsafe { @@ -88,6 +157,10 @@ impl ProgressObserver { } } + /// Changes the currently used nr of expected steps for this `ZyppProgressObserver`, if the given value is less than + /// 0 nothing is changed. + /// ## `stepCount` + /// New number of steps #[doc(alias = "zypp_progress_observer_set_base_steps")] #[doc(alias = "base-steps")] pub fn set_base_steps(&self, stepCount: i32) { @@ -103,6 +176,7 @@ impl ProgressObserver { } } + /// Fills the progress and all its children up to 100% and emits the finished signal #[doc(alias = "zypp_progress_observer_set_finished")] pub fn set_finished(&self) { unsafe { @@ -110,6 +184,9 @@ impl ProgressObserver { } } + /// Changes the currently used label + /// ## `label` + /// The new label #[doc(alias = "zypp_progress_observer_set_label")] #[doc(alias = "label")] pub fn set_label(&self, label: &str) { diff --git a/rust/libzypp/src/auto/repo_info.rs b/rust/libzypp/src/auto/repo_info.rs index ed2ce501f1..7a284f4222 100644 --- a/rust/libzypp/src/auto/repo_info.rs +++ b/rust/libzypp/src/auto/repo_info.rs @@ -7,6 +7,33 @@ use glib::{prelude::*,signal::{connect_raw, SignalHandlerId},translate::*}; use std::{boxed::Box as Box_}; glib::wrapper! { + /// + /// + /// ## Properties + /// + /// + /// #### `alias` + /// Readable | Writeable + /// + /// + /// #### `enabled` + /// Readable | Writeable + /// + /// + /// #### `name` + /// Readable | Writeable + /// + /// + /// #### `zypp-cppObj` + /// Writeable | Construct Only + /// + /// + /// #### `zyppcontext` + /// Writeable | Construct Only + /// + /// # Implements + /// + /// [`InfoBaseExt`][trait@crate::prelude::InfoBaseExt] #[doc(alias = "ZyppRepoInfo")] pub struct RepoInfo(Object) @implements InfoBase; @@ -33,6 +60,10 @@ impl RepoInfo { } + /// + /// # Returns + /// + /// The type of repository #[doc(alias = "zypp_repo_info_get_repo_type")] #[doc(alias = "get_repo_type")] pub fn repo_type(&self) -> RepoInfoType { diff --git a/rust/libzypp/src/auto/repo_manager.rs b/rust/libzypp/src/auto/repo_manager.rs index 6f8bde24b1..6f880b1a25 100644 --- a/rust/libzypp/src/auto/repo_manager.rs +++ b/rust/libzypp/src/auto/repo_manager.rs @@ -7,6 +7,21 @@ use glib::{prelude::*,signal::{connect_raw, SignalHandlerId},translate::*}; use std::{boxed::Box as Box_}; glib::wrapper! { + /// + /// + /// ## Properties + /// + /// + /// #### `options` + /// Readable | Writeable | Construct + /// + /// + /// #### `zypp-cppObj` + /// Writeable | Construct Only + /// + /// + /// #### `zyppcontext` + /// Writeable | Construct Only #[doc(alias = "ZyppRepoManager")] pub struct RepoManager(Object); @@ -16,6 +31,12 @@ glib::wrapper! { } impl RepoManager { + /// ## `ctx` + /// The [`Context`][crate::Context] the RepoManager should operate on + /// + /// # Returns + /// + /// newly created [`RepoManager`][crate::RepoManager] #[doc(alias = "zypp_repo_manager_new")] pub fn new(ctx: &Context) -> RepoManager { skip_assert_initialized!(); @@ -33,6 +54,11 @@ impl RepoManager { } + /// + /// # Returns + /// + /// list of repositories, + /// free the list with g_list_free and the elements with gobject_unref when done. #[doc(alias = "zypp_repo_manager_get_known_repos")] #[doc(alias = "get_known_repos")] pub fn known_repos(&self) -> Vec { @@ -41,6 +67,11 @@ impl RepoManager { } } + /// + /// # Returns + /// + /// list of existing services, + /// free the list with g_list_free and the elements with gobject_unref when done. #[doc(alias = "zypp_repo_manager_get_known_services")] #[doc(alias = "get_known_services")] pub fn known_services(&self) -> Vec { @@ -49,6 +80,11 @@ impl RepoManager { } } + /// Loads the known repositories and services. + /// + /// # Returns + /// + /// True if init was successful, otherwise returns false and sets the error #[doc(alias = "zypp_repo_manager_initialize")] pub fn initialize(&self) -> Result<(), glib::Error> { unsafe { @@ -59,6 +95,16 @@ impl RepoManager { } } + /// ## `repos` + /// the repositories to refresh + /// ## `forceDownload` + /// Force downloading the repository even if its up 2 date + /// ## `statusTracker` + /// Progress tracker + /// + /// # Returns + /// + /// list of results for the refreshed repos #[doc(alias = "zypp_repo_manager_refresh_repos")] pub fn refresh_repos(&self, repos: &[RepoInfo], forceDownload: bool, statusTracker: Option) -> Vec { unsafe { diff --git a/rust/libzypp/src/auto/repo_manager_options.rs b/rust/libzypp/src/auto/repo_manager_options.rs index ddb7ad1c72..38a69edf76 100644 --- a/rust/libzypp/src/auto/repo_manager_options.rs +++ b/rust/libzypp/src/auto/repo_manager_options.rs @@ -17,6 +17,12 @@ glib::wrapper! { } impl RepoManagerOptions { + /// ## `root` + /// The prefix for all paths + /// + /// # Returns + /// + /// newly created [`RepoManagerOptions`][crate::RepoManagerOptions] #[doc(alias = "zypp_repo_manager_options_new")] pub fn new(root: &str) -> RepoManagerOptions { assert_initialized_main_thread!(); @@ -25,6 +31,10 @@ impl RepoManagerOptions { } } + /// + /// # Returns + /// + /// The currently managed path #[doc(alias = "zypp_repo_manager_options_get_root")] #[doc(alias = "get_root")] pub fn root(&mut self) -> Option { diff --git a/rust/libzypp/src/auto/repository.rs b/rust/libzypp/src/auto/repository.rs index 499920e06c..3c81afe3b7 100644 --- a/rust/libzypp/src/auto/repository.rs +++ b/rust/libzypp/src/auto/repository.rs @@ -6,6 +6,7 @@ use crate::{ffi,RepoInfo}; use glib::{translate::*}; glib::wrapper! { + /// #[doc(alias = "ZyppRepository")] pub struct Repository(Object); @@ -15,6 +16,10 @@ glib::wrapper! { } impl Repository { + /// + /// # Returns + /// + /// Name of the repository #[doc(alias = "zypp_repository_get_name")] #[doc(alias = "get_name")] pub fn name(&self) -> Option { @@ -23,6 +28,10 @@ impl Repository { } } + /// + /// # Returns + /// + /// The corresponding ZyppRepoInfo #[doc(alias = "zypp_repository_get_repoinfo")] #[doc(alias = "get_repoinfo")] pub fn repoinfo(&self) -> Option { diff --git a/rust/libzypp/src/auto/service_info.rs b/rust/libzypp/src/auto/service_info.rs index 4305cfaa23..49c7833f2f 100644 --- a/rust/libzypp/src/auto/service_info.rs +++ b/rust/libzypp/src/auto/service_info.rs @@ -6,6 +6,11 @@ use crate::{ffi,Context,InfoBase}; use glib::{translate::*}; glib::wrapper! { + /// + /// + /// # Implements + /// + /// [`InfoBaseExt`][trait@crate::prelude::InfoBaseExt] #[doc(alias = "ZyppServiceInfo")] pub struct ServiceInfo(Object) @implements InfoBase; From 13d2d60c1f70fda6acc0beb72c31a0368b2c01a5 Mon Sep 17 00:00:00 2001 From: Josef Reidinger Date: Fri, 20 Sep 2024 10:40:51 +0200 Subject: [PATCH 22/30] Add readme and install doc tool --- rust/libzypp/README.md | 21 +++++++++++++++++++++ rust/libzypp/setup_env.sh | 3 +++ 2 files changed, 24 insertions(+) create mode 100644 rust/libzypp/README.md diff --git a/rust/libzypp/README.md b/rust/libzypp/README.md new file mode 100644 index 0000000000..25f967f689 --- /dev/null +++ b/rust/libzypp/README.md @@ -0,0 +1,21 @@ +## Experimental bindings for libzypp glib + +Goal of this crate is to provide direct rust bindings to libzypp to avoid long path over yast component system. + +### Code Organization + +- zypp-sys dir is low level unsafe libzypp bindings +- libzypp dir git submodule for glib branch of libzypp +- gir dir is gir submodule for gir tool on revision used for code generation +- gir-files dir is git submodule with directory with curated gir files ( see gir book for details ) +- ./ is high level libzypp bindings + +### Updating bindings + +In general follow gir book. Ideally update gir submodule to master. Then regenerate zypp-sys, +then high level bindings and do not forget to also update documentation with `rustdoc-stripper` + +### Resources + +- gir book: https://gtk-rs.org/gir/book/introduction.html +- git submodules: https://git-scm.com/book/en/v2/Git-Tools-Submodules diff --git a/rust/libzypp/setup_env.sh b/rust/libzypp/setup_env.sh index 86ec5b4e47..4dca921531 100644 --- a/rust/libzypp/setup_env.sh +++ b/rust/libzypp/setup_env.sh @@ -84,6 +84,9 @@ cd - # to use gir follow https://gtk-rs.org/gir/book/tutorial/sys_library.html +# install doc tool +cargo install rustdoc-stripper + cargo build echo 'To test if everything work run `../target/debug/zypprs`' From 84094d20a59fa8099e103856ccd6ff7c33298e83 Mon Sep 17 00:00:00 2001 From: Martin Vidner Date: Fri, 20 Sep 2024 14:11:38 +0200 Subject: [PATCH 23/30] setup_env.sh: sudo only where it is available in the Agama testing containers it is missing --- rust/libzypp/setup_env.sh | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/rust/libzypp/setup_env.sh b/rust/libzypp/setup_env.sh index 4dca921531..82ba716833 100644 --- a/rust/libzypp/setup_env.sh +++ b/rust/libzypp/setup_env.sh @@ -12,10 +12,24 @@ # # to clean use distrobox stop zyppng and if no longer image is needed use distrobox rm zyppng # ``` +set -eu BASEDIR=$(dirname "$0") +# Helper: +# Ensure root privileges for the installation. +# In a testing container, we are root but there is no sudo. +if [ $(id --user) != 0 ]; then + SUDO=sudo + if [ $($SUDO id --user) != 0 ]; then + echo "We are not root and cannot sudo, cannot continue." + exit 1 + fi +else + SUDO="" +fi + # install all required packages and only required as recommends are really huge -sudo zypper --non-interactive install --no-recommends \ +$SUDO zypper --non-interactive install --no-recommends \ git \ cmake \ openssl \ @@ -68,7 +82,7 @@ cd libzypp make -f Makefile.cvs cmake -D BUILD_GLIB_API=ON make -sudo make install +$SUDO make install cd - # now lets make rust working From 9a1e4c876c0f1d4ee0e612607b553405588e0da5 Mon Sep 17 00:00:00 2001 From: Martin Vidner Date: Fri, 20 Sep 2024 14:12:40 +0200 Subject: [PATCH 24/30] setup_env.sh: parallel make (nproc) --- rust/libzypp/setup_env.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust/libzypp/setup_env.sh b/rust/libzypp/setup_env.sh index 82ba716833..87421037d9 100644 --- a/rust/libzypp/setup_env.sh +++ b/rust/libzypp/setup_env.sh @@ -81,7 +81,7 @@ git submodule update --checkout cd libzypp make -f Makefile.cvs cmake -D BUILD_GLIB_API=ON -make +make -j$(nproc) $SUDO make install cd - From db9914c685e6da56ae575b3c57bc2d751c52db27 Mon Sep 17 00:00:00 2001 From: Martin Vidner Date: Fri, 20 Sep 2024 15:33:45 +0200 Subject: [PATCH 25/30] setup_env.sh: remove rust RPMs before installing via rustup the Agama testing container has them --- rust/libzypp/setup_env.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/rust/libzypp/setup_env.sh b/rust/libzypp/setup_env.sh index 87421037d9..c5a1640d95 100644 --- a/rust/libzypp/setup_env.sh +++ b/rust/libzypp/setup_env.sh @@ -28,6 +28,8 @@ else SUDO="" fi +$SUDO zypper --non-interactive rm rust\* || true + # install all required packages and only required as recommends are really huge $SUDO zypper --non-interactive install --no-recommends \ git \ From 4bf4f97e81cd22069edc4b229fa925fa18f28ca4 Mon Sep 17 00:00:00 2001 From: Martin Vidner Date: Fri, 20 Sep 2024 15:34:35 +0200 Subject: [PATCH 26/30] setup_env.sh: save space by not building zypp autodocs --- rust/libzypp/setup_env.sh | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/rust/libzypp/setup_env.sh b/rust/libzypp/setup_env.sh index c5a1640d95..9e20d551c8 100644 --- a/rust/libzypp/setup_env.sh +++ b/rust/libzypp/setup_env.sh @@ -41,12 +41,6 @@ $SUDO zypper --non-interactive install --no-recommends \ libboost_test-devel \ libboost_thread-devel \ dejagnu \ - doxygen \ - texlive-latex \ - texlive-xcolor \ - texlive-newunicodechar \ - texlive-dvips \ - ghostscript \ gcc-c++ \ gettext-devel \ graphviz \ @@ -82,7 +76,7 @@ git submodule update --checkout # lets build libzypp cd libzypp make -f Makefile.cvs -cmake -D BUILD_GLIB_API=ON +cmake -D BUILD_GLIB_API=ON -D DISABLE_AUTODOCS=ON make -j$(nproc) $SUDO make install cd - From 15a5f9b0cade5e928bec07dd993cfa55e2f7b3b2 Mon Sep 17 00:00:00 2001 From: Martin Vidner Date: Fri, 20 Sep 2024 15:55:47 +0200 Subject: [PATCH 27/30] setup_env.sh: a readable error when sudo is missing It still fails but explains why Before, it just failed because of set -e and missing sudo --- rust/libzypp/setup_env.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust/libzypp/setup_env.sh b/rust/libzypp/setup_env.sh index 9e20d551c8..e1be0da861 100644 --- a/rust/libzypp/setup_env.sh +++ b/rust/libzypp/setup_env.sh @@ -20,7 +20,7 @@ BASEDIR=$(dirname "$0") # In a testing container, we are root but there is no sudo. if [ $(id --user) != 0 ]; then SUDO=sudo - if [ $($SUDO id --user) != 0 ]; then + if [ "$($SUDO id --user)" != 0 ]; then echo "We are not root and cannot sudo, cannot continue." exit 1 fi From 61b1e1942de67233d2d2b995db75355b4185a0cb Mon Sep 17 00:00:00 2001 From: Martin Vidner Date: Fri, 20 Sep 2024 16:35:45 +0200 Subject: [PATCH 28/30] setup_env.sh: make executable --- rust/libzypp/setup_env.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 rust/libzypp/setup_env.sh diff --git a/rust/libzypp/setup_env.sh b/rust/libzypp/setup_env.sh old mode 100644 new mode 100755 From 07f3a45806f38630def862e93d166fe7d9fed076 Mon Sep 17 00:00:00 2001 From: Martin Vidner Date: Mon, 23 Sep 2024 16:33:28 +0200 Subject: [PATCH 29/30] testing_using_container: fix unbound variable --- setup-services.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup-services.sh b/setup-services.sh index c573ea566e..eb964260c5 100755 --- a/setup-services.sh +++ b/setup-services.sh @@ -116,7 +116,7 @@ fi sed -e '/gemspec/a gem "ruby-dbus", path: "/checkout-ruby-dbus"' -i Gemfile fi - if [ -n "$CI" ]; then + if [ -n "${CI-}" ]; then # in CI reuse the pre-installed system gems from RPMs bundle config set --local disable_shared_gems 0 else From 581537b20b77ae78f50b179af934c5f526485222 Mon Sep 17 00:00:00 2001 From: Martin Vidner Date: Mon, 23 Sep 2024 16:51:39 +0200 Subject: [PATCH 30/30] setup_env.sh: don't invoke cmake twice Makefile.cvs would do it in build/ and then here in ./ Call it once, in build/ --- rust/libzypp/setup_env.sh | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/rust/libzypp/setup_env.sh b/rust/libzypp/setup_env.sh index e1be0da861..6d658f844a 100755 --- a/rust/libzypp/setup_env.sh +++ b/rust/libzypp/setup_env.sh @@ -74,12 +74,18 @@ git submodule init git submodule update --checkout # lets build libzypp +( cd libzypp -make -f Makefile.cvs -cmake -D BUILD_GLIB_API=ON -D DISABLE_AUTODOCS=ON +mkdir -p build +cd build +# With /usr/local, we have to set a path: LD_LIBRARY_PATH=/usr/local/lib64 zypprs +# but the plus side is that the /usr zypper keeps working :) +# +# cmake -D CMAKE_INSTALL_PREFIX=/usr/local -D BUILD_GLIB_API=ON -D DISABLE_AUTODOCS=ON .. +cmake -D BUILD_GLIB_API=ON -D DISABLE_AUTODOCS=ON .. make -j$(nproc) $SUDO make install -cd - +) # now lets make rust working rustup install stable