Merge ~mwhudson/curtin:simplify-apt_update into curtin:master

Proposed by Michael Hudson-Doyle
Status: Merged
Approved by: Michael Hudson-Doyle
Approved revision: b3b81771a2b368c564bb7bd3735b159d1fdddae9
Merge reported by: Server Team CI bot
Merged at revision: not available
Proposed branch: ~mwhudson/curtin:simplify-apt_update
Merge into: curtin:master
Diff against target: 61 lines (+0/-25)
1 file modified
curtin/distro.py (+0/-25)
Reviewer Review Type Date Requested Status
Server Team CI bot continuous-integration Approve
Dan Bungert Approve
Review via email: mp+450288@code.launchpad.net

Commit message

distro: remove disabling of deb-src lines in apt_update

The current code has the side-effect of ignoring deb822 .sources files
which is a problem that could be fixed but really it's hard to see why
this code is still useful (we do not expect to deploy images with
deb-src enabled!) so just deleting it makes more sense.

To post a comment you must log in.
Revision history for this message
Dan Bungert (dbungert) :
Revision history for this message
Server Team CI bot (server-team-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Dan Bungert (dbungert) :
review: Approve
~mwhudson/curtin:simplify-apt_update updated
b3b8177... by Michael Hudson-Doyle

flakes

Revision history for this message
Server Team CI bot (server-team-bot) wrote :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/curtin/distro.py b/curtin/distro.py
2index 433004c..622a520 100644
3--- a/curtin/distro.py
4+++ b/curtin/distro.py
5@@ -3,8 +3,6 @@ import glob
6 from collections import namedtuple
7 import os
8 import re
9-import shutil
10-import tempfile
11 import textwrap
12 from typing import Optional, Sequence
13
14@@ -229,14 +227,7 @@ def apt_update(target=None, env=None, force=False, comment=None,
15
16 restore_perms = []
17
18- abs_tmpdir = tempfile.mkdtemp(dir=target_path(target, "/tmp"))
19 try:
20- abs_slist = abs_tmpdir + "/sources.list"
21- abs_slistd = abs_tmpdir + "/sources.list.d"
22- ch_tmpdir = "/tmp/" + os.path.basename(abs_tmpdir)
23- ch_slist = ch_tmpdir + "/sources.list"
24- ch_slistd = ch_tmpdir + "/sources.list.d"
25-
26 # this file gets executed on apt-get update sometimes. (LP: #1527710)
27 motd_update = target_path(
28 target, "/usr/lib/update-notifier/update-motd-updates-available")
29@@ -244,23 +235,9 @@ def apt_update(target=None, env=None, force=False, comment=None,
30 if pmode is not None:
31 restore_perms.append((motd_update, pmode),)
32
33- # create tmpdir/sources.list with all lines other than deb-src
34- # avoid apt complaining by using existing and empty dir for sourceparts
35- os.mkdir(abs_slistd)
36- with open(abs_slist, "w") as sfp:
37- for sfile in listfiles:
38- with open(sfile, "r") as fp:
39- contents = fp.read()
40- for line in contents.splitlines():
41- line = line.lstrip()
42- if not line.startswith("deb-src"):
43- sfp.write(line + "\n")
44-
45 update_cmd = [
46 'apt-get', '--quiet',
47 '--option=Acquire::Languages=none',
48- '--option=Dir::Etc::sourcelist=%s' % ch_slist,
49- '--option=Dir::Etc::sourceparts=%s' % ch_slistd,
50 'update']
51
52 # do not using 'run_apt_command' so we can use 'retries' to subp
53@@ -269,8 +246,6 @@ def apt_update(target=None, env=None, force=False, comment=None,
54 finally:
55 for fname, perms in restore_perms:
56 os.chmod(fname, perms)
57- if abs_tmpdir:
58- shutil.rmtree(abs_tmpdir)
59
60 with open(marker, "w") as fp:
61 fp.write(comment + "\n")

Subscribers

People subscribed via source and target branches