← Back to team overview

curtin-dev team mailing list archive

[Merge] ~ogayot/curtin:deb822-sources-noble into curtin:master

 

Olivier Gayot has proposed merging ~ogayot/curtin:deb822-sources-noble into curtin:master.

Commit message:
apt-config: enable deb822 sources from 24.04 onwards

This reverts commit a7640fdcac396f9f09044dc7ca7553043ce4231c and applies
further modifications to enable deb822 sources starting from 24.04 and
not 23.10.

LP: #2056308

Signed-off-by: Olivier Gayot <olivier.gayot@xxxxxxxxxxxxx>


Requested reviews:
  curtin developers (curtin-dev)
Related bugs:
  Bug #2056308 in curtin: "Subiquity ignores mirror address on 24.04"
  https://bugs.launchpad.net/curtin/+bug/2056308

For more details, see:
https://code.launchpad.net/~ogayot/curtin/+git/curtin/+merge/462033

On 24.04 installer images, the template sources are stored in the deb822 format in etc/apt/sources.list.d/ubuntu.sources. The legacy etc/apt/sources.list is basically empty (it only contains comments pointing users to the new location).

However, the support in apt-config for reading and write from/to etc/apt/sources.list.d/ubuntu.sources got disabled at the end of the mantic cycle when we decided deb822 sources by default was not happening.

Therefore, curtin apt-config was still trying to do variable substitutions in sources.list instead of using the new approach in ubuntu.sources.

deb822 support by default is live again for 24.04, so let's instruct curtin apt-config to do the right thing.
-- 
Your team curtin developers is requested to review the proposed merge of ~ogayot/curtin:deb822-sources-noble into curtin:master.
diff --git a/curtin/commands/apt_config.py b/curtin/commands/apt_config.py
index af02298..ce2cb75 100644
--- a/curtin/commands/apt_config.py
+++ b/curtin/commands/apt_config.py
@@ -75,15 +75,8 @@ def want_deb822(target=None):
     False otherwise.
 
     This is determined by the version of Ubuntu: deb822 is the default starting
-    with Ubuntu 23.10 (Mantic Minotaur).
+    with Ubuntu 24.04 (Noble Numbat).
     """
-
-    """
-    FIXME: The deb822-by-default goal was delayed in 23.10.
-    Re-enable/update this code (and the test case in
-    tests/unittests/test_apt_source.py) when we are ready for deb822 by
-    default.
-
     os_release = distro.os_release(target)
 
     if os_release.get('ID') != 'ubuntu':
@@ -97,10 +90,7 @@ def want_deb822(target=None):
     if len(version) != 2:
         return False
 
-    return version[0] > 23 or (version[0] >= 23 and version[1] >= 10)
-    """
-
-    return False
+    return version[0] >= 24
 
 
 class Deb822SourceFormatException(Exception):
diff --git a/doc/topics/apt_source.rst b/doc/topics/apt_source.rst
index 12baf9f..902c9c6 100644
--- a/doc/topics/apt_source.rst
+++ b/doc/topics/apt_source.rst
@@ -132,29 +132,28 @@ That would be specified as ::
 
 The file examples/apt-source.yaml holds various further examples that can be configured with this feature.
 
-..
-    deb822 sources on Ubuntu >= 23.10
-    ---------------------------------
+deb822 sources on Ubuntu >= 24.04
+---------------------------------
 
-    By default, Ubuntu 23.10 and newer use the
-    `deb822 format for apt sources <https://manpages.ubuntu.com/manpages/en/man5/sources.list.5.html>`_.
-    When processing the apt configuration for a target system that should use deb822 sources, curtin will migrate legacy one-line sources to deb822 on-the-fly.
-    The resulting configuration is functionally equivalent, but the sources on the target system will be formatted differently than provided in the configuration.
+By default, Ubuntu 24.04 and newer use the
+`deb822 format for apt sources <https://manpages.ubuntu.com/manpages/en/man5/sources.list.5.html>`_.
+When processing the apt configuration for a target system that should use deb822 sources, curtin will migrate legacy one-line sources to deb822 on-the-fly.
+The resulting configuration is functionally equivalent, but the sources on the target system will be formatted differently than provided in the configuration.
 
-    For example, a configuration snippet that looks like ::
+For example, a configuration snippet that looks like ::
 
-     apt:
-       sources:
-         proposed.list:
-           source: |
-             deb http://archive.ubuntu.com/ubuntu/ mantic-proposed main restricted universe multiverse
+ apt:
+   sources:
+     proposed.list:
+       source: |
+         deb http://archive.ubuntu.com/ubuntu/ noble-proposed main restricted universe multiverse
 
-    will result in a file on the target system called ``/etc/apt/sources.list.d/proposed.sources`` that looks like ::
+will result in a file on the target system called ``/etc/apt/sources.list.d/proposed.sources`` that looks like ::
 
-     Types: deb
-     URIs: http://archive.ubuntu.com/ubuntu/
-     Suites: mantic-proposed
-     Components: main restricted universe multiverse
+ Types: deb
+ URIs: http://archive.ubuntu.com/ubuntu/
+ Suites: noble-proposed
+ Components: main restricted universe multiverse
 
 Common snippets
 ~~~~~~~~~~~~~~~
diff --git a/tests/unittests/test_apt_source.py b/tests/unittests/test_apt_source.py
index 2065b86..2b07045 100644
--- a/tests/unittests/test_apt_source.py
+++ b/tests/unittests/test_apt_source.py
@@ -9,7 +9,7 @@ import re
 import socket
 
 
-from unittest import (mock, skip)
+from unittest import mock
 from unittest.mock import call
 
 from aptsources.sourceslist import SourceEntry
@@ -1269,7 +1269,6 @@ deb-src http://ubuntu.com//ubuntu xenial universe multiverse
         filepath = os.path.join(self.target, 'etc/apt/sources.list')
         write_file.assert_called_with(filepath, expect, mode=0o644)
 
-    @skip('Skipping until ready for migration to deb822 by default')
     @mock.patch('curtin.distro.os_release')
     def test_want_deb822(self, mock_os_release):
         testdata = [
@@ -1277,7 +1276,7 @@ deb-src http://ubuntu.com//ubuntu xenial universe multiverse
             ('ubuntu', '22.04', False),
             ('ubuntu', '22.10', False),
             ('ubuntu', '23.04', False),
-            ('ubuntu', '23.10', True),
+            ('ubuntu', '23.10', False),
             ('ubuntu', '24.04', True),
             ('ubuntu', '24.10', True),
             ('fedora', '38', False),

Follow ups