How to use get_current_kernel_arch method in autotest

Best Python code snippet using autotest_python Github


Full Screen

...145 self.applied_patches = []146 self.target_arch = None147 self.build_target = 'bzImage'148 self.build_image = None149 arch = utils.get_current_kernel_arch()150 if arch == 'ia64':151 self.build_target = 'all'152 self.build_image = 'vmlinux.gz'153 elif arch in ['s390', 's390x']:154 self.build_target = 'image'155 elif 'ppc' in arch:156 self.build_target = 'vmlinux'157 if not leave:158 self.logfile.write('BASE: %s\n' % base_tree)159 # Where we have direct version hint record that160 # for later configuration selection.161 shorthand = re.compile(r'^\d+\.\d+\.\d+')162 if shorthand.match(base_tree):163 self.base_tree_version = base_tree164 else:165 self.base_tree_version = None166 # Actually extract the tree. Make sure we know it occurred167 self.extract(base_tree)168 def kernelexpand(self, kernel):169 # If we have something like a path, just use it as it is170 if '/' in kernel:171 return [kernel]172 # Find the configured mirror list.173 mirrors = self.job.config_get('mirror.mirrors')174 if not mirrors:175 # LEGACY: convert the mirror176 mirror = self.job.config_get('mirror.ftp_kernel_org')177 if mirror:178 korg = ''179 mirrors = [180 [korg + '/v2.6', mirror + '/v2.6'],181 [korg + '/people/akpm/patches/2.6', mirror + '/akpm'],182 [korg + '/people/mbligh', mirror + '/mbligh'],183 ]184 patches = kernelexpand.expand_classic(kernel, mirrors)185 print patches186 return patches187 @log.record188 @tee_output_logdir_mark189 def extract(self, base_tree):190 if os.path.exists(base_tree):191 self.get_kernel_tree(base_tree)192 else:193 base_components = self.kernelexpand(base_tree)194 print 'kernelexpand: '195 print base_components196 self.get_kernel_tree(base_components.pop(0))197 if base_components: # apply remaining patches198 self.patch(*base_components)199 @log.record200 @tee_output_logdir_mark201 def patch(self, *patches):202 """Apply a list of patches (in order)"""203 if not patches:204 return205 print 'Applying patches: ', patches206 self.apply_patches(self.get_patches(patches))207 @log.record208 @tee_output_logdir_mark209 def config(self, config_file='', config_list=None, defconfig=False,210 make=None):211 self.set_cross_cc()212 config = kernel_config.kernel_config(self.job, self.build_dir,213 self.config_dir,214 config_file, config_list,215 defconfig, self.base_tree_version,216 make)217 if kernel_config.feature_enabled("CONFIG_DEFAULT_UIMAGE",218 config.build_config):219 self.build_target = 'uImage'220 def get_patches(self, patches):221 """fetch the patches to the local src_dir"""222 local_patches = []223 for patch in patches:224 dest = os.path.join(self.src_dir, os.path.basename(patch))225 # FIXME: this isn't unique. Append something to it226 # like wget does if it's not there?227 print "get_file %s %s %s %s" % (patch, dest, self.src_dir,228 os.path.basename(patch))229 utils.get_file(patch, dest)230 # probably safer to use the command, not python library231 md5sum = utils.system_output('md5sum ' + dest).split()[0]232 local_patches.append((patch, dest, md5sum))233 return local_patches234 def apply_patches(self, local_patches):235 """apply the list of patches, in order"""236 builddir = self.build_dir237 os.chdir(builddir)238 if not local_patches:239 return None240 for (spec, local, md5sum) in local_patches:241 if local.endswith('.bz2') or local.endswith('.gz'):242 ref = spec243 else:244 ref = utils.force_copy(local, self.results_dir)245 ref = self.job.relative_path(ref)246 patch_id = "%s %s %s" % (spec, ref, md5sum)247 log = "PATCH: " + patch_id + "\n"248 print log249 utils.cat_file_to_cmd(local, 'patch -p1 > /dev/null')250 self.logfile.write(log)251 self.applied_patches.append(patch_id)252 def get_kernel_tree(self, base_tree):253 """Extract/link base_tree to self.build_dir"""254 # if base_tree is a dir, assume uncompressed kernel255 if os.path.isdir(base_tree):256 print 'Symlinking existing kernel source'257 if os.path.islink(self.build_dir):258 os.remove(self.build_dir)259 os.symlink(base_tree, self.build_dir)260 # otherwise, extract tarball261 else:262 os.chdir(os.path.dirname(self.src_dir))263 # Figure out local destination for tarball264 tarball = os.path.join(self.src_dir, os.path.basename(base_tree.split(';')[0]))265 utils.get_file(base_tree, tarball)266 print 'Extracting kernel tarball:', tarball, '...'267 utils.extract_tarball_to_dir(tarball, self.build_dir)268 def extraversion(self, tag, append=True):269 os.chdir(self.build_dir)270 extraversion_sub = r's/^CONFIG_LOCALVERSION=\s*"\(.*\)"/CONFIG_LOCALVERSION='271 cfg = self.build_dir + '/.config'272 if append:273 p = extraversion_sub + '"\\1-%s"/' % tag274 else:275 p = extraversion_sub + '"-%s"/' % tag276 if os.path.exists(cfg):277 utils.system('mv %s %s.old' % (cfg, cfg))278 utils.system("sed '%s' < %s.old > %s" % (p, cfg, cfg))279 self.config(make='oldconfig')280 else:281 self.config()282 @log.record283 @tee_output_logdir_mark284 def build(self, make_opts='', logfile='', extraversion='autotest'):285 """build the kernel286 make_opts287 additional options to make, if any288 """289 os_dep.commands('gcc', 'make')290 if logfile == '':291 logfile = os.path.join(self.log_dir, 'kernel_build')292 os.chdir(self.build_dir)293 if extraversion:294 self.extraversion(extraversion)295 self.set_cross_cc()296 # setup_config_file(config_file, config_overrides)297 # Not needed on 2.6, but hard to tell -- handle failure298 utils.system('make dep', ignore_status=True)299 threads = 2 * utils.count_cpus()300 build_string = 'make -j %d %s %s' % (threads, make_opts,301 self.build_target)302 # eg make bzImage, or make zImage303 print build_string304 utils.system(build_string)305 if kernel_config.modules_needed('.config'):306 utils.system('make -j %d %s modules' % (threads, make_opts))307 kernel_version = self.get_kernel_build_ver()308 kernel_version = re.sub('-autotest', '', kernel_version)309 self.logfile.write('BUILD VERSION: %s\n' % kernel_version)310 utils.force_copy(self.build_dir + '/', self.results_dir)311 def build_timed(self, threads, timefile='/dev/null', make_opts='',312 output='/dev/null'):313 """time the bulding of the kernel"""314 os.chdir(self.build_dir)315 self.set_cross_cc()316 self.clean()317 build_string = ("/usr/bin/time -o %s make %s -j %s vmlinux" %318 (timefile, make_opts, threads))319 build_string += ' > %s 2>&1' % output320 print build_string321 utils.system(build_string)322 if (not os.path.isfile('vmlinux')):323 errmsg = "no vmlinux found, kernel build failed"324 raise error.TestError(errmsg)325 @log.record326 @tee_output_logdir_mark327 def clean(self):328 """make clean in the kernel tree"""329 os.chdir(self.build_dir)330 print "make clean"331 utils.system('make clean > /dev/null 2> /dev/null')332 @log.record333 @tee_output_logdir_mark334 def mkinitrd(self, version, image, system_map, initrd):335 """Build kernel initrd image.336 Try to use distro specific way to build initrd image.337 Parameters:338 version339 new kernel version340 image341 new kernel image file342 system_map343 file344 initrd345 initrd image file to build346 """347 d = distro.detect()348 if os.path.isfile(initrd):349 print "Existing %s file, will remove it." % initrd350 os.remove(initrd)351 args = self.job.config_get('kernel.mkinitrd_extra_args')352 # don't leak 'None' into mkinitrd command353 if not args:354 args = ''355 # It is important to match the version with a real directory inside356 # /lib/modules357 real_version_list = glob.glob('/lib/modules/%s*' % version)358 rl = len(real_version_list)359 if rl == 0:360 logging.error("No directory %s found under /lib/modules. Initramfs"361 "creation will most likely fail and your new kernel"362 "will fail to build", version)363 else:364 if rl > 1:365 logging.warning("Found more than one possible match for "366 "kernel version %s under /lib/modules", version)367 version = os.path.basename(real_version_list[0])368 if in ['redhat', 'fedora']:369 try:370 cmd = os_dep.command('dracut')371 full_cmd = '%s -f %s %s' % (cmd, initrd, version)372 except ValueError:373 cmd = os_dep.command('mkinitrd')374 full_cmd = '%s %s %s %s' % (cmd, args, initrd, version)375 utils.system(full_cmd)376 elif in ['sles']:377 utils.system('mkinitrd %s -k %s -i %s -M %s' %378 (args, image, initrd, system_map))379 elif in ['debian', 'ubuntu']:380 if os.path.isfile('/usr/sbin/mkinitrd'):381 cmd = '/usr/sbin/mkinitrd'382 elif os.path.isfile('/usr/sbin/mkinitramfs'):383 cmd = '/usr/sbin/mkinitramfs'384 else:385 raise error.TestError('No Debian initrd builder')386 utils.system('%s %s -o %s %s' % (cmd, args, initrd, version))387 else:388 raise error.TestError('Unsupported distro %s' % def set_build_image(self, image):390 self.build_image = image391 @log.record392 @tee_output_logdir_mark393 def install(self, tag='autotest', prefix='/', install_vmlinux=True):394 """make install in the kernel tree"""395 # Record that we have installed the kernel, and396 # the tag under which we installed it.397 self.installed_as = tag398 os.chdir(self.build_dir)399 if not os.path.isdir(prefix):400 os.mkdir(prefix)401 self.boot_dir = os.path.join(prefix, 'boot')402 if not os.path.isdir(self.boot_dir):403 os.mkdir(self.boot_dir)404 if not self.build_image:405 images = glob.glob('arch/*/boot/' + self.build_target)406 if len(images):407 self.build_image = images[0]408 else:409 self.build_image = self.build_target410 # remember installed files411 self.vmlinux = self.boot_dir + '/vmlinux-' + tag412 if (self.build_image != 'vmlinux'):413 self.image = self.boot_dir + '/vmlinuz-' + tag414 else:415 self.image = self.vmlinux416 install_vmlinux = True417 self.system_map = self.boot_dir + '/' + tag418 self.config_file = self.boot_dir + '/config-' + tag419 self.initrd = ''420 # copy to boot dir421 if install_vmlinux:422 utils.force_copy('vmlinux', self.vmlinux)423 if (self.build_image != 'vmlinux'):424 utils.force_copy(self.build_image, self.image)425 utils.force_copy('', self.system_map)426 utils.force_copy('.config', self.config_file)427 if not kernel_config.modules_needed('.config'):428 return429 utils.system('make modules_install INSTALL_MOD_PATH=%s' % prefix)430 if prefix == '/':431 self.initrd = self.boot_dir + '/initrd-' + tag432 self.mkinitrd(self.get_kernel_build_ver(), self.image,433 self.system_map, self.initrd)434 def get_kernel_build_arch(self, arch=None):435 """436 Work out the current kernel architecture (as a kernel arch)437 """438 if not arch:439 arch = utils.get_current_kernel_arch()440 if re.match('i.86', arch):441 return 'i386'442 elif re.match('sun4u', arch):443 return 'sparc64'444 elif re.match('arm.*', arch):445 return 'arm'446 elif re.match('sa110', arch):447 return 'arm'448 elif re.match('s390x', arch):449 return 's390'450 elif re.match('parisc64', arch):451 return 'parisc'452 elif re.match('ppc.*', arch):453 return 'powerpc'454 elif re.match('mips.*', arch):455 return 'mips'456 else:457 return arch458 def get_kernel_build_release(self):459 releasem = re.compile(r'.*UTS_RELEASE\s+"([^"]+)".*')460 versionm = re.compile(r'.*UTS_VERSION\s+"([^"]+)".*')461 release = None462 version = None463 for f in [self.build_dir + "/include/linux/version.h",464 self.build_dir + "/include/linux/utsrelease.h",465 self.build_dir + "/include/linux/compile.h",466 self.build_dir + "/include/generated/utsrelease.h",467 self.build_dir + "/include/generated/compile.h"]:468 if os.path.exists(f):469 fd = open(f, 'r')470 for line in fd.readlines():471 m = releasem.match(line)472 if m:473 release = m.groups()[0]474 m = versionm.match(line)475 if m:476 version = m.groups()[0]477 fd.close()478 return (release, version)479 def get_kernel_build_ident(self):480 (release, version) = self.get_kernel_build_release()481 if not release or not version:482 raise error.JobError('kernel has no identity')483 return release + '::' + version484 def boot(self, args='', ident=True):485 """ install and boot this kernel, do not care how486 just make it happen.487 """488 # If the kernel has not yet been installed,489 # install it now as default tag.490 if not self.installed_as:491 self.install()492 expected_ident = self.get_kernel_build_ident()493 self._boot_kernel(args, ident, expected_ident,494 self.subdir, self.applied_patches)495 def get_kernel_build_ver(self):496 """Check Makefile and .config to return kernel version"""497 version = patchlevel = sublevel = extraversion = localversion = ''498 for line in open(self.build_dir + '/Makefile', 'r').readlines():499 if line.startswith('VERSION'):500 version = line[line.index('=') + 1:].strip()501 if line.startswith('PATCHLEVEL'):502 patchlevel = line[line.index('=') + 1:].strip()503 if line.startswith('SUBLEVEL'):504 sublevel = line[line.index('=') + 1:].strip()505 if line.startswith('EXTRAVERSION'):506 extraversion = line[line.index('=') + 1:].strip()507 for line in open(self.build_dir + '/.config', 'r').readlines():508 if line.startswith('CONFIG_LOCALVERSION='):509 localversion = line.rstrip().split('"')[1]510 return "%s.%s.%s%s%s" % (version, patchlevel, sublevel, extraversion, localversion)511 def set_build_target(self, build_target):512 if build_target:513 self.build_target = build_target514 print 'BUILD TARGET: %s' % self.build_target515 def set_cross_cc(self, target_arch=None, cross_compile=None,516 build_target='bzImage'):517 """Set up to cross-compile.518 This is broken. We need to work out what the default519 compile produces, and if not, THEN set the cross520 compiler.521 """522 if self.target_arch:523 return524 # if someone has set build_target, don't clobber in set_cross_cc525 # run set_build_target before calling set_cross_cc526 if not self.build_target:527 self.set_build_target(build_target)528 # If no 'target_arch' given assume native compilation529 if target_arch is None:530 target_arch = utils.get_current_kernel_arch()531 if target_arch == 'ppc64':532 if self.build_target == 'bzImage':533 self.build_target = 'vmlinux'534 if not cross_compile:535 cross_compile = self.job.config_get('kernel.cross_cc')536 if cross_compile:537 os.environ['CROSS_COMPILE'] = cross_compile538 else:539 if 'CROSS_COMPILE' in os.environ:540 del os.environ['CROSS_COMPILE']541 return # HACK. Crap out for now.542 # At this point I know what arch I *want* to build for543 # but have no way of working out what arch the default544 # compiler DOES build for.545 def install_package(package):546 raise NotImplementedError("I don't exist yet!")547 if target_arch in ['ppc64', 'ppc']:548 install_package('ppc64-cross')549 cross_compile = os.path.join(self.autodir, 'sources/ppc64-cross/bin')550 elif target_arch == 'x86_64':551 install_package('x86_64-cross')552 cross_compile = os.path.join(self.autodir, 'sources/x86_64-cross/bin')553 os.environ['ARCH'] = self.target_arch = target_arch554 self.cross_compile = cross_compile555 if self.cross_compile:556 os.environ['CROSS_COMPILE'] = self.cross_compile557 def pickle_dump(self, filename):558 """dump a pickle of ourself out to the specified filename559 we can't pickle the backreference to job (it contains fd's),560 nor would we want to. Same for logfile (fd's).561 """562 temp = copy.copy(self)563 temp.job = None564 temp.logfile = None565 pickle.dump(temp, open(filename, 'w'))566class rpm_kernel(BootableKernel):567 """568 Class for installing a binary rpm kernel package569 """570 kernel_string = '/boot/vmlinuz'571 def __init__(self, job, rpm_package, subdir):572 super(rpm_kernel, self).__init__(job)573 self.rpm_package = rpm_package574 self.log_dir = os.path.join(subdir, 'debug')575 self.subdir = os.path.basename(subdir)576 if os.path.exists(self.log_dir):577 utils.system('rm -rf ' + self.log_dir)578 os.mkdir(self.log_dir)579 def build(self, *args, **dargs):580 """581 Dummy function, binary kernel so nothing to build.582 """583 pass584 @log.record585 @tee_output_logdir_mark586 def install(self, tag='autotest', install_vmlinux=True):587 self.installed_as = tag588 self.image = None589 self.initrd = ''590 for rpm_pack in self.rpm_package:591 rpm_name = utils.system_output('rpm -qp ' + rpm_pack)592 # install without dependencies (e.g., kernel-firmware)593 utils.system('rpm -i --force --nodeps ' + rpm_pack)594 # get file list595 files = utils.system_output('rpm -ql ' + rpm_name).splitlines()596 # search for vmlinuz597 for file in files:598 if file.startswith(self.kernel_string):599 self.full_version = file[len(self.kernel_string + '-'):]600 self.image = file601 self.rpm_flavour = rpm_name.split('-')[1]602 # get version and release number603 r_cmd = ('rpm --queryformat="%{VERSION}\\n%{RELEASE}\\n" '604 '-q ' + rpm_name)605 (self.version,606 self.release) = utils.system_output(607 r_cmd).splitlines()[0:2]608 # prefer /boot/kernel-version before /boot/kernel609 if self.full_version:610 break611 # search for initrd612 for file in files:613 if file.startswith('/boot/init'):614 self.initrd = file615 # prefer /boot/initrd-version before /boot/initrd616 if len(file) > len('/boot/initrd'):617 break618 if self.image is None:619 errmsg = "specified rpm file(s) don't contain /boot/vmlinuz"620 raise error.TestError(errmsg)621 # install vmlinux622 if install_vmlinux:623 for rpm_pack in self.rpm_package:624 vmlinux = utils.system_output(625 'rpm -q -l -p %s | grep /boot/vmlinux' % rpm_pack)626 utils.system('cd /; rpm2cpio %s | cpio -imuv .%s 2>&1'627 % (rpm_pack, vmlinux))628 if not os.path.exists(vmlinux):629 raise error.TestError('%s does not exist after installing %s'630 % (vmlinux, rpm_pack))631 def boot(self, args='', ident=True):632 """ install and boot this kernel633 """634 # If the kernel has not yet been installed,635 # install it now as default tag.636 if not self.installed_as:637 self.install()638 expected_ident = self.full_version639 if not expected_ident:640 expected_ident = '-'.join([self.version,641 self.rpm_flavour,642 self.release])643 self._boot_kernel(args, ident, expected_ident,644 None, 'rpm')645class srpm_kernel(kernel):646 prefix = '/root/rpmbuild'647 binrpm_pattern = re.compile(r'kernel-[0-9]')648 def __init__(self, job, rpm_package, subdir):649 # download and install src.rpm650 self.job = job651 self.subdir = subdir652 self.SOURCES_dir = os.path.join(self.prefix, 'SOURCES')653 self.SPECS_dir = os.path.join(self.prefix, 'SPECS')654 self.BUILD_dir = os.path.join(self.prefix, 'BUILD')655 self.BUILDROOT_dir = os.path.join(self.prefix, 'BUILDROOT')656 self.RPMS_dir = os.path.join(self.prefix, 'RPMS')657 # technically this is where both patches and tarballs get put, but658 # since we don't have any tarballs, we just fudge it659 self.src_dir = self.SOURCES_dir660 self.spec = os.path.join(self.SPECS_dir, 'kernel.spec')661 self.results_dir = os.path.join(subdir, 'results')662 self.log_dir = os.path.join(subdir, 'debug')663 self.patches = []664 self.configs = []665 self.built = False666 self.finish_init()667 self.__init(rpm_package)668 # dummy function to override in children classes to modify __init__ behavior669 def finish_init(self):670 pass671 def __init(self, rpm_package):672 for path in [self.prefix, self.SOURCES_dir, self.SPECS_dir,673 self.BUILD_dir, self.BUILDROOT_dir, self.RPMS_dir,674 self.src_dir, self.results_dir, self.log_dir]:675 utils.system('rm -rf ' + path)676 os.mkdir(path)677 utils.system('rpm -ivh %s' % rpm_package)678 def apply_patches(self, local_patches):679 self.patches += local_patches680 def setup_source(self):681 if len(self.configs) > 0:682 for config_file in glob.glob(os.path.join(self.SOURCES_dir, 'kernel-*%s*' % utils.get_current_kernel_arch())):683 with open(config_file, 'a') as cfg:684 for config in self.configs:685 cfg.write("%s\n" % config)686 def consume_one_config(self, config_option):687 if os.path.exists(config_option) or utils.is_url(config_option):688 if os.path.exists(config_option):689 cfg = open(config_option, 'r')690 if utils.is_url(config_option):691 cfg = utils.urlopen(config_option)692 # read the file693 for line in cfg.readlines():694 self.configs.append(line)695 else:696 self.configs.append(config_option)697 def config(self, *args, **kwargs):698 for config_option in args:699 self.consume_one_config(config_option)700 def update_spec_line(self, line, outspec, tag):701 if line.startswith('# % define buildid'):702 outspec.write('%%define buildid .%s\n' % tag)703 return704 if len(self.patches) > 0:705 if line.startswith('Patch999999'):706 for index, (spec, dest, md5sum) in enumerate(self.patches):707 outspec.write('Patch%d: %s\n' %708 (index,709 os.path.relpath(dest, self.SOURCES_dir)))710 if line.startswith('ApplyOptionalPatch linux-kernel-test.patch'):711 for (spec, dest, md5sum) in self.patches:712 outspec.write('ApplyPatch %s\n' %713 os.path.relpath(dest, self.SOURCES_dir))714 if len(self.configs) > 0:715 if line.startswith('%define listnewconfig_fail'):716 outspec.write('%define listnewconfig_fail 0\n')717 return718 outspec.write(line)719 def update_spec(self, tag):720 utils.system('cp %s %s' % (self.spec, self.spec + '.bak'))721 with open(self.spec + '.bak', 'r') as inspec:722 with open(self.spec, 'w+') as outspec:723 for line in inspec:724 self.update_spec_line(line, outspec, tag)725 def prep(self, tag='autotest'):726 self.setup_source()727 self.update_spec(tag)728 utils.system('rpmbuild -bp %s' % self.spec)729 def build(self, tag='autotest'):730 self.setup_source()731 self.update_spec(tag)732 utils.system('rpmbuild -bb %s' % self.spec)733 dest = os.path.join(self.results_dir, "RPMs")734 shutil.copytree(self.RPMS_dir, dest)735 rpms = []736 for root, dirs, files in os.walk(self.RPMS_dir):737 for name in files:738 if is not None:739 rpms.append(os.path.join(root, name))740 self.binrpms = rpms741 self.built = True742 def install(self, tag='autotest'):743 # install resulting rpm on system744 if not self.built:745 r = rpm_kernel_vendor(self.job, self.binrpms, self.subdir)747 r.install(tag=tag)748 def boot(self, args=''):749 # boot resulting rpm on system750 if not self.built:751 r = rpm_kernel_vendor(self.job, self.binrpms, self.subdir)753 r.boot(args=args)754class rpm_kernel_suse(rpm_kernel):755 """ Class for installing openSUSE/SLE rpm kernel package756 """757 kernel_string = '/boot/vmlinux'758 def install(self):759 # do not set the new kernel as the default one760 os.environ['PBL_AUTOTEST'] = '1'761 rpm_kernel.install(self, 'dummy')762 self.installed_as = self.job.bootloader.get_title_for_kernel(self.image)763 if not self.installed_as:764 errmsg = "cannot find installed kernel in bootloader configuration"765 raise error.TestError(errmsg)766 def add_to_bootloader(self, args=''):767 """ Set parameters of this kernel in bootloader768 """769 # pull the base argument set from the job config770 baseargs = self.job.config_get('boot.default_args')771 if baseargs:772 args = baseargs + ' ' + args773 self.job.bootloader.add_args(self.installed_as, args)774class srpm_kernel_suse(srpm_kernel):775 prefix = '/usr/src/packages'776 def __init__(self, job, rpm_package, subdir):777 # download and install src.rpm778 super(srpm_kernel_suse, self).__init__(job, rpm_package, subdir)779 utils.system('rm -rf ' + self.cfg_dir)780 os.mkdir(self.cfg_dir)781 os.mkdir(os.path.join(self.cfg_dir, utils.get_current_kernel_arch()))782 def finish_init(self):783 self.src_dir = os.path.join(self.SOURCES_dir, 'patches.addon')784 self.cfg_dir = os.path.join(self.SOURCES_dir, 'config.addon')785 d = distro.detect()786 if d.version == '11':787 self.spec = os.path.join(self.SPECS_dir, 'kernel-ppc64.spec')788 self.config_file = os.path.join(self.cfg_dir, utils.get_current_kernel_arch(), utils.get_current_kernel_arch())789 # sles11 needs both kernel and kernel-base790 self.binrpm_pattern = re.compile(r'kernel-%s-(base|[0-9])' % utils.get_current_kernel_arch())791 if d.version == '12':792 self.spec = os.path.join(self.SPECS_dir, 'kernel-default.spec')793 self.config_file = os.path.join(self.cfg_dir, utils.get_current_kernel_arch(), 'default')794 self.binrpm_pattern = re.compile(r'kernel-default-[0-9]')795 def setup_source(self):796 # setup tarball797 if len(self.patches) > 0:798 # need to ensure the tarball's contents are relative to SOURCES799 utils.system('tar jCcf %s %s.tar.bz2 %s' % (self.SOURCES_dir,800 self.src_dir,801 os.path.basename(self.src_dir)))802 # append to series file803 with open(os.path.join(self.SOURCES_dir, 'series.conf'), 'a') as series:804 for (spec, local, md5sum) in self.patches:805 series.write("%s\n" % os.path.relpath(local, self.SOURCES_dir))806 if len(self.configs) > 0:807 with open(self.config_file, 'w+') as cfg:...

Full Screen

Full Screen

Automation Testing Tutorials

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.

LambdaTest Learning Hubs:


You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run autotest automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?