@@ -59,27 +59,18 @@ def append_line_to_file(path, line):
5959def install_x86_support_libraries ():
6060 """Install support libraries needed to build x86 on x86_64 hosts."""
6161 if utils .is_linux_os ():
62- packages = ('libglib2.0-dev:i386' , 'libsecret-1-dev:i386' )
62+ packages = ('gcc-multilib' , 'g++-multilib' , ' libglib2.0-dev:i386' , 'libsecret-1-dev:i386' )
6363
6464 # First check if these packages exist on the machine already
65- for package in packages :
66- devnull = open (os .devnull , "w" )
67- retval = subprocess .call (["dpkg" , "-s" , package ], stdout = devnull , stderr = subprocess .STDOUT )
68- devnull .close ()
69- # if package is not installed, dpkg returns a value other than 0 and in this case,
70- # we get out of this loop and install those packages.
71- if retval != 0 :
72- break
73- else :
74- # If the for loop iterated without breaking, all required packages are already installed.
75- # Nothing to do. Return from the function.
76- return
77-
78- utils .run_command (['apt' , 'install' , 'gcc-multilib' , 'g++-multilib' ], as_root = True )
79- utils .run_command (['dpkg' , '--add-architecture' , 'i386' ], as_root = True )
80- utils .run_command (['apt' , 'update' ], as_root = True )
81- for package in packages :
82- utils .run_command (['apt' , 'install' , package ], as_root = True )
65+ devnull = open (os .devnull , "w" )
66+ process = subprocess .run (["dpkg" , "-s" ] + packages , stdout = devnull , stderr = subprocess .STDOUT )
67+ devnull .close ()
68+ if process .returncode != 0 :
69+ # This implies not all of the required packages are already installed on user's machine
70+ # Install them.
71+ utils .run_command (['dpkg' , '--add-architecture' , 'i386' ], as_root = True )
72+ utils .run_command (['apt' , 'update' ], as_root = True )
73+ utils .run_command (['apt' , 'install' ] + packages , as_root = True )
8374
8475
8576def _install_cpp_dependencies_with_vcpkg (arch , msvc_runtime_library ):
0 commit comments