knauss added a comment.

  @bcooksley for akonadi-search we need some special settings for the 
abi-create step. Where we should  store such settings?
  
  This is a more general solution, that we can also modify the settings for 
other platforms etc.
  
  `ci-tooling/local-metadata/abi-complience-checker.yaml`:
  
    gcc_options:
        - "-std=c++11"
        - "-fPIC"
    skip_include_paths:
        - /usr/lib/python3.6/site-packages/utils/fake_libc_include
        - /usr/include/clang/AST
        - /usr/lib64/clang/6.0.1/include
    add_include_paths:
        - /usr/lib64/qt5/mkspecs/linux-g++
    
    # "SUSEQt5.10":    # platform specific
    # gcc_options:
    #    - "-DSUSE5.10"
    
    #"kde/*":    # special settings for all repos in kde (fnmatch)
    #   gcc_options:
    #       - "-DKDE"
    
    #"kde/pim/*":    # special settings for all repos in kde/pim
    #   gcc_options:
    #       - "-DKDEPIM"
    #  "SUSEQt5.10":   # for one specific platform
    #     gcc_options:
    #         - "-DKDEPIMSUSEQT5.10"
    
    "kde/pim/akonadi-search":     # for one repo
      "SUSEQt5.10":   # for one specific platform
        gcc_options:
          - "-std=c++11"
          - "-fPIC"
          - "-DQT_NO_KEYWORDS"
  
  and the Python code to handle this:
  rules are:
  
  - anthing overwrites defauls (outer level)
  - most matching path overwrites less matching path
  - platform specific overwrites non platform stuff
  
  general -> specific
  default -> "basepath/*" -> "basepath/* - platform" -> "basepath/repo" ->  
"basepath/* - platform"
  
    import yaml, fnmatch, copy
    
    metadata = yaml.load(open('local-metadata/abi-complience-checker.yaml'))
    
    def getSettings(path, platform):
        
        entries = []
        for key in metadata:
            if fnmatch.fnmatch(path, key):
                entries.append(key)
    
        # sorting all entries - the entries at the end overwrites the former 
settings
        # len is efficient, but would fail if we have single letter repo names
        entries.sort(key=len)
        entries.insert(0, platform) # add platform settings at the start
    
        d = copy.copy(metadata)     # load default settings
        for entry in entries:
            try:
              content = metadata[entry]
              d.update(content)
              d.update(content[platform]) # try to load platform specific 
settings
            except KeyError:
              pass
        return d    
    
    getSettings("kde/pim/akonadi-search",  "SUSEQt5.10")

TASK DETAIL
  https://phabricator.kde.org/T3689

To: knauss
Cc: dfaure, kde-frameworks-devel, bcooksley, sysadmin, scarlettclark, aacid, 
knauss, alexeymin, kaning, blazquez

Reply via email to