self.build_environ.set("SAT_VERBOSE", "1")
+ def list2cmdline(self, args): return ' '.join(map(
+ lambda a: a if a.lstrip().startswith('"') or '"' not in a else '"' + a + '"',
+ map(lambda a: subprocess.list2cmdline([a]), args)))
+
def do_batch_script_build(self, script, nb_proc):
if src.architecture.is_windows():
self.log_command(" " + _("Run build script %s\n") % script)
self.complete_environment(make_options)
- res = subprocess.call(script,
+ res = subprocess.call(self.list2cmdline([script]),
shell=True,
stdout=self.logger.logTxtFile,
stderr=subprocess.STDOUT,
cwd=str(self.build_dir),
env=self.build_environ.environ.environ)
+ print("==",res)
res_check=self.check_install()
if res_check > 0 :
if dist_name in ["CO","FD","MG","MD","CO","OS"]: # linux using rpm
linux="RH"
- manager_msg_err="Error : command failed because sat was not able to find apt command"
+ manager_msg_err="Error : command failed because sat was not able to find rpm command"
else:
linux="DB"
- manager_msg_err="Error : command failed because sat was not able to find rpm command"
+ manager_msg_err="Error : command failed because sat was not able to find apt command"
# 1- search for an installed package manager (rpm on rh, apt or dpkg-query on db)
cmd_which_rpm = ["which", "rpm"]
cmd_which_apt = ["which", "apt"]
cmd_which_dpkg = ["which", "dpkg-query"]
- with open(os.devnull, 'w') as devnull:
- # 1) we search for apt (debian based systems)
- completed=SP.call(cmd_which_dpkg,stdout=devnull, stderr=SP.STDOUT)
- if completed==0 and linux=="DB":
- cmd_is_package_installed = ["dpkg-query", "-l"]
- else:
- # 2) if dpkg not found search for apt
- completed = SP.call(cmd_which_apt, stdout=devnull, stderr=SP.STDOUT)
- if completed == 0 and linux == "DB":
- cmd_is_package_installed = ["apt", "list", "--installed"]
- else:
- # 3) if apt not found search for rpm (redhat)
- completed=SP.call(cmd_which_rpm,stdout=devnull, stderr=SP.STDOUT) # only 3.8! ,capture_output=True)
- if completed==0 and linux=="RH":
- cmd_is_package_installed=["rpm", "-q"]
- else:
- # no package manager was found corresponding to dist_name
- raise src.SatException(manager_msg_err)
+ cmd_which_pacman = ["which", "pacman"]
+ if src.architecture.is_msys2():
+ cmd_is_package_installed = ["pacman", "-Q"]
+ else:
+ with open(os.devnull, 'w') as devnull:
+ # 1) we search for apt (debian based systems)
+ completed=SP.call(cmd_which_dpkg,stdout=devnull, stderr=SP.STDOUT)
+ if completed==0 and linux=="DB":
+ cmd_is_package_installed = ["dpkg-query", "-l"]
+ else:
+ # 2) if dpkg not found search for apt
+ completed = SP.call(cmd_which_apt, stdout=devnull, stderr=SP.STDOUT)
+ if completed == 0 and linux == "DB":
+ cmd_is_package_installed = ["apt", "list", "--installed"]
+ else:
+ # 3) if apt not found search for rpm (redhat)
+ completed=SP.call(cmd_which_rpm,stdout=devnull, stderr=SP.STDOUT) # only 3.8! ,capture_output=True)
+ if completed==0 and linux=="RH":
+ cmd_is_package_installed=["rpm", "-q"]
+ else:
+ # no package manager was found corresponding to dist_name
+ raise src.SatException(manager_msg_err)
return cmd_is_package_installed
def check_system_pkg(check_cmd,pkg):