Skip to content

Commit

Permalink
Merge pull request #467 from yast/pattern_deselection
Browse files Browse the repository at this point in the history
Pattern deselection (SP5)
  • Loading branch information
lslezak committed Aug 6, 2019
2 parents 7815f81 + 2440995 commit c214091
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 1 deletion.
7 changes: 7 additions & 0 deletions package/yast2-packager.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
-------------------------------------------------------------------
Mon Aug 5 18:36:42 UTC 2019 - Ladislav Slezák <lslezak@suse.cz>

- Better handle unselecting the default pre-selected patterns
by the user (bsc#1140735)
- 3.3.2

-------------------------------------------------------------------
Tue Jun 21 08:59:39 UTC 2019 - David Diaz <dgonzalez@suse.com>

Expand Down
2 changes: 1 addition & 1 deletion package/yast2-packager.spec
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@


Name: yast2-packager
Version: 3.3.1
Version: 3.3.2
Release: 0

BuildRoot: %{_tmppath}/%{name}-%{version}-build
Expand Down
3 changes: 3 additions & 0 deletions src/clients/inst_sw_select.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ def main
# from scratch. See BNC #436925.
Packages.ResetProposalCache

# avoid selecting again the unselected patterns
Packages.RememberNotSelectedPatterns

Packages.base_selection_modified = true
@ret = :next
Packages.solve_errors = 0 # all have been either solved
Expand Down
20 changes: 20 additions & 0 deletions src/modules/Packages.rb
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,8 @@ def main
@base_source_id = nil

@old_packages_proposal = nil

@not_selected_patterns = []
end

# summary functions
Expand Down Expand Up @@ -2079,6 +2081,8 @@ def SelectSystemPatterns(reselect)
next
elsif prop["status"] == :available && prop["transact_by"] == :user
log.info "Skipping pattern #{pattern_name} deselected by user"
elsif @not_selected_patterns.include?(pattern_name)
log.info "Pattern #{pattern_name} was already deselected, skipping"
else
Pkg.ResolvableInstall(pattern_name, :pattern)
end
Expand All @@ -2101,6 +2105,22 @@ def SelectSystemPatterns(reselect)
nil
end

# Remember the not selected patterns to avoid reselecting them again.
# The user (de)selection status might be lost (bsc#1140735#c11),
# we need to explicitly remember the not selected patterns.
def RememberNotSelectedPatterns
@not_selected_patterns.clear

all_patterns = Pkg.ResolvableProperties("", :pattern, "")
pattern_names = all_patterns.map{|p| p["name"]}
pattern_names.uniq!

pattern_names.each do |n|
next if all_patterns.any?{ |p| p["name"] == n && p["status"] == :selected }
@not_selected_patterns << n
end
end

# Select system packages
# @param [Boolean] reselect boolean true to select only those which are alrady selected
def SelectSystemPackages(reselect)
Expand Down

0 comments on commit c214091

Please sign in to comment.