← Back to team overview

curtin-dev team mailing list archive

[Merge] ~ogayot/curtin:deb822-no-suite-stanza into curtin:master

 

Olivier Gayot has proposed merging ~ogayot/curtin:deb822-no-suite-stanza into curtin:master.

Commit message:
apt_source: do not produce a deb822 source stanza with zero suite

When no suite is set for a given repository, we end up with a
deb822 styled source such as:

 Type: deb
 Suites:
 URIs: http://archive.ubuntu.com/ubuntu

This is invalid and apt/apt-get will raise the following error:

E: Malformed entry 2 in sources file /etc/apt/sources.list.d/ubuntu.sources (Suite)

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

Requested reviews:
  curtin developers (curtin-dev)

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

Prevent creation of invalid deb822 source when no suite is configured.
-- 
Your team curtin developers is requested to review the proposed merge of ~ogayot/curtin:deb822-no-suite-stanza into curtin:master.
diff --git a/curtin/commands/apt_config.py b/curtin/commands/apt_config.py
index f045163..d2a12d5 100644
--- a/curtin/commands/apt_config.py
+++ b/curtin/commands/apt_config.py
@@ -638,6 +638,11 @@ def _generate_sources_deb822(cfg, release, mirrors, target=None, arch=None):
         entry['Suites'] = list(set(entry['Suites']) - suites_to_disable)
         entry['Components'] = list(set(entry['Components']) - comps_to_disable)
 
+        if not entry['Suites']:
+            # It is invalid for a stanza to have zero suite configured. In
+            # practise, it can happen when -security is disabled.
+            continue
+
         stanzas.append(deb822_entry_to_str(entry))
 
     target_path = paths.target_path(target, sources_deb822)

Follow ups