From f6f35f622120b7eb8c10bf3b272caa2832e12b20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Iv=C3=A1n=20L=C3=B3pez=20Gonz=C3=A1lez?= Date: Tue, 13 May 2025 14:23:18 +0100 Subject: [PATCH 1/2] Make #candidate_device? public --- src/lib/y2storage/disk_analyzer.rb | 38 +++++++++++++++--------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/src/lib/y2storage/disk_analyzer.rb b/src/lib/y2storage/disk_analyzer.rb index a467ac399..925423763 100644 --- a/src/lib/y2storage/disk_analyzer.rb +++ b/src/lib/y2storage/disk_analyzer.rb @@ -1,4 +1,4 @@ -# Copyright (c) [2015-2021] SUSE LLC +# Copyright (c) [2015-2025] SUSE LLC # # All Rights Reserved. # @@ -144,6 +144,21 @@ def candidate_disks @candidate_disks end + # Checks whether a device can be used as candidate for installation + # + # A device is candidate for installation if no filesystem belonging to the device is mounted and the + # device does not contain a repository for installation. + # + # Moreover, RAM disks are also discarded. + # + # @param device [BlkDevice] + # @return [Boolean] + def candidate_device?(device) + !contain_mounted_filesystem?(device) && + !contain_installation_repository?(device) && + !device.name.match?(/^\/dev\/ram\d+$/) + end + # Look up devicegraph element by device name. # # @return [Device] @@ -244,7 +259,7 @@ def all_linux_suitable_filesystems # Finds software RAIDs that are considered valid candidates for a Linux installation # - # Apart from matching conditions of #candidate_disk?, a valid software RAID candidate must + # Apart from matching conditions of #candidate_device?, a valid software RAID candidate must # either, have a partition table or do not have children. # # See {#candidate_disks} for extra explanations (e.g. the relevance of EFI) and for @@ -255,7 +270,7 @@ def candidate_software_raids return [] unless arch.efiboot? devicegraph.software_raids.select do |md| - (md.partition_table? || md.children.empty?) && candidate_disk?(md) + (md.partition_table? || md.children.empty?) && candidate_device?(md) end end @@ -266,26 +281,11 @@ def candidate_software_raids # @return [Array] def candidate_disk_devices rejected_disk_devices = candidate_software_raids.map(&:ancestors).flatten - candidate_disk_devices = devicegraph.disk_devices.select { |d| candidate_disk?(d) } + candidate_disk_devices = devicegraph.disk_devices.select { |d| candidate_device?(d) } candidate_disk_devices - rejected_disk_devices end - # Checks whether a device can be used as candidate disk for installation - # - # A device is candidate for installation if no filesystem belonging to the device is mounted and the - # device does not contain a repository for installation. - # - # Moreover, RAM disks are also discarded. - # - # @param device [BlkDevice] - # @return [Boolean] - def candidate_disk?(device) - !contain_mounted_filesystem?(device) && - !contain_installation_repository?(device) && - !device.name.match?(/^\/dev\/ram\d+$/) - end - # Checks whether a device contains a mounted filesystem # # @see #device_filesystems, #mounted_filesystem? From a596e26ee9bee3d363d304742cf2fce2330422fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Iv=C3=A1n=20L=C3=B3pez=20Gonz=C3=A1lez?= Date: Tue, 13 May 2025 14:31:35 +0100 Subject: [PATCH 2/2] Update version and changelog --- package/yast2-storage-ng.changes | 7 +++++++ package/yast2-storage-ng.spec | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/package/yast2-storage-ng.changes b/package/yast2-storage-ng.changes index 1953727f8..f35914624 100644 --- a/package/yast2-storage-ng.changes +++ b/package/yast2-storage-ng.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Tue May 13 13:29:23 UTC 2025 - José Iván López González + +- Make method DiskAnalyzer#candidate_device? public + (gh#agama-project/agama#2338). +- 5.0.30 + ------------------------------------------------------------------- Thu Apr 10 11:30:44 UTC 2025 - Ancor Gonzalez Sosa diff --git a/package/yast2-storage-ng.spec b/package/yast2-storage-ng.spec index bfc9e33d7..fa14bc3eb 100644 --- a/package/yast2-storage-ng.spec +++ b/package/yast2-storage-ng.spec @@ -16,7 +16,7 @@ # Name: yast2-storage-ng -Version: 5.0.29 +Version: 5.0.30 Release: 0 Summary: YaST2 - Storage Configuration License: GPL-2.0-only OR GPL-3.0-only