How to use get_mappings_2x method in autotest

Best Python code snippet using autotest_python

kernelexpand.py

Source:kernelexpand.py Github

copy

Full Screen

...17import re18import sys19import urllib220from autotest.client.shared.settings import settings21def get_mappings_2x():22 KERNEL_BASE_URL = settings.get_value('CLIENT', 'kernel_mirror', default='')23 GITWEB_BASE_URL = settings.get_value('CLIENT', 'kernel_gitweb', default='')24 STABLE_GITWEB_BASE_URL = settings.get_value('CLIENT', 'stable_kernel_gitweb', default='')25 MAPPINGS_2X = [26 [r'^\d+\.\d+$', '', True,27 map(lambda x: x + 'v%(major)s/linux-%(full)s.tar.bz2', KERNEL_BASE_URL.split()) +28 map(lambda x: x + ';a=snapshot;h=refs/tags/v%(full)s;sf=tgz', GITWEB_BASE_URL.split())29 ],30 [r'^\d+\.\d+\.\d+$', '', True,31 map(lambda x: x + 'v%(major)s/linux-%(full)s.tar.bz2', KERNEL_BASE_URL.split()) +32 map(lambda x: x + ';a=snapshot;h=refs/tags/v%(full)s;sf=tgz', GITWEB_BASE_URL.split())33 ],34 [r'^\d+\.\d+\.\d+\.\d+$', '', True,35 map(lambda x: x + 'v%(major)s/linux-%(full)s.tar.bz2', KERNEL_BASE_URL.split()) +36 map(lambda x: x + ';a=snapshot;h=refs/tags/v%(full)s;sf=tgz', STABLE_GITWEB_BASE_URL.split())37 ],38 [r'-rc\d+$', '%(minor-prev)s', True,39 map(lambda x: x + 'v%(major)s/testing/v%(minor)s/linux-%(full)s.tar.bz2', KERNEL_BASE_URL.split()) +40 map(lambda x: x + 'v%(major)s/testing/linux-%(full)s.tar.bz2', KERNEL_BASE_URL.split()) +41 map(lambda x: x + ';a=snapshot;h=refs/tags/v%(full)s;sf=tgz', GITWEB_BASE_URL.split())42 ],43 [r'-(git|bk)\d+$', '%(base)s', False,44 map(lambda x: x + 'v%(major)s/snapshots/old/patch-%(full)s.bz2', KERNEL_BASE_URL.split()) +45 map(lambda x: x + 'v%(major)s/snapshots/patch-%(full)s.bz2', KERNEL_BASE_URL.split())46 ],47 [r'-mm\d+$', '%(base)s', False,48 map(lambda x: x + 'people/akpm/patches/' + '%(major)s/%(base)s/%(full)s/%(full)s.bz2', KERNEL_BASE_URL.split())49 ],50 [r'-mjb\d+$', '%(base)s', False,51 map(lambda x: x + 'people/mbligh/%(base)s/patch-%(full)s.bz2', KERNEL_BASE_URL.split())52 ],53 [r'[a-f0-9]{7,40}$', '', True,54 map(lambda x: x + ';a=snapshot;h=%(full)s;sf=tgz', GITWEB_BASE_URL.split()) +55 map(lambda x: x + ';a=snapshot;h=%(full)s;sf=tgz', STABLE_GITWEB_BASE_URL.split())56 ]57 ]58 return MAPPINGS_2X59def get_mappings_post_2x():60 KERNEL_BASE_URL = settings.get_value('CLIENT', 'kernel_mirror', default='')61 GITWEB_BASE_URL = settings.get_value('CLIENT', 'kernel_gitweb', default='')62 STABLE_GITWEB_BASE_URL = settings.get_value('CLIENT', 'stable_kernel_gitweb', default='')63 MAPPINGS_POST_2X = [64 [r'^\d+\.\d+$', '', True,65 map(lambda x: x + 'v%(major)s/linux-%(full)s.tar.bz2', KERNEL_BASE_URL.split()) +66 map(lambda x: x + 'v%(major)s/linux-%(full)s.tar.xz', KERNEL_BASE_URL.split()) +67 map(lambda x: x + ';a=snapshot;h=refs/tags/v%(full)s;sf=tgz', GITWEB_BASE_URL.split())68 ],69 [r'^\d+\.\d+\.\d+$', '', True,70 map(lambda x: x + 'v%(major)s/linux-%(full)s.tar.bz2', KERNEL_BASE_URL.split()) +71 map(lambda x: x + 'v%(major)s/linux-%(full)s.tar.xz', KERNEL_BASE_URL.split()) +72 map(lambda x: x + ';a=snapshot;h=refs/tags/v%(full)s;sf=tgz', STABLE_GITWEB_BASE_URL.split())73 ],74 [r'-rc\d+$', '', True,75 map(lambda x: x + 'v%(major)s/testing/linux-%(full)s.tar.bz2', KERNEL_BASE_URL.split()) +76 map(lambda x: x + 'v%(major)s/testing/linux-%(full)s.tar.xz', KERNEL_BASE_URL.split()) +77 map(lambda x: x + ';a=snapshot;h=refs/tags/v%(full)s;sf=tgz', GITWEB_BASE_URL.split())78 ],79 [r'[a-f0-9]{7,40}$', '', True,80 map(lambda x: x + ';a=snapshot;h=%(full)s;sf=tgz', GITWEB_BASE_URL.split()) +81 map(lambda x: x + ';a=snapshot;h=%(full)s;sf=tgz', STABLE_GITWEB_BASE_URL.split())82 ]83 ]84 return MAPPINGS_POST_2X85def decompose_kernel_2x_once(kernel):86 """87 Generate the parameters for the patches (2.X version):88 full => full kernel name89 base => all but the matches suffix90 minor => 2.n.m91 major => 2.n92 minor-prev => 2.n.m-193 :param kernel: String representing a kernel version to be expanded.94 """95 for mapping in get_mappings_2x():96 (suffix, becomes, is_full, patch_templates) = mapping97 params = {}98 match = re.search(r'^(.*)' + suffix, kernel)99 if not match:100 continue101 params['full'] = kernel102 params['base'] = match.group(1)103 match = re.search(r'^((\d+\.\d+)\.(\d+))', kernel)104 if not match:105 raise NameError("Unable to determine major/minor version for "106 "kernel %s" % kernel)107 params['minor'] = match.group(1)108 params['major'] = match.group(2)109 params['minor-prev'] = match.group(2) + '.%d' % (int(match.group(3)) - 1)...

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:

YouTube

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?

Helpful

NotHelpful