Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dnf5 groupinstall alias #1286

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion mock-core-configs/etc/mock/templates/fedora-rawhide.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ config_opts['root'] = 'fedora-rawhide-{{ target_arch }}'
# fedora 31+ isn't mirrored, we need to run from koji
config_opts['mirrored'] = config_opts['target_arch'] != 'i686'

config_opts['chroot_setup_cmd'] = 'install @{% if mirrored %}buildsys-{% endif %}build'
config_opts['chroot_setup_cmd'] = 'groupinstall {% if mirrored %}buildsys-{% endif %}build'

config_opts['dist'] = 'rawhide' # only useful for --resultdir variable subst
config_opts['extra_chroot_dirs'] = [ '/run/lock', ]
Expand Down
6 changes: 5 additions & 1 deletion mock/py/mockbuild/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,11 @@ def setup_default_config_opts():
config_opts['dnf5_disable_plugins'] = []
# No --allowerasing with remove, per
# https://github.com/rpm-software-management/dnf5/issues/729
config_opts["dnf5_avoid_opts"] = {"remove": ["--allowerasing"]}
config_opts["dnf5_avoid_opts"] = {
"remove": ["--allowerasing"],
"groupinstall": ["--allowerasing"],
"group": ["--allowerasing"],
Copy link
Member Author

Choose a reason for hiding this comment

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

group install will support --allowerasing in the next release rpm-software-management/dnf5#1174

}

config_opts['microdnf_command'] = '/usr/bin/microdnf'
# "dnf-install" is special keyword which tells mock to use install but with DNF
Expand Down
27 changes: 27 additions & 0 deletions mock/py/mockbuild/package_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -765,3 +765,30 @@ def execute(self, *args, **kwargs):

def update(self, *args, **_kwargs):
return self.execute('upgrade', *args)

def initialize_aliases(self):
"""
Koji compatibility fix. Koji uses 'groupinstall' not 'group install' or
'install @group'.
"""
self.buildroot.root_log.info("configure DNF5 aliases")
if not self.buildroot.bootstrap_buildroot:
self.buildroot.root_log.info("no-op")
return
aliases_path = self.buildroot.bootstrap_buildroot.make_chroot_path('etc/dnf/dnf5-aliases.d/')
file_util.mkdirIfAbsent(aliases_path)
with open(os.path.join(aliases_path, "groupinstall.conf"), "w+",
encoding="utf8") as alias_fd:
alias_fd.write("""version = '1.0'
['groupinstall']
type = 'command'
attached_command = 'group.install'
descr = "Alias for 'group install'"
group_id = 'commands-compatibility-aliases'
complete = true
Copy link
Member Author

Choose a reason for hiding this comment

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

Koji is switching to group install by default: https://pagure.io/koji/pull-request/3974

""")

@traceLog()
def initialize_config(self):
super().initialize_config()
self.initialize_aliases()