Merge ~chad.smith/ubuntu/+source/ubuntu-advantage-tools:release-27-impish into ubuntu/+source/ubuntu-advantage-tools:ubuntu/devel

Proposed by Chad Smith
Status: Merged
Merged at revision: 8730165fe58aa5a8ee58659e38b8b17626942911
Proposed branch: ~chad.smith/ubuntu/+source/ubuntu-advantage-tools:release-27-impish
Merge into: ubuntu/+source/ubuntu-advantage-tools:ubuntu/devel
Diff against target: 349 lines (+106/-76)
10 files modified
.gitignore (+5/-0)
Jenkinsfile (+4/-4)
apt-hook/Makefile (+21/-3)
apt-hook/json-hook-src/go.mod (+1/-1)
apt-hook/json-hook-src/json-hook.go (+23/-33)
apt-hook/json-hook-src/json-hook_test.go (+28/-28)
debian/changelog (+15/-0)
debian/control (+2/-2)
debian/rules (+1/-0)
uaclient/tests/test_util.py (+6/-5)
Reviewer Review Type Date Requested Status
Bryce Harrington Approve
Christian Ehrhardt  Needs Fixing
Canonical Server Team Pending
Review via email: mp+402459@code.launchpad.net

Description of the change

Bug fix release 27.0.2 to address package build issues on riscv64 focal++. Sync upstream commits (and retain rich git commit history) with the following:

git rebase --onto pkg/ubuntu/devel 27.0.1 27.0.2 # 27.0.1 and 27.0.2 are upstream annotated tags in the upstream/release-27 branch at https://github.com/canonical/ubuntu-advantage-client/tree/release-27

The desire with this `git rebase --onto` approach is to retain rich git history (making for easier comparison across repos with unrelate git histories (Ubuntu pkging repo versus project upstream). If there is a way to ensure the upload to Ubuntu retains the git commits, our future selves will be in better shape correlating pkg/ubuntu/* branches vs upstream branches.

In our recent SRU of ua-tools https://bugs.launchpad.net/ubuntu/+source/ubuntu-advantage-tools/+bug/1926361 Łukasz noted that we broke riscv64. The d/control and makefile changes herein avoid including our simple golang APT json hook on platforms where we don't have the appropriate go depenedencies available. This results in only a slight deteriment to APT hook messaging during 'apt upgrade' calls on architectures where we cannot build/ship the go apt-hook utility.

FWIW I have been able to reproduce golang build-dependency errors (powerpc Xenial and riscv64 Focal) prior to this commit set in my own local schroots setup with the following cmds:
sudo sbuild-launchpad-chroot create --architecture="powerpc" "--name=xenial-powerpc" --series=xenial

sbuild --resolve-alternatives --dist=focal --arch=riscv64 ../out/ubuntu-advantage-tools_27.0.dsc

sudo sbuild-launchpad-chroot create --architecture="riscv64" "--name=focal-riscv64" --series=focal

sbuild --resolve-alternatives --dist=focal --arch=riscv64 ../out/ubuntu-advantage-tools_27.0.dsc

The plan is to upload impish - H, F, B and X to ppa:ua-client/staging PPA which will build riscv64 and powerpc where applicable which should make for easier integration testing which we will perform as part of upload and SRU verification.

To post a comment you must log in.
Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

P.S. I've fixed/added review slots to make this MP correct

Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

This one more or less matches the Hirsute MP and thereby can be considered "process cleanups should be considered, but if urgent can be considered approved" just like:
https://code.launchpad.net/~chad.smith/ubuntu/+source/ubuntu-advantage-tools/+git/ubuntu-advantage-tools/+merge/402465/comments/1060979

review: Approve
Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

Ah no wait, this also was affected by branching off the wrong commit, this has to be fixed before any upload (but after a rebase it would be ok'ish).

review: Needs Fixing
Revision history for this message
Chad Smith (chad.smith) wrote :

Thanks Christian for the reviews. I've properly re-recreated this impish branch and will base all other releases X, B, F, G and H off of this PR to simplify the proposals for other branches.

Revision history for this message
Chad Smith (chad.smith) wrote :
Revision history for this message
Chad Smith (chad.smith) wrote :
Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

This is now properly based on pkg/ubuntu/impish-devel == import/27.0.1 - thanks!
I've already confirmed that the other branches all are now properly based on this.

Since thereby this branch is the base of all the others I'm re-reviewing the individual changes to be extra sure ...

old: upload/27.0.1..bd4f0d51
new: import/27.0.1..chad.smith/release-27-impish

Range diff confirms that the new code matches the old (already reviewed) code exactly except the update to the changelog.

 1: 1d9365af = 1: 00c61952 sync ubuntu pkg branch changelog
 2: 4572a943 = 2: 24b8bfbf apt-hook: run new json hook tests on package build
 3: 6d42915e = 3: 55f4c80f apt-hook: ignore build artifacts in git
 4: b32b4760 = 4: 05e2ad87 apt-hook: refactor json hook messaging to be dry
 5: 4053b400 = 5: 3451bb6c apt-hook: ignore go hook on some architectures
 6: d32eef4b = 6: 10fd37ea build: order build-depends alternatives newer first
 7: f30579b2 = 7: 2880c9d2 tests: fix subp ls error case
 8: 3bfe06c8 ! 8: 28d0e330 changelog 27.0.1 & 27.0.2
 9: bd4f0d51 ! 9: 32bcbd07 jenkinsfile: trusty sbuild --resolve-depends for CI runs
 -: -------- > 10: 6669606a changelog: add bugs for riscv64 and powerpc builds

28d0e330 changelog 27.0.1 & 27.0.2
  This now needlessly modifies the stanza of 27.0.1
  - removes "apt-hook: mitigate failures with true" (which isn't true, that happened and is in
    27.0.1); This shows this is present
    $ git show import/27.0.1:apt-hook/20apt-esm-hook.conf
  - Bumps the date Wed, 28 Apr 2021 -> Fri, 07 May 2021 (which isn't true either)

=> Please remove that hunk modifying 27.0.1, the actual new changelog of 27.0.2 on top is fine.

32bcbd07 jenkinsfile: trusty sbuild --resolve-depends for CI runs
6669606a changelog: add bugs for riscv64 and powerpc builds

These two are ok, the old bd4f0d51 was combining changelog+functional change and it is now properly split into 32bcbd07+6669606a

So you are a minimal changes away from having all in place to be sponsorable.

P.S. Please remember to rebase all the other MPs for H/G/F/B/X onto the new impish branch as well then

review: Needs Fixing
Revision history for this message
Chad Smith (chad.smith) wrote :

Christian, good sentiments on the changelog diffs.
1. Corrected 28d0e330 changelog 27.0.1 & 27.0.2.

rebased and squashed in impish to this commit which drops the other chunk.

commit 9be476720ff7383583832570f828e743a32f8340
Author: Chad Smith <email address hidden>
Date: Fri May 7 12:44:50 2021 -0600

    changelog 27.0.1 & 27.0.2

diff --git a/debian/changelog b/debian/changelog
index a17be1b8..aaf2d005 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,16 @@
+ubuntu-advantage-tools (27.0.2) impish; urgency=medium
+
+ * d/control:
+ - order build-depends alternatives newer first (LP: #1926949)
+ - apt-hook: do not attempt to package go APT JSON hook on some
+ architectures (GH: #1603)
+ * Bug-fix release 27.0.2: autopkg build failures on riscv64 and powerpc
+ - apt-hook: refactor json hook messaging to be dry
+ - tests: fix subp ls error case for powerpc builds
+ - jenkinsfile: add --resolve-alternatives for trusty builds
+
+ -- Chad Smith <email address hidden> Fri, 07 May 2021 11:58:03 -0600
+
 ubuntu-advantage-tools (27.0.1) impish; urgency=medium

   * Add .gitignore and cleanup ignored directory .pytest_cache

2. Performed git reset --hard chad.smith/release-27-impish on X, B, F, G and H and added a single commit for each diminished ~XX.YY.1 for each release.

Revision history for this message
Bryce Harrington (bryce) wrote :
Download full text (4.8 KiB)

1. All the builds are getting this lintian error:
    E: ubuntu-advantage-tools source: build-depends-on-essential-package-without-using-version build-depends: debianutils

That is more of a warning in the sense that generally essential packages like debianutils will always be present on the system so don't need to be specifically listed. The one situation where you might list it is if a particular version requirement exists. So, if this was added deliberately you may want to set the required version.

Otherwise I suspect this is innocuous and will ignore.

2. In the changelog, couple minor typos:
  * ammend -> amend
  * ommitted -> omitted

    W: ubuntu-advantage-pro: spelling-error-in-changelog ammend amend
    W: ubuntu-advantage-pro: spelling-error-in-changelog ommitted omitted
    W: ubuntu-advantage-tools: spelling-error-in-changelog ammend amend
    W: ubuntu-advantage-tools: spelling-error-in-changelog ommitted omitted

3. On xenial, we're getting this lintian error:

   E: ubuntu-advantage-tools source: invalid-arch-string-in-source-relation riscv64 [build-depends: golang-1.10-go [!powerpc !riscv64]]

   I'm guessing it just means that xenial's lintian just isn't aware of riscv64. Assuming that to be the case I think we can ignore this as a bug in lintian?

4. Package build shows these lintian warnings:

a. W: ubuntu-advantage-pro: systemd-service-file-refers-to-unusual-wantedby-target lib/systemd/system/ua-auto-attach.service cloud-config.service

I think that ones just an overly aggressive warning, and is appropriate to add a lintian override for.

b. W: ubuntu-advantage-tools: hardening-no-pie usr/lib/ubuntu-advantage/apt-esm-json-hook

No idea how pertinent this warning is, but the description is at https://lintian.debian.org/tags/hardening-no-pie

c. W: ubuntu-advantage-tools: hardening-no-relro usr/lib/ubuntu-advantage/apt-esm-json-hook

For this one it sounds like it just needs a tweak to the compiler flags - https://lintian.debian.org/tags/hardening-no-relro

5. impish (only) has a build failure testing python hooks:

python3 -m pytest
============================= test session starts ==============================
platform linux -- Python 3.9.4, pytest-6.0.2, py-1.10.0, pluggy-0.13.0
rootdir: /home/bryce/pkg/UbuntuAdvantageTools/review-27.0.2-impish/ubuntu-advantage-tools-gu-build, configfile: tox.ini
collected 1164 items / 1 error / 1163 selected

==================================== ERRORS ====================================
_________ ERROR collecting uaclient/tests/test_ua_update_messaging.py __________
ImportError while importing test module '/home/bryce/pkg/UbuntuAdvantageTools/review-27.0.2-impish/ubuntu-advantage-tools-gu-build/uaclient/tests/test_ua_update_messaging.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/lib/python3.9/importlib/__init__.py:127: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
uaclient/tests/test_ua_update_messaging.py:25: in <module>
    from lib.ua_update_messaging import (
E ModuleNotFoundError: No module named 'lib.ua_update_messaging'

I again was able to work around this by touch lib/__init__.py and...

Read more...

review: Needs Fixing
Revision history for this message
Bryce Harrington (bryce) wrote :

Grant identified the xenial issue is resolved by removing golang-go.
Since that was the only issue I considered a true blocker, I am proceeding with uploads.

review: Approve
Revision history for this message
Bryce Harrington (bryce) wrote :

triage-impish+21.10:~/pkg/UbuntuAdvantageTools/review-27.0.2-impish$ dput ubuntu ubuntu-advantage-tools_27.0.2_source.changes
D: Setting host argument.
Checking signature on .changes
gpg: /home/bryce/pkg/UbuntuAdvantageTools/review-27.0.2-impish/ubuntu-advantage-tools_27.0.2_source.changes: Valid signature from E603B2578FB8F0FB
Checking signature on .dsc
gpg: /home/bryce/pkg/UbuntuAdvantageTools/review-27.0.2-impish/ubuntu-advantage-tools_27.0.2.dsc: Valid signature from E603B2578FB8F0FB
Uploading to ubuntu (via ftp to upload.ubuntu.com):
  Uploading ubuntu-advantage-tools_27.0.2.dsc: done.
  Uploading ubuntu-advantage-tools_27.0.2.tar.xz: done.
  Uploading ubuntu-advantage-tools_27.0.2_source.buildinfo: done.
  Uploading ubuntu-advantage-tools_27.0.2_source.changes: done.
Successfully uploaded packages.
triage-impish+21.10:~/pkg/UbuntuAdvantageTools/review-27.0.2-impish/ubuntu-advantage-tools-gu$ git ubuntu tag --upload
triage-impish+21.10:~/pkg/UbuntuAdvantageTools/review-27.0.2-impish/ubuntu-advantage-tools-gu$ git push pkg upload/27.0.2
Enumerating objects: 62, done.
Counting objects: 100% (62/62), done.
Delta compression using up to 12 threads
Compressing objects: 100% (21/21), done.
Writing objects: 100% (46/46), 6.26 KiB | 6.26 MiB/s, done.
Total 46 (delta 33), reused 36 (delta 24), pack-reused 0
To ssh://git.launchpad.net/ubuntu/+source/ubuntu-advantage-tools
 * [new tag] upload/27.0.2 -> upload/27.0.2

Revision history for this message
Chad Smith (chad.smith) wrote :

Thank you @bryce for the review:
I've already put up a PR for lintian fixes for 2. and 4. for your comment here https://code.launchpad.net/~chad.smith/ubuntu/+source/ubuntu-advantage-tools/+git/ubuntu-advantage-tools/+merge/402459/comments/1061309

This PR should land for inclusion in next release 27.1 which should be scheduled in about a week.

https://github.com/canonical/ubuntu-advantage-client/pull/1628

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/.gitignore b/.gitignore
2index 2b2da67..fee8771 100644
3--- a/.gitignore
4+++ b/.gitignore
5@@ -22,3 +22,8 @@ ubuntu_advantage_tools.dsc
6 # test/jenkins artifacts
7 pytest_results.xml
8 reports/
9+
10+# apt-hook build artifacts
11+apt-hook/hook
12+apt-hook/ubuntu-advantage.pot
13+apt-hook/json-hook-src/json-hook
14diff --git a/Jenkinsfile b/Jenkinsfile
15index 2082e19..0170f6d 100644
16--- a/Jenkinsfile
17+++ b/Jenkinsfile
18@@ -87,7 +87,7 @@ pipeline {
19 cp debian/changelog ${WORKSPACE}/debian/changelog-${SERIES_VERSION}
20 sed -i "s/${PKG_VERSION}/${NEW_PKG_VERSION}/" ${WORKSPACE}/debian/changelog-${SERIES_VERSION}
21 dpkg-source -l${WORKSPACE}/debian/changelog-${SERIES_VERSION} -b .
22- sbuild --nolog --verbose --dist=${BUILD_SERIES} --no-run-lintian --append-to-version=~${SERIES_VERSION} ../ubuntu-advantage-tools*${NEW_PKG_VERSION}*dsc
23+ sbuild --resolve-alternatives --nolog --verbose --dist=${BUILD_SERIES} --no-run-lintian --append-to-version=~${SERIES_VERSION} ../ubuntu-advantage-tools*${NEW_PKG_VERSION}*dsc
24 cp ./ubuntu-advantage-tools*${SERIES_VERSION}*.deb ${ARTIFACT_DIR}/ubuntu-advantage-tools-${BUILD_SERIES}.deb
25 cp ./ubuntu-advantage-pro*${SERIES_VERSION}*.deb ${ARTIFACT_DIR}/ubuntu-advantage-pro-${BUILD_SERIES}.deb
26 '''
27@@ -108,7 +108,7 @@ pipeline {
28 cp debian/changelog ${WORKSPACE}/debian/changelog-${SERIES_VERSION}
29 sed -i "s/${PKG_VERSION}/${NEW_PKG_VERSION}/" ${WORKSPACE}/debian/changelog-${SERIES_VERSION}
30 dpkg-source -l${WORKSPACE}/debian/changelog-${SERIES_VERSION} -b .
31- sbuild --nolog --verbose --dist=${BUILD_SERIES} --no-run-lintian --append-to-version=~${SERIES_VERSION} ../ubuntu-advantage-tools*${NEW_PKG_VERSION}*dsc
32+ sbuild --resolve-alternatives --nolog --verbose --dist=${BUILD_SERIES} --no-run-lintian --append-to-version=~${SERIES_VERSION} ../ubuntu-advantage-tools*${NEW_PKG_VERSION}*dsc
33 cp ./ubuntu-advantage-tools*${SERIES_VERSION}*.deb ${ARTIFACT_DIR}/ubuntu-advantage-tools-${BUILD_SERIES}.deb
34 cp ./ubuntu-advantage-pro*${SERIES_VERSION}*.deb ${ARTIFACT_DIR}/ubuntu-advantage-pro-${BUILD_SERIES}.deb
35 '''
36@@ -129,7 +129,7 @@ pipeline {
37 cp debian/changelog ${WORKSPACE}/debian/changelog-${SERIES_VERSION}
38 sed -i "s/${PKG_VERSION}/${NEW_PKG_VERSION}/" ${WORKSPACE}/debian/changelog-${SERIES_VERSION}
39 dpkg-source -l${WORKSPACE}/debian/changelog-${SERIES_VERSION} -b .
40- sbuild --nolog --verbose --dist=${BUILD_SERIES} --no-run-lintian --append-to-version=~${SERIES_VERSION} ../ubuntu-advantage-tools*${NEW_PKG_VERSION}*dsc
41+ sbuild --resolve-alternatives --nolog --verbose --dist=${BUILD_SERIES} --no-run-lintian --append-to-version=~${SERIES_VERSION} ../ubuntu-advantage-tools*${NEW_PKG_VERSION}*dsc
42 cp ./ubuntu-advantage-tools*${SERIES_VERSION}*.deb ${ARTIFACT_DIR}/ubuntu-advantage-tools-${BUILD_SERIES}.deb
43 cp ./ubuntu-advantage-pro*${SERIES_VERSION}*.deb ${ARTIFACT_DIR}/ubuntu-advantage-pro-${BUILD_SERIES}.deb
44 '''
45@@ -150,7 +150,7 @@ pipeline {
46 cp debian/changelog ${WORKSPACE}/debian/changelog-${SERIES_VERSION}
47 sed -i "s/${PKG_VERSION}/${NEW_PKG_VERSION}/" ${WORKSPACE}/debian/changelog-${SERIES_VERSION}
48 dpkg-source -l${WORKSPACE}/debian/changelog-${SERIES_VERSION} -b .
49- sbuild --nolog --verbose --dist=${BUILD_SERIES} --no-run-lintian --append-to-version=~${SERIES_VERSION} ../ubuntu-advantage-tools*${NEW_PKG_VERSION}*dsc
50+ sbuild --resolve-alternatives --nolog --verbose --dist=${BUILD_SERIES} --no-run-lintian --append-to-version=~${SERIES_VERSION} ../ubuntu-advantage-tools*${NEW_PKG_VERSION}*dsc
51 cp ./ubuntu-advantage-tools*${SERIES_VERSION}*.deb ${ARTIFACT_DIR}/ubuntu-advantage-tools-${BUILD_SERIES}.deb
52 cp ./ubuntu-advantage-pro*${SERIES_VERSION}*.deb ${ARTIFACT_DIR}/ubuntu-advantage-pro-${BUILD_SERIES}.deb
53 '''
54diff --git a/apt-hook/Makefile b/apt-hook/Makefile
55index 15c4856..fd39cfd 100644
56--- a/apt-hook/Makefile
57+++ b/apt-hook/Makefile
58@@ -1,3 +1,21 @@
59+# the go hook steps will be skipped if this is a nonempty string
60+SKIP_GO_HOOK = ""
61+
62+GO_BIN = $(shell which go)
63+# Try go-1.14 and go-1.10 if not in path
64+ifeq ($(GO_BIN),)
65+ ifneq ($(wildcard /usr/lib/go-1.14/bin/go),)
66+ GO_BIN = /usr/lib/go-1.14/bin/go
67+ else ifneq ($(wildcard /usr/lib/go-1.10/bin/go),)
68+ GO_BIN = /usr/lib/go-1.10/bin/go
69+ endif
70+endif
71+
72+# If still not found then just don't build the go hook
73+ifeq ($(GO_BIN),)
74+ SKIP_GO_HOOK = "1"
75+endif
76+
77 all: build
78
79 build: hook ubuntu-advantage.pot json-hook
80@@ -9,15 +27,15 @@ hook: hook.cc
81 $(CXX) -Wall -Wextra -pedantic -std=c++11 $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) -g -o hook hook.cc -lapt-pkg $(LDLIBS)
82
83 json-hook:
84- cd json-hook-src && GOCACHE=/tmp/ go build json-hook.go
85+ [ $(SKIP_GO_HOOK) ] || (cd json-hook-src && GOCACHE=/tmp/ $(GO_BIN) build json-hook.go)
86
87 install: hook json-hook
88 install -D -m 644 20apt-esm-hook.conf $(DESTDIR)/etc/apt/apt.conf.d/20apt-esm-hook.conf
89 install -D -m 755 hook $(DESTDIR)/usr/lib/ubuntu-advantage/apt-esm-hook
90- install -D -m 755 json-hook-src/json-hook $(DESTDIR)/usr/lib/ubuntu-advantage/apt-esm-json-hook
91+ [ $(SKIP_GO_HOOK) ] || install -D -m 755 json-hook-src/json-hook $(DESTDIR)/usr/lib/ubuntu-advantage/apt-esm-json-hook
92
93 clean:
94 rm -f hook ubuntu-advantage.pot json-hook-src/json-hook
95
96 test:
97- cd json-hook-src && go test
98+ [ $(SKIP_GO_HOOK) ] || (cd json-hook-src && GOCACHE=/tmp/ $(GO_BIN) test)
99diff --git a/apt-hook/json-hook-src/go.mod b/apt-hook/json-hook-src/go.mod
100index 66726af..5fac8c8 100644
101--- a/apt-hook/json-hook-src/go.mod
102+++ b/apt-hook/json-hook-src/go.mod
103@@ -1,3 +1,3 @@
104 module json-hook
105
106-go 1.2
107+go 1.7
108diff --git a/apt-hook/json-hook-src/json-hook.go b/apt-hook/json-hook-src/json-hook.go
109index 0f2e3eb..a24e6f2 100644
110--- a/apt-hook/json-hook-src/json-hook.go
111+++ b/apt-hook/json-hook-src/json-hook.go
112@@ -45,6 +45,18 @@ type jsonRPC struct {
113 } `json:"params"`
114 }
115
116+func updatesFromSource(count int, source string, first bool) string {
117+ security := ""
118+ if first {
119+ security = "security "
120+ }
121+ updates := "updates"
122+ if count == 1 {
123+ updates = "update"
124+ }
125+ return fmt.Sprintf("%d %s %s%s", count, source, security, updates)
126+}
127+
128 func createUpdateMessage(standardSecurityCount int, esmInfraCount int, esmAppsCount int) string {
129 displayStandard := true
130 displayEsmInfra := true
131@@ -72,52 +84,30 @@ func createUpdateMessage(standardSecurityCount int, esmInfraCount int, esmAppsCo
132 }
133
134 standardUpdates := ""
135+ afterStandard := ""
136 esmInfraUpdates := ""
137+ afterInfra := ""
138 esmAppsUpdates := ""
139+
140 if displayStandard {
141- standardUpdates = fmt.Sprintf("%d standard security ", standardSecurityCount)
142- if standardSecurityCount > 1 {
143- standardUpdates += "updates"
144- } else {
145- standardUpdates += "update"
146- }
147+ standardUpdates = updatesFromSource(standardSecurityCount, "standard", true)
148 if displayEsmInfra && displayEsmApps {
149- standardUpdates += ","
150- }
151- if displayEsmInfra || displayEsmApps {
152- standardUpdates += " "
153- }
154- if (displayEsmInfra && !displayEsmApps) || (!displayEsmInfra && displayEsmApps) {
155- standardUpdates += "and "
156+ afterStandard = ", "
157+ } else if displayEsmInfra || displayEsmApps {
158+ afterStandard = " and "
159 }
160 }
161 if displayEsmInfra {
162- esmInfraUpdates = fmt.Sprintf("%d esm-infra ", esmInfraCount)
163- if esmInfraFirst {
164- esmInfraUpdates += "security "
165- }
166- if esmInfraCount > 1 {
167- esmInfraUpdates += "updates"
168- } else {
169- esmInfraUpdates += "update"
170- }
171+ esmInfraUpdates = updatesFromSource(esmInfraCount, "esm-infra", esmInfraFirst)
172 if displayEsmApps {
173- esmInfraUpdates += " and "
174+ afterInfra = " and "
175 }
176 }
177 if displayEsmApps {
178- esmAppsUpdates = fmt.Sprintf("%d esm-apps ", esmAppsCount)
179- if esmAppsFirst {
180- esmAppsUpdates += "security "
181- }
182- if esmAppsCount > 1 {
183- esmAppsUpdates += "updates"
184- } else {
185- esmAppsUpdates += "update"
186- }
187+ esmAppsUpdates = updatesFromSource(esmAppsCount, "esm-apps", esmAppsFirst)
188 }
189
190- return standardUpdates + esmInfraUpdates + esmAppsUpdates
191+ return standardUpdates + afterStandard + esmInfraUpdates + afterInfra + esmAppsUpdates
192 }
193
194 func fromOriginAndArchive(pkgVersion jsonRPCPackageVersion, origin string, archive string) bool {
195diff --git a/apt-hook/json-hook-src/json-hook_test.go b/apt-hook/json-hook-src/json-hook_test.go
196index cfc1788..0a2a2eb 100644
197--- a/apt-hook/json-hook-src/json-hook_test.go
198+++ b/apt-hook/json-hook-src/json-hook_test.go
199@@ -14,33 +14,33 @@ func TestCreateUpdateMessages(t *testing.T) {
200 expectedMessage string
201 }
202 testParamsList := []params{
203- params{0, 0, 0, ""},
204- params{0, 0, 1, "1 esm-apps security update"},
205- params{0, 0, 2, "2 esm-apps security updates"},
206- params{0, 1, 0, "1 esm-infra security update"},
207- params{0, 1, 1, "1 esm-infra security update and 1 esm-apps update"},
208- params{0, 1, 2, "1 esm-infra security update and 2 esm-apps updates"},
209- params{0, 2, 0, "2 esm-infra security updates"},
210- params{0, 2, 1, "2 esm-infra security updates and 1 esm-apps update"},
211- params{0, 2, 2, "2 esm-infra security updates and 2 esm-apps updates"},
212- params{1, 0, 0, "1 standard security update"},
213- params{1, 0, 1, "1 standard security update and 1 esm-apps update"},
214- params{1, 0, 2, "1 standard security update and 2 esm-apps updates"},
215- params{1, 1, 0, "1 standard security update and 1 esm-infra update"},
216- params{1, 1, 1, "1 standard security update, 1 esm-infra update and 1 esm-apps update"},
217- params{1, 1, 2, "1 standard security update, 1 esm-infra update and 2 esm-apps updates"},
218- params{1, 2, 0, "1 standard security update and 2 esm-infra updates"},
219- params{1, 2, 1, "1 standard security update, 2 esm-infra updates and 1 esm-apps update"},
220- params{1, 2, 2, "1 standard security update, 2 esm-infra updates and 2 esm-apps updates"},
221- params{2, 0, 0, "2 standard security updates"},
222- params{2, 0, 1, "2 standard security updates and 1 esm-apps update"},
223- params{2, 0, 2, "2 standard security updates and 2 esm-apps updates"},
224- params{2, 1, 0, "2 standard security updates and 1 esm-infra update"},
225- params{2, 1, 1, "2 standard security updates, 1 esm-infra update and 1 esm-apps update"},
226- params{2, 1, 2, "2 standard security updates, 1 esm-infra update and 2 esm-apps updates"},
227- params{2, 2, 0, "2 standard security updates and 2 esm-infra updates"},
228- params{2, 2, 1, "2 standard security updates, 2 esm-infra updates and 1 esm-apps update"},
229- params{2, 2, 2, "2 standard security updates, 2 esm-infra updates and 2 esm-apps updates"},
230+ {0, 0, 0, ""},
231+ {0, 0, 1, "1 esm-apps security update"},
232+ {0, 0, 2, "2 esm-apps security updates"},
233+ {0, 1, 0, "1 esm-infra security update"},
234+ {0, 1, 1, "1 esm-infra security update and 1 esm-apps update"},
235+ {0, 1, 2, "1 esm-infra security update and 2 esm-apps updates"},
236+ {0, 2, 0, "2 esm-infra security updates"},
237+ {0, 2, 1, "2 esm-infra security updates and 1 esm-apps update"},
238+ {0, 2, 2, "2 esm-infra security updates and 2 esm-apps updates"},
239+ {1, 0, 0, "1 standard security update"},
240+ {1, 0, 1, "1 standard security update and 1 esm-apps update"},
241+ {1, 0, 2, "1 standard security update and 2 esm-apps updates"},
242+ {1, 1, 0, "1 standard security update and 1 esm-infra update"},
243+ {1, 1, 1, "1 standard security update, 1 esm-infra update and 1 esm-apps update"},
244+ {1, 1, 2, "1 standard security update, 1 esm-infra update and 2 esm-apps updates"},
245+ {1, 2, 0, "1 standard security update and 2 esm-infra updates"},
246+ {1, 2, 1, "1 standard security update, 2 esm-infra updates and 1 esm-apps update"},
247+ {1, 2, 2, "1 standard security update, 2 esm-infra updates and 2 esm-apps updates"},
248+ {2, 0, 0, "2 standard security updates"},
249+ {2, 0, 1, "2 standard security updates and 1 esm-apps update"},
250+ {2, 0, 2, "2 standard security updates and 2 esm-apps updates"},
251+ {2, 1, 0, "2 standard security updates and 1 esm-infra update"},
252+ {2, 1, 1, "2 standard security updates, 1 esm-infra update and 1 esm-apps update"},
253+ {2, 1, 2, "2 standard security updates, 1 esm-infra update and 2 esm-apps updates"},
254+ {2, 2, 0, "2 standard security updates and 2 esm-infra updates"},
255+ {2, 2, 1, "2 standard security updates, 2 esm-infra updates and 1 esm-apps update"},
256+ {2, 2, 2, "2 standard security updates, 2 esm-infra updates and 2 esm-apps updates"},
257 }
258
259 for i, testParams := range testParamsList {
260@@ -62,7 +62,7 @@ func TestCountSecurityUpdates(t *testing.T) {
261 expectedEsmAppsCount int
262 }
263 testParamsList := []params{
264- params{mockJson, 1, 2, 3},
265+ {mockJson, 1, 2, 3},
266 }
267
268 for i, testParams := range testParamsList {
269diff --git a/debian/changelog b/debian/changelog
270index 9c6e17f..43b8ea1 100644
271--- a/debian/changelog
272+++ b/debian/changelog
273@@ -1,3 +1,17 @@
274+ubuntu-advantage-tools (27.0.2) impish; urgency=medium
275+
276+ * d/control:
277+ - order build-depends alternatives newer first (LP: #1926949)
278+ - apt-hook: do not attempt to package go APT JSON hook on some
279+ architectures (GH: #1603) (LP: #1927886, LP: #1927795)
280+ * Bug-fix release 27.0.2: build failures on riscv64 and powerpc
281+ - apt-hook: refactor json hook messaging to be dry
282+ - tests: fix subp ls error case for powerpc builds
283+ - jenkinsfile: add --resolve-alternatives for trusty builds
284+ - ammend changelog: add ommitted apt-hook message for 27.0.1 stanza
285+
286+ -- Chad Smith <chad.smith@canonical.com> Fri, 07 May 2021 11:58:03 -0600
287+
288 ubuntu-advantage-tools (27.0.1) impish; urgency=medium
289
290 * Add .gitignore and cleanup ignored directory .pytest_cache
291@@ -8,6 +22,7 @@ ubuntu-advantage-tools (27.0.1) impish; urgency=medium
292 ubuntu-advantage-tools (27.0) impish; urgency=medium
293
294 * New upstream release 27.0:
295+ - apt-hook: mitigate failures with true
296 - messages: add optional (s) to apt messaging to include
297 singular/plural pkgs
298 - apt-hook: avoid reporting and counting duplicate package
299diff --git a/debian/control b/debian/control
300index cd28a1f..c54f09f 100644
301--- a/debian/control
302+++ b/debian/control
303@@ -6,10 +6,10 @@ Build-Depends: bash-completion,
304 debhelper (>=9),
305 debianutils,
306 dh-python,
307- dh-systemd | debhelper (>= 13.3),
308+ debhelper (>= 13.3) | dh-systemd,
309 gettext,
310 git,
311- golang,
312+ golang-go (>= 2:1.14~) [!powerpc] | golang-1.14-go [!powerpc] | golang-1.10-go [!powerpc !riscv64],
313 libapt-pkg-dev,
314 po-debconf,
315 python3 (>= 3.4),
316diff --git a/debian/rules b/debian/rules
317index 9bea522..57898f9 100755
318--- a/debian/rules
319+++ b/debian/rules
320@@ -27,6 +27,7 @@ override_dh_auto_build:
321
322 override_dh_auto_test:
323 ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
324+ make -C apt-hook test
325 python3 -m pytest
326 ifdef FLAKE8
327 # required for Trusty: flake8 does not install a __main__ for -m
328diff --git a/uaclient/tests/test_util.py b/uaclient/tests/test_util.py
329index 019faf2..d19adab 100644
330--- a/uaclient/tests/test_util.py
331+++ b/uaclient/tests/test_util.py
332@@ -291,11 +291,12 @@ class TestSubp:
333 with pytest.raises(util.ProcessExecutionError) as excinfo:
334 util.subp(["ls", "--bogus"])
335
336- expected_error = (
337- "Failed running command 'ls --bogus' [exit(2)]."
338- " Message: ls: unrecognized option"
339- )
340- assert expected_error in str(excinfo.value)
341+ expected_errors = [
342+ "Failed running command 'ls --bogus' [exit(2)].",
343+ "ls: unrecognized option '--bogus'",
344+ ]
345+ for msg in expected_errors:
346+ assert msg in str(excinfo.value)
347 assert 0 == m_sleep.call_count # no retries
348
349 @mock.patch("uaclient.util.time.sleep")

Subscribers

People subscribed via source and target branches

to status/vote changes: