Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package agama for openSUSE:Factory checked 
in at 2025-01-12 11:21:33
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/agama (Old)
 and      /work/SRC/openSUSE:Factory/.agama.new.1881 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "agama"

Sun Jan 12 11:21:33 2025 rev:11 rq:1236914 version:0

Changes:
--------
--- /work/SRC/openSUSE:Factory/agama/agama.changes      2025-01-01 
23:04:13.987405675 +0100
+++ /work/SRC/openSUSE:Factory/.agama.new.1881/agama.changes    2025-01-12 
11:28:27.181718749 +0100
@@ -1,0 +2,18 @@
+Fri Jan 10 08:58:29 UTC 2025 - Imobach Gonzalez Sosa <igonzalezs...@suse.com>
+
+- Disable the browser cache setting the "Cache-Control" header to
+  "no-store" (gh#agama-project/agama#1880).
+
+-------------------------------------------------------------------
+Thu Jan  9 12:52:05 UTC 2025 - Josef Reidinger <jreidin...@suse.com>
+
+- Increase disk size in _constraints to fix build on ppc
+  (gh#agama-project/agama#1876).
+
+-------------------------------------------------------------------
+Wed Jan  8 14:05:34 UTC 2025 - Imobach Gonzalez Sosa <igonzalezs...@suse.com>
+
+- Add support for products registration (jsc#PED-11192,
+  gh#agama-project/agama#1809).
+
+-------------------------------------------------------------------

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ agama.spec ++++++
--- /var/tmp/diff_new_pack.VN2rJt/_old  2025-01-12 11:28:27.857746570 +0100
+++ /var/tmp/diff_new_pack.VN2rJt/_new  2025-01-12 11:28:27.861746734 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package agama
 #
-# Copyright (c) 2024 SUSE LLC
+# Copyright (c) 2025 SUSE LLC
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed

++++++ _constraints ++++++
--- /var/tmp/diff_new_pack.VN2rJt/_old  2025-01-12 11:28:27.897748216 +0100
+++ /var/tmp/diff_new_pack.VN2rJt/_new  2025-01-12 11:28:27.901748380 +0100
@@ -2,7 +2,7 @@
   <hardware>
     <jobs>4</jobs>
     <disk>
-      <size unit="G">20</size>
+      <size unit="G">25</size>
     </disk>
     <physicalmemory>
       <size unit="G">8</size>

++++++ agama.obscpio ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/agama/agama-lib/src/product/client.rs 
new/agama/agama-lib/src/product/client.rs
--- old/agama/agama-lib/src/product/client.rs   2024-12-20 13:41:09.000000000 
+0100
+++ new/agama/agama-lib/src/product/client.rs   2025-01-10 10:46:08.000000000 
+0100
@@ -19,7 +19,9 @@
 // find current contact information at www.suse.com.
 
 use std::collections::HashMap;
+use std::str::FromStr;
 
+use crate::dbus::get_property;
 use crate::error::ServiceError;
 use crate::software::model::RegistrationRequirement;
 use crate::software::proxies::SoftwareProductProxy;
@@ -39,6 +41,8 @@
     pub description: String,
     /// Product icon (e.g., "default.svg")
     pub icon: String,
+    /// Registration requirement
+    pub registration: RegistrationRequirement,
 }
 
 /// D-Bus client for the software service
@@ -72,11 +76,17 @@
                     Some(value) => value.try_into().unwrap(),
                     None => "default.svg",
                 };
+
+                let registration = get_property::<String>(&data, 
"registration")
+                    .map(|r| 
RegistrationRequirement::from_str(&r).unwrap_or_default())
+                    .unwrap_or_default();
+
                 Product {
                     id,
                     name,
                     description: description.to_string(),
                     icon: icon.to_string(),
+                    registration,
                 }
             })
             .collect();
@@ -114,13 +124,6 @@
         Ok(self.registration_proxy.email().await?)
     }
 
-    pub async fn registration_requirement(&self) -> 
Result<RegistrationRequirement, ServiceError> {
-        let requirement = self.registration_proxy.requirement().await?;
-        // unknown number can happen only if we do programmer mistake
-        let result: RegistrationRequirement = requirement.try_into().unwrap();
-        Ok(result)
-    }
-
     /// register product
     pub async fn register(&self, code: &str, email: &str) -> Result<(u32, 
String), ServiceError> {
         let mut options: HashMap<&str, &zbus::zvariant::Value> = 
HashMap::new();
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/agama/agama-lib/src/product/http_client.rs 
new/agama/agama-lib/src/product/http_client.rs
--- old/agama/agama-lib/src/product/http_client.rs      2024-12-20 
13:41:09.000000000 +0100
+++ new/agama/agama-lib/src/product/http_client.rs      2025-01-10 
10:46:08.000000000 +0100
@@ -18,6 +18,7 @@
 // To contact SUSE LLC about this file by physical or electronic mail, you may
 // find current contact information at www.suse.com.
 
+use crate::software::model::RegistrationError;
 use crate::software::model::RegistrationInfo;
 use crate::software::model::RegistrationParams;
 use crate::software::model::SoftwareConfig;
@@ -64,13 +65,29 @@
     }
 
     /// register product
-    pub async fn register(&self, key: &str, email: &str) -> Result<(u32, 
String), ServiceError> {
+    pub async fn register(&self, key: &str, email: &str) -> Result<(), 
ServiceError> {
         // note RegistrationParams != RegistrationInfo, fun!
         let params = RegistrationParams {
             key: key.to_owned(),
             email: email.to_owned(),
         };
+        let result = self
+            .client
+            .post_void("/software/registration", &params)
+            .await;
 
-        self.client.post("/software/registration", &params).await
+        let Err(error) = result else {
+            return Ok(());
+        };
+
+        let message = match error {
+            ServiceError::BackendError(_, details) => {
+                let details: RegistrationError = 
serde_json::from_str(&details).unwrap();
+                format!("{} (error code: {})", details.message, details.id)
+            }
+            _ => format!("Could not register the product: #{error:?}"),
+        };
+
+        Err(ServiceError::FailedRegistration(message))
     }
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/agama/agama-lib/src/product/store.rs 
new/agama/agama-lib/src/product/store.rs
--- old/agama/agama-lib/src/product/store.rs    2024-12-20 13:41:09.000000000 
+0100
+++ new/agama/agama-lib/src/product/store.rs    2025-01-10 10:46:08.000000000 
+0100
@@ -68,17 +68,8 @@
             }
         }
         if let Some(reg_code) = &settings.registration_code {
-            let (result, message);
-            if let Some(email) = &settings.registration_email {
-                (result, message) = self.product_client.register(reg_code, 
email).await?;
-            } else {
-                (result, message) = self.product_client.register(reg_code, 
"").await?;
-            }
-            // FIXME: name the magic numbers. 3 is Registration not required
-            // FIXME: well don't register when not required (no regcode in 
profile)
-            if result != 0 && result != 3 {
-                return Err(ServiceError::FailedRegistration(message));
-            }
+            let email = settings.registration_email.as_deref().unwrap_or("");
+            self.product_client.register(reg_code, email).await?;
             probe = true;
         }
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/agama/agama-lib/src/software/model.rs 
new/agama/agama-lib/src/software/model.rs
--- old/agama/agama-lib/src/software/model.rs   2024-12-20 13:41:09.000000000 
+0100
+++ new/agama/agama-lib/src/software/model.rs   2025-01-10 10:46:08.000000000 
+0100
@@ -47,38 +47,36 @@
     pub key: String,
     /// Registration email. Empty value mean email not used or not registered.
     pub email: String,
-    /// if registration is required, optional or not needed for current 
product.
-    /// Change only if selected product is changed.
-    pub requirement: RegistrationRequirement,
 }
 
-#[derive(Clone, Debug, Serialize, Deserialize, utoipa::ToSchema)]
+#[derive(
+    Clone,
+    Default,
+    Debug,
+    Serialize,
+    Deserialize,
+    strum::Display,
+    strum::EnumString,
+    utoipa::ToSchema,
+)]
+#[strum(serialize_all = "camelCase")]
+#[serde(rename_all = "camelCase")]
 pub enum RegistrationRequirement {
     /// Product does not require registration
-    NotRequired = 0,
+    #[default]
+    No = 0,
     /// Product has optional registration
     Optional = 1,
     /// It is mandatory to register the product
     Mandatory = 2,
 }
 
-impl TryFrom<u32> for RegistrationRequirement {
-    type Error = ();
-
-    fn try_from(v: u32) -> Result<Self, Self::Error> {
-        match v {
-            x if x == RegistrationRequirement::NotRequired as u32 => {
-                Ok(RegistrationRequirement::NotRequired)
-            }
-            x if x == RegistrationRequirement::Optional as u32 => {
-                Ok(RegistrationRequirement::Optional)
-            }
-            x if x == RegistrationRequirement::Mandatory as u32 => {
-                Ok(RegistrationRequirement::Mandatory)
-            }
-            _ => Err(()),
-        }
-    }
+#[derive(Clone, Serialize, Deserialize, utoipa::ToSchema)]
+pub struct RegistrationError {
+    /// ID of error. See dbus API for possible values
+    pub id: u32,
+    /// human readable error string intended to be displayed to user
+    pub message: String,
 }
 
 /// Software resolvable type (package or pattern).
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/agama/agama-server/Cargo.toml 
new/agama/agama-server/Cargo.toml
--- old/agama/agama-server/Cargo.toml   2024-12-20 13:41:09.000000000 +0100
+++ new/agama/agama-server/Cargo.toml   2025-01-10 10:46:08.000000000 +0100
@@ -24,7 +24,12 @@
 async-trait = "0.1.83"
 axum = { version = "0.7.7", features = ["ws"] }
 serde_json = "1.0.128"
-tower-http = { version = "0.5.2", features = ["compression-br", "fs", "trace"] 
}
+tower-http = { version = "0.5.2", features = [
+    "compression-br",
+    "fs",
+    "trace",
+    "set-header",
+] }
 tracing-subscriber = { version = "0.3.18", features = ["env-filter"] }
 tracing-journald = "0.3.0"
 tracing = "0.1.40"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/agama/agama-server/src/software/web.rs 
new/agama/agama-server/src/software/web.rs
--- old/agama/agama-server/src/software/web.rs  2024-12-20 13:41:09.000000000 
+0100
+++ new/agama/agama-server/src/software/web.rs  2025-01-10 10:46:08.000000000 
+0100
@@ -37,7 +37,10 @@
     error::ServiceError,
     product::{proxies::RegistrationProxy, Product, ProductClient},
     software::{
-        model::{RegistrationInfo, RegistrationParams, ResolvableParams, 
SoftwareConfig},
+        model::{
+            RegistrationError, RegistrationInfo, RegistrationParams, 
ResolvableParams,
+            SoftwareConfig,
+        },
         proxies::{Software1Proxy, SoftwareProductProxy},
         Pattern, SelectedBy, SoftwareClient, UnknownSelectedBy,
     },
@@ -49,7 +52,7 @@
     routing::{get, post, put},
     Json, Router,
 };
-use serde::{Deserialize, Serialize};
+use serde::Serialize;
 use std::collections::HashMap;
 use tokio_stream::{Stream, StreamExt};
 
@@ -75,10 +78,6 @@
             Box::pin(product_changed_stream(dbus.clone()).await?),
         ),
         (
-            "registration_requirement_changed",
-            
Box::pin(registration_requirement_changed_stream(dbus.clone()).await?),
-        ),
-        (
             "registration_code_changed",
             Box::pin(registration_code_changed_stream(dbus.clone()).await?),
         ),
@@ -131,27 +130,6 @@
     Ok(stream)
 }
 
-async fn registration_requirement_changed_stream(
-    dbus: zbus::Connection,
-) -> Result<impl Stream<Item = Event>, Error> {
-    // TODO: move registration requirement to product in dbus and so just one 
event will be needed.
-    let proxy = RegistrationProxy::new(&dbus).await?;
-    let stream = proxy
-        .receive_requirement_changed()
-        .await
-        .then(|change| async move {
-            if let Ok(id) = change.get().await {
-                // unwrap is safe as possible numbers is send by our 
controlled dbus
-                return Some(Event::RegistrationRequirementChanged {
-                    requirement: id.try_into().unwrap(),
-                });
-            }
-            None
-        })
-        .filter_map(|e| e);
-    Ok(stream)
-}
-
 async fn registration_email_changed_stream(
     dbus: zbus::Connection,
 ) -> Result<impl Stream<Item = Event>, Error> {
@@ -269,19 +247,10 @@
     let result = RegistrationInfo {
         key: state.product.registration_code().await?,
         email: state.product.email().await?,
-        requirement: state.product.registration_requirement().await?,
     };
     Ok(Json(result))
 }
 
-#[derive(Clone, Serialize, Deserialize, utoipa::ToSchema)]
-pub struct FailureDetails {
-    /// ID of error. See dbus API for possible values
-    id: u32,
-    /// human readable error string intended to be displayed to user
-    message: String,
-}
-
 /// Register product
 ///
 /// * `state`: service state.
@@ -291,7 +260,7 @@
     context_path = "/api/software",
     responses(
         (status = 204, description = "registration successfull"),
-        (status = 422, description = "Registration failed. Details are in 
body", body = FailureDetails),
+        (status = 422, description = "Registration failed. Details are in 
body", body = RegistrationError),
         (status = 400, description = "The D-Bus service could not perform the 
action")
     )
 )]
@@ -300,10 +269,10 @@
     Json(config): Json<RegistrationParams>,
 ) -> Result<impl IntoResponse, Error> {
     let (id, message) = state.product.register(&config.key, 
&config.email).await?;
-    let details = FailureDetails { id, message };
     if id == 0 {
         Ok((StatusCode::NO_CONTENT, ().into_response()))
     } else {
+        let details = RegistrationError { id, message };
         Ok((
             StatusCode::UNPROCESSABLE_ENTITY,
             Json(details).into_response(),
@@ -320,13 +289,13 @@
     context_path = "/api/software",
     responses(
         (status = 200, description = "deregistration successfull"),
-        (status = 422, description = "De-registration failed. Details are in 
body", body = FailureDetails),
+        (status = 422, description = "De-registration failed. Details are in 
body", body = RegistrationError),
         (status = 400, description = "The D-Bus service could not perform the 
action")
     )
 )]
 async fn deregister(State(state): State<SoftwareState<'_>>) -> Result<impl 
IntoResponse, Error> {
     let (id, message) = state.product.deregister().await?;
-    let details = FailureDetails { id, message };
+    let details = RegistrationError { id, message };
     if id == 0 {
         Ok((StatusCode::NO_CONTENT, ().into_response()))
     } else {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/agama/agama-server/src/web/service.rs 
new/agama/agama-server/src/web/service.rs
--- old/agama/agama-server/src/web/service.rs   2024-12-20 13:41:09.000000000 
+0100
+++ new/agama/agama-server/src/web/service.rs   2025-01-10 10:46:08.000000000 
+0100
@@ -21,6 +21,7 @@
 use super::http::{login, login_from_query, logout, session};
 use super::{config::ServiceConfig, state::ServiceState, EventsSender};
 use agama_lib::auth::TokenClaims;
+use axum::http::HeaderValue;
 use axum::{
     body::Body,
     extract::Request,
@@ -29,12 +30,14 @@
     routing::{get, post},
     Router,
 };
+use hyper::header::CACHE_CONTROL;
 use std::time::Duration;
 use std::{
     convert::Infallible,
     path::{Path, PathBuf},
 };
 use tower::Service;
+use tower_http::set_header::SetResponseHeaderLayer;
 use tower_http::{compression::CompressionLayer, services::ServeDir, 
trace::TraceLayer};
 use tracing::Span;
 
@@ -128,6 +131,10 @@
                     ),
             )
             .layer(CompressionLayer::new().br(true))
+            .layer(SetResponseHeaderLayer::if_not_present(
+                CACHE_CONTROL,
+                HeaderValue::from_static("no-store"),
+            ))
             .with_state(state)
     }
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/agama/package/_constraints 
new/agama/package/_constraints
--- old/agama/package/_constraints      2024-12-20 13:41:09.000000000 +0100
+++ new/agama/package/_constraints      2025-01-10 10:46:08.000000000 +0100
@@ -2,7 +2,7 @@
   <hardware>
     <jobs>4</jobs>
     <disk>
-      <size unit="G">20</size>
+      <size unit="G">25</size>
     </disk>
     <physicalmemory>
       <size unit="G">8</size>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/agama/package/agama.changes 
new/agama/package/agama.changes
--- old/agama/package/agama.changes     2024-12-20 13:41:09.000000000 +0100
+++ new/agama/package/agama.changes     2025-01-10 10:46:08.000000000 +0100
@@ -1,4 +1,22 @@
 -------------------------------------------------------------------
+Fri Jan 10 08:58:29 UTC 2025 - Imobach Gonzalez Sosa <igonzalezs...@suse.com>
+
+- Disable the browser cache setting the "Cache-Control" header to
+  "no-store" (gh#agama-project/agama#1880).
+
+-------------------------------------------------------------------
+Thu Jan  9 12:52:05 UTC 2025 - Josef Reidinger <jreidin...@suse.com>
+
+- Increase disk size in _constraints to fix build on ppc
+  (gh#agama-project/agama#1876).
+
+-------------------------------------------------------------------
+Wed Jan  8 14:05:34 UTC 2025 - Imobach Gonzalez Sosa <igonzalezs...@suse.com>
+
+- Add support for products registration (jsc#PED-11192,
+  gh#agama-project/agama#1809).
+
+-------------------------------------------------------------------
 Fri Dec 20 12:17:26 UTC 2024 - Josef Reidinger <jreidin...@suse.com>
 
 - Add bootloader.stopOnBootMenu section to profile to allow stop
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/agama/share/agama-web-server.service 
new/agama/share/agama-web-server.service
--- old/agama/share/agama-web-server.service    2024-12-20 13:41:09.000000000 
+0100
+++ new/agama/share/agama-web-server.service    2025-01-10 10:46:08.000000000 
+0100
@@ -6,6 +6,7 @@
 BindsTo=agama.service
 
 [Service]
+EnvironmentFile=-/etc/agama.d/cmdline.conf
 Environment="AGAMA_LOG=debug,zbus=info"
 Type=notify
 ExecStart=/usr/bin/agama-web-server serve --address :::80 --address2 :::443

++++++ agama.obsinfo ++++++
--- /var/tmp/diff_new_pack.VN2rJt/_old  2025-01-12 11:28:28.133757928 +0100
+++ /var/tmp/diff_new_pack.VN2rJt/_new  2025-01-12 11:28:28.133757928 +0100
@@ -1,5 +1,5 @@
 name: agama
-version: 10+717
-mtime: 1734698469
-commit: 1cca04c4541ad6338ea3c33060ea105734c8aa9a
+version: 10+863
+mtime: 1736502368
+commit: 9ac7280c05645c7438f3c77c48f23a2c93f6dbdb
 

Reply via email to