Merge ~simpoir/ubuntu/+source/landscape-client:focal_pulse into ubuntu/+source/landscape-client:ubuntu/focal-devel

Proposed by Simon Poirier
Status: Work in progress
Proposed branch: ~simpoir/ubuntu/+source/landscape-client:focal_pulse
Merge into: ubuntu/+source/landscape-client:ubuntu/focal-devel
Diff against target: 346 lines (+312/-0)
5 files modified
debian/changelog (+8/-0)
debian/patches/apt-pulse-1758529.patch (+27/-0)
debian/patches/reporter_logging.patch (+19/-0)
debian/patches/security_pocket_1848828.patch (+255/-0)
debian/patches/series (+3/-0)
Reviewer Review Type Date Requested Status
Canonical Server Team Pending
Ubuntu Server Dev import team Pending
Review via email: mp+374569@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Eric Desrochers (slashd) wrote :

It might be a good timing to take benefit of the upload in focal to release a new version of landscape-client instead carrying 18.01 which seems to be introduced in Bionic and keep adding fixes on top of it ?

@simpoir, Do we have enough new materials in lds-client to consider releasing a new version ?

- Eric

Revision history for this message
Eric Desrochers (slashd) wrote :

and also take advantage of this upload to modernise the package which is deprecated to some regards.

lintian report:

$ lintian --pedantic -I landscape-client_18.01-0ubuntu9.dsc
P: landscape-client source: package-uses-deprecated-source-override-location
P: landscape-client source: file-contains-trailing-whitespace debian/changelog (line 327)
P: landscape-client source: file-contains-trailing-whitespace debian/changelog (line 490)
P: landscape-client source: file-contains-trailing-whitespace debian/changelog (line 493)
P: landscape-client source: file-contains-trailing-whitespace ... use --no-tag-display-limit to see all (or pipe to a file/program)
I: landscape-client source: debian-pycompat-is-obsolete
W: landscape-client source: package-uses-deprecated-debhelper-compat-version 7
P: landscape-client source: rules-requires-root-missing
P: landscape-client source: no-dep5-copyright
I: landscape-client source: no-complete-debconf-translation
I: landscape-client source: debian-rules-parses-dpkg-parsechangelog (line 20)
P: landscape-client source: no-homepage-field
W: landscape-client source: ancient-standards-version 3.8.2 (released 2009-06-16) (current is 4.4.0)
W: landscape-client source: ancient-python-version-field x-python3-version 3.5
I: landscape-client source: testsuite-autopkgtest-missing

- Eric

Revision history for this message
Eric Desrochers (slashd) wrote :
Revision history for this message
Eric Desrochers (slashd) wrote :

I had a quick look at the upstream code/src package and lds-client does have enough materials.

One of them is the full integration of a systemd, dropping the init script.

https://github.com/CanonicalLtd/landscape-client/commit/dfc308665

Unmerged commits

c584fa1... by Simon Poirier

Updated changelog:

* d/p/apt-pulse-1758529.patch: Override the apt progress pulse (LP: #1758529)
* d/p/security_pocket_1848828.patch (LP: #1848828)
* d/p/reporter_logging.patch (LP: #1848828)<Paste>

1112de7... by Simon Poirier

d/p/security_pocket_1848828.patch
d/p/reporter_logging.patch

147055f... by Simon Poirier

d/p/apt-pulse-1758529.patch: Override the apt progress pulse (LP: #1758529)

db27ca0... by Simon Poirier

Import patches-unapplied version 18.01-0ubuntu9 to ubuntu/eoan-proposed

Imported using git-ubuntu import.

Upload parent: ba2b91dfd960345a2bcdae49cd034f6e579a2287

ba2b91d... by Simon Poirier

Update changelog

  * d/p/product-name-vminfo-1828217.patch: Add product_name to things scanned
    for vm_info (LP: #1828217)
  * d/landscape-client.postinst: Set default value if data_path is
    missing. (LP: #1728681)
  * d/p/stagger-launch-1788518.patch: Add option to stagger launch of broker
    plugins. (LP: #1788518)
  * d/landscape-client.init: Fix init script stop action.

8e14c04... by Simon Poirier

Fix regression with d/landscape-client.init

Add an additional --name filter to start-stop-daemon to correct
a regression introduced by dpkg>=1.19.3.

e325c2d... by Simon Poirier

Add d/p/stagger-launch-1788518.patch

9692f3d... by Simon Poirier

Default data_path in postinst (LP: #1728681)

3afe8de... by Simon Poirier

Add d/p/product-name-vminfo-1828217.patch

7721e87... by Simon Poirier

Import patches-unapplied version 18.01-0ubuntu8 to ubuntu/eoan-proposed

Imported using git-ubuntu import.

Changelog parent: 9fb0c5464e8acb76dbd5edbbe42a8f4a75f4849f

New changelog entries:
  * Set LANG in sysinfo wrapper. (LP: #1780071)

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 c8629f4..3906faa 100644
3--- a/debian/changelog
4+++ b/debian/changelog
5@@ -1,3 +1,11 @@
6+landscape-client (18.01-0ubuntu10) focal; urgency=medium
7+
8+ * d/p/apt-pulse-1758529.patch: Override the apt progress pulse (LP: #1758529)
9+ * d/p/security_pocket_1848828.patch (LP: #1848828)
10+ * d/p/reporter_logging.patch (LP: #1848828)
11+
12+ -- Simon Poirier <simon.poirier@canonical.com> Tue, 22 Oct 2019 18:54:21 -0400
13+
14 landscape-client (18.01-0ubuntu9) eoan; urgency=medium
15
16 * d/p/product-name-vminfo-1828217.patch: Add product_name to things scanned
17diff --git a/debian/patches/apt-pulse-1758529.patch b/debian/patches/apt-pulse-1758529.patch
18new file mode 100644
19index 0000000..14db379
20--- /dev/null
21+++ b/debian/patches/apt-pulse-1758529.patch
22@@ -0,0 +1,27 @@
23+Description: Override the apt progress pulse.
24+ This should remove the tracebacks under python3 + bionic.
25+Author: Simon Poirier <simon.poirier@canonical.com>
26+Origin: upstream, https://github.com/CanonicalLtd/landscape-client/commit/8e52e1d3418b3b042a2f305d82336b9866914e43
27+Bug-Ubuntu: https://bugs.launchpad.net/bugs/1758529
28+Last-Update: 2019-09-30
29+
30+diff --git a/landscape/lib/apt/package/facade.py b/landscape/lib/apt/package/facade.py
31+index 1c026beb..15c57ab5 100644
32+--- a/landscape/lib/apt/package/facade.py
33++++ b/landscape/lib/apt/package/facade.py
34+@@ -57,6 +57,15 @@ class LandscapeAcquireProgress(AcquireProgress):
35+ fcntl.ioctl API differences for different Python versions.
36+ """
37+
38++ def pulse(self, owner):
39++ """Override updating the acquire progress, which needs a tty.
40++
41++ Under Python3, StringIO.fileno() raises UnsupportedOperation instead
42++ of an AttributeError. This would be uncaught by apt, thus we force a
43++ NOOP here.
44++ """
45++ return True
46++
47+
48+ class LandscapeInstallProgress(InstallProgress):
49+
50diff --git a/debian/patches/reporter_logging.patch b/debian/patches/reporter_logging.patch
51new file mode 100644
52index 0000000..42d8535
53--- /dev/null
54+++ b/debian/patches/reporter_logging.patch
55@@ -0,0 +1,19 @@
56+Description: Remove extra keyword which breaks log format
57+Author: Simon Poirier <simon.poirier@canonical.com>
58+Origin: upstream, https://github.com/CanonicalLtd/landscape-client/commit/ad37c28e80ebfb85f43bdabece9946d3a062c0e9
59+Bug-Ubuntu: https://bugs.launchpad.net/bugs/1848828
60+Last-Update: 2019-10-22
61+
62+diff --git a/landscape/client/package/reporter.py b/landscape/client/package/reporter.py
63+index 9f34f2a1..39b67df3 100644
64+--- a/landscape/client/package/reporter.py
65++++ b/landscape/client/package/reporter.py
66+@@ -755,7 +755,7 @@ class PackageReporter(PackageTaskHandler):
67+ "%(not_locked)d not locked, "
68+ "%(not_auto)d not autoremovable, "
69+ "%(not_security)d not security.",
70+- extra=dict(
71++ dict(
72+ installed=len(new_installed), available=len(new_available),
73+ upgrades=len(new_upgrades), locked=len(new_locked),
74+ auto=len(new_autoremovable), not_installed=len(not_installed),
75diff --git a/debian/patches/security_pocket_1848828.patch b/debian/patches/security_pocket_1848828.patch
76new file mode 100644
77index 0000000..cbcd104
78--- /dev/null
79+++ b/debian/patches/security_pocket_1848828.patch
80@@ -0,0 +1,255 @@
81+Description: report packages from security-pocket
82+Author: Simon Poirier <simon.poirier@canonical.com>
83+Origin: upstream, https://github.com/CanonicalLtd/landscape-client/commit/77c54c2e9c01255f8ed43935b47b65abcd62d021
84+Bug-Ubuntu: https://bugs.launchpad.net/bugs/1848828
85+Last-Update: 2019-10-22
86+
87+diff --git a/Makefile.travis b/Makefile.travis
88+index d82d473d..b532241a 100644
89+--- a/Makefile.travis
90++++ b/Makefile.travis
91+@@ -11,6 +11,7 @@ pipinstallpythonapt: pipinstallpythonapt_deps
92+ pipinstallpythonapt_deps:
93+ pip install pyopenssl
94+ pip install service_identity
95++ sudo apt-get update
96+ sudo apt-get -y build-dep python-apt python3-apt
97+ sudo apt-get -y install libapt-pkg-dev
98+
99+diff --git a/landscape/client/package/reporter.py b/landscape/client/package/reporter.py
100+index c48a4c04..6054ec3b 100644
101+--- a/landscape/client/package/reporter.py
102++++ b/landscape/client/package/reporter.py
103+@@ -609,6 +609,9 @@ class PackageReporter(PackageTaskHandler):
104+ - are now set, and were not;
105+ - were previously set but are not anymore;
106+
107++ Also, packages coming from the security pocket will be
108++ reported as such.
109++
110+ In all cases, the server is notified of the new situation
111+ with a "packages" message.
112+
113+@@ -622,14 +625,17 @@ class PackageReporter(PackageTaskHandler):
114+ old_upgrades = set(self._store.get_available_upgrades())
115+ old_locked = set(self._store.get_locked())
116+ old_autoremovable = set(self._store.get_autoremovable())
117++ old_security = set(self._store.get_security())
118+
119+ current_installed = set()
120+ current_available = set()
121+ current_upgrades = set()
122+ current_locked = set()
123+ current_autoremovable = set()
124++ current_security = set()
125+ lsb = parse_lsb_release(LSB_RELEASE_FILENAME)
126+ backports_archive = "{}-backports".format(lsb["code-name"])
127++ security_archive = "{}-security".format(lsb["code-name"])
128+
129+ for package in self._facade.get_packages():
130+ # Don't include package versions from the official backports
131+@@ -664,6 +670,13 @@ class PackageReporter(PackageTaskHandler):
132+ if self._facade.is_package_upgrade(package):
133+ current_upgrades.add(id)
134+
135++ # Is this package present in the security pocket?
136++ security_origins = any(
137++ origin for origin in package.origins
138++ if origin.archive == security_archive)
139++ if security_origins:
140++ current_security.add(id)
141++
142+ for package in self._facade.get_locked_packages():
143+ hash = self._facade.get_package_hash(package)
144+ id = self._store.get_hash_id(hash)
145+@@ -675,12 +688,14 @@ class PackageReporter(PackageTaskHandler):
146+ new_upgrades = current_upgrades - old_upgrades
147+ new_locked = current_locked - old_locked
148+ new_autoremovable = current_autoremovable - old_autoremovable
149++ new_security = current_security - old_security
150+
151+ not_installed = old_installed - current_installed
152+ not_available = old_available - current_available
153+ not_upgrades = old_upgrades - current_upgrades
154+ not_locked = old_locked - current_locked
155+ not_autoremovable = old_autoremovable - current_autoremovable
156++ not_security = old_security - current_security
157+
158+ message = {}
159+ if new_installed:
160+@@ -703,6 +718,13 @@ class PackageReporter(PackageTaskHandler):
161+ message["not-autoremovable"] = list(
162+ sequence_to_ranges(sorted(not_autoremovable)))
163+
164++ if new_security:
165++ message["security"] = list(
166++ sequence_to_ranges(sorted(new_security)))
167++ if not_security:
168++ message["not-security"] = list(
169++ sequence_to_ranges(sorted(not_security)))
170++
171+ if not_installed:
172+ message["not-installed"] = \
173+ list(sequence_to_ranges(sorted(not_installed)))
174+@@ -722,17 +744,25 @@ class PackageReporter(PackageTaskHandler):
175+ message["type"] = "packages"
176+ result = self.send_message(message)
177+
178+- logging.info("Queuing message with changes in known packages: "
179+- "%d installed, %d available, %d available upgrades, "
180+- "%d locked, %d autoremovable, %d not installed, "
181+- "%d not available, %d not available upgrades, "
182+- "%d not locked, %d not autoremovable. "
183+- % (len(new_installed), len(new_available),
184+- len(new_upgrades), len(new_locked),
185+- len(new_autoremovable),
186+- len(not_installed), len(not_available),
187+- len(not_upgrades), len(not_locked),
188+- len(not_autoremovable)))
189++ logging.info(
190++ "Queuing message with changes in known packages: "
191++ "%(installed)d installed, %(available)d available, "
192++ "%(upgrades)d available upgrades, %(locked)d locked, "
193++ "%(auto)d autoremovable, %(security)d security, "
194++ "%(not_installed)d not installed, "
195++ "%(not_available)d not available, "
196++ "%(not_upgrades)d not available upgrades, "
197++ "%(not_locked)d not locked, "
198++ "%(not_auto)d not autoremovable, "
199++ "%(not_security)d not security.",
200++ extra=dict(
201++ installed=len(new_installed), available=len(new_available),
202++ upgrades=len(new_upgrades), locked=len(new_locked),
203++ auto=len(new_autoremovable), not_installed=len(not_installed),
204++ not_available=len(not_available),
205++ not_upgrades=len(not_upgrades), not_locked=len(not_locked),
206++ not_auto=len(not_autoremovable), security=len(new_security),
207++ not_security=len(not_security)))
208+
209+ def update_currently_known(result):
210+ if new_installed:
211+@@ -755,6 +785,10 @@ class PackageReporter(PackageTaskHandler):
212+ self._store.remove_locked(not_locked)
213+ if not_autoremovable:
214+ self._store.remove_autoremovable(not_autoremovable)
215++ if new_security:
216++ self._store.add_security(new_security)
217++ if not_security:
218++ self._store.remove_security(not_security)
219+ # Something has changed wrt the former run, let's update the
220+ # timestamp and return True.
221+ stamp_file = self._config.detect_package_changes_stamp
222+diff --git a/landscape/client/package/tests/test_reporter.py b/landscape/client/package/tests/test_reporter.py
223+index 851c8eb9..6500affb 100644
224+--- a/landscape/client/package/tests/test_reporter.py
225++++ b/landscape/client/package/tests/test_reporter.py
226+@@ -999,6 +999,47 @@ class PackageReporterAptTest(LandscapeTest):
227+ self.assertFalse(result)
228+ self.assertEqual([1], self.store.get_autoremovable())
229+
230++ @inlineCallbacks
231++ def test_detect_packages_from_security_pocket(self):
232++ """Packages versions coming from security are reported as such."""
233++ message_store = self.broker_service.message_store
234++ message_store.set_accepted_types(["packages"])
235++ lsb = parse_lsb_release(LSB_RELEASE_FILENAME)
236++ release_path = os.path.join(self.repository_dir, "Release")
237++ with open(release_path, "w") as release:
238++ release.write("Suite: {}-security".format(lsb["code-name"]))
239++
240++ self.store.set_hash_ids({HASH1: 1, HASH2: 2, HASH3: 3})
241++
242++ yield self.reporter.detect_packages_changes()
243++
244++ self.assertMessages(message_store.get_pending_messages(), [{
245++ "type": "packages",
246++ "available": [(1, 3)],
247++ "security": [(1, 3)],
248++ }])
249++ self.assertEqual(sorted(self.store.get_available()), [1, 2, 3])
250++ self.assertEqual(sorted(self.store.get_security()), [1, 2, 3])
251++
252++ @inlineCallbacks
253++ def test_detect_packages_not_from_security_pocket(self):
254++ """Packages versions removed from security are reported as such."""
255++ message_store = self.broker_service.message_store
256++ message_store.set_accepted_types(["packages"])
257++
258++ self.store.set_hash_ids({HASH1: 1, HASH2: 2, HASH3: 3})
259++ self.store.add_available([1, 2, 3])
260++ self.store.add_security([1, 2])
261++
262++ yield self.reporter.detect_packages_changes()
263++
264++ self.assertMessages(message_store.get_pending_messages(), [{
265++ "type": "packages",
266++ "not-security": [1, 2],
267++ }])
268++ self.assertEqual(sorted(self.store.get_available()), [1, 2, 3])
269++ self.assertEqual(self.store.get_security(), [])
270++
271+ def test_detect_packages_changes_with_backports(self):
272+ """
273+ Package versions coming from backports aren't considered to be
274+diff --git a/landscape/lib/apt/package/store.py b/landscape/lib/apt/package/store.py
275+index 2764f7cd..59d5ca4f 100644
276+--- a/landscape/lib/apt/package/store.py
277++++ b/landscape/lib/apt/package/store.py
278+@@ -232,6 +232,25 @@ class PackageStore(HashIdStore):
279+ cursor.execute("SELECT id FROM autoremovable")
280+ return [row[0] for row in cursor.fetchall()]
281+
282++ @with_cursor
283++ def add_security(self, cursor, ids):
284++ for id in ids:
285++ cursor.execute("REPLACE INTO security VALUES (?)", (id,))
286++
287++ @with_cursor
288++ def remove_security(self, cursor, ids):
289++ id_list = ",".join(str(int(id)) for id in ids)
290++ cursor.execute("DELETE FROM security WHERE id IN (%s)" % id_list)
291++
292++ @with_cursor
293++ def clear_security(self, cursor):
294++ cursor.execute("DELETE FROM security")
295++
296++ @with_cursor
297++ def get_security(self, cursor):
298++ cursor.execute("SELECT id FROM security")
299++ return [row[0] for row in cursor.fetchall()]
300++
301+ @with_cursor
302+ def add_installed(self, cursor, ids):
303+ for id in ids:
304+@@ -450,6 +469,8 @@ def ensure_package_schema(db):
305+ # try block.
306+ cursor = db.cursor()
307+ try:
308++ cursor.execute("CREATE TABLE security"
309++ " (id INTEGER PRIMARY KEY)")
310+ cursor.execute("CREATE TABLE autoremovable"
311+ " (id INTEGER PRIMARY KEY)")
312+ cursor.execute("CREATE TABLE locked"
313+diff --git a/landscape/message_schemas/server_bound.py b/landscape/message_schemas/server_bound.py
314+index be06c8d6..a03d76c3 100644
315+--- a/landscape/message_schemas/server_bound.py
316++++ b/landscape/message_schemas/server_bound.py
317+@@ -367,13 +367,16 @@ PACKAGES = Message(
318+ "locked": package_ids_or_ranges,
319+ "autoremovable": package_ids_or_ranges,
320+ "not-autoremovable": package_ids_or_ranges,
321++ "security": package_ids_or_ranges,
322+ "not-installed": package_ids_or_ranges,
323+ "not-available": package_ids_or_ranges,
324+ "not-available-upgrades": package_ids_or_ranges,
325+- "not-locked": package_ids_or_ranges},
326++ "not-locked": package_ids_or_ranges,
327++ "not-security": package_ids_or_ranges},
328+ optional=["installed", "available", "available-upgrades", "locked",
329+ "not-available", "not-installed", "not-available-upgrades",
330+- "not-locked", "autoremovable", "not-autoremovable"])
331++ "not-locked", "autoremovable", "not-autoremovable", "security",
332++ "not-security"])
333+
334+ package_locks = List(Tuple(Unicode(), Unicode(), Unicode()))
335+ PACKAGE_LOCKS = Message(
336diff --git a/debian/patches/series b/debian/patches/series
337index ebfbf13..7dd8fac 100644
338--- a/debian/patches/series
339+++ b/debian/patches/series
340@@ -9,3 +9,6 @@ unicode-tags-script.patch
341 mem-usage-1685885.patch
342 product-name-vminfo-1828217.patch
343 stagger-launch-1788518.patch
344+apt-pulse-1758529.patch
345+security_pocket_1848828.patch
346+reporter_logging.patch

Subscribers

People subscribed via source and target branches