curtin-dev team mailing list archive
-
curtin-dev team
-
Mailing list archive
-
Message #03068
[Merge] ~mwhudson/curtin:simplify-apt_update into curtin:master
Michael Hudson-Doyle has proposed merging ~mwhudson/curtin:simplify-apt_update into curtin:master.
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.
Requested reviews:
curtin developers (curtin-dev)
For more details, see:
https://code.launchpad.net/~mwhudson/curtin/+git/curtin/+merge/450288
--
Your team curtin developers is requested to review the proposed merge of ~mwhudson/curtin:simplify-apt_update into curtin:master.
diff --git a/curtin/distro.py b/curtin/distro.py
index 433004c..0f7e45b 100644
--- a/curtin/distro.py
+++ b/curtin/distro.py
@@ -229,14 +229,7 @@ def apt_update(target=None, env=None, force=False, comment=None,
restore_perms = []
- abs_tmpdir = tempfile.mkdtemp(dir=target_path(target, "/tmp"))
try:
- abs_slist = abs_tmpdir + "/sources.list"
- abs_slistd = abs_tmpdir + "/sources.list.d"
- ch_tmpdir = "/tmp/" + os.path.basename(abs_tmpdir)
- ch_slist = ch_tmpdir + "/sources.list"
- ch_slistd = ch_tmpdir + "/sources.list.d"
-
# this file gets executed on apt-get update sometimes. (LP: #1527710)
motd_update = target_path(
target, "/usr/lib/update-notifier/update-motd-updates-available")
@@ -244,23 +237,9 @@ def apt_update(target=None, env=None, force=False, comment=None,
if pmode is not None:
restore_perms.append((motd_update, pmode),)
- # create tmpdir/sources.list with all lines other than deb-src
- # avoid apt complaining by using existing and empty dir for sourceparts
- os.mkdir(abs_slistd)
- with open(abs_slist, "w") as sfp:
- for sfile in listfiles:
- with open(sfile, "r") as fp:
- contents = fp.read()
- for line in contents.splitlines():
- line = line.lstrip()
- if not line.startswith("deb-src"):
- sfp.write(line + "\n")
-
update_cmd = [
'apt-get', '--quiet',
'--option=Acquire::Languages=none',
- '--option=Dir::Etc::sourcelist=%s' % ch_slist,
- '--option=Dir::Etc::sourceparts=%s' % ch_slistd,
'update']
# do not using 'run_apt_command' so we can use 'retries' to subp
@@ -269,8 +248,6 @@ def apt_update(target=None, env=None, force=False, comment=None,
finally:
for fname, perms in restore_perms:
os.chmod(fname, perms)
- if abs_tmpdir:
- shutil.rmtree(abs_tmpdir)
with open(marker, "w") as fp:
fp.write(comment + "\n")
Follow ups