From 2b73c707f4f36a51cecdf9013598c7ce7b32ed7b Mon Sep 17 00:00:00 2001 From: Owen W. Taylor Date: Mar 31 2019 21:14:46 +0000 Subject: Ignore any specified profile when finding the Flatpak build target The source module for a Flatpak build can be specified as something like 'flatpak-runtime:28/sdk' to indicate that the Flatpak is built from the 'sdk' profile of the flatpak-runtime module. This should be ignored when looking up module builds to find the platform stream and build target. Signed-off-by: Owen W. Taylor --- diff --git a/pyrpkg/__init__.py b/pyrpkg/__init__.py index 4a0c487..85a1d81 100644 --- a/pyrpkg/__init__.py +++ b/pyrpkg/__init__.py @@ -990,6 +990,12 @@ class Commands(object): raise rpkgError("Multiple modules listed in 'container.yaml'") module = modules[0] + # The module can include a profile to specify what packages to + # put in the Flatpak container Strip it out, since we don't + # need it for finding the platform stream + if '/' in module: + module, _ = module.rsplit('/', 1) + parts = module.split(':') if len(parts) == 2: name, stream = parts @@ -997,7 +1003,7 @@ class Commands(object): elif len(parts) == 3: name, stream, version = parts else: - raise rpkgError("Module in container.yaml should be NAME:STREAM[:VERSION]") + raise rpkgError("Module in container.yaml should be NAME:STREAM[:VERSION][/PROFILE]") platform_stream = self._find_platform_stream(name, stream, version=version) if platform_stream is None: diff --git a/tests/test_flatpak_build.py b/tests/test_flatpak_build.py index f9d365a..28d37f6 100644 --- a/tests/test_flatpak_build.py +++ b/tests/test_flatpak_build.py @@ -259,6 +259,10 @@ class FlatpakBuildCase(CommandTestCase): self.set_container_modules(['eog:f28:20170629213428']) assert self.cmd.flatpak_build_target == 'f28-flatpak-candidate' + def test_find_target_profile(self): + self.set_container_modules(['eog:f28/sdk']) + assert self.cmd.flatpak_build_target == 'f28-flatpak-candidate' + def module_failure(self, container_modules, exception_str): if container_modules is not None: self.set_container_modules(container_modules)