-
Notifications
You must be signed in to change notification settings - Fork 357
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support Flatpak preinstallation as part of a DNF install
Add new functionality for running Flatpak preinstallation after installing the base system. It's initially implemented only for the DNF payload. Flatpak installation is done as an extra "side" payload that the payloads service calls after the base payload to install additional content. The base payload provides the list of Flatpak refs that should be installed from the side payload and the Flatpaks are installed from a location that is determined from the base payload's primary source - if the source is a local or remote install tree we look for a OCI image layout there, if the base payload is the network (CDN, closest mirror), we install directly from the configured Flatpak remote. For http/ftp payloads we mirror the OCI image layout locally before runing the installation.
- Loading branch information
Showing
17 changed files
with
1,094 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# | ||
# Copyright (C) 2019 Red Hat, Inc. | ||
# | ||
# This program is free software; you can redistribute it and/or modify | ||
# it under the terms of the GNU Lesser General Public License as published | ||
# by the Free Software Foundation; either version 2.1 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU Lesser General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU Lesser General Public License | ||
# along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
pkgpyexecdir = $(pyexecdir)/py$(PACKAGE_NAME) | ||
flatpak_moduledir = $(pkgpyexecdir)/modules/payloads/payload/flatpak | ||
dist_flatpak_module_DATA = $(wildcard $(srcdir)/*.py) | ||
|
||
MAINTAINERCLEANFILES = Makefile.in |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
# | ||
# Kickstart module for Live OS payload. | ||
# | ||
# Copyright (C) 2019 Red Hat, Inc. | ||
# | ||
# This copyrighted material is made available to anyone wishing to use, | ||
# modify, copy, or redistribute it subject to the terms and conditions of | ||
# the GNU General Public License v.2, or (at your option) any later version. | ||
# This program is distributed in the hope that it will be useful, but WITHOUT | ||
# ANY WARRANTY expressed or implied, including the implied warranties of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | ||
# Public License for more details. You should have received a copy of the | ||
# GNU General Public License along with this program; if not, write to the | ||
# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | ||
# 02110-1301, USA. Any Red Hat trademarks that are incorporated in the | ||
# source code or documentation are not subject to the GNU General Public | ||
# License and may only be used or replicated with the express permission of | ||
# Red Hat, Inc. | ||
# | ||
from pyanaconda.core.configuration.anaconda import conf | ||
from pyanaconda.modules.common.errors.payload import IncompatibleSourceError | ||
from pyanaconda.modules.payloads.base.utils import calculate_required_space | ||
from pyanaconda.modules.payloads.constants import SourceType, PayloadType | ||
from pyanaconda.modules.payloads.payload.flatpak.flatpak_manager import FlatpakManager | ||
from pyanaconda.modules.payloads.payload.flatpak.installation import CalculateFlatpaksSizeTask, \ | ||
CleanUpDownloadLocationTask, DownloadFlatpaksTask, InstallFlatpaksTask, \ | ||
PrepareDownloadLocationTask | ||
from pyanaconda.modules.payloads.payload.payload_base import PayloadBase | ||
from pyanaconda.modules.payloads.payload.flatpak.flatpak_interface import FlatpakInterface | ||
|
||
from pyanaconda.anaconda_loggers import get_module_logger | ||
log = get_module_logger(__name__) | ||
|
||
|
||
class FlatpakModule(PayloadBase): | ||
"""The Flatpak payload module.""" | ||
|
||
def __init__(self): | ||
super().__init__() | ||
self._flatpak_manager = FlatpakManager() | ||
|
||
def for_publication(self): | ||
"""Get the interface used to publish this source.""" | ||
return FlatpakInterface(self) | ||
|
||
@property | ||
def type(self): | ||
"""Type of this payload.""" | ||
return PayloadType.FLATPAK | ||
|
||
@property | ||
def default_source_type(self): | ||
"""Type of the default source.""" | ||
return None | ||
|
||
@property | ||
def supported_source_types(self): | ||
"""List of supported source types.""" | ||
# Include all the types of SourceType. | ||
return list(SourceType) | ||
|
||
def set_sources(self, sources): | ||
"""Set a new list of sources to this payload. | ||
This overrides the base implementation since the sources we set here | ||
are the sources from the main payload, and can already be initialized. | ||
:param sources: set a new sources | ||
:type sources: instance of pyanaconda.modules.payloads.source.source_base.PayloadSourceBase | ||
""" | ||
self._sources = sources | ||
self._flatpak_manager.set_sources(sources) | ||
self.sources_changed.emit() | ||
|
||
def set_flatpak_refs(self, refs): | ||
"""Set the flatpak refs. | ||
:param refs: a list of flatpak refs | ||
""" | ||
self._flatpak_manager.set_flatpak_refs(refs) | ||
|
||
def calculate_required_space(self): | ||
"""Calculate space required for the installation. | ||
:return: required size in bytes | ||
:rtype: int | ||
""" | ||
return calculate_required_space(self._flatpak_manager.download_size, | ||
self._flatpak_manager.install_size) | ||
|
||
def install_with_tasks(self): | ||
"""Install the payload with tasks.""" | ||
|
||
tasks = [ | ||
CalculateFlatpaksSizeTask( | ||
flatpak_manager=self._flatpak_manager, | ||
), | ||
PrepareDownloadLocationTask( | ||
flatpak_manager=self._flatpak_manager, | ||
), | ||
DownloadFlatpaksTask( | ||
flatpak_manager=self._flatpak_manager, | ||
), | ||
InstallFlatpaksTask( | ||
flatpak_manager=self._flatpak_manager, | ||
), | ||
CleanUpDownloadLocationTask( | ||
flatpak_manager=self._flatpak_manager, | ||
), | ||
] | ||
|
||
return tasks |
28 changes: 28 additions & 0 deletions
28
pyanaconda/modules/payloads/payload/flatpak/flatpak_interface.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# | ||
# DBus interface for Flatpak payload. | ||
# | ||
# Copyright (C) 2024 Red Hat, Inc. | ||
# | ||
# This copyrighted material is made available to anyone wishing to use, | ||
# modify, copy, or redistribute it subject to the terms and conditions of | ||
# the GNU General Public License v.2, or (at your option) any later version. | ||
# This program is distributed in the hope that it will be useful, but WITHOUT | ||
# ANY WARRANTY expressed or implied, including the implied warranties of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | ||
# Public License for more details. You should have received a copy of the | ||
# GNU General Public License along with this program; if not, write to the | ||
# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | ||
# 02110-1301, USA. Any Red Hat trademarks that are incorporated in the | ||
# source code or documentation are not subject to the GNU General Public | ||
# License and may only be used or replicated with the express permission of | ||
# Red Hat, Inc. | ||
# | ||
from dasbus.server.interface import dbus_interface | ||
|
||
from pyanaconda.modules.common.constants.interfaces import PAYLOAD_FLATPAK | ||
from pyanaconda.modules.payloads.payload.payload_base_interface import PayloadBaseInterface | ||
|
||
|
||
@dbus_interface(PAYLOAD_FLATPAK.interface_name) | ||
class FlatpakInterface(PayloadBaseInterface): | ||
"""DBus interface for Flatpak payload module.""" |
Oops, something went wrong.