Merge ~mitchburton/ubuntu/+source/landscape-client:plucky-fix-build into ubuntu/+source/landscape-client:ubuntu/devel

Proposed by Mitch Burton
Status: Merged
Merged at revision: 8992f1bea43124d019dfec59ef75fdb3b11cb308
Proposed branch: ~mitchburton/ubuntu/+source/landscape-client:plucky-fix-build
Merge into: ubuntu/+source/landscape-client:ubuntu/devel
Diff against target: 369 lines (+312/-3)
7 files modified
debian/changelog (+18/-0)
debian/patches/2087852-feat-manage-ubuntu-sources-glob.patch (+188/-0)
debian/patches/allow-http-proxy-in-tests.patch (+60/-0)
debian/patches/series (+3/-0)
debian/patches/unittest-makeSuite-deprecation.patch (+40/-0)
debian/rules (+2/-2)
debian/tests/control (+1/-1)
Reviewer Review Type Date Requested Status
Andreas Hasenack Approve
Ubuntu Sponsors Pending
Review via email: mp+483505@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Mitch Burton (mitchburton) wrote :

Successful build can be seen in this PPA: https://launchpad.net/~mitchburton/+archive/ubuntu/landscape-client-ppa/+packages, version 24.12-0ubuntu2~ppa2.

I've had to remove the ownership change to root for landscape-sysinfo.wrapper and apt-update. Since these are both 755 it shouldn't impact the ability to execute them, but I am curious if anyone knows why this root ownership change now produces build errors.

Revision history for this message
Andreas Hasenack (ahasenack) wrote :
Revision history for this message
Mitch Burton (mitchburton) wrote :
Revision history for this message
Andreas Hasenack (ahasenack) wrote :
Revision history for this message
Andreas Hasenack (ahasenack) :
review: Needs Fixing
Revision history for this message
Andreas Hasenack (ahasenack) :
Revision history for this message
Andreas Hasenack (ahasenack) :
Revision history for this message
Mitch Burton (mitchburton) wrote :

I believe I've addressed all the diff comments left by ahasenack:

  - Created bug LP: #2106263 for the FTBFS and referenced it in the changelog and commits
  - Updated the headers on the first patch to include the Bug-Ubuntu reference to same
  - Reformatted the changelog entry for multiple authors

Revision history for this message
Andreas Hasenack (ahasenack) wrote :

+1

review: Approve
Revision history for this message
Andreas Hasenack (ahasenack) wrote :

Actually, hold that thought. I triggered the autopkgtests in your ppa, and got a failure[1]:

558s [ERROR]
558s Traceback (most recent call last):
558s File "/tmp/autopkgtest.IgNtA7/build.1IR/src/landscape/client/tests/test_watchdog.py", line 580, in setUp
558s super().setUp()
558s File "/tmp/autopkgtest.IgNtA7/build.1IR/src/landscape/client/tests/helpers.py", line 74, in setUp
558s result = testing.HelperTestCase.setUp(self)
558s File "/tmp/autopkgtest.IgNtA7/build.1IR/src/landscape/lib/testing.py", line 49, in setUp
558s result = helper.set_up(self)
558s File "/tmp/autopkgtest.IgNtA7/build.1IR/src/landscape/client/tests/helpers.py", line 148, in set_up
558s test_case.broker_service = FakeBrokerService(config)
558s File "/tmp/autopkgtest.IgNtA7/build.1IR/src/landscape/client/broker/service.py", line 54, in __init__
558s super().__init__(config)
558s File "/tmp/autopkgtest.IgNtA7/build.1IR/src/landscape/client/service.py", line 36, in __init__
558s self.persist = get_versioned_persist(self)
558s File "/tmp/autopkgtest.IgNtA7/build.1IR/src/landscape/client/deployment.py", line 255, in get_versioned_persist
558s persist.save(service.persist_filename)
558s File "/tmp/autopkgtest.IgNtA7/build.1IR/src/landscape/lib/persist.py", line 179, in save
558s shutil.chown(dirname, user=self._user, group=self._group)
558s File "/usr/lib/python3.13/shutil.py", line 1427, in chown
558s raise LookupError("no such user: {!r}".format(user))
558s builtins.LookupError: no such user: 'landscape'

I remember this having been fixed already, is that ppa old? Just to be sure, I'll create a new one and run the tests there. It will be a while, though.

1. https://autopkgtest.ubuntu.com/results/autopkgtest-plucky-mitchburton-landscape-client-ppa/plucky/amd64/l/landscape-client/20250404_202328_93494@/log.gz

review: Needs Information
Revision history for this message
Mitch Burton (mitchburton) wrote (last edit ):

I've made changes that should hopefully resolve the autopkgtest issues. I've also made a new upload to my PPA of this version (~ppa4). My autopkgtest testbed has the landscape user, so that's likely why I didn't see this issue previously.

I've also updated LP: #2106263 to include the autopkgtest build failure.

Revision history for this message
Andreas Hasenack (ahasenack) wrote :

autopkgtests are still failing[1]. Multiple tests show this error pattern with the proxy variables:

626s landscape.client.tests.test_configuration.ConfigurationFunctionsTest.test_silent_setup
626s ===============================================================================
626s [FAIL]
626s Traceback (most recent call last):
626s File "/usr/lib/python3.13/unittest/mock.py", line 1426, in patched
626s return func(*newargs, **newkeywargs)
626s File "/tmp/autopkgtest.62rtX1/build.DIQ/src/landscape/client/tests/test_configuration.py", line 785, in test_silent_setup_no_register
626s self.assertConfigEqual(
626s File "/tmp/autopkgtest.62rtX1/build.DIQ/src/landscape/lib/testing.py", line 192, in assertConfigEqual
626s self.assertEqual(
626s File "/usr/lib/python3/dist-packages/twisted/trial/_synctest.py", line 444, in assertEqual
626s super().assertEqual(first, second, msg)
626s File "/usr/lib/python3.13/unittest/case.py", line 907, in assertEqual
626s assertion_func(first, second, msg=msg)
626s File "/usr/lib/python3.13/unittest/case.py", line 1206, in assertDictEqual
626s self.fail(self._formatMessage(msg, standardMsg))
626s twisted.trial.unittest.FailTest: {'url': 'https://landscape.canonical.com/me[138 chars]128'} != {'data_path': '/tmp/tmpsrhj5v8p/client', 'u[49 chars]tem'}
626s {'data_path': '/tmp/tmpsrhj5v8p/client',
626s - 'http_proxy': 'http://squid.internal:3128',
626s - 'https_proxy': 'http://squid.internal:3128',
626s 'url': 'https://landscape.canonical.com/message-system'}

1. https://autopkgtest.ubuntu.com/results/autopkgtest-plucky-mitchburton-landscape-client-ppa/plucky/amd64/l/landscape-client/20250407_093831_f2105@/log.gz

review: Needs Fixing
Revision history for this message
Mitch Burton (mitchburton) wrote :

I've added a fix for the http/https proxy variable issue based on https://github.com/canonical/landscape-client/commit/e79f605e3c69fc5b9b529a9997e4e89a6728066f

Revision history for this message
Andreas Hasenack (ahasenack) wrote :

As soon as your ppa finishes publishing the new builds, I'll trigger the autopkgtests there.

Revision history for this message
Andreas Hasenack (ahasenack) wrote :

Tests are good. There is a failure on ppc64el that looks like it's just flaky (connection errors).

+1

review: Approve
Revision history for this message
Andreas Hasenack (ahasenack) wrote :

Actually, you dropped the d/t/control change from d/changelog :(

review: Needs Fixing
Revision history for this message
Mitch Burton (mitchburton) wrote :

Ah my mistake. Will rectify.

Revision history for this message
Andreas Hasenack (ahasenack) wrote :

\o/

Revision history for this message
Andreas Hasenack (ahasenack) wrote :

+1

review: Approve
Revision history for this message
Andreas Hasenack (ahasenack) wrote :

Sponsored:

Uploading landscape-client_24.12-0ubuntu2.dsc
Uploading landscape-client_24.12-0ubuntu2.debian.tar.xz
Uploading landscape-client_24.12-0ubuntu2_source.buildinfo
Uploading landscape-client_24.12-0ubuntu2_source.changes

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/debian/changelog b/debian/changelog
2index cd69d49..461698e 100644
3--- a/debian/changelog
4+++ b/debian/changelog
5@@ -1,3 +1,21 @@
6+landscape-client (24.12-0ubuntu2) plucky; urgency=medium
7+
8+ [ Bryan Fraschetti ]
9+ * d/p/2087852-feat-manage-ubuntu-sources-glob.patch: include DEB822 formatted sources
10+ when managing apt sources by regex matching .sources files (LP: #2087852)
11+
12+ [ Mitch Burton ]
13+ * Fix FTBFS (LP: #2106263)
14+ - d/p/unittest-makeSuite-deprecation.patch: fix tests on python versions
15+ where unittest.makeSuite has been removed
16+ - d/rules: don't make root:root owner of installed executables
17+ - d/tests/control: set environment variables for autopkgtest user and
18+ build environment
19+ - d/p/allow-http-proxy-in-tests.patch: fix tests by making them
20+ insensitive to http/https proxy environment variables
21+
22+ -- Mitch Burton <mitch.burton@canonical.com> Wed, 26 Mar 2025 17:47:28 -0700
23+
24 landscape-client (24.12-0ubuntu1) plucky; urgency=medium
25
26 * New upstream release 24.12
27diff --git a/debian/patches/2087852-feat-manage-ubuntu-sources-glob.patch b/debian/patches/2087852-feat-manage-ubuntu-sources-glob.patch
28new file mode 100644
29index 0000000..7dd82a5
30--- /dev/null
31+++ b/debian/patches/2087852-feat-manage-ubuntu-sources-glob.patch
32@@ -0,0 +1,188 @@
33+Subject: feat: add support for .sources when applying repository profiles
34+
35+ This is the backport of an upstream commit which added support to manage
36+ ubuntu sources in DEB822 format (.sources files) alongside the one-liner
37+ format (.list files). The bug reported is outlined in LP: #2087852.
38+
39+Origin: upstream, https://github.com/canonical/landscape-client/commit/556f87c2819b218029ba0a13e2b2ceddfbec3e6b
40+Bug-Ubuntu: https://bugs.launchpad.net/landscape-client/+bug/2087852
41+Last-Update: 2025-03-31
42+
43+diff --git a/landscape/client/manager/aptsources.py b/landscape/client/manager/aptsources.py
44+index 179fa723..785fa215 100644
45+--- a/landscape/client/manager/aptsources.py
46++++ b/landscape/client/manager/aptsources.py
47+@@ -27,6 +27,11 @@ class AptSources(ManagerPlugin):
48+ SOURCES_LIST_D = "/etc/apt/sources.list.d"
49+ TRUSTED_GPG_D = "/etc/apt/trusted.gpg.d"
50+
51++ """
52++ Valid file patterns for one-line and Deb822-style sources, respectively.
53++ """
54++ SOURCES_LIST_D_FILE_PATTERNS = ["*.list", "*.sources"]
55++
56+ def register(self, registry):
57+ super().register(registry)
58+ registry.register_message(
59+@@ -140,10 +145,14 @@ def _handle_sources(self, ignored, sources):
60+ "manage_sources_list_d",
61+ True,
62+ )
63++
64+ if manage_sources_list_d not in FALSE_VALUES:
65+- filenames = glob.glob(os.path.join(self.SOURCES_LIST_D, "*.list"))
66+- for filename in filenames:
67+- shutil.move(filename, f"{filename}.save")
68++ for pattern in self.SOURCES_LIST_D_FILE_PATTERNS:
69++ filenames = glob.glob(
70++ os.path.join(self.SOURCES_LIST_D, pattern)
71++ )
72++ for filename in filenames:
73++ shutil.move(filename, f"{filename}.save")
74+
75+ for source in sources:
76+ filename = os.path.join(
77+diff --git a/landscape/client/manager/tests/test_aptsources.py b/landscape/client/manager/tests/test_aptsources.py
78+index aa648be6..c17aac44 100644
79+--- a/landscape/client/manager/tests/test_aptsources.py
80++++ b/landscape/client/manager/tests/test_aptsources.py
81+@@ -260,20 +260,28 @@ def buggy_source_handler(*args):
82+
83+ def test_renames_sources_list_d(self):
84+ """
85+- The sources files in sources.list.d are renamed to .save when a message
86+- is received if config says to manage them, which is the default.
87++ The sources files (.list, .sources) in sources.list.d
88++ are renamed to .save when a message is received
89++ if config says to manage them, which is the default.
90+ """
91++ FILE_1_LIST = os.path.join(
92++ self.sourceslist.SOURCES_LIST_D, "file1.list"
93++ )
94++
95++ FILE_2_SOURCES = os.path.join(
96++ self.sourceslist.SOURCES_LIST_D, "file2.sources"
97++ )
98+ with open(
99+- os.path.join(self.sourceslist.SOURCES_LIST_D, "file1.list"),
100++ FILE_1_LIST,
101+ "w",
102+- ) as sources1:
103+- sources1.write("ok\n")
104++ ) as source1:
105++ source1.write("ok\n")
106+
107+ with open(
108+- os.path.join(self.sourceslist.SOURCES_LIST_D, "file2.list.save"),
109++ FILE_2_SOURCES,
110+ "w",
111+- ) as sources2:
112+- sources2.write("ok\n")
113++ ) as source2:
114++ source2.write("ok\n")
115+
116+ self.manager.dispatch_message(
117+ {
118+@@ -285,45 +293,42 @@ def test_renames_sources_list_d(self):
119+ )
120+
121+ self.assertFalse(
122+- os.path.exists(
123+- os.path.join(self.sourceslist.SOURCES_LIST_D, "file1.list"),
124+- ),
125++ os.path.exists(FILE_1_LIST),
126+ )
127+
128++ self.assertFalse(os.path.exists(FILE_2_SOURCES))
129++
130+ self.assertTrue(
131+- os.path.exists(
132+- os.path.join(
133+- self.sourceslist.SOURCES_LIST_D,
134+- "file1.list.save",
135+- ),
136+- ),
137++ os.path.exists(f"{FILE_1_LIST}.save"),
138+ )
139+
140+ self.assertTrue(
141+- os.path.exists(
142+- os.path.join(
143+- self.sourceslist.SOURCES_LIST_D,
144+- "file2.list.save",
145+- ),
146+- ),
147++ os.path.exists(f"{FILE_2_SOURCES}.save"),
148+ )
149+
150+ def test_does_not_rename_sources_list_d(self):
151+ """
152+- The sources files in sources.list.d are not renamed to .save when a
153+- message is received if config says not to manage them.
154++ The sources files (.list, .sources) in sources.list.d
155++ are not renamed to .save when a message is received
156++ if config says not to manage them
157+ """
158++ FILE_3_LIST = os.path.join(
159++ self.sourceslist.SOURCES_LIST_D, "file3.list"
160++ )
161++
162++ FILE_4_SOURCES = os.path.join(
163++ self.sourceslist.SOURCES_LIST_D, "file4.sources"
164++ )
165+ with open(
166+- os.path.join(self.sourceslist.SOURCES_LIST_D, "file1.list"),
167++ FILE_3_LIST,
168+ "w",
169+- ) as sources1:
170+- sources1.write("ok\n")
171+-
172++ ) as source3:
173++ source3.write("ok\n")
174+ with open(
175+- os.path.join(self.sourceslist.SOURCES_LIST_D, "file2.list.save"),
176++ FILE_4_SOURCES,
177+ "w",
178+- ) as sources2:
179+- sources2.write("ok\n")
180++ ) as source4:
181++ source4.write("ok\n")
182+
183+ self.manager.config.manage_sources_list_d = False
184+ self.manager.dispatch_message(
185+@@ -336,27 +341,19 @@ def test_does_not_rename_sources_list_d(self):
186+ )
187+
188+ self.assertTrue(
189+- os.path.exists(
190+- os.path.join(self.sourceslist.SOURCES_LIST_D, "file1.list"),
191+- ),
192++ os.path.exists(FILE_3_LIST),
193++ )
194++
195++ self.assertTrue(
196++ os.path.exists(FILE_4_SOURCES),
197+ )
198+
199+ self.assertFalse(
200+- os.path.exists(
201+- os.path.join(
202+- self.sourceslist.SOURCES_LIST_D,
203+- "file1.list.save",
204+- ),
205+- ),
206++ os.path.exists(f"{FILE_3_LIST}.save"),
207+ )
208+
209+- self.assertTrue(
210+- os.path.exists(
211+- os.path.join(
212+- self.sourceslist.SOURCES_LIST_D,
213+- "file2.list.save",
214+- ),
215+- ),
216++ self.assertFalse(
217++ os.path.exists(f"{FILE_4_SOURCES}.save"),
218+ )
219+
220+ def test_create_landscape_sources(self):
221diff --git a/debian/patches/allow-http-proxy-in-tests.patch b/debian/patches/allow-http-proxy-in-tests.patch
222new file mode 100644
223index 0000000..3fc6473
224--- /dev/null
225+++ b/debian/patches/allow-http-proxy-in-tests.patch
226@@ -0,0 +1,60 @@
227+Description: Fix config tests; make them insensitive to http(s) proxy environment variables
228+Author: Mitch Burton <mitch.burton@canonical.com>
229+Origin: upstream
230+Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/landscape-client/+bug/2106263
231+Applied-Upstream: https://github.com/canonical/landscape-client/commit/e79f605e3c69fc5b9b529a9997e4e89a6728066f
232+Last-Update: 2025-04-07
233+---
234+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
235+Index: landscape-client/landscape/client/tests/test_configuration.py
236+===================================================================
237+--- landscape-client.orig/landscape/client/tests/test_configuration.py
238++++ landscape-client/landscape/client/tests/test_configuration.py
239+@@ -756,6 +756,7 @@ class ConfigurationFunctionsTest(Landsca
240+ )
241+
242+ @mock.patch("landscape.client.configuration.ServiceConfig")
243++ @mock.patch("os.environ", new={})
244+ def test_silent_setup(self, mock_serviceconfig):
245+ """
246+ Only command-line options are used in silent mode.
247+@@ -775,6 +776,7 @@ url = https://landscape.canonical.com/me
248+ )
249+
250+ @mock.patch("landscape.client.configuration.ServiceConfig")
251++ @mock.patch("os.environ", {})
252+ def test_silent_setup_no_register(self, mock_serviceconfig):
253+ """
254+ Called with command line options to write a config file but no
255+@@ -846,6 +848,7 @@ url = https://landscape.canonical.com/me
256+ )
257+
258+ @mock.patch("landscape.client.configuration.ServiceConfig")
259++ @mock.patch("os.environ", {})
260+ def test_silent_setup_unicode_computer_title(self, mock_serviceconfig):
261+ """
262+ Setup accepts a non-ascii computer title and registration is
263+@@ -880,6 +883,7 @@ url = https://landscape.canonical.com/me
264+
265+ @mock.patch("landscape.client.configuration.input")
266+ @mock.patch("landscape.client.configuration.ServiceConfig")
267++ @mock.patch("os.environ", new={})
268+ def test_silent_script_users_imply_script_execution_plugin(
269+ self,
270+ mock_serviceconfig,
271+@@ -951,6 +955,7 @@ bus = session
272+ mock_serviceconfig.set_start_on_boot.assert_called_once_with(True)
273+
274+ @mock.patch("landscape.client.configuration.ServiceConfig")
275++ @mock.patch("os.environ", new={})
276+ def test_silent_setup_with_ping_url(self, mock_serviceconfig):
277+ mock_serviceconfig.restart_landscape.return_value = True
278+ filename = self.makeFile(
279+@@ -1814,6 +1819,7 @@ registration_key = shared-secret
280+ )
281+
282+ @mock.patch("landscape.client.configuration.ServiceConfig")
283++ @mock.patch("os.environ", new={})
284+ def test_import_from_file_may_reset_old_options(self, mock_serviceconfig):
285+ """
286+ This test ensures that setting an empty option in an imported
287diff --git a/debian/patches/series b/debian/patches/series
288index 051c373..62e9fa0 100644
289--- a/debian/patches/series
290+++ b/debian/patches/series
291@@ -1 +1,4 @@
292 fix-landscape-client-manpage.patch
293+unittest-makeSuite-deprecation.patch
294+2087852-feat-manage-ubuntu-sources-glob.patch
295+allow-http-proxy-in-tests.patch
296diff --git a/debian/patches/unittest-makeSuite-deprecation.patch b/debian/patches/unittest-makeSuite-deprecation.patch
297new file mode 100644
298index 0000000..e06382e
299--- /dev/null
300+++ b/debian/patches/unittest-makeSuite-deprecation.patch
301@@ -0,0 +1,40 @@
302+Description: Fix tests on python versions where unittest.makeSuite has been removed
303+Author: Mitch Burton <mitch.burton@canonical.com>
304+Origin: upstream
305+Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/landscape-client/+bug/2106263
306+Applied-Upstream: https://github.com/canonical/landscape-client/commit/e3f051ad6a33029845f9f11b17649299004598a7
307+Last-Update: 2025-03-26
308+---
309+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
310+Index: landscape-client/landscape/lib/tests/test_sequenceranges.py
311+===================================================================
312+--- landscape-client.orig/landscape/lib/tests/test_sequenceranges.py
313++++ landscape-client/landscape/lib/tests/test_sequenceranges.py
314+@@ -297,11 +297,21 @@ class RemoveFromRangesTest(unittest.Test
315+ def test_suite():
316+ return unittest.TestSuite(
317+ (
318+- unittest.makeSuite(SequenceToRangesTest),
319+- unittest.makeSuite(RangesToSequenceTest),
320+- unittest.makeSuite(SequenceRangesTest),
321+- unittest.makeSuite(FindRangesIndexTest),
322+- unittest.makeSuite(AddToRangesTest),
323+- unittest.makeSuite(RemoveFromRangesTest),
324++ unittest.defaultTestLoader.loadTestsFromTestCase(
325++ SequenceToRangesTest
326++ ),
327++ unittest.defaultTestLoader.loadTestsFromTestCase(
328++ RangesToSequenceTest
329++ ),
330++ unittest.defaultTestLoader.loadTestsFromTestCase(
331++ SequenceRangesTest
332++ ),
333++ unittest.defaultTestLoader.loadTestsFromTestCase(
334++ FindRangesIndexTest
335++ ),
336++ unittest.defaultTestLoader.loadTestsFromTestCase(AddToRangesTest),
337++ unittest.defaultTestLoader.loadTestsFromTestCase(
338++ RemoveFromRangesTest
339++ ),
340+ ),
341+ )
342diff --git a/debian/rules b/debian/rules
343index 3fcf3ae..267a32a 100755
344--- a/debian/rules
345+++ b/debian/rules
346@@ -19,8 +19,8 @@ override_dh_auto_build:
347 override_dh_auto_install:
348 dh_auto_install
349 make -C apt-update
350- install -D -o root -g root -m 755 debian/landscape-sysinfo.wrapper $(CURDIR)/$(root_dir)$(SHAREDIR)/landscape-sysinfo.wrapper
351- install -D -o root -g root -m 755 apt-update/apt-update $(CURDIR)/$(root_dir)$(LIBDIR)/apt-update
352+ install -D -m 755 debian/landscape-sysinfo.wrapper $(CURDIR)/$(root_dir)$(SHAREDIR)/landscape-sysinfo.wrapper
353+ install -D -m 755 apt-update/apt-update $(CURDIR)/$(root_dir)$(LIBDIR)/apt-update
354
355 override_dh_installsystemd:
356 dh_installsystemd
357diff --git a/debian/tests/control b/debian/tests/control
358index 082632c..0f6d748 100644
359--- a/debian/tests/control
360+++ b/debian/tests/control
361@@ -1,7 +1,7 @@
362 Tests: smoke
363 Restrictions: allow-stderr, needs-sudo, superficial
364
365-Test-Command: HOME=$(mktemp -d) make check
366+Test-Command: HOME=$(mktemp -d) LANDSCAPE_CLIENT_USER=$(whoami) LANDSCAPE_CLIENT_BUILDING=1 make check
367 Depends: @builddeps@
368 Restrictions: allow-stderr
369 Features: test-name=unit

Subscribers

People subscribed via source and target branches