Skip to content

Commit

Permalink
Merge master into the architecture_2024 branch (#1073)
Browse files Browse the repository at this point in the history
The `architecture_2024` branch is rather outdated. Take the latest
changes from `master`.
  • Loading branch information
imobachgs authored Mar 6, 2024
2 parents 9ae1ae3 + 1eac98f commit 7de4495
Show file tree
Hide file tree
Showing 100 changed files with 2,647 additions and 1,486 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/obs-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
with:
install_packages: obs-service-cargo_audit obs-service-cargo_vendor
project_name: systemsmanagement:Agama:Devel
package_name: agama-cli
package_name: agama

update_web:
uses: ./.github/workflows/obs-staging-shared.yml
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/obs-service-shared.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ jobs:
OBS_USER: ${{ secrets.OBS_USER }}
OBS_PASSWORD: ${{ secrets.OBS_PASSWORD }}

- name: Commit the rubygem-agama package to ${{ inputs.project_name }}
- name: Commit the rubygem-agama-yast package to ${{ inputs.project_name }}
run: rake osc:commit
working-directory: ./service
env:
Expand All @@ -71,7 +71,7 @@ jobs:
SKIP_OSC_BUILD: 1
OBS_PROJECT: ${{ inputs.project_name }}

- name: Submit the rubygem-agama package
- name: Submit the rubygem-agama-yast package
# only when a tag has been pushed
if: ${{ github.ref_type == 'tag' }}
# the package has been comitted in the previous step, just submit it
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/obs-staging-rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ jobs:
with:
install_packages: obs-service-cargo_audit obs-service-cargo_vendor
project_name: systemsmanagement:Agama:Staging
package_name: agama-cli
package_name: agama
2 changes: 1 addition & 1 deletion .github/workflows/obs-staging-service.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Submit rubygem-agama
name: Submit rubygem-agama-yast

on:
# runs on pushes targeting the default branch
Expand Down
20 changes: 11 additions & 9 deletions PACKAGING.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@ The Agama packages are available in two OBS projects:
You can find more details the automatic OBS synchronization in the
[obs_integration.md](doc/obs_integration.md) file.

The process to build each package is slightly different depending on the technology we are using.
While the Ruby-based one (`rubygem-agama`) is built as any other YaST package, the web UI
(`cockpit-agama`) and the CLI (`agama-cli`) rely on [OBS source
services](https://openbuildservice.org/help/manuals/obs-user-guide/cha.obs.source_service.html).
The process to build each package is slightly different depending on the
technology we are using. While the Ruby-based one (`rubygem-agama-yast`) is
built as any other YaST package, Agama server (`agama`), the CLI (`agama-cli`),
and the web UI (`cockpit-agama`) rely on
[OBS source services](https://openbuildservice.org/help/manuals/obs-user-guide/cha.obs.source_service.html).

## Versioning Policy

Expand Down Expand Up @@ -71,8 +72,8 @@ for manual update.
### Service

You can check the current package in
[systemsmanagement:Agama:Staging/rubygem-agama](
https://build.opensuse.org/package/show/systemsmanagement:Agama:Staging/rubygem-agama).
[systemsmanagement:Agama:Staging/rubygem-agama-yast](
https://build.opensuse.org/package/show/systemsmanagement:Agama:Staging/rubygem-agama-yast).

Use `rake` to update the package in OBS as you would do with any other YaST package:

Expand Down Expand Up @@ -108,10 +109,11 @@ respect such a tag. (e.g. `2.1+42`).
You can read more about the overall approach of this package in the following article: [Git work
flows in the upcoming 2.7 release](https://openbuildservice.org/2016/04/08/new_git_in_27/).

### Command-line Interface
### Server and Command-line Interface

The current package is [systemsmanagement:Agama:Staging/agama-cli](
https://build.opensuse.org/package/show/systemsmanagement:Agama:Staging/agama-cli).
The current package is [systemsmanagement:Agama:Staging/agama](
https://build.opensuse.org/package/show/systemsmanagement:Agama:Staging/agama),
which includes `agama` and `agama-cli` as a subpackage.

To manually update the package in the build service, run the following commands:

Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@

**[OBS systemsmanagement:Agama:Staging](https://build.opensuse.org/project/show/systemsmanagement:Agama:Staging)**

[![Submit agama-cli](https://github.com/openSUSE/agama/actions/workflows/obs-staging-rust.yml/badge.svg)](https://github.com/openSUSE/agama/actions/workflows/obs-staging-rust.yml)
[![Submit agama](https://github.com/openSUSE/agama/actions/workflows/obs-staging-rust.yml/badge.svg)](https://github.com/openSUSE/agama/actions/workflows/obs-staging-rust.yml)
[![Submit cockpit-agama](https://github.com/openSUSE/agama/actions/workflows/obs-staging-web.yml/badge.svg)](https://github.com/openSUSE/agama/actions/workflows/obs-staging-web.yml)
[![Submit rubygem-agama](https://github.com/openSUSE/agama/actions/workflows/obs-staging-service.yml/badge.svg)](https://github.com/openSUSE/agama/actions/workflows/obs-staging-service.yml)
[![Submit rubygem-agama-yast](https://github.com/openSUSE/agama/actions/workflows/obs-staging-service.yml/badge.svg)](https://github.com/openSUSE/agama/actions/workflows/obs-staging-service.yml)
[![Submit cockpit-agama-playwright](https://github.com/openSUSE/agama/actions/workflows/obs-staging-playwright.yml/badge.svg)](https://github.com/openSUSE/agama/actions/workflows/obs-staging-playwright.yml)

[![OBS Staging/agama-cli](https://img.shields.io/obs/systemsmanagement:Agama:Staging/agama-cli/openSUSE_Tumbleweed/x86_64?label=Package%20agama-cli)](https://build.opensuse.org/package/show/systemsmanagement:Agama:Staging/agama-cli)
[![OBS Staging/agama](https://img.shields.io/obs/systemsmanagement:Agama:Staging/agama/openSUSE_Tumbleweed/x86_64?label=Package%20agama)](https://build.opensuse.org/package/show/systemsmanagement:Agama:Staging/agama)
[![OBS Staging/cockpit-agama](https://img.shields.io/obs/systemsmanagement:Agama:Staging/cockpit-agama/openSUSE_Tumbleweed/x86_64?label=Package%20cockpit-agama)](https://build.opensuse.org/package/show/systemsmanagement:Agama:Staging/cockpit-agama)
[![OBS Staging/rubygem-agama](https://img.shields.io/obs/systemsmanagement:Agama:Staging/rubygem-agama/openSUSE_Tumbleweed/x86_64?label=Package%20rubygem-agama)](https://build.opensuse.org/package/show/systemsmanagement:Agama:Staging/rubygem-agama)
[![OBS Staging/rubygem-agama-yast](https://img.shields.io/obs/systemsmanagement:Agama:Staging/rubygem-agama-yast/openSUSE_Tumbleweed/x86_64?label=Package%20rubygem-agama-yast)](https://build.opensuse.org/package/show/systemsmanagement:Agama:Staging/rubygem-agama-yast)
[![OBS Staging/agama-products-opensuse](https://img.shields.io/obs/systemsmanagement%3AAgama%3AStaging/agama-products-opensuse/openSUSE_Tumbleweed/x86_64?label=Package%20agama-products-opensuse)](https://build.opensuse.org/package/show/systemsmanagement:Agama:Staging/agama-products-opensuse)
[![OBS Staging/cockpit-agama-playwright](https://img.shields.io/obs/systemsmanagement:Agama:Staging/cockpit-agama-playwright/openSUSE_Tumbleweed/x86_64?label=Package%20cockpit-agama-playwright)](https://build.opensuse.org/package/show/systemsmanagement:Agama:Staging/cockpit-agama-playwright)
[![OBS Staging/agama-live](https://img.shields.io/obs/systemsmanagement:Agama:Staging/agama-live:openSUSE/images/x86_64?label=Live%20ISO)](https://build.opensuse.org/package/show/systemsmanagement:Agama:Staging/agama-live)
Expand All @@ -35,9 +35,9 @@
![GitHub tag (latest SemVer)](https://img.shields.io/github/v/tag/openSUSE/agama?label=Version&sort=semver)
[![Release](https://github.com/openSUSE/agama/actions/workflows/obs-release.yml/badge.svg)](https://github.com/openSUSE/agama/actions/workflows/obs-release.yml)

[![OBS Devel/agama-cli](https://img.shields.io/obs/systemsmanagement:Agama:Devel/agama-cli/openSUSE_Tumbleweed/x86_64?label=Package%20agama-cli)](https://build.opensuse.org/package/show/systemsmanagement:Agama:Devel/agama-cli)
[![OBS Devel/agama](https://img.shields.io/obs/systemsmanagement:Agama:Devel/agama/openSUSE_Tumbleweed/x86_64?label=Package%20agama)](https://build.opensuse.org/package/show/systemsmanagement:Agama:Devel/agama)
[![OBS Devel/cockpit-agama](https://img.shields.io/obs/systemsmanagement:Agama:Devel/cockpit-agama/openSUSE_Tumbleweed/x86_64?label=Package%20cockpit-agama)](https://build.opensuse.org/package/show/systemsmanagement:Agama:Devel/cockpit-agama)
[![OBS Devel/rubygem-agama](https://img.shields.io/obs/systemsmanagement:Agama:Devel/rubygem-agama/openSUSE_Tumbleweed/x86_64?label=Package%20rubygem-agama)](https://build.opensuse.org/package/show/systemsmanagement:Agama:Devel/rubygem-agama)
[![OBS Devel/rubygem-agama-yast](https://img.shields.io/obs/systemsmanagement:Agama:Devel/rubygem-agama-yast/openSUSE_Tumbleweed/x86_64?label=Package%20rubygem-agama-yast)](https://build.opensuse.org/package/show/systemsmanagement:Agama:Devel/rubygem-agama-yast)
[![OBS Devel/agama-live](https://img.shields.io/obs/systemsmanagement:Agama:Devel/agama-live:openSUSE/images/x86_64?label=Live%20ISO)](https://build.opensuse.org/package/show/systemsmanagement:Agama:Devel/agama-live)

# Agama: A Service-based Linux Installer
Expand Down
87 changes: 44 additions & 43 deletions rust/Cargo.lock

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

2 changes: 1 addition & 1 deletion rust/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[workspace]
members = [
"agama-cli",
"agama-dbus-server",
"agama-server",
"agama-derive",
"agama-lib",
"agama-locale-data",
Expand Down
15 changes: 0 additions & 15 deletions rust/agama-dbus-server/src/web/docs.rs

This file was deleted.

1 change: 1 addition & 0 deletions rust/agama-lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,5 @@ thiserror = "1.0.39"
tokio = { version = "1.33.0", features = ["macros", "rt-multi-thread"] }
tokio-stream = "0.1.14"
url = "2.5.0"
utoipa = "4.2.0"
zbus = { version = "3", default-features = false, features = ["tokio"] }
2 changes: 1 addition & 1 deletion rust/agama-lib/src/product.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ mod proxies;
mod settings;
mod store;

pub use client::ProductClient;
pub use client::{Product, ProductClient};
pub use settings::ProductSettings;
pub use store::ProductStore;
3 changes: 2 additions & 1 deletion rust/agama-lib/src/product/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use zbus::Connection;
use super::proxies::RegistrationProxy;

/// Represents a software product
#[derive(Debug, Serialize)]
#[derive(Default, Debug, Serialize, utoipa::ToSchema)]
pub struct Product {
/// Product ID (eg., "ALP", "Tumbleweed", etc.)
pub id: String,
Expand All @@ -19,6 +19,7 @@ pub struct Product {
}

/// D-Bus client for the software service
#[derive(Clone)]
pub struct ProductClient<'a> {
product_proxy: SoftwareProductProxy<'a>,
registration_proxy: RegistrationProxy<'a>,
Expand Down
2 changes: 1 addition & 1 deletion rust/agama-lib/src/software.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ pub mod proxies;
mod settings;
mod store;

pub use client::SoftwareClient;
pub use client::{Pattern, SelectedBy, SoftwareClient, UnknownSelectedBy};
pub use settings::SoftwareSettings;
pub use store::SoftwareStore;
70 changes: 66 additions & 4 deletions rust/agama-lib/src/software/client.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
use super::proxies::Software1Proxy;
use crate::error::ServiceError;
use serde::Serialize;
use std::collections::HashMap;
use zbus::Connection;

/// Represents a software product
#[derive(Debug, Serialize)]
#[derive(Debug, Serialize, utoipa::ToSchema)]
pub struct Pattern {
/// Pattern ID (eg., "aaa_base", "gnome")
pub id: String,
Expand All @@ -20,7 +21,35 @@ pub struct Pattern {
pub order: String,
}

/// Represents the reason why a pattern is selected.
#[derive(Clone, Copy, Debug, PartialEq, Serialize)]
pub enum SelectedBy {
/// The pattern was selected by the user.
User = 0,
/// The pattern was selected automatically.
Auto = 1,
/// The pattern has not be selected.
None = 2,
}

#[derive(Debug, thiserror::Error)]
#[error("Unknown selected by value: '{0}'")]
pub struct UnknownSelectedBy(u8);

impl TryFrom<u8> for SelectedBy {
type Error = UnknownSelectedBy;

fn try_from(value: u8) -> Result<Self, Self::Error> {
match value {
0 => Ok(Self::User),
1 => Ok(Self::Auto),
_ => Err(UnknownSelectedBy(value)),
}
}
}

/// D-Bus client for the software service
#[derive(Clone)]
pub struct SoftwareClient<'a> {
software_proxy: Software1Proxy<'a>,
}
Expand Down Expand Up @@ -55,14 +84,35 @@ impl<'a> SoftwareClient<'a> {

/// Returns the ids of patterns selected by user
pub async fn user_selected_patterns(&self) -> Result<Vec<String>, ServiceError> {
const USER_SELECTED: u8 = 0;
let patterns: Vec<String> = self
.software_proxy
.selected_patterns()
.await?
.into_iter()
.filter(|(_id, reason)| *reason == USER_SELECTED)
.map(|(id, _reason)| id)
.filter_map(|(id, reason)| match SelectedBy::try_from(reason) {
Ok(reason) if reason == SelectedBy::User => Some(id),
Ok(_reason) => None,
Err(e) => {
log::warn!("Ignoring pattern {}. Error: {}", &id, e);
None
}
})
.collect();
Ok(patterns)
}

/// Returns the selected pattern and the reason each one selected.
pub async fn selected_patterns(&self) -> Result<HashMap<String, SelectedBy>, ServiceError> {
let patterns = self.software_proxy.selected_patterns().await?;
let patterns = patterns
.into_iter()
.filter_map(|(id, reason)| match SelectedBy::try_from(reason) {
Ok(reason) => Some((id, reason)),
Err(e) => {
log::warn!("Ignoring pattern {}. Error: {}", &id, e);
None
}
})
.collect();
Ok(patterns)
}
Expand All @@ -80,4 +130,16 @@ impl<'a> SoftwareClient<'a> {
Ok(())
}
}

/// Returns the required space for installing the selected patterns.
///
/// It returns a formatted string including the size and the unit.
pub async fn used_disk_space(&self) -> Result<String, ServiceError> {
Ok(self.software_proxy.used_disk_space().await?)
}

/// Starts the process to read the repositories data.
pub async fn probe(&self) -> Result<(), ServiceError> {
Ok(self.software_proxy.probe().await?)
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "agama-dbus-server"
name = "agama-server"
version = "0.1.0"
edition = "2021"
rust-version.workspace = true
Expand Down
File renamed without changes.
Loading

0 comments on commit 7de4495

Please sign in to comment.