mbligh | b62f724 | 2009-07-29 14:34:30 +0000 | [diff] [blame] | 1 | """ |
| 2 | Sample configuration file for the "mirror" script that will use |
| 3 | rsync://rsync.kernel.org to fetch a kernel file list and schedule jobs on new |
| 4 | kernel releases. |
| 5 | |
| 6 | This file has to be valid python code executed by the "mirror" script. The file |
| 7 | may 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 |
| 10 | will 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 |
| 14 | named "arg" then the original kernel filename will be replaced with the |
| 15 | contents of that group; if no such match group is defined then all the filename |
| 16 | will be considered (if there is at least one regular expression that matches |
| 17 | the filename, otherwise the filename is just filtered out); if "filter_exprs" |
| 18 | is 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 |
| 21 | initialized 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 |
| 23 | most certainly want to add a couple of actions to the trigger instance to |
| 24 | be executed for the new kernels (by default the list is empty and nothing |
| 25 | will happen with the new kernels other than being included in the known |
| 26 | kernels database so future lookups will not consider them new again) |
| 27 | """ |
| 28 | from autotest_lib.mirror import database, source as source_module |
| 29 | from autotest_lib.mirror import trigger as trigger_module |
| 30 | |
| 31 | # create a database object where to store information about known files |
| 32 | db = 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) |
| 36 | source = source_module.rsync_source(db, |
| 37 | 'rsync://rsync.kernel.org/pub/linux/kernel', |
| 38 | excludes=('2.6.0-test*/', 'broken-out/', '*.sign', '*.gz')) |
| 39 | source.add_path('v2.6/patch-2.6.*.bz2', 'v2.6') |
| 40 | source.add_path('v2.6/linux-2.6.[0-9].tar.bz2', 'v2.6') |
| 41 | source.add_path('v2.6/linux-2.6.[0-9][0-9].tar.bz2', 'v2.6') |
| 42 | source.add_path('v2.6/testing/patch*.bz2', 'v2.6/testing') |
| 43 | source.add_path('v2.6/snapshots/*.bz2', 'v2.6/snapshots') |
| 44 | source.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". |
| 50 | filter_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 | |
mbligh | b8f5b70 | 2009-11-06 03:09:03 +0000 | [diff] [blame] | 72 | # 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 = { |
mbligh | b62f724 | 2009-07-29 14:34:30 +0000 | [diff] [blame] | 76 | 'mach1': trigger_module.map_action.machine_info( |
mbligh | b8f5b70 | 2009-11-06 03:09:03 +0000 | [diff] [blame] | 77 | ('test1', 'server test2'), _common_kernel_config), |
mbligh | b62f724 | 2009-07-29 14:34:30 +0000 | [diff] [blame] | 78 | 'mach2': trigger_module.map_action.machine_info( |
mbligh | b8f5b70 | 2009-11-06 03:09:03 +0000 | [diff] [blame] | 79 | ('test1',), _common_kernel_config), |
mbligh | b62f724 | 2009-07-29 14:34:30 +0000 | [diff] [blame] | 80 | 'mach3': trigger_module.map_action.machine_info( |
mbligh | b8f5b70 | 2009-11-06 03:09:03 +0000 | [diff] [blame] | 81 | ('test3',), _common_kernel_config), |
mbligh | b62f724 | 2009-07-29 14:34:30 +0000 | [diff] [blame] | 82 | 'mach4': trigger_module.map_action.machine_info( |
mbligh | b8f5b70 | 2009-11-06 03:09:03 +0000 | [diff] [blame] | 83 | ('test4',), _common_kernel_config), |
mbligh | b62f724 | 2009-07-29 14:34:30 +0000 | [diff] [blame] | 84 | } |
| 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 |
mbligh | b8f5b70 | 2009-11-06 03:09:03 +0000 | [diff] [blame] | 91 | trigger.add_action(trigger_module.map_action(_tests_map, 'kerntest-%s')) |
mbligh | b62f724 | 2009-07-29 14:34:30 +0000 | [diff] [blame] | 92 | trigger.add_action(trigger_module.email_action('test@test.com')) |