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

Subscribers

People subscribed via source and target branches