Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/ci-rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ jobs:
gcc-c++
git
libopenssl-3-devel
libsuseconnect
libzypp-devel
make
openssl-3
Expand Down Expand Up @@ -148,6 +149,7 @@ jobs:
golang-github-google-jsonnet
jq
libopenssl-3-devel
libsuseconnect
libzypp-devel
make
openssl-3
Expand Down Expand Up @@ -254,6 +256,7 @@ jobs:
gcc-c++
git
libopenssl-3-devel
libsuseconnect
libzypp-devel
make
openssl-3
Expand Down
77 changes: 38 additions & 39 deletions rust/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions rust/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ members = [
"agama-storage",
"agama-transfer",
"agama-utils",
"suseconnect-agama",
"suseconnect-agama/suseconnect-agama-sys",
"xtask",
"zypp-agama",
"zypp-agama/zypp-agama-sys",
Expand Down
21 changes: 21 additions & 0 deletions rust/suseconnect-agama/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
[package]
name = "suseconnect-agama"
version = "0.1.0"
rust-version.workspace = true
edition.workspace = true

[lib]
name = "suseconnect_agama"
path = "src/lib.rs"

[dependencies]
serde = { version = "1.0.228", features = ["derive"] }
serde_json = "1.0.140"
suseconnect-agama-sys = { path="./suseconnect-agama-sys" }
thiserror = "2.0.16"
tracing = "0.1.41"
url = "2.5.4"

[dev-dependencies]
tempfile = "3.20.0"
tracing-subscriber = "0.3.20"
22 changes: 22 additions & 0 deletions rust/suseconnect-agama/examples/announce.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
use std::env;

use suseconnect_agama::{announce_system, ConnectParams};

pub fn main() {
tracing_subscriber::fmt::init();
let args: Vec<String> = env::args().collect();
let Some(code) = args.get(1) else {
eprintln!("Provide reg code as first parameter");
return;
};

let params = ConnectParams {
language: Some("en_US".to_string()),
url: None,
token: Some(code.to_string()),
email: None,
};

let result = announce_system(params, "sles16");
println!("{:?}", result);
}
16 changes: 16 additions & 0 deletions rust/suseconnect-agama/examples/print_addons.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
use suseconnect_agama::{show_product, ConnectParams, ProductSpecification};

// Note: the example has to be run on registered SLES 16, otherwise it returns different errors
pub fn main() {
tracing_subscriber::fmt::init();

let product_spec = ProductSpecification {
identifier: "SLES".to_string(),
version: "16.0".to_string(),
arch: "x86_64".to_string(),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know this is just a testing example, but how difficult would be to detect the real current architecture? We need it in the real code anyway...

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, in original code we use rpm arch...sadly using zypper system-architecture returns different string, so it would probably need a bit of processing. I kind of hope that we can get rpm architecture from libzypp. ( which I do not want to use here )

};
let params = ConnectParams::default();

let result = show_product(product_spec, params);
println!("{:?}", result);
}
Loading
Loading