diff -Nru landscape-client-24.02/debian/changelog landscape-client-24.02/debian/changelog --- landscape-client-24.02/debian/changelog 2024-03-31 09:12:19.000000000 +0000 +++ landscape-client-24.02/debian/changelog 2024-04-22 21:42:34.000000000 +0000 @@ -1,3 +1,10 @@ +landscape-client (24.02-0ubuntu5) noble; urgency=medium + + * d/p/2062561-fix-deb822-sources.patch: fix to include deb822 formatted + sources when collecting source channels (LP: #2062561) + + -- Austin Nhung Mon, 22 Apr 2024 15:42:34 -0600 + landscape-client (24.02-0ubuntu4) noble; urgency=medium * No-change rebuild for CVE-2024-3094 diff -Nru landscape-client-24.02/debian/patches/2062561-fix-deb822-sources.patch landscape-client-24.02/debian/patches/2062561-fix-deb822-sources.patch --- landscape-client-24.02/debian/patches/2062561-fix-deb822-sources.patch 1970-01-01 00:00:00.000000000 +0000 +++ landscape-client-24.02/debian/patches/2062561-fix-deb822-sources.patch 2024-04-22 21:42:34.000000000 +0000 @@ -0,0 +1,114 @@ +Description: Fix to include deb822 formatted sources when collecting source channels. +Origin: upstream, https://github.com/canonical/landscape-client/commit/a9a22e59634b4005da9a9dc70fb4ebfd7da6778c +Bug-Ubuntu: https://bugs.launchpad.net/landscape-client/+bug/2062561 +Last-Update: 2024-04-22 +--- +This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ +--- a/landscape/lib/apt/package/facade.py ++++ b/landscape/lib/apt/package/facade.py +@@ -282,10 +282,16 @@ + return + self.reload_channels() + ++ @property ++ def _sourceparts_directory(self): ++ return apt_pkg.config.find_dir("Dir::Etc::sourceparts") ++ + def _get_internal_sources_list(self): + """Return the path to the source.list file for the facade channels.""" +- sources_dir = apt_pkg.config.find_dir("Dir::Etc::sourceparts") +- return os.path.join(sources_dir, "_landscape-internal-facade.list") ++ return os.path.join( ++ self._sourceparts_directory, ++ "_landscape-internal-facade.list", ++ ) + + def add_channel_apt_deb( + self, +@@ -358,6 +364,10 @@ + and type keys. + """ + sources_list = SourcesList() ++ if hasattr(sources_list, "deb822"): ++ sources_list.deb822 = True ++ sources_list.refresh() ++ + return [ + { + "baseurl": entry.uri, +@@ -372,6 +382,10 @@ + def reset_channels(self): + """Remove all the configured channels.""" + sources_list = SourcesList() ++ if hasattr(sources_list, "deb822"): ++ sources_list.deb822 = True ++ sources_list.refresh() ++ + for entry in sources_list: + entry.set_enabled(False) + sources_list.save() +--- a/landscape/lib/apt/package/testing.py ++++ b/landscape/lib/apt/package/testing.py +@@ -15,6 +15,7 @@ + + def set_up(self, test_case): + test_case.apt_root = test_case.makeDir() ++ os.makedirs(os.path.join(test_case.apt_root, "etc/apt/preferences.d")) + self.dpkg_status = os.path.join( + test_case.apt_root, + "var", +--- a/landscape/lib/apt/package/tests/test_facade.py ++++ b/landscape/lib/apt/package/tests/test_facade.py +@@ -6,6 +6,7 @@ + import weakref + from collections import namedtuple + from unittest import mock ++from unittest import skipIf + + import apt + import apt_pkg +@@ -595,6 +596,44 @@ + self.facade.get_channels(), + ) + ++ @skipIf(not hasattr(SourcesList(), "deb822"), "aptsources version too old") ++ def test_get_channels_deb822(self): ++ """`get_channels` includes *.sources files with deb822 format.""" ++ sourceparts_dir = self.facade._sourceparts_directory ++ sources_file_path = os.path.join( ++ sourceparts_dir, ++ "test_deb822.sources", ++ ) ++ ++ with open(sources_file_path, "w") as sources_file: ++ sources_file.write( ++ textwrap.dedent( ++ """\ ++ Types: deb ++ URIs: http://test.archive.ubuntu.com/ubuntu/ ++ Suites: unicorn-test ++ Components: main restricted universe multiverse ++ Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg ++ """, ++ ), ++ ) ++ ++ channels = self.facade.get_channels() ++ ++ self.assertEqual( ++ [ ++ { ++ "baseurl": "http://test.archive.ubuntu.com/ubuntu/", ++ "components": "main restricted universe multiverse", ++ "distribution": "unicorn-test", ++ "type": "deb", ++ }, ++ ], ++ channels, ++ ) ++ ++ os.remove(sources_file_path) ++ + def test_reset_channels(self): + """ + C{reset_channels()} disables all the configured deb URLs. diff -Nru landscape-client-24.02/debian/patches/series landscape-client-24.02/debian/patches/series --- landscape-client-24.02/debian/patches/series 2024-03-14 22:47:11.000000000 +0000 +++ landscape-client-24.02/debian/patches/series 2024-04-22 21:42:34.000000000 +0000 @@ -1,2 +1,3 @@ +2062561-fix-deb822-sources.patch 2055348-fix-expandvars-arb-exec.patch 2057976-fix-ubuntu-pro-registration.patch