Best Python code snippet using autotest_python
kernelinstall.py
Source:kernelinstall.py
...24 kernel.install(install_vmlinux=False)25 if need_reboot:26 kernel.boot()27 else:28 kernel.add_to_bootloader()29 def _kernel_install_koji(self, koji_tag, package="kernel", dep_pkgs=None,30 need_reboot=True, sub_pkgs=None):31 sm = software_manager.SoftwareManager()32 for utility in ['/usr/bin/koji', '/usr/bin/brew']:33 if not os.access(utility, os.X_OK):34 logging.debug("%s missing - trying to install", utility)35 pkg = sm.provides(utility)36 if pkg is not None:37 sm.install(pkg)38 else:39 logging.error("No %s available on software sources" %40 utility)41 # First, download packages via koji/brew42 c = utils_koji.KojiClient()43 deps_rpms = ""44 if dep_pkgs:45 for p in dep_pkgs.split():46 logging.info('Fetching kernel dependencies: %s', p)47 k_dep = utils_koji.KojiPkgSpec(tag=koji_tag, package=p,48 subpackages=[p])49 c.get_pkgs(k_dep, self.bindir)50 deps_rpms += " "51 deps_rpms += os.path.join(self.bindir,52 c.get_pkg_rpm_file_names(k_dep)[0])53 if sub_pkgs:54 sub_pkgs = sub_pkgs.split()55 subpackages = [package] + sub_pkgs56 else:57 subpackages = [package]58 k = utils_koji.KojiPkgSpec(tag=koji_tag, package=package,59 subpackages=subpackages)60 c.get_pkgs(k, self.bindir)61 pkgs = c.get_pkg_rpm_file_names(k)62 for pkg in pkgs:63 for sub_pkg in sub_pkgs:64 if sub_pkg in pkg:65 deps_rpms += os.path.join(self.bindir, pkg)66 break67 else:68 kernel_rpm = os.path.join(self.bindir, pkg)69 # Then install kernel rpm packages.70 self._kernel_install_rpm(kernel_rpm, deps_rpms, need_reboot)71 def _kernel_install_src(self, base_tree, config, config_list=None,72 patch_list=None, need_reboot=True):73 if not utils.is_url(base_tree):74 base_tree = os.path.join(self.bindir, base_tree)75 if not utils.is_url(config):76 config = os.path.join(self.bindir, config)77 kernel = self.job.kernel(base_tree, self.outputdir)78 if patch_list:79 patches = []80 for p in patch_list:81 # Make sure all the patches are in local.82 if not utils.is_url(p):83 continue84 dst = os.path.join(self.bindir, os.path.basename(p))85 local_patch = utils.get_file(p, dst)86 patches.append(local_patch)87 kernel.patch(*patches)88 kernel.config(config, config_list)89 kernel.build()90 kernel.install()91 if need_reboot:92 kernel.boot()93 else:94 kernel.add_to_bootloader()95 def _kernel_install_git(self, repo, config, repo_base=None,96 branch="master", commit=None, config_list=None,97 patch_list=None, need_reboot=True):98 repodir = os.path.join("/tmp", 'kernel_src')99 repodir = git.get_repo(uri=repo, branch=branch,100 destination_dir=repodir,101 commit=commit, base_uri=repo_base)102 self._kernel_install_src(repodir, config, config_list, patch_list,103 need_reboot)104 def execute(self, install_type="koji", params=None):105 need_reboot = params.get("need_reboot") == "yes"106 logging.info("Chose to install kernel through '%s', proceeding",107 install_type)108 if install_type == "rpm":...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!