Allow iso-codes-lang upgrades while preventing installation of any other *-lang

A while ago the package iso-codes-lang appeared as a hard dependency for Plasma. It’s not the case for Gnome.


$ zypper se --requires-pkg iso-codes-lang
Loading repository data...
Reading installed packages...

S | Name        | Summary                                        | Type
--+-------------+------------------------------------------------+--------
i | libKF5I18n5 | KDE Gettext-based UI text internationalization | package

I have the following lock:

$ grep -B 3 lang /etc/zypp/locks
type: package
match_type: glob
case_sensitive: on
solvable_name: *-lang

The result of this is when there’s an update to iso-codes-lang, zypper presents a conflict.

$ zypper dup
Loading repository data...
Reading installed packages...
Warning: You are about to do a distribution upgrade with all enabled repositories. Make sure these repositories are compatible before you continue. See 'man zypper' for more information about this command.
Computing distribution upgrade...

Problem: the installed iso-codes-lang-4.9.0-1.2.noarch requires 'iso-codes = 4.9.0', but this requirement cannot be provided
  deleted providers: iso-codes-4.9.0-1.2.noarch
 Solution 1: keep obsolete iso-codes-4.9.0-1.2.noarch
 Solution 2: remove lock to allow removal of iso-codes-lang-4.9.0-1.2.noarch
 Solution 3: break iso-codes-lang-4.9.0-1.2.noarch by ignoring some of its dependencies

Choose from above solutions by number or cancel [1/2/3/c/d/?] (c):

According to https://en.opensuse.org/openSUSE:Libzypp_locks_file I should be able to use install_status flag but neither installed/not-installed have effect. The mention version field also doesn’t work.

I want find a way to exclude the iso-codes-lang from the locks, given it’s the only -lang package installed.

Is there a bug here? I think it could be helpful if the locks syntax offered more flexibility. It could also be said that iso-codes-lang should be folded in the parent package.

It supports regex matching, so something like

^(^i]|i^s]).*-lang$

should match everything except iso-codes-lang. If any other package is*-lang appears you will need to refine this regular expression.

Thanks! That worked. I had to manually change match_type to regex as addlock thinks it’s a glob.

$ grep -B 3 lang /etc/zypp/locks
type: package
match_type: regex
case_sensitive: on
solvable_name: ^(^i]|i^s]).*-lang$

The snippet above ended up removing a few characters, probably during forum migration, the correct should be:

$ grep -B 3 lang /etc/zypp/locks
type: package
match_type: regex
case_sensitive: on
solvable_name: ^([^i]|i[^s]).*-lang$