phase2: support multiple branch in parse_feed_entry and SingleBranchScheduler
authorChristian Marangi <ansuelsmth@gmail.com>
Tue, 5 Nov 2024 15:22:48 +0000 (16:22 +0100)
committerChristian Marangi <ansuelsmth@gmail.com>
Tue, 5 Nov 2024 15:30:27 +0000 (16:30 +0100)
Add support for multiple branch in parse_feed_entry and
SingleBranchScheduler.

- Moving to GitPoller branches
- Change feedbranches to define an array of branches
- Update the filter_fn to check multiple entry in feedbranches

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
phase2/master.cfg

index a3e7417bc39dd2ce77b0e16cece177d110fc3bea..3fb117e8699049cfa9cfddab82f15203cdd55923 100644 (file)
@@ -177,9 +177,9 @@ def parse_feed_entry(line):
        if parts[0].startswith("src-git"):
                feeds.append(parts)
                url = parts[2].strip().split(';')
-               branch = url[1] if len(url) > 1 else 'main'
-               feedbranches[url[0]] = branch
-               c['change_source'].append(GitPoller(url[0], branch=branch, workdir='%s/%s.git' %(os.getcwd(), parts[1]), pollInterval=300))
+               branches = [url[1]] if len(url) > 1 else ['main', 'master']
+               feedbranches[url[0]] = branches
+               c['change_source'].append(GitPoller(url[0], branches=branches, workdir='%s/%s.git' %(os.getcwd(), parts[1]), pollInterval=300))
 
 make = subprocess.Popen(['make', '--no-print-directory', '-C', work_dir+'/source.git/target/sdk/', 'val.BASE_FEED'],
        env = dict(os.environ, TOPDIR=work_dir+'/source.git'), stdout = subprocess.PIPE)
@@ -205,7 +205,7 @@ c['schedulers'] = []
 c['schedulers'].append(SingleBranchScheduler(
        name            = "all",
        change_filter   = filter.ChangeFilter(
-               filter_fn = lambda change: change.branch == feedbranches[change.repository]
+               filter_fn = lambda change: change.branch in feedbranches[change.repository]
        ),
        treeStableTimer = 60,
        builderNames    = archnames))