Merge ~nteodosio/software-properties:xenial-test-fix into software-properties:ubuntu/xenial

Proposed by Nathan Teodosio
Status: Merged
Approved by: Sebastien Bacher
Approved revision: 89dca972c5f9185ecf0353e7e10d06afdc4a4df0
Merged at revision: 89dca972c5f9185ecf0353e7e10d06afdc4a4df0
Proposed branch: ~nteodosio/software-properties:xenial-test-fix
Merge into: software-properties:ubuntu/xenial
Diff against target: 73 lines (+17/-1)
4 files modified
debian/changelog (+8/-0)
debian/control (+1/-1)
softwareproperties/SoftwareProperties.py (+4/-0)
tests/test_dbus.py (+4/-0)
Reviewer Review Type Date Requested Status
Sebastien Bacher Approve
Ubuntu Core Development Team Pending
Review via email: mp+461724@code.launchpad.net

Description of the change

In Xenial, autopkgtest fails on Dbus tests[2].

'python3 tests/test_dbus.py' with these changes locally succeeds.

However, we need to wait the release of distro-info .3 (LP:2029089) otherwise there is failure when setting up the autopkgtest[1]:

--->
227s The following packages have unmet dependencies:
227s python3-software-properties : Depends: python3-distro-info (>= 0.14ubuntu0.3) but it is not going to be installed
<---

[1] wget -O- https://autopkgtest.ubuntu.com/results/autopkgtest-xenial-nteodosio-ubuntu-pro/xenial/amd64/s/software-properties/20240304_153233_2ad5f@/log.gz|zless
[2] https://objectstorage.prodstack5.canonical.com/swift/v1/AUTH_0f9aae918d5b4744bf7b827671c86842/autopkgtest-xenial/xenial/amd64/s/software-properties/20240301_100314_9e242@/log.gz

To post a comment you must log in.
Revision history for this message
Nathan Teodosio (nteodosio) wrote :

I tested against distro-info from proposed and the exit code is 0[1], so this can be merged now.

[1] https://autopkgtest.ubuntu.com/results/autopkgtest-xenial-nteodosio-ubuntu-pro/xenial/amd64/s/software-properties/20240312_102806_20800@/result.tar

Revision history for this message
Nathan Teodosio (nteodosio) wrote :

As for why this failed now...

The last version in xenial-updates is https://launchpad.net/ubuntu/+source/software-properties/0.96.20.10. If one pulls that source package and inspects its source tree, he finds the tests/aptroot/etc/apt and tests/aptroot/etc/apt/apt.conf.d directories there:

--->
% tree tests
tests/
├── aptroot/
│   ├── etc/
│   │   ├── apt/
│   │   │   └── apt.conf.d/
│   │   └── popularity-contest.conf
<---

However, the Git repository[1] does not contain those directories. Using

  git log --all --stat -- tests/aptroot/etc/apt

I found a commit from Jun 2019 that removed tests/aptroot/etc/apt/apt.conf.d/.keep, so that explains as much.

[1] https://git.launchpad.net/software-properties/tree/tests/aptroot/etc?h=ubuntu/xenial

Revision history for this message
Sebastien Bacher (seb128) wrote :

Thanks, indeed the directory got missing from the recent update, which is confusing because debdiff isn't reflecting that change. Creating the directory if it's missing will make the code more robust

review: Approve

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 95f06af..5ea0a4c 100644
3--- a/debian/changelog
4+++ b/debian/changelog
5@@ -1,3 +1,11 @@
6+software-properties (0.96.20.13) xenial; urgency=medium
7+
8+ * Fix autopkgtest: Make sure directory exists before trying to create file
9+ in it.
10+ * d/control: Add python-pathlib.
11+
12+ -- Nathan Pratta Teodosio <nathan.teodosio@canonical.com> Tue, 12 Mar 2024 10:06:55 +0100
13+
14 software-properties (0.96.20.12) xenial; urgency=medium
15
16 * Fix invalid syntax for old Python and unused import (lp: #2029473).
17diff --git a/debian/control b/debian/control
18index f00e135..063f46a 100644
19--- a/debian/control
20+++ b/debian/control
21@@ -20,7 +20,7 @@ Package: python-software-properties
22 Section: python
23 Architecture: all
24 Depends: ${python:Depends}, ${misc:Depends}, python, python-apt (>=
25- 0.6.20ubuntu16), python-pycurl, lsb-release, iso-codes
26+ 0.6.20ubuntu16), python-pathlib, python-pycurl, lsb-release, iso-codes
27 Recommends: unattended-upgrades
28 Description: manage the repositories that you install software from
29 This software provides an abstraction of the used apt repositories.
30diff --git a/softwareproperties/SoftwareProperties.py b/softwareproperties/SoftwareProperties.py
31index 0caa598..9ae0800 100644
32--- a/softwareproperties/SoftwareProperties.py
33+++ b/softwareproperties/SoftwareProperties.py
34@@ -34,6 +34,7 @@ import shutil
35 import threading
36 import atexit
37 import tempfile
38+import pathlib
39 try:
40 from string import maketrans
41 except ImportError:
42@@ -620,6 +621,9 @@ class SoftwareProperties(object):
43 break
44 else:
45 print("No config found, creating one")
46+ dirname = os.path.dirname(f)
47+ if not os.path.exists(dirname):
48+ pathlib.Path(dirname).mkdir(parents=True)
49 open(conffiles[0], "w")
50
51 # ensure /etc/cron.daily/apt is executable
52diff --git a/tests/test_dbus.py b/tests/test_dbus.py
53index 1115e85..f38a8a3 100755
54--- a/tests/test_dbus.py
55+++ b/tests/test_dbus.py
56@@ -14,6 +14,7 @@ import subprocess
57 import sys
58 import time
59 import unittest
60+import pathlib
61
62 sys.path.insert(0, "../")
63 from softwareproperties.dbus.SoftwarePropertiesDBus import (
64@@ -45,6 +46,9 @@ def create_sources_list():
65 s = get_test_source_line() + "\n"
66 name = os.path.join(os.path.dirname(__file__),
67 "aptroot", "etc", "apt", "sources.list")
68+ dirname = os.path.dirname(name)
69+ if not os.path.exists(dirname):
70+ pathlib.Path(dirname).mkdir(parents=True)
71 with open(name, "w") as f:
72 f.write(s)
73 return name

Subscribers

People subscribed via source and target branches