• Skip to sidebar navigation
  • Skip to content

Bitbucket

  • More
    ProjectsRepositories
  • Help
    • Online help
    • Learn Git
    • Welcome to Bitbucket
    • Keyboard shortcuts
  • Log In
Alexander Dahl
  1. Alexander Dahl

buildroot

Public
Actions
  • Clone
  • Compare

Learn more about cloning repositories

You have read-only access

Navigation
  • Source
  • Commits
  • Branches
  • All Branches Graph
  • Forks
  1. Alexander Dahl
  2. buildroot

Source

buildroot/support/scripts/getdeveloperlib.py
Rahul BedarkarRahul Bedarkar committed 1b0df8f23c621 Sep 2016
Raw file
Source viewDiff to previous
xxxxxxxxxx
                print("Syntax error in DEVELOPERS file, line %d: '%s'" % (linen, l))
 
1
import sys
2
import os
3
import re
4
import argparse
5
import glob
6
import subprocess
7
​
8
#
9
# Patch parsing functions
10
#
11
​
12
FIND_INFRA_IN_PATCH = re.compile("^\+\$\(eval \$\((host-)?([^-]*)-package\)\)$")
13
​
14
def analyze_patch(patch):
15
    """Parse one patch and return the list of files modified, added or
16
    removed by the patch."""
17
    files = set()
18
    infras = set()
19
    for line in patch:
20
        # If the patch is adding a package, find which infra it is
21
        m = FIND_INFRA_IN_PATCH.match(line)
22
        if m:
23
            infras.add(m.group(2))
24
        if not line.startswith("+++ "):
25
            continue
26
        line.strip()
27
        fname = line[line.find("/") + 1 : ].strip()
28
        if fname == "dev/null":
29
            continue
30
        files.add(fname)
31
    return (files, infras)
32
​
33
FIND_INFRA_IN_MK = re.compile("^\$\(eval \$\((host-)?([^-]*)-package\)\)$")
34
​
35
def fname_get_package_infra(fname):
36
    """Checks whether the file name passed as argument is a Buildroot .mk
37
    file describing a package, and find the infrastructure it's using."""
38
    if not fname.endswith(".mk"):
39
        return None
40
​
41
    if not os.path.exists(fname):
42
        return None
43
​
44
    with open(fname, "r") as f:
45
        for l in f:
46
            l = l.strip()
47
            m = FIND_INFRA_IN_MK.match(l)
48
            if m:
49
                return m.group(2)
50
    return None
51
​
52
def get_infras(files):
53
    """Search in the list of files for .mk files, and collect the package
54
    infrastructures used by those .mk files."""
55
    infras = set()
56
    for fname in files:
57
        infra = fname_get_package_infra(fname)
58
        if infra:
59
            infras.add(infra)
60
    return infras
61
​
62
def analyze_patches(patches):
63
    """Parse a list of patches and returns the list of files modified,
  • Git repository management for enterprise teams powered by Atlassian Bitbucket
  • Atlassian Bitbucket v6.7.2
  • Documentation
  • Request a feature
  • About
  • Contact Atlassian
Atlassian

Everything looks good. We'll let you know here if there's anything you should know about.