blob: 29e215f0ecb1ca6d0dc9647afdb1776dc1f24cfa [file] [log] [blame]
mblighb62f7242009-07-29 14:34:30 +00001"""
2Sample configuration file for the "mirror" script that will use
3rsync://rsync.kernel.org to fetch a kernel file list and schedule jobs on new
4kernel releases.
5
6This file has to be valid python code executed by the "mirror" script. The file
7may define and do anything but the following "names" are special:
8
9- a global name "source" is expected to implement get_new_files() method which
10will be used by "mirror" to fetch the list of new files
11
12- an optional global iteratable of regular expression strings named
13"filter_exprs" where for each regular expression if there is a match group
14named "arg" then the original kernel filename will be replaced with the
15contents of that group; if no such match group is defined then all the filename
16will be considered (if there is at least one regular expression that matches
17the filename, otherwise the filename is just filtered out); if "filter_exprs"
18is not defined (or defined to be empty) then no filtering is performed
19
20- an optional "trigger" instance of a trigger class; by default this is
21initialized with trigger.trigger() but you can set it to another instance
22(of your own site specific trigger class); even if you don't set it you
23most certainly want to add a couple of actions to the trigger instance to
24be executed for the new kernels (by default the list is empty and nothing
25will happen with the new kernels other than being included in the known
26kernels database so future lookups will not consider them new again)
27"""
28from autotest_lib.mirror import database, source as source_module
29from autotest_lib.mirror import trigger as trigger_module
30
31# create a database object where to store information about known files
32db = database.dict_database('rsync.kernel.org.db')
33
34# create a source object that will be used to fetch the list of new kernel
35# files (this example uses rsync_source)
36source = source_module.rsync_source(db,
37 'rsync://rsync.kernel.org/pub/linux/kernel',
38 excludes=('2.6.0-test*/', 'broken-out/', '*.sign', '*.gz'))
39source.add_path('v2.6/patch-2.6.*.bz2', 'v2.6')
40source.add_path('v2.6/linux-2.6.[0-9].tar.bz2', 'v2.6')
41source.add_path('v2.6/linux-2.6.[0-9][0-9].tar.bz2', 'v2.6')
42source.add_path('v2.6/testing/patch*.bz2', 'v2.6/testing')
43source.add_path('v2.6/snapshots/*.bz2', 'v2.6/snapshots')
44source.add_path('people/akpm/patches/2.6/*', 'akpm')
45
46# Given a list of files filter and transform it for entries that look like
47# legitimate releases (may be empty in which case no filtering/transformation
48# is done). If you want to replace the matched filename to only a part of it
49# put the part you want extracted in a match group named "arg".
50filter_exprs = (
51 # The major tarballs
52 r'^(.*/)?linux-(?P<arg>2\.6\.\d+)\.tar\.bz2$',
53 # Stable releases
54 r'^(.*/)?patch-(?P<arg>2\.6\.\d+\.\d+)\.bz2$',
55 # -rc releases
56 r'^(.*/)?patch-(?P<arg>2\.6\.\d+-rc\d+)\.bz2$',
57 # -git releases
58 r'^(.*/)?patch-(?P<arg>2\.6\.\d+(-rc\d+)?-git\d+)\.bz2$',
59 # -mm tree
60 r'^(.*/)?(?P<arg>2\.6\.\d+(-rc\d+)?-mm\d+)\.bz2$',
61 )
62
63# associate kernel versions with kernel config files
64# all machines have the same hardware configuration so they will all
65# use the same mapping for kernel version -> kernel config file
66_common_kernel_config = {
67 '2.6.20': '/path/to/2.6.20.config',
68 '2.6.25': '~/kernel-2.6.25.config',
69 '2.6.29': 'http://somesite/configs/2.6.29.conf',
70 }
71
mblighb8f5b702009-11-06 03:09:03 +000072# a mapping of machine -> machine_info (containing list a of test names as
73# they are named in the frontend database and kernel version association to
74# kernel config filenames)
75_tests_map = {
mblighb62f7242009-07-29 14:34:30 +000076 'mach1': trigger_module.map_action.machine_info(
mblighb8f5b702009-11-06 03:09:03 +000077 ('test1', 'server test2'), _common_kernel_config),
mblighb62f7242009-07-29 14:34:30 +000078 'mach2': trigger_module.map_action.machine_info(
mblighb8f5b702009-11-06 03:09:03 +000079 ('test1',), _common_kernel_config),
mblighb62f7242009-07-29 14:34:30 +000080 'mach3': trigger_module.map_action.machine_info(
mblighb8f5b702009-11-06 03:09:03 +000081 ('test3',), _common_kernel_config),
mblighb62f7242009-07-29 14:34:30 +000082 'mach4': trigger_module.map_action.machine_info(
mblighb8f5b702009-11-06 03:09:03 +000083 ('test4',), _common_kernel_config),
mblighb62f7242009-07-29 14:34:30 +000084 }
85
86# no need to instantiate trigger_module.trigger() as it's already done so
87# trigger = trigger_module.trigger()
88
89# now register some trigger actions otherwise nothing will be done for the new
90# kernel versions
mblighb8f5b702009-11-06 03:09:03 +000091trigger.add_action(trigger_module.map_action(_tests_map, 'kerntest-%s'))
mblighb62f7242009-07-29 14:34:30 +000092trigger.add_action(trigger_module.email_action('test@test.com'))