diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000000..5c70608d07 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,15 @@ +[submodule "rust/libzypp/gir"] + path = rust/libzypp/gir + url = https://github.com/gtk-rs/gir + branch = master + update = none +[submodule "rust/libzypp/gir-files"] + path = rust/libzypp/gir-files + url = https://github.com/gtk-rs/gir-files + branch = master + update = none +[submodule "rust/libzypp/libzypp"] + path = rust/libzypp/libzypp + url = https://github.com/openSUSE/libzypp + branch = zyppng-staging + update = none diff --git a/rust/Cargo.lock b/rust/Cargo.lock index 9b1ec100a3..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" @@ -805,6 +828,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" @@ -867,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", @@ -877,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", @@ -890,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]] @@ -1023,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", ] @@ -1109,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", @@ -1143,7 +1176,7 @@ dependencies = [ "proc-macro2", "quote", "strsim", - "syn 2.0.72", + "syn 2.0.77", ] [[package]] @@ -1154,7 +1187,7 @@ checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" dependencies = [ "darling_core", "quote", - "syn 2.0.72", + "syn 2.0.77", ] [[package]] @@ -1279,7 +1312,7 @@ checksum = "de0d48a183585823424a4ce1aa132d174a6a81bd540895822eb4c8373a8e49e8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.77", ] [[package]] @@ -1380,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" @@ -1392,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", @@ -1461,6 +1494,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" @@ -1488,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", @@ -1503,7 +1547,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.77", ] [[package]] @@ -1577,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", @@ -1587,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", @@ -1597,9 +1641,62 @@ 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.21.0" +source = "git+https://github.com/gtk-rs/gtk-rs-core#d34db6baf53bda50c65af02d9493d536087d2cf4" +dependencies = [ + "glib-sys", + "gobject-sys", + "libc", + "system-deps", + "windows-sys 0.59.0", +] + +[[package]] +name = "glib" +version = "0.21.0" +source = "git+https://github.com/gtk-rs/gtk-rs-core#d34db6baf53bda50c65af02d9493d536087d2cf4" +dependencies = [ + "bitflags 2.6.0", + "futures-channel", + "futures-core", + "futures-executor", + "futures-task", + "futures-util", + "gio-sys", + "glib-macros", + "glib-sys", + "gobject-sys", + "libc", + "memchr", + "smallvec", +] + +[[package]] +name = "glib-macros" +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.77", +] + +[[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" @@ -1609,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", @@ -1619,6 +1716,16 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "gobject-sys" +version = "0.21.0" +source = "git+https://github.com/gtk-rs/gtk-rs-core#d34db6baf53bda50c65af02d9493d536087d2cf4" +dependencies = [ + "glib-sys", + "libc", + "system-deps", +] + [[package]] name = "h2" version = "0.3.26" @@ -1631,7 +1738,7 @@ dependencies = [ "futures-sink", "futures-util", "http 0.2.12", - "indexmap 2.2.6", + "indexmap 2.5.0", "slab", "tokio", "tokio-util", @@ -1640,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", @@ -1650,7 +1757,7 @@ dependencies = [ "futures-core", "futures-sink", "http 1.1.0", - "indexmap 2.2.6", + "indexmap 2.5.0", "slab", "tokio", "tokio-util", @@ -1882,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", @@ -1896,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", @@ -1942,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", @@ -2022,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", @@ -2082,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" @@ -2127,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", ] @@ -2247,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" @@ -2281,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", @@ -2291,6 +2398,15 @@ dependencies = [ "vcpkg", ] +[[package]] +name = "libzypp" +version = "0.1.0" +dependencies = [ + "glib", + "libc", + "zypp-sys", +] + [[package]] name = "linked-hash-map" version = "0.5.6" @@ -2413,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]] @@ -2434,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", @@ -2642,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", ] @@ -2678,7 +2794,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.77", ] [[package]] @@ -2761,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" @@ -2821,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", @@ -2832,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", @@ -2842,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", @@ -2871,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]] @@ -2944,7 +3060,7 @@ checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" dependencies = [ "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.77", ] [[package]] @@ -2961,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", ] @@ -2994,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]] @@ -3021,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" @@ -3041,6 +3160,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" @@ -3102,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", ] @@ -3141,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", @@ -3161,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", @@ -3217,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", @@ -3225,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", @@ -3241,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", @@ -3257,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", @@ -3270,7 +3398,7 @@ dependencies = [ "wasm-bindgen", "wasm-bindgen-futures", "web-sys", - "winreg 0.52.0", + "windows-registry", ] [[package]] @@ -3338,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", @@ -3351,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", @@ -3373,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", @@ -3383,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", @@ -3421,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]] @@ -3465,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", @@ -3523,7 +3651,7 @@ checksum = "6c64451ba24fc7a6a2d60fc75dd9c83c90903b19028d4eff35e88fc1e86564e9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.77", ] [[package]] @@ -3557,7 +3685,7 @@ dependencies = [ "chrono", "hex", "indexmap 1.9.3", - "indexmap 2.2.6", + "indexmap 2.5.0", "serde", "serde_derive", "serde_json", @@ -3574,7 +3702,7 @@ dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.77", ] [[package]] @@ -3583,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", @@ -3621,6 +3749,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" @@ -3776,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", @@ -3796,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" @@ -3805,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]] @@ -3818,6 +3966,35 @@ 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" +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" @@ -3826,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]] @@ -3853,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", ] @@ -3874,7 +4052,7 @@ checksum = "a4558b58466b9ad7ca0f102865eccc95938dca1a74a856f2b57b6629050da261" dependencies = [ "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.77", ] [[package]] @@ -3944,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", @@ -3968,7 +4146,7 @@ checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" dependencies = [ "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.77", ] [[package]] @@ -4006,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", @@ -4042,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", @@ -4055,21 +4233,21 @@ 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", "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", ] @@ -4080,22 +4258,22 @@ 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", ] [[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", + "indexmap 2.5.0", "serde", "serde_spanned", "toml_datetime", - "winnow 0.6.16", + "winnow 0.6.18", ] [[package]] @@ -4143,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" @@ -4173,7 +4351,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.77", ] [[package]] @@ -4287,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" @@ -4314,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" @@ -4369,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", @@ -4385,7 +4563,7 @@ dependencies = [ "proc-macro2", "quote", "regex", - "syn 2.0.72", + "syn 2.0.77", ] [[package]] @@ -4416,6 +4594,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" @@ -4455,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", @@ -4492,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", @@ -4502,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", @@ -4547,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]] @@ -4569,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" @@ -4587,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" @@ -4719,9 +4943,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", ] @@ -4736,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]] @@ -4772,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", @@ -4807,7 +5021,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", @@ -4832,6 +5046,7 @@ version = "0.7.35" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" dependencies = [ + "byteorder", "zerocopy-derive", ] @@ -4843,7 +5058,7 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.77", ] [[package]] @@ -4872,7 +5087,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 +5104,15 @@ dependencies = [ "quote", "syn 1.0.109", ] + +[[package]] +name = "zypp-sys" +version = "0.0.1" +dependencies = [ + "glib-sys", + "gobject-sys", + "libc", + "shell-words", + "system-deps", + "tempfile", +] diff --git a/rust/Cargo.toml b/rust/Cargo.toml index 991ffaae7f..8cd1abb28c 100644 --- a/rust/Cargo.toml +++ b/rust/Cargo.toml @@ -4,7 +4,14 @@ members = [ "agama-server", "agama-lib", "agama-locale-data", + "libzypp", + "libzypp/zypp-sys", ] + +exclude = [ + "libzypp/gir" +] + resolver = "2" [workspace.package] diff --git a/rust/libzypp/Cargo.toml b/rust/libzypp/Cargo.toml new file mode 100644 index 0000000000..29eb5dbd51 --- /dev/null +++ b/rust/libzypp/Cargo.toml @@ -0,0 +1,22 @@ +[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" +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/Gir.toml b/rust/libzypp/Gir.toml new file mode 100644 index 0000000000..0c1a46d817 --- /dev/null +++ b/rust/libzypp/Gir.toml @@ -0,0 +1,35 @@ +[options] +library = "Zypp" +version = "1.0" +min_cfg_version = "1.0" +target_path = "." +girs_directories = ["gir-files", "libzypp/build/zypp-glib"] +work_mode = "normal" +single_version_file = true +generate_safety_asserts = true +deprecate_by_min_version = true +generate_builder = true + +generate = [ + "Zypp.Context", + "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.*", +] + +manual = [ + "GLib.Error", + "GLib.Quark", + "GObject.Value" +] 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/gir b/rust/libzypp/gir new file mode 160000 index 0000000000..a11b11f2e4 --- /dev/null +++ b/rust/libzypp/gir @@ -0,0 +1 @@ +Subproject commit a11b11f2e403d615edd94497b6fe5b3c5283145b 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 diff --git a/rust/libzypp/libzypp b/rust/libzypp/libzypp new file mode 160000 index 0000000000..9e5ce29270 --- /dev/null +++ b/rust/libzypp/libzypp @@ -0,0 +1 @@ +Subproject commit 9e5ce2927098de2fbc474cacf698d04f94600ca8 diff --git a/rust/libzypp/setup_env.sh b/rust/libzypp/setup_env.sh new file mode 100755 index 0000000000..6d658f844a --- /dev/null +++ b/rust/libzypp/setup_env.sh @@ -0,0 +1,108 @@ +#!/usr/bin/bash + +# 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 +# ``` + +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 + +$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 \ + cmake \ + openssl \ + libudev1 \ + libboost_headers-devel \ + libboost_program_options-devel \ + libboost_test-devel \ + libboost_thread-devel \ + dejagnu \ + 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(asciidoctor)" \ + libzck-devel \ + libzstd-devel \ + libbz2-devel \ + xz-devel \ + rustup + +cd "$BASEDIR" +# checkout submodules +git submodule init +git submodule update --checkout + +# lets build libzypp +( +cd libzypp +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 +) + +# now lets make rust working +rustup install stable +# lets install gir +cd gir +# workaround for badly working exclude in cargo see https://github.com/rust-lang/cargo/issues/6745 +if ! grep -q '\[workspace\]' Cargo.toml; then + printf '\n[workspace]' >> Cargo.toml +fi +cargo install --path . +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`' diff --git a/rust/libzypp/src/auto/context.rs b/rust/libzypp/src/auto/context.rs new file mode 100644 index 0000000000..d61f5315b6 --- /dev/null +++ b/rust/libzypp/src/auto/context.rs @@ -0,0 +1,120 @@ +// 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! { + /// 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); + + match fn { + type_ => || ffi::zypp_context_get_type(), + } +} + +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() + } + + + /// 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 { + 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)) } + } + } + + /// + /// # Returns + /// + /// The context root as requested when loading the system + #[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)) + } + } +} + +// 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/enums.rs b/rust/libzypp/src/auto/enums.rs new file mode 100644 index 0000000000..1ae4341127 --- /dev/null +++ b/rust/libzypp/src/auto/enums.rs @@ -0,0 +1,440 @@ +// 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 { + /// 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)] + __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) + } +} + +#[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/expected.rs b/rust/libzypp/src/auto/expected.rs new file mode 100644 index 0000000000..c5436a77d9 --- /dev/null +++ b/rust/libzypp/src/auto/expected.rs @@ -0,0 +1,76 @@ +// 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 { + /// 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!(); + unsafe { + from_glib_full(ffi::zypp_expected_new_error(error.to_glib_none_mut().0)) + } + } + + /// 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!(); + unsafe { + from_glib_full(ffi::zypp_expected_new_value(value.to_glib_none().0)) + } + } + + /// + /// # 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 { + unsafe { + from_glib_none(ffi::zypp_expected_get_error(self.to_glib_none().0)) + } + } + + /// + /// # 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> { + 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 { + 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/info_base.rs b/rust/libzypp/src/auto/info_base.rs new file mode 100644 index 0000000000..1fb93bccfd --- /dev/null +++ b/rust/libzypp/src/auto/info_base.rs @@ -0,0 +1,132 @@ +// 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 {} +} + +/// 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 { + 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/managed_file.rs b/rust/libzypp/src/auto/managed_file.rs new file mode 100644 index 0000000000..3349bbf421 --- /dev/null +++ b/rust/libzypp/src/auto/managed_file.rs @@ -0,0 +1,51 @@ +// 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 { + /// ## `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!(); + unsafe { + from_glib_full(ffi::zypp_managed_file_new(path.to_glib_none().0, dispose.into_glib())) + } + } + + /// + /// # Returns + /// + /// The currently managed path + #[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)) + } + } + + /// 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 { + 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 new file mode 100644 index 0000000000..74a8d5d6cb --- /dev/null +++ b/rust/libzypp/src/auto/mod.rs @@ -0,0 +1,49 @@ +// 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; + +mod expected; +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; +} +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 new file mode 100644 index 0000000000..7a2eabae21 --- /dev/null +++ b/rust/libzypp/src/auto/progress_observer.rs @@ -0,0 +1,333 @@ +// 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! { + /// + /// + /// ## 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); + + match fn { + type_ => || ffi::zypp_progress_observer_get_type(), + } +} + +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() + } + + + /// 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 { + ffi::zypp_progress_observer_add_subtask(self.to_glib_none().0, newChild.to_glib_none().0, weight); + } + } + + /// + /// # 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")] + pub fn base_steps(&self) -> i32 { + unsafe { + ffi::zypp_progress_observer_get_base_steps(self.to_glib_none().0) + } + } + + /// + /// # Returns + /// + /// The direct children of this Task + #[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)) + } + } + + /// + /// # 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 { + unsafe { + ffi::zypp_progress_observer_get_current(self.to_glib_none().0) + } + } + + /// + /// # 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 { + unsafe { + from_glib_none(ffi::zypp_progress_observer_get_label(self.to_glib_none().0)) + } + } + + /// + /// # 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 { + unsafe { + ffi::zypp_progress_observer_get_progress(self.to_glib_none().0) + } + } + + /// + /// # 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 { + unsafe { + ffi::zypp_progress_observer_get_steps(self.to_glib_none().0) + } + } + + /// 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 { + ffi::zypp_progress_observer_inc(self.to_glib_none().0, increase); + } + } + + /// 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) { + 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); + } + } + + /// 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 { + ffi::zypp_progress_observer_set_finished(self.to_glib_none().0); + } + } + + /// 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) { + 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)) + } + } +} + +// 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 new file mode 100644 index 0000000000..7a284f4222 --- /dev/null +++ b/rust/libzypp/src/auto/repo_info.rs @@ -0,0 +1,160 @@ +// 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! { + /// + /// + /// ## 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; + + 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)) + } + } + + // 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() + } + + + /// + /// # Returns + /// + /// The type of repository + #[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)) + } + } +} + +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 new file mode 100644 index 0000000000..6f880b1a25 --- /dev/null +++ b/rust/libzypp/src/auto/repo_manager.rs @@ -0,0 +1,174 @@ +// 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! { + /// + /// + /// ## Properties + /// + /// + /// #### `options` + /// Readable | Writeable | Construct + /// + /// + /// #### `zypp-cppObj` + /// Writeable | Construct Only + /// + /// + /// #### `zyppcontext` + /// Writeable | Construct Only + #[doc(alias = "ZyppRepoManager")] + pub struct RepoManager(Object); + + match fn { + type_ => || ffi::zypp_repo_manager_get_type(), + } +} + +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!(); + unsafe { + from_glib_full(ffi::zypp_repo_manager_new(ctx.to_glib_none().0)) + } + } + + // 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() + } + + + /// + /// # 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 { + unsafe { + FromGlibPtrContainer::from_glib_full(ffi::zypp_repo_manager_get_known_repos(self.to_glib_none().0)) + } + } + + /// + /// # 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 { + unsafe { + FromGlibPtrContainer::from_glib_full(ffi::zypp_repo_manager_get_known_services(self.to_glib_none().0)) + } + } + + /// 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 { + 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)) } + } + } + + /// ## `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 { + 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)) + } + } +} + +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() } +} 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..38a69edf76 --- /dev/null +++ b/rust/libzypp/src/auto/repo_manager_options.rs @@ -0,0 +1,45 @@ +// 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 { + /// ## `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!(); + unsafe { + from_glib_full(ffi::zypp_repo_manager_options_new(root.to_glib_none().0)) + } + } + + /// + /// # Returns + /// + /// The currently managed path + #[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..3c81afe3b7 --- /dev/null +++ b/rust/libzypp/src/auto/repository.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,RepoInfo}; +use glib::{translate::*}; + +glib::wrapper! { + /// + #[doc(alias = "ZyppRepository")] + pub struct Repository(Object); + + match fn { + type_ => || ffi::zypp_repository_get_type(), + } +} + +impl Repository { + /// + /// # Returns + /// + /// Name of the 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)) + } + } + + /// + /// # Returns + /// + /// The corresponding ZyppRepoInfo + #[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..49c7833f2f --- /dev/null +++ b/rust/libzypp/src/auto/service_info.rs @@ -0,0 +1,30 @@ +// 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! { + /// + /// + /// # Implements + /// + /// [`InfoBaseExt`][trait@crate::prelude::InfoBaseExt] + #[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/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/bin.rs b/rust/libzypp/src/bin.rs new file mode 100644 index 0000000000..d7c3c37a95 --- /dev/null +++ b/rust/libzypp/src/bin.rs @@ -0,0 +1,44 @@ +use std::process::exit; + +use glib::Error; +use libzypp::InfoBaseExt; + +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()); + } + + Ok(()) +} + +fn main() -> () { + if let Err(err) = print_system() { + println!("Failed to system: {}", err.to_string()); + exit(1); + } + + if let Err(err) = print_host() { + println!("Failed to system: {}", err.to_string()); + exit(1); + } +} \ No newline at end of file diff --git a/rust/libzypp/src/lib.rs b/rust/libzypp/src/lib.rs new file mode 100644 index 0000000000..2913e2b937 --- /dev/null +++ b/rust/libzypp/src/lib.rs @@ -0,0 +1,18 @@ +#![cfg_attr(docsrs, feature(doc_cfg))] + +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; +pub use auto::traits::*; 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..ceddcc47f7 --- /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/", "../libzypp/build/zypp-glib"] +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..122c8117c2 --- /dev/null +++ b/rust/libzypp/zypp-sys/build.rs @@ -0,0 +1,18 @@ +// 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))] +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..b396a2ba04 --- /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 (@ ???) diff --git a/rust/libzypp/zypp-sys/src/lib.rs b/rust/libzypp/zypp-sys/src/lib.rs new file mode 100644 index 0000000000..8231ca15a6 --- /dev/null +++ b/rust/libzypp/zypp-sys/src/lib.rs @@ -0,0 +1,454 @@ +// 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() + } +} + +// 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 ZyppProgressObserver) -> *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 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