implements patch support for repos

With this commit its now possible to patch 3rd party repos before bitbake is started.

Example:

This is our repo:
  .
  ├── kas.yml
  ├── first-patch.patch
  └── quilt-patches
      ├── second-patch.patch
      ├── third-patch.patch
      └── series

Content of kas.yml:
  header:
    version: 8

  repos:
    my:
    third-party:
      url: "git://example.com/third-party.git"
      refspec: "35adf4...34"
      patches:
        01-first:
          repo: my
          path: "first-patch.patch"
        02-second:
          repo: my
          path: "quilt-patches"

Currently only 'git' repositories can be patched.

Signed-off-by: Claudius Heine <ch@denx.de>
This commit is contained in:
Claudius Heine
2018-03-09 08:22:52 +01:00
committed by Daniel Wagner
parent b9032ec025
commit e8851a5fb3
9 changed files with 175 additions and 12 deletions

View File

@@ -28,7 +28,7 @@ import logging
import shutil
import os
from .libkas import (ssh_cleanup_agent, ssh_setup_agent, ssh_no_host_key_check,
get_build_environ, repos_fetch)
get_build_environ, repos_fetch, repos_apply_patches)
__license__ = 'MIT'
__copyright__ = 'Copyright (c) Siemens AG, 2017'
@@ -92,6 +92,8 @@ class SetupHome(Command):
fds.write('\n')
with open(self.tmpdirname + '/.netrc', 'w') as fds:
fds.write('\n')
shutil.copyfile(os.path.expanduser('~/.gitconfig'),
self.tmpdirname + '/.gitconfig')
config.environ['HOME'] = self.tmpdirname
@@ -204,6 +206,18 @@ class ReposFetch(Command):
repos_fetch(config, config.get_repos())
class ReposApplyPatches(Command):
"""
Applies the patches defined in the configuration to the repositories.
"""
def __str__(self):
return 'repos_apply_patches'
def execute(self, config):
repos_apply_patches(config, config.get_repos())
class ReposCheckout(Command):
"""
Ensures that the right revision of each repo is check out.