Skip to content

feat: ask for license acceptance#1922

Merged
imobachgs merged 25 commits intomasterfrom
eula-support
Jan 20, 2025
Merged

feat: ask for license acceptance#1922
imobachgs merged 25 commits intomasterfrom
eula-support

Conversation

@imobachgs
Copy link
Contributor

@imobachgs imobachgs commented Jan 20, 2025

Problem

Agama does not show the license of any product and does not ask the user to accept it. This is a requirement for beta 1, and it needs to be implemented as soon as possible.

Solution

Extend Agama to allow the specification of a license per product. The license should be accepted on the product selection page. The solution does not cover all cases (e.g., openSUSE licenses are not there yet) and the technical details might change soon. But it is expected to be good enough for beta 1.

The licenses are included in /usr/share/agama/eula with one directory per license. The directory name is used as the license ID (license.beta and license.final) and it contains the translations.

Licenses

The licenses come from the https://build.suse.de/package/show/SUSE:SLE-15-SP7:GA/skelcd package.

Testing

  • Added a new unit test
  • Tested manually

Screenshots

Click to show/hide some screenshots

Be aware below screenshots were taken using mock data for emulating a license in a product and illustrating the new interface controls and behavior.

Product without license Product with license
Product without license Product with license
License accepted for a product not selected yet License accepted for a product previously selected
License accepted for a product not selected yet License accepted for a product previously selected
License dialog
License dialog

@coveralls
Copy link

coveralls commented Jan 20, 2025

Pull Request Test Coverage Report for Build 12866228169

Details

  • 8 of 21 (38.1%) changed or added relevant lines in 6 files are covered.
  • 124 unchanged lines in 6 files lost coverage.
  • Overall coverage increased (+0.005%) to 70.966%

Changes Missing Coverage Covered Lines Changed/Added Lines %
rust/agama-lib/src/product/client.rs 0 2 0.0%
service/lib/agama/dbus/software/product.rb 0 2 0.0%
rust/agama-server/src/software/web.rs 0 9 0.0%
Files with Coverage Reduction New Missed Lines %
service/service/lib/agama/software/product_builder.rb 1 96.0%
service/service/lib/agama/software/product.rb 1 97.62%
service/service/lib/agama/software/manager.rb 9 74.58%
service/service/lib/agama/dbus/software/product.rb 11 84.26%
rust/agama-lib/src/product/client.rs 25 0.0%
rust/agama-server/src/software/web.rs 77 0.0%
Totals Coverage Status
Change from base Build 12836679478: 0.005%
Covered Lines: 17188
Relevant Lines: 24220

💛 - Coveralls

@imobachgs imobachgs marked this pull request as ready for review January 20, 2025 10:22
Jiné. Uplatnění Konvence OSN o smlouvách v mezinárodním obchodě se
zbožím je tímto výslovně vyloučeno.

©2013 SUSE LLC nebo její přidružené společnosti. Všechna práva
Copy link
Contributor

Choose a reason for hiding this comment

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

license copyright looks quite old :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, indeed.


let body: String = std::fs::read_to_string(license_path).ok()?;

Some(LicenseContent {
Copy link
Contributor

Choose a reason for hiding this comment

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

I would like to see here at least a bit of logging, like candidates and found licese so we know from logs why given license is shown.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

IMHO that's too much logging just for retrieving a license (the logic is pretty straightforward). But I can live with that :-)

/// The language is inferred from the file name (e.g., "es-ES" for license.es_ES.txt").
fn language_tag_from_file(name: &str) -> Option<LanguageTag> {
if !name.starts_with("license") {
return None;
Copy link
Contributor

Choose a reason for hiding this comment

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

this basically means there is some mess in our directory. Maybe we should also log here.


let mut licenses_repo = LicensesRepo::default();
if let Err(error) = licenses_repo.read() {
tracing::error!("Could not read the licenses repository: {:?}", error);
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

let software_issues = issues_router(&dbus, DBUS_SERVICE, DBUS_PATH).await?;
let product_issues = issues_router(&dbus, DBUS_SERVICE, DBUS_PRODUCT_PATH).await?;

let mut licenses_repo = LicensesRepo::default();
Copy link
Contributor

Choose a reason for hiding this comment

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

so if read below failed it will act as NulObject? And not display any license?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It considers there repository is empty. We could add some logging.

Copy link
Contributor

@mvidner mvidner left a comment

Choose a reason for hiding this comment

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

For traceability, we should mention where we took the license texts from

  • in this commit message 'feat(live): add licenses to the live image '
  • or in the PR description (which will get committed too)

const { products, selectedProduct } = useProduct({ suspense: true });
const [nextProduct, setNextProduct] = useState(selectedProduct);
// FIXME: should not be accepted by default first selectedProduct is accepted
// because it's a singleProduct iso.
Copy link
Contributor

Choose a reason for hiding this comment

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

this can be really issue with s390 SLES iso as it is single product. So I would ask in advance

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In a single product ISO, if there is a license, the product will not be auto-selected. So we should be safe.

@imobachgs
Copy link
Contributor Author

For traceability, we should mention where we took the license texts from

* in this commit message 'feat(live): add licenses to the live image '

* or in the PR description (which will get committed too)

Good point. I am adding it to the PR description. Thanks!

@imobachgs imobachgs merged commit 31823f4 into master Jan 20, 2025
10 checks passed
@imobachgs imobachgs deleted the eula-support branch January 20, 2025 14:58
@imobachgs imobachgs mentioned this pull request Feb 26, 2025
imobachgs added a commit that referenced this pull request Feb 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants