do_build_image: make sure updates get installed
Improve run_apt_get so it actually install updates (instead of refreshing the repo metadata cache) Closes-Bug: #1489646 Change-Id: I23bcca940772cda954386661b12a630eff348df0
This commit is contained in:
parent
1e8f38bbb8
commit
082a47bf01
|
@ -59,6 +59,8 @@ class BuildUtilsTestCase(unittest2.TestCase):
|
|||
mock_exec_expected_calls = [
|
||||
mock.call('chroot', 'chroot', 'apt-get', '-y', 'update',
|
||||
attempts=2),
|
||||
mock.call('chroot', 'chroot', 'apt-get', '-y', 'dist-upgrade',
|
||||
attempts=2),
|
||||
mock.call('chroot', 'chroot', 'apt-get', '-y', 'install',
|
||||
'package1 package2', attempts=2)]
|
||||
self.assertEqual(mock_exec_expected_calls, mock_exec.call_args_list)
|
||||
|
@ -70,6 +72,8 @@ class BuildUtilsTestCase(unittest2.TestCase):
|
|||
mock_exec_expected_calls = [
|
||||
mock.call('chroot', 'chroot', 'apt-get', '-y', 'update',
|
||||
attempts=2),
|
||||
mock.call('chroot', 'chroot', 'apt-get', '-y', 'dist-upgrade',
|
||||
attempts=2),
|
||||
mock.call('chroot', 'chroot', 'eatmydata', 'apt-get', '-y',
|
||||
'install', 'package1 package2', attempts=2)]
|
||||
self.assertEqual(mock_exec_expected_calls, mock_exec.call_args_list)
|
||||
|
|
|
@ -76,10 +76,11 @@ def run_apt_get(chroot, packages, eatmydata=False, attempts=10):
|
|||
dpkg/apt-get tools. It's dangerous, but could decrease package install
|
||||
time in X times.
|
||||
"""
|
||||
cmds = ['chroot', chroot, 'apt-get', '-y', 'update']
|
||||
stdout, stderr = utils.execute(*cmds, attempts=attempts)
|
||||
LOG.debug('Running apt-get update completed.\nstdout: %s\nstderr: %s',
|
||||
stdout, stderr)
|
||||
for action in ('update', 'dist-upgrade'):
|
||||
cmds = ['chroot', chroot, 'apt-get', '-y', action]
|
||||
stdout, stderr = utils.execute(*cmds, attempts=attempts)
|
||||
LOG.debug('Running apt-get %s completed.\nstdout: %s\nstderr: %s',
|
||||
action, stdout, stderr)
|
||||
cmds = ['chroot', chroot, 'apt-get', '-y', 'install', ' '.join(packages)]
|
||||
if eatmydata:
|
||||
cmds.insert(2, 'eatmydata')
|
||||
|
|
Loading…
Reference in New Issue