From 33e0d2283546c8bebfe81be405004dfe9ef30634 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ladislav=20Slez=C3=A1k?= Date: Fri, 1 Dec 2023 10:07:04 +0100 Subject: [PATCH 01/15] yupdate - update also the YAML product files --- .yupdate.post | 4 ++-- Rakefile | 16 ++++++++++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/.yupdate.post b/.yupdate.post index 2d91b28549..c3560a7012 100755 --- a/.yupdate.post +++ b/.yupdate.post @@ -25,8 +25,8 @@ function restart_service() { if [ -n "$SERVICE_START" ]; then SERVICE_START_UNIX_TIME=$(date -d "$SERVICE_START" +"%s") - # find the date of the latest file in the gem - NEWEST_FILE_TIME=$(find /usr/lib*/ruby/gems/*/gems/$SERVICE_NAME-* -exec stat --format %Y "{}" \; | sort -nr | head -n 1) + # find the date of the latest file in the product configuration or in the gem + NEWEST_FILE_TIME=$(find /usr/share/agama/products.d /usr/lib*/ruby/gems/*/gems/$SERVICE_NAME-* -exec stat --format %Y "{}" \; | sort -nr | head -n 1) # when a file is newer than the start time then restart the service if [ -n "$NEWEST_FILE_TIME" ] && [ "$SERVICE_START_UNIX_TIME" -lt "$NEWEST_FILE_TIME" ]; then diff --git a/Rakefile b/Rakefile index 37ec973652..095acb3b1c 100644 --- a/Rakefile +++ b/Rakefile @@ -170,5 +170,21 @@ if ENV["YUPDATE_FORCE"] == "1" || File.exist?("/.packages.initrd") || live_iso? FileUtils.mkdir_p(File.join(destdir, "/usr/share")) FileUtils.cp_r("playwright/.", File.join(destdir, "/usr/share/agama-playwright")) end + + if ENV["YUPDATE_SKIP_PRODUCTS"] != "1" + files = Dir.glob("products.d/*.y{a}ml") + files.each do |f| + # the sources contain several products, update only the existing files + oldfile = File.join("/usr/share/agama/", f) + if File.exist?(oldfile) + target = File.join(destdir, "/usr/share/agama/", f) + FileUtils.mkdir_p(File.dirname(target)) + FileUtils.cp(f, target) + else + # if there is a new product file it needs to be copied manually + puts "Skipping product file: #{f}" + end + end + end end end From 1193ed3318f58cc1e8ca42cd6e25dfff17b8d7d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ladislav=20Slez=C3=A1k?= Date: Fri, 1 Dec 2023 10:07:54 +0100 Subject: [PATCH 02/15] Define the user visible patterns in the product YAML files --- products.d/ALP-Dolomite.yaml | 2 ++ products.d/leap16.yaml | 2 ++ products.d/tumbleweed.yaml | 9 +++++++++ 3 files changed, 13 insertions(+) diff --git a/products.d/ALP-Dolomite.yaml b/products.d/ALP-Dolomite.yaml index f87af0f9f5..d1cbea6f61 100644 --- a/products.d/ALP-Dolomite.yaml +++ b/products.d/ALP-Dolomite.yaml @@ -23,6 +23,8 @@ software: - alp_cockpit - alp_hardware optional_patterns: null # no optional pattern shared + # no user selectable patterns, do not display the pattern selector + user_patterns: [] mandatory_packages: - package: ppc64-diag # Needed for hardware-based installations archs: ppc64 diff --git a/products.d/leap16.yaml b/products.d/leap16.yaml index 30060510af..c7b91d0714 100644 --- a/products.d/leap16.yaml +++ b/products.d/leap16.yaml @@ -28,6 +28,8 @@ software: - alp-container_runtime - alp_defaults optional_patterns: null # no optional pattern shared + user_patterns: + - alp_selinux mandatory_packages: null optional_packages: null base_product: Leap16 diff --git a/products.d/tumbleweed.yaml b/products.d/tumbleweed.yaml index 1ef74d4147..5d79f503e4 100644 --- a/products.d/tumbleweed.yaml +++ b/products.d/tumbleweed.yaml @@ -47,6 +47,15 @@ software: mandatory_patterns: - enhanced_base # only pattern that is shared among all roles on TW optional_patterns: null # no optional pattern shared + user_patterns: + - basic_desktop + - xfce + - kde + - gnome + - yast2_x11 + - yast2_server + - multimedia + - office mandatory_packages: - NetworkManager optional_packages: null From 8e48e413218c65fac328374bd5e3a408a0b7bb83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ladislav=20Slez=C3=A1k?= Date: Fri, 1 Dec 2023 10:08:50 +0100 Subject: [PATCH 03/15] Web - do not display the pattern selector if there are no patterns --- .../components/overview/SoftwareSection.jsx | 11 +++--- .../overview/SoftwareSection.test.jsx | 35 +++++++++++++++++++ 2 files changed, 42 insertions(+), 4 deletions(-) diff --git a/web/src/components/overview/SoftwareSection.jsx b/web/src/components/overview/SoftwareSection.jsx index fbcd81cee8..6046a9ab2f 100644 --- a/web/src/components/overview/SoftwareSection.jsx +++ b/web/src/components/overview/SoftwareSection.jsx @@ -34,6 +34,7 @@ const initialState = { errors: [], errorsRead: false, size: "", + patterns: {}, progress: { message: _("Reading software repositories"), current: 0, total: 0, finished: false } }; @@ -51,8 +52,8 @@ const reducer = (state, action) => { case "UPDATE_PROPOSAL": { if (state.busy) return state; - const { errors, size } = action.payload; - return { ...state, errors, size, errorsRead: true }; + const { errors, size, patterns } = action.payload; + return { ...state, errors, size, patterns, errorsRead: true }; } default: { @@ -82,8 +83,9 @@ export default function SoftwareSection({ showErrors }) { const updateProposal = async () => { const errors = await cancellablePromise(client.getIssues()); const size = await cancellablePromise(client.getUsedSpace()); + const patterns = await cancellablePromise(client.patterns(true)); - dispatch({ type: "UPDATE_PROPOSAL", payload: { errors, size } }); + dispatch({ type: "UPDATE_PROPOSAL", payload: { errors, size, patterns } }); }; updateProposal(); @@ -142,7 +144,8 @@ export default function SoftwareSection({ showErrors }) { icon="apps" loading={state.busy} errors={errors.map(toValidationError)} - path="/software" + // do not display the pattern selector when there are no patterns to display + path={Object.keys(state.patterns).length > 0 ? "/software" : null} > diff --git a/web/src/components/overview/SoftwareSection.test.jsx b/web/src/components/overview/SoftwareSection.test.jsx index d21df0e84c..d0fdf55711 100644 --- a/web/src/components/overview/SoftwareSection.test.jsx +++ b/web/src/components/overview/SoftwareSection.test.jsx @@ -29,9 +29,20 @@ import { SoftwareSection } from "~/components/overview"; jest.mock("~/client"); +const kdePattern = { + kde: [ + "Graphical Environments", + "Packages providing the Plasma desktop environment and applications from KDE.", + "./pattern-kde", + "KDE Applications and Plasma 5 Desktop", + "1110" + ] +}; + let getStatusFn = jest.fn().mockResolvedValue(IDLE); let getProgressFn = jest.fn().mockResolvedValue({}); let getIssuesFn = jest.fn().mockResolvedValue([]); +let patternsFn = jest.fn().mockResolvedValue(kdePattern); beforeEach(() => { createClient.mockImplementation(() => { @@ -42,6 +53,7 @@ beforeEach(() => { getIssues: getIssuesFn, onStatusChange: noop, onProgressChange: noop, + patterns: patternsFn, getUsedSpace: jest.fn().mockResolvedValue("500 MB") }, }; @@ -51,6 +63,7 @@ beforeEach(() => { describe("when the proposal is calculated", () => { beforeEach(() => { getStatusFn = jest.fn().mockResolvedValue(IDLE); + patternsFn = jest.fn().mockResolvedValue(kdePattern); }); it("renders the required space", async () => { @@ -59,6 +72,28 @@ describe("when the proposal is calculated", () => { await screen.findByText("500 MB"); }); + describe("patterns are available", () => { + it("the header is a link", async () => { + const { container } = installerRender(); + // wait until the component is fully rendered + await screen.findByText("Installation will take"); + expect(container.querySelector("h2 a[href='/software']")).not.toBeNull(); + }); + }); + + describe("no patterns are available", () => { + beforeEach(() => { + patternsFn = jest.fn().mockResolvedValue({}); + }); + + it("the header is a plain text", async () => { + const { container } = installerRender(); + // wait until the component is fully rendered + await screen.findByText("Installation will take"); + expect(container.querySelector("h2 a")).toBeNull(); + }); + }); + describe("and there are errors", () => { beforeEach(() => { getIssuesFn = jest.fn().mockResolvedValue([{ description: "Could not install..." }]); From 405d3c618fc8bdb0bb7e3d73ba5f02a519f9f22c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ladislav=20Slez=C3=A1k?= Date: Fri, 1 Dec 2023 10:09:50 +0100 Subject: [PATCH 04/15] service - return only the configured patterns --- service/lib/agama/config.rb | 4 ++-- service/lib/agama/software/manager.rb | 5 +++++ service/lib/agama/software/product.rb | 7 +++++++ service/lib/agama/software/product_builder.rb | 4 ++++ 4 files changed, 18 insertions(+), 2 deletions(-) diff --git a/service/lib/agama/config.rb b/service/lib/agama/config.rb index 0e524d648c..0ae3ee2d96 100644 --- a/service/lib/agama/config.rb +++ b/service/lib/agama/config.rb @@ -170,10 +170,10 @@ def merge(config) # @param property [Symbol|String|nil] Property to retrieve of the elements. # # @return [Array] - def arch_elements_from(*keys, property: nil) + def arch_elements_from(*keys, property: nil, default: []) keys.map!(&:to_s) elements = products.dig(*keys) - return [] unless elements.is_a?(Array) + return default unless elements.is_a?(Array) elements.map do |element| if !element.is_a?(Hash) diff --git a/service/lib/agama/software/manager.rb b/service/lib/agama/software/manager.rb index be47087609..68296ab1ef 100644 --- a/service/lib/agama/software/manager.rb +++ b/service/lib/agama/software/manager.rb @@ -214,6 +214,11 @@ def patterns(filtered) patterns = Y2Packager::Resolvable.find({ kind: :pattern }, preload) patterns = patterns.select(&:user_visible) if filtered + # only display the configured patterns + if product.user_patterns + patterns.select! {|p| product.user_patterns.include?(p.name)} + end + patterns end diff --git a/service/lib/agama/software/product.rb b/service/lib/agama/software/product.rb index 24bb8c0b2b..5f2cd72da8 100644 --- a/service/lib/agama/software/product.rb +++ b/service/lib/agama/software/product.rb @@ -73,6 +73,11 @@ class Product # @return [Array] attr_accessor :optional_patterns + # Optional user selectable patterns + # + # @return [Array] + attr_accessor :user_patterns + # Product translations. # # @example @@ -94,6 +99,8 @@ def initialize(id) @optional_packages = [] @mandatory_patterns = [] @optional_patterns = [] + # nil = display all patterns, [] = display none patterns + @user_patterns = nil @translations = {} end diff --git a/service/lib/agama/software/product_builder.rb b/service/lib/agama/software/product_builder.rb index b4ecfeddf8..7ee3d270ca 100644 --- a/service/lib/agama/software/product_builder.rb +++ b/service/lib/agama/software/product_builder.rb @@ -47,6 +47,7 @@ def build product.optional_packages = data[:optional_packages] product.mandatory_patterns = data[:mandatory_patterns] product.optional_patterns = data[:optional_patterns] + product.user_patterns = data[:user_patterns] product.translations = attrs["translations"] || {} end end @@ -79,6 +80,9 @@ def product_data_from_config(id) ), optional_patterns: config.arch_elements_from( id, "software", "optional_patterns", property: :pattern + ), + user_patterns: config.arch_elements_from( + id, "software", "user_patterns", property: :pattern, default: nil ) } end From 4876a11bfb233e25262e4fd5565ace2c5e1fc8fa Mon Sep 17 00:00:00 2001 From: Ancor Gonzalez Sosa Date: Mon, 4 Dec 2023 14:13:58 +0000 Subject: [PATCH 05/15] Preliminary definitions of openSUSE MicroOS products --- products.d/agama-products-opensuse.changes | 5 + products.d/agama-products-opensuse.spec | 2 + products.d/microos-desktop.yaml | 109 ++++++++++++++++++ products.d/microos.yaml | 125 +++++++++++++++++++++ 4 files changed, 241 insertions(+) create mode 100644 products.d/microos-desktop.yaml create mode 100644 products.d/microos.yaml diff --git a/products.d/agama-products-opensuse.changes b/products.d/agama-products-opensuse.changes index f84460af9e..020082bd94 100644 --- a/products.d/agama-products-opensuse.changes +++ b/products.d/agama-products-opensuse.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Mon Dec 4 14:11:51 UTC 2023 - Ancor Gonzalez Sosa + +- Preliminary definitions of openSUSE MicroOS products + ------------------------------------------------------------------- Mon Oct 30 14:38:51 UTC 2023 - Josef Reidinger diff --git a/products.d/agama-products-opensuse.spec b/products.d/agama-products-opensuse.spec index d2c23829f9..10807eb15e 100644 --- a/products.d/agama-products-opensuse.spec +++ b/products.d/agama-products-opensuse.spec @@ -52,6 +52,8 @@ install -m 0644 *.yaml %{buildroot}%{_datadir}/agama/products.d %files %dir %{_datadir}/agama %dir %{_datadir}/agama/products.d +%{_datadir}/agama/products.d/microos.yaml +%{_datadir}/agama/products.d/microos-desktop.yaml %{_datadir}/agama/products.d/tumbleweed.yaml %{_datadir}/agama/products.d/leap16.yaml diff --git a/products.d/microos-desktop.yaml b/products.d/microos-desktop.yaml new file mode 100644 index 0000000000..9caf0d7432 --- /dev/null +++ b/products.d/microos-desktop.yaml @@ -0,0 +1,109 @@ +id: MicroOS-Desktop +name: openSUSE MicroOS Desktop +# ------------------------------------------------------------------------------ +# WARNING: When changing the product description delete the translations located +# at the at translations/description key below to avoid using obsolete +# translations!! +# ------------------------------------------------------------------------------ +description: 'A distribution for the desktop offering automatic updates and + rollback on top of the foundations of openSUSE MicroOS. Includes Podman + Container Runtime and allows to manage software using Gnome Software or + KDE Discover.' +# Do not manually change any translations! See README.md for more details. +software: + installation_repositories: + - url: https://download.opensuse.org/tumbleweed/repo/oss/ + archs: x86_64 + - url: https://download.opensuse.org/ports/aarch64/tumbleweed/repo/oss/ + archs: aarch64 + - url: https://download.opensuse.org/ports/zsystems/tumbleweed/repo/oss/ + archs: s390 + - url: https://download.opensuse.org/ports/ppc/tumbleweed/repo/oss/ + archs: ppc + - url: https://download.opensuse.org/tumbleweed/repo/non-oss/ + archs: x86_64 + # aarch64 does not have non-oss ports. Keep eye if it change + - url: https://download.opensuse.org/ports/zsystems/tumbleweed/repo/non-oss/ + archs: s390 + - url: https://download.opensuse.org/ports/ppc/tumbleweed/repo/non-oss/ + archs: ppc + - url: https://download.opensuse.org/update/tumbleweed/ + archs: x86_64 + - url: https://download.opensuse.org/ports/aarch64/update/tumbleweed/ + archs: aarch64 + - url: https://download.opensuse.org/ports/zsystems/update/tumbleweed/ + archs: s390 + - url: https://download.opensuse.org/ports/ppc/tumbleweed/repo/oss/ + archs: ppc + mandatory_patterns: + - microos_base + - microos_base_zypper + - microos_defaults + - microos_hardware + - container_runtime + - pattern: 32bit + archs: x86_64 + optional_patterns: + - microos_gnome_desktop + user_patterns: + - microos_gnome_desktop + - microos_kde_desktop + mandatory_packages: + - NetworkManager + optional_packages: null + base_product: openSUSE + +security: + lsm: selinux + available_lsms: + selinux: + patterns: + - microos_selinux + policy: enforcing + none: + patterns: null + +storage: + space_policy: delete + volumes: + - "/" + volume_templates: + - mount_path: "/" + filesystem: btrfs + btrfs: + snapshots: true + read_only: true + default_subvolume: "@" + subvolumes: + - path: home + - path: opt + - path: root + - path: srv + - path: usr/local + - path: boot/writable + # Unified var subvolume - https://lists.opensuse.org/opensuse-packaging/2017-11/msg00017.html + - path: var + copy_on_write: false + # Architecture specific subvolumes + - path: boot/grub2/arm64-efi + archs: aarch64 + - path: boot/grub2/arm-efi + archs: arm + - path: boot/grub2/i386-pc + archs: x86_64 + - path: boot/grub2/powerpc-ieee1275 + archs: ppc,!board_powernv + - path: boot/grub2/s390x-emu + archs: s390 + - path: boot/grub2/x86_64-efi + archs: x86_64 + - path: boot/grub2/riscv64-efi + archs: riscv64 + size: + auto: false + min: 5 GiB + outline: + required: true + snapshots_configurable: false + filesystems: + - btrfs diff --git a/products.d/microos.yaml b/products.d/microos.yaml new file mode 100644 index 0000000000..7c52493b7e --- /dev/null +++ b/products.d/microos.yaml @@ -0,0 +1,125 @@ +id: MicroOS +name: openSUSE MicroOS +# ------------------------------------------------------------------------------ +# WARNING: When changing the product description delete the translations located +# at the at translations/description key below to avoid using obsolete +# translations!! +# ------------------------------------------------------------------------------ +description: 'A quick, small distribution designed to host container workloads + with automated administration & patching. openSUSE MicroOS provides + transactional (atomic) updates upon a read-only btrfs root file system. + As rolling release distribution the software is always up-to-date.' +# Do not manually change any translations! See README.md for more details. +software: + installation_repositories: + - url: https://download.opensuse.org/tumbleweed/repo/oss/ + archs: x86_64 + - url: https://download.opensuse.org/ports/aarch64/tumbleweed/repo/oss/ + archs: aarch64 + - url: https://download.opensuse.org/ports/zsystems/tumbleweed/repo/oss/ + archs: s390 + - url: https://download.opensuse.org/ports/ppc/tumbleweed/repo/oss/ + archs: ppc + - url: https://download.opensuse.org/tumbleweed/repo/non-oss/ + archs: x86_64 + # aarch64 does not have non-oss ports. Keep eye if it change + - url: https://download.opensuse.org/ports/zsystems/tumbleweed/repo/non-oss/ + archs: s390 + - url: https://download.opensuse.org/ports/ppc/tumbleweed/repo/non-oss/ + archs: ppc + - url: https://download.opensuse.org/update/tumbleweed/ + archs: x86_64 + - url: https://download.opensuse.org/ports/aarch64/update/tumbleweed/ + archs: aarch64 + - url: https://download.opensuse.org/ports/zsystems/update/tumbleweed/ + archs: s390 + - url: https://download.opensuse.org/ports/ppc/tumbleweed/repo/oss/ + archs: ppc + mandatory_patterns: + - microos_base + - microos_base_zypper + - microos_defaults + - microos_hardware + - pattern: 32bit + archs: x86_64 + optional_patterns: null + user_patterns: + - container_runtime + - microos_ra_agent + - microos_ra_verifier + mandatory_packages: + - NetworkManager + optional_packages: null + base_product: openSUSE + +security: + lsm: selinux + available_lsms: + selinux: + patterns: + - microos_selinux + policy: enforcing + none: + patterns: null + +storage: + space_policy: delete + volumes: + - "/" + - "/var" + volume_templates: + - mount_path: "/" + filesystem: btrfs + btrfs: + snapshots: true + read_only: true + default_subvolume: "@" + subvolumes: + - path: home + - path: opt + - path: root + - path: srv + - path: usr/local + - path: boot/writable + # Unified var subvolume - https://lists.opensuse.org/opensuse-packaging/2017-11/msg00017.html + - path: var + copy_on_write: false + # Architecture specific subvolumes + - path: boot/grub2/arm64-efi + archs: aarch64 + - path: boot/grub2/arm-efi + archs: arm + - path: boot/grub2/i386-pc + archs: x86_64 + - path: boot/grub2/powerpc-ieee1275 + archs: ppc,!board_powernv + - path: boot/grub2/s390x-emu + archs: s390 + - path: boot/grub2/x86_64-efi + archs: x86_64 + - path: boot/grub2/riscv64-efi + archs: riscv64 + size: + auto: true + outline: + required: true + snapshots_configurable: false + filesystems: + - btrfs + auto_size: + base_min: 5 GiB + base_max: 25 GiB + max_fallback_for: + - "/var" + - mount_path: "/var" + filesystem: btrfs + mount_options: + - "x-initrd.mount" + - "nodatacow" + size: + auto: false + min: 5 GiB + outline: + required: false + filesystems: + - btrfs From 0eb856c4edab755abf9db1062b4a35269a781c7b Mon Sep 17 00:00:00 2001 From: Ancor Gonzalez Sosa Date: Mon, 4 Dec 2023 14:15:51 +0000 Subject: [PATCH 06/15] Fix pattern name --- products.d/tumbleweed.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/products.d/tumbleweed.yaml b/products.d/tumbleweed.yaml index 5d79f503e4..41f5dc858c 100644 --- a/products.d/tumbleweed.yaml +++ b/products.d/tumbleweed.yaml @@ -52,7 +52,7 @@ software: - xfce - kde - gnome - - yast2_x11 + - yast2_desktop - yast2_server - multimedia - office From 988a792117e0ed4a97737bfd7fca21ef5da2b752 Mon Sep 17 00:00:00 2001 From: Ancor Gonzalez Sosa Date: Mon, 4 Dec 2023 16:16:49 +0000 Subject: [PATCH 07/15] Fix base product for MicroOS --- products.d/microos-desktop.yaml | 2 +- products.d/microos.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/products.d/microos-desktop.yaml b/products.d/microos-desktop.yaml index 9caf0d7432..b6e73b45f1 100644 --- a/products.d/microos-desktop.yaml +++ b/products.d/microos-desktop.yaml @@ -51,7 +51,7 @@ software: mandatory_packages: - NetworkManager optional_packages: null - base_product: openSUSE + base_product: MicroOS security: lsm: selinux diff --git a/products.d/microos.yaml b/products.d/microos.yaml index 7c52493b7e..cd3d6b51ad 100644 --- a/products.d/microos.yaml +++ b/products.d/microos.yaml @@ -50,7 +50,7 @@ software: mandatory_packages: - NetworkManager optional_packages: null - base_product: openSUSE + base_product: MicroOS security: lsm: selinux From 515477ac07bbc36dc8859ae5a4ca6069045feb36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ladislav=20Slez=C3=A1k?= Date: Mon, 4 Dec 2023 17:55:03 +0100 Subject: [PATCH 08/15] update documentation --- doc/yaml_config.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/doc/yaml_config.md b/doc/yaml_config.md index a98d48c929..c2a8e0de9a 100644 --- a/doc/yaml_config.md +++ b/doc/yaml_config.md @@ -38,6 +38,15 @@ Array of patterns that have to be selected. Array of patterns that should be selected but can be deselected or skipped if not available. +#### user\_patterns + +Array of patterns that are displayed in the pattern selector UI and user can +select them to install. + +If the list is empty then the pattern selector is not displayed. If the key is +not defined or the value is missing or is `null` then all available user visible +patterns are displayed. + ### security Options related to security From de02a86d35ba5401f7511cbb491b1e077dfaa275 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ladislav=20Slez=C3=A1k?= Date: Tue, 5 Dec 2023 12:26:10 +0100 Subject: [PATCH 09/15] Explicitly add the "translation" sections to the product YAML Otherwise the automated script would add it at the end of the file. --- products.d/microos-desktop.yaml | 1 + products.d/microos.yaml | 1 + 2 files changed, 2 insertions(+) diff --git a/products.d/microos-desktop.yaml b/products.d/microos-desktop.yaml index b6e73b45f1..8a850ec72d 100644 --- a/products.d/microos-desktop.yaml +++ b/products.d/microos-desktop.yaml @@ -10,6 +10,7 @@ description: 'A distribution for the desktop offering automatic updates and Container Runtime and allows to manage software using Gnome Software or KDE Discover.' # Do not manually change any translations! See README.md for more details. +translations: software: installation_repositories: - url: https://download.opensuse.org/tumbleweed/repo/oss/ diff --git a/products.d/microos.yaml b/products.d/microos.yaml index cd3d6b51ad..ec998f2eec 100644 --- a/products.d/microos.yaml +++ b/products.d/microos.yaml @@ -10,6 +10,7 @@ description: 'A quick, small distribution designed to host container workloads transactional (atomic) updates upon a read-only btrfs root file system. As rolling release distribution the software is always up-to-date.' # Do not manually change any translations! See README.md for more details. +translations: software: installation_repositories: - url: https://download.opensuse.org/tumbleweed/repo/oss/ From acadadc5ef2d44da60c18456576f2adf3e210f8b Mon Sep 17 00:00:00 2001 From: Ancor Gonzalez Sosa Date: Tue, 5 Dec 2023 11:56:43 +0000 Subject: [PATCH 10/15] List the yast2_basis pattern (installed by default) --- products.d/tumbleweed.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/products.d/tumbleweed.yaml b/products.d/tumbleweed.yaml index 41f5dc858c..fc8e934e5a 100644 --- a/products.d/tumbleweed.yaml +++ b/products.d/tumbleweed.yaml @@ -52,6 +52,7 @@ software: - xfce - kde - gnome + - yast2_basis - yast2_desktop - yast2_server - multimedia From ddcffaad69cc5676c5f6c8d3555bbe66d220376e Mon Sep 17 00:00:00 2001 From: Lubos Kocman Date: Mon, 4 Dec 2023 12:23:23 +0100 Subject: [PATCH 11/15] Drop Leap 16.0 for now * we can probably expect openSUSE variants of Dolomite or Marble prior we have Leap 16.0 * Fixes Issue #907 --- products.d/leap16.yaml | 102 ----------------------------------------- 1 file changed, 102 deletions(-) delete mode 100644 products.d/leap16.yaml diff --git a/products.d/leap16.yaml b/products.d/leap16.yaml deleted file mode 100644 index c7b91d0714..0000000000 --- a/products.d/leap16.yaml +++ /dev/null @@ -1,102 +0,0 @@ -id: Leap16 -name: openSUSE Leap 16.0 -archs: x86_64,aarch64 -# ------------------------------------------------------------------------------ -# WARNING: When changing the product description delete the translations located -# at the at translations/description key below to avoid using obsolete -# translations!! -# ------------------------------------------------------------------------------ -description: '[Experimental project] openSUSE Leap 16 is built on top of the - next generation Adaptable Linux Platform (ALP) from SUSE.' -# Do not manually change any translations! See README.md for more details. -translations: - description: - cs: "[Experimentální projekt] openSUSE Leap 16 je postaven na budoucí generaci - Adaptable Linux Platform (ALP) od SUSE." - sv: "[Experimentellt projekt] openSUSE Leap 16 är byggt ovanpå nästa generations - Anpassningsbara Linux Plattform (ALP) från SUSE." -software: - installation_repositories: - - url: https://download.opensuse.org/repositories/openSUSE:/Leap:/16.0/images/repo/Leap-16.0-x86_64-Media1/ - archs: x86_64 - - url: https://download.opensuse.org/repositories/openSUSE:/Leap:/16.0/images/repo/Leap-16.0-aarch64-Media1/ - archs: aarch64 - mandatory_patterns: - - alp_base - - alp_base_zypper - - alp_cockpit - - alp-container_runtime - - alp_defaults - optional_patterns: null # no optional pattern shared - user_patterns: - - alp_selinux - mandatory_packages: null - optional_packages: null - base_product: Leap16 - -security: - lsm: selinux - available_lsms: - # apparmor: - # patterns: - # - apparmor - selinux: - patterns: - - alp_selinux - policy: enforcing - none: - patterns: null - -storage: - space_policy: delete - encryption: - method: luks2 - pbkd_function: pbkdf2 - tpm_luks_open: true - volumes: - - "/" - volume_templates: - - mount_path: "/" - filesystem: btrfs - btrfs: - snapshots: true - read_only: true - default_subvolume: "@" - subvolumes: - - path: root - - path: home - - path: opt - - path: srv - - path: boot/writable - - path: usr/local - - path: boot/grub2/arm64-efi - archs: aarch64 - - path: boot/grub2/i386-pc - archs: x86_64 - - path: boot/grub2/powerpc-ieee1275 - archs: ppc,!board_powernv - - path: boot/grub2/s390x-emu - archs: s390 - - path: boot/grub2/x86_64-efi - archs: x86_64 - - path: var - copy_on_write: false - size: - auto: false - min: 5 GiB - outline: - required: true - filesystems: - - btrfs - snapshots_configurable: false - - filesystem: xfs - size: - auto: false - outline: - required: false - filesystems: - - btrfs - - ext2 - - ext3 - - ext4 - - xfs From 7a19b73aae465578b19ee025ef027e67befc4b8e Mon Sep 17 00:00:00 2001 From: Ancor Gonzalez Sosa Date: Tue, 5 Dec 2023 12:01:03 +0000 Subject: [PATCH 12/15] Update specfile and changelog --- products.d/agama-products-opensuse.changes | 1 + products.d/agama-products-opensuse.spec | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/products.d/agama-products-opensuse.changes b/products.d/agama-products-opensuse.changes index 020082bd94..eb6cd2d50f 100644 --- a/products.d/agama-products-opensuse.changes +++ b/products.d/agama-products-opensuse.changes @@ -2,6 +2,7 @@ Mon Dec 4 14:11:51 UTC 2023 - Ancor Gonzalez Sosa - Preliminary definitions of openSUSE MicroOS products +- Remove Leap 16.0 for now ------------------------------------------------------------------- Mon Oct 30 14:38:51 UTC 2023 - Josef Reidinger diff --git a/products.d/agama-products-opensuse.spec b/products.d/agama-products-opensuse.spec index 10807eb15e..815663bc4a 100644 --- a/products.d/agama-products-opensuse.spec +++ b/products.d/agama-products-opensuse.spec @@ -55,7 +55,6 @@ install -m 0644 *.yaml %{buildroot}%{_datadir}/agama/products.d %{_datadir}/agama/products.d/microos.yaml %{_datadir}/agama/products.d/microos-desktop.yaml %{_datadir}/agama/products.d/tumbleweed.yaml -%{_datadir}/agama/products.d/leap16.yaml %files -n agama-products-ALP-Dolomite %dir %{_datadir}/agama From 9376a7247a53ffd2f72e8a9e3ea8827b09eb882c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ladislav=20Slez=C3=A1k?= Date: Tue, 5 Dec 2023 13:50:37 +0100 Subject: [PATCH 13/15] Added unit test --- service/.rubocop.yml | 4 ++ service/lib/agama/software/manager.rb | 4 +- service/lib/agama/software/product_builder.rb | 2 +- service/test/agama/software/manager_test.rb | 62 ++++++++++++++++++- 4 files changed, 67 insertions(+), 5 deletions(-) diff --git a/service/.rubocop.yml b/service/.rubocop.yml index ed2faf80db..137ea30537 100644 --- a/service/.rubocop.yml +++ b/service/.rubocop.yml @@ -24,3 +24,7 @@ Metrics/BlockLength: # assignment in method calls is used to document some params Lint/UselessAssignment: Enabled: false + +# be less strict +Metrics/AbcSize: + Max: 32 diff --git a/service/lib/agama/software/manager.rb b/service/lib/agama/software/manager.rb index 68296ab1ef..9c2aeb8cf9 100644 --- a/service/lib/agama/software/manager.rb +++ b/service/lib/agama/software/manager.rb @@ -215,8 +215,8 @@ def patterns(filtered) patterns = patterns.select(&:user_visible) if filtered # only display the configured patterns - if product.user_patterns - patterns.select! {|p| product.user_patterns.include?(p.name)} + if product.user_patterns && filtered + patterns.select! { |p| product.user_patterns.include?(p.name) } end patterns diff --git a/service/lib/agama/software/product_builder.rb b/service/lib/agama/software/product_builder.rb index 7ee3d270ca..c048be304e 100644 --- a/service/lib/agama/software/product_builder.rb +++ b/service/lib/agama/software/product_builder.rb @@ -81,7 +81,7 @@ def product_data_from_config(id) optional_patterns: config.arch_elements_from( id, "software", "optional_patterns", property: :pattern ), - user_patterns: config.arch_elements_from( + user_patterns: config.arch_elements_from( id, "software", "user_patterns", property: :pattern, default: nil ) } diff --git a/service/test/agama/software/manager_test.rb b/service/test/agama/software/manager_test.rb index f899ab64b3..1603656c4f 100644 --- a/service/test/agama/software/manager_test.rb +++ b/service/test/agama/software/manager_test.rb @@ -229,12 +229,70 @@ describe "#products" do it "returns the list of known products" do products = subject.products - expect(products.size).to eq(3) + expect(products.size).to eq(4) expect(products).to all(be_a(Agama::Software::Product)) expect(products).to contain_exactly( an_object_having_attributes(id: "ALP-Dolomite"), an_object_having_attributes(id: "Tumbleweed"), - an_object_having_attributes(id: "Leap16") + an_object_having_attributes(id: "MicroOS"), + an_object_having_attributes(id: "MicroOS-Desktop") + ) + end + end + + describe "#patterns" do + it "returns only the specified patterns" do + expect(Y2Packager::Resolvable).to receive(:find).and_return( + [ + double( + arch: "x86_64", + category: "Base Technologies", + description: "YaST tools for installing your system.", + icon: "./yast", + kind: :pattern, + name: "yast2_install_wf", + order: "1240", + source: 0, + summary: "YaST Installation Packages", + user_visible: false, + version: "20220411-1.4" + ), + double( + arch: "x86_64", + category: "Base Technologies", + description: "YaST tools for basic system administration.", + icon: "./yast", + kind: :pattern, + name: "yast2_basis", + order: "1220", + source: 0, + summary: "YaST Base Utilities", + user_visible: true, + version: "20220411-1.4" + ), + double( + arch: "noarch", + category: "Graphical Environments", + description: + "Packages providing the Plasma desktop environment and " \ + "applications from KDE.", + icon: "./pattern-kde", + kind: :pattern, + name: "kde", + order: "1110", + source: 0, + summary: "KDE Applications and Plasma 5 Desktop", + user_visible: true, + version: "20230801-1.1" + ) + ] + ) + + allow(subject.product).to receive(:user_patterns).and_return(["kde"]) + patterns = subject.patterns(true) + + expect(patterns).to contain_exactly( + an_object_having_attributes(name: "kde") ) end end From 980893336b8770860690ae1b73e524f4ff123d32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ladislav=20Slez=C3=A1k?= Date: Tue, 5 Dec 2023 18:10:50 +0100 Subject: [PATCH 14/15] Review fixes --- service/lib/agama/config.rb | 2 ++ service/lib/agama/software/product.rb | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/service/lib/agama/config.rb b/service/lib/agama/config.rb index 0ae3ee2d96..3b4c2ba811 100644 --- a/service/lib/agama/config.rb +++ b/service/lib/agama/config.rb @@ -168,6 +168,8 @@ def merge(config) # # @param keys [Array] Config data keys of the collection. # @param property [Symbol|String|nil] Property to retrieve of the elements. + # @param default [Object] The default value returned when the value is not + # found or is not an array # # @return [Array] def arch_elements_from(*keys, property: nil, default: []) diff --git a/service/lib/agama/software/product.rb b/service/lib/agama/software/product.rb index 5f2cd72da8..509f6f0ea7 100644 --- a/service/lib/agama/software/product.rb +++ b/service/lib/agama/software/product.rb @@ -99,7 +99,7 @@ def initialize(id) @optional_packages = [] @mandatory_patterns = [] @optional_patterns = [] - # nil = display all patterns, [] = display none patterns + # nil = display all patterns, [] = display no patterns @user_patterns = nil @translations = {} end From 97da667357cf1d9142276288eb34b8bf81b5c211 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ladislav=20Slez=C3=A1k?= Date: Wed, 6 Dec 2023 09:36:47 +0100 Subject: [PATCH 15/15] Better comment --- service/lib/agama/software/product.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/service/lib/agama/software/product.rb b/service/lib/agama/software/product.rb index 509f6f0ea7..9e1179ce3a 100644 --- a/service/lib/agama/software/product.rb +++ b/service/lib/agama/software/product.rb @@ -99,7 +99,7 @@ def initialize(id) @optional_packages = [] @mandatory_patterns = [] @optional_patterns = [] - # nil = display all patterns, [] = display no patterns + # nil = display all visible patterns, [] = display no patterns @user_patterns = nil @translations = {} end