Skip to content

Commit

Permalink
Reorganize Ruby and Rust packages (#1056)
Browse files Browse the repository at this point in the history
Since we started to build Agama, we have introduced *a lot* of changes.
Initially, it was just Ruby code, but then we introduced the Agama CLI,
moved some code to Rust, etc. So, it is time to reorganize our packages.

This PR includes the following changes:

* A new `agama` package that contains `agama-dbus-server` and
`agama-web-server` binaries. You don't need to keep them separated.
* A new `agama-cli` package, which is a subpackage of `agama`.
* Renamed the `rubygem-agama` package to `rubygem-agama-yast` package
as, in the short term, it should only contain YaST-specific bits to
Agama.
* Additionally, it re-enable some tests and fixes some warnings.

You can (temporarily) see the results in [my home
project](https://build.opensuse.org/project/show/home:IGonzalezSosa:branches:systemsmanagement:Agama:Staging).

## Todo

- [x] Rename `rubygem-agama` to `rubygem-agama-yast`
- [x] Reorganize Rust-based packages
- [x] Update the documentation
- [x] Update the changes files 

## Links

* Trello: https://trello.com/c/8KGOkTkE/
  • Loading branch information
imobachgs authored Feb 28, 2024
2 parents 2244bab + 3bbfbb2 commit 0951b8c
Show file tree
Hide file tree
Showing 65 changed files with 76 additions and 64 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
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ mod tests {
use super::LocalesDatabase;
use agama_locale_data::LocaleCode;

#[ignore]
#[test]
fn test_read_locales() {
let mut db = LocalesDatabase::new();
Expand All @@ -129,7 +128,6 @@ mod tests {
assert_eq!(&found.territory, "Spanien");
}

#[ignore]
#[test]
fn test_locale_exists() {
let mut db = LocalesDatabase::new();
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
mod common;
pub mod common;

use agama_dbus_server::l10n::web::l10n_service;
use axum::{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
mod common;
pub mod common;

use self::common::{async_retry, DBusServer};
use agama_dbus_server::network::{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
mod common;
pub mod common;

use agama_dbus_server::{
service,
Expand Down
4 changes: 2 additions & 2 deletions rust/package/_service
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
<param name="revision">master</param>
<param name="subdir">rust</param>
<param name="without-version">enable</param>
<param name="extract">package/agama-cli.changes</param>
<param name="extract">package/agama-cli.spec</param>
<param name="extract">package/agama.changes</param>
<param name="extract">package/agama.spec</param>
</service>
<service name="cargo_vendor" mode="manual">
<param name="srcdir">agama/rust</param>
Expand Down
8 changes: 8 additions & 0 deletions rust/package/agama-cli.changes → rust/package/agama.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
-------------------------------------------------------------------
Tue Feb 27 15:55:28 UTC 2024 - Imobach Gonzalez Sosa <[email protected]>

- Reorganize RPM packages (gh#openSUSE/agama#1056):
* agama is now the main package and it contains agama-dbus-server
and agama-web-server.
* agama-cli is a subpackage.

-------------------------------------------------------------------
Wed Feb 7 11:49:02 UTC 2024 - Imobach Gonzalez Sosa <[email protected]>

Expand Down
59 changes: 28 additions & 31 deletions rust/package/agama-cli.spec → rust/package/agama.spec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#
# spec file for package agama-cli
# spec file for package agama
#
# Copyright (c) 2023 SUSE LINUX GmbH, Nuernberg, Germany.
# Copyright (c) 2023-2024 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
Expand All @@ -15,64 +15,61 @@
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#

Name: agama-cli
Name: agama
# This will be set by osc services, that will run after this.
Version: 0
Release: 0
Summary: Agama command line interface
Summary: Agama Installer
# If you know the license, put it's SPDX string here.
# Alternately, you can use cargo lock2rpmprovides to help generate this.
License: GPL-2.0-only
Url: https://github.com/opensuse/agama
Source0: agama.tar
Source1: vendor.tar.zst

BuildRequires: cargo-packaging
BuildRequires: pkgconfig(openssl)
# used in tests for dbus service
BuildRequires: python-langtable-data
BuildRequires: timezone
BuildRequires: dbus-1-common
Requires: dbus-1-common
# required by agama-dbus-server integration tests
BuildRequires: dbus-1-daemon
BuildRequires: clang-devel
BuildRequires: pkgconfig(pam)
# required by autoinstallation
Requires: jsonnet
Requires: lshw
# required by "agama logs store"
Requires: bzip2
Requires: tar
# required for translating the keyboards descriptions
BuildRequires: xkeyboard-config-lang
Requires: xkeyboard-config-lang
# required for getting the list of timezones
Requires: timezone
BuildRequires: timezone
# dependency on the YaST part of Agama
Requires: agama-yast

%description
Command line program to interact with the agama service.

%package -n agama-dbus-server
# This will be set by osc services, that will run after this.
Version: 0
Release: 0
Summary: Agama Rust D-Bus service
License: GPL-2.0-only
Url: https://github.com/opensuse/agama
Requires: python-langtable-data
Requires: dbus-1-common
# conflicts with the old packages
Conflicts: agama-dbus-server

%description -n agama-dbus-server
D-Bus service for agama project. It provides localization, networking and questions services.
%description
Agama is a service-based Linux installer. It is composed of an HTTP-based API,
a web user interface, a command-line interface and a D-Bus service which exposes
part of the YaST libraries.

%package -n agama-web-server
%package -n agama-cli
# This will be set by osc services, that will run after this.
Version: 0
Release: 0
Summary: Agama web server
Summary: Agama command-line interface
License: GPL-2.0-only
Url: https://github.com/opensuse/agama
Requires: agama-dbus-server

%description -n agama-web-server
Agama project web server. It provides a web-based API to Agama.
%description -n agama-cli
Command line program to interact with the Agama installer.

%prep
%autosetup -a1 -n agama
Expand All @@ -95,23 +92,23 @@ install -m 0644 --target-directory=%{buildroot}%{_datadir}/dbus-1/agama-services


%check
PATH=$PWD/share/bin:$PATH
%ifarch aarch64
/usr/bin/cargo auditable test -j1 --offline --no-fail-fast
%else
echo $PATH
%{cargo_test}
%endif

%files
%{_bindir}/agama
%dir %{_datadir}/agama-cli
%{_datadir}/agama-cli/profile.schema.json

%files -n agama-dbus-server
%{_bindir}/agama-dbus-server
%{_bindir}/agama-web-server
%{_datadir}/dbus-1/agama-services
%{_pam_vendordir}/agama

%files -n agama-web-server
%{_bindir}/agama-web-server
%files -n agama-cli
%{_bindir}/agama
%dir %{_datadir}/agama-cli
%{_datadir}/agama-cli/profile.schema.json

%changelog
8 changes: 4 additions & 4 deletions service/agama.gemspec → service/agama-yast.gemspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

#
# Copyright (c) [2022] SUSE LLC
# Copyright (c) 2022-2024 SUSE LLC
#
# All Rights Reserved.
#
Expand All @@ -21,7 +21,7 @@
# find current contact information at www.suse.com.

Gem::Specification.new do |spec|
spec.name = "agama"
spec.name = "agama-yast"

# in a git checkout?
if File.exist?(File.join(__dir__, "../.git"))
Expand All @@ -33,8 +33,8 @@ Gem::Specification.new do |spec|
spec.version = "99.yupdate"
end

spec.summary = "Agama Installer Service"
spec.description = "System service for Agama, an experimental YaST-based installer."
spec.summary = "YaST integration service for Agama"
spec.description = "D-Bus service exposing some YaST features that are useful for Agama."
spec.author = "YaST Team"
spec.email = "[email protected]"
spec.homepage = "https://github.com/openSUSE/agama"
Expand Down
1 change: 1 addition & 0 deletions service/package/gem2rpm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
:preamble: |-
# Override build.rpm, see also https://github.com/openSUSE/obs-build/blob/master/configs/
%global rb_build_versions %{rb_default_ruby}
Provides: agama-yast
BuildRequires: dbus-1-common
Requires: dbus-1-common
Requires: suseconnect-ruby-bindings
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
-------------------------------------------------------------------
Tue Feb 27 15:53:46 UTC 2024 - Imobach Gonzalez Sosa <[email protected]>

- Rename the gem to agama-yast and the package to
rubygem-agama-yast (gh#openSUSE/agama#1056).

-------------------------------------------------------------------
Tue Feb 20 13:15:15 UTC 2024 - José Iván López González <[email protected]>

Expand Down
2 changes: 1 addition & 1 deletion setup-services.sh
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ fi
# Only install cargo if it is not available (avoid conflicts with rustup)
which cargo || $SUDO zypper --non-interactive install cargo

# Packages required by Rust code (see ./rust/package/agama-cli.spec)
# Packages required by Rust code (see ./rust/package/agama.spec)
$SUDO zypper --non-interactive install \
bzip2 \
clang-devel \
Expand Down

0 comments on commit 0951b8c

Please sign in to comment.