@@ -933,12 +933,43 @@ def tue_install_gem_now(self, pkgs: List[str]) -> bool:
933933
934934 return True
935935
936- def tue_install_dpkg (self , pkg_file : str ) -> bool :
937- return True
938-
939936 def tue_install_dpkg_now (self , pkg_file : str ) -> bool :
937+ self .tue_install_debug (f"tue-install-dpkg-now { pkg_file = } " )
938+
939+ if not pkg_file :
940+ self .tue_install_error ("Invalid tue-install-dpkg-now call: got an empty package file as argument." )
941+ # ToDo: This depends on behaviour of tue-install-error
942+ return False
943+
944+ if not os .path .isabs (pkg_file ):
945+ pkg_file = os .path .join (self ._current_target_dir , pkg_file )
946+
947+ if not os .path .isfile (pkg_file ):
948+ self .tue_install_error (f"Invalid tue-install-dpkg-now call: { pkg_file } is not a file." )
949+ # ToDo: This depends on behaviour of tue-install-error
950+ return False
951+
952+ cmd = f"sudo dpkg -i { pkg_file } "
953+ sub = self ._default_background_popen (cmd )
954+ # ToDo: Should we check the return code?
955+ # if sub.returncode != 0:
956+ # self.tue_install_error(f"An error occurred while installing dpkg package({sub.returncode}):"
957+ # f"\n {repr(cmd)}")
958+ # # ToDo: This depends on behaviour of tue-install-error
959+ # return False
960+
961+ cmd = f"sudo apt-get install -f"
962+ sub = self ._default_background_popen (cmd )
963+ if sub .returncode != 0 :
964+ self .tue_install_error (f"An error occurred while fixing dpkg isntall({ sub .returncode } ):"
965+ f"\n { repr (cmd )} " )
966+ # ToDo: This depends on behaviour of tue-install-error
967+ return False
968+
940969 return True
941970
971+ tue_install_dpkg = tue_install_dpkg_now
972+
942973 def tue_install_ros (self , source_type : str , ** kwargs ) -> bool :
943974 return True
944975
0 commit comments