tests: add a testcase for applying patches
This adds a test where we clone a git and a hg repo and apply a single patch and later a quilt series on each of them. Signed-off-by: Henning Schild <henning.schild@siemens.com> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
This commit is contained in:
parent
8a2a21d799
commit
fafc017392
@ -10,6 +10,11 @@ sudo: required
|
|||||||
services:
|
services:
|
||||||
- docker
|
- docker
|
||||||
|
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
packages:
|
||||||
|
- mercurial
|
||||||
|
|
||||||
install:
|
install:
|
||||||
# install kas to have all kas dependencies:
|
# install kas to have all kas dependencies:
|
||||||
- pip install .
|
- pip install .
|
||||||
|
35
tests/test_patch.py
Normal file
35
tests/test_patch.py
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
# kas - setup tool for bitbake based projects
|
||||||
|
#
|
||||||
|
# Copyright (c) Siemens AG, 2019
|
||||||
|
#
|
||||||
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
# of this software and associated documentation files (the "Software"), to deal
|
||||||
|
# in the Software without restriction, including without limitation the rights
|
||||||
|
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
# copies of the Software, and to permit persons to whom the Software is
|
||||||
|
# furnished to do so, subject to the following conditions:
|
||||||
|
#
|
||||||
|
# The above copyright notice and this permission notice shall be
|
||||||
|
# included in all copies or substantial portions of the Software.
|
||||||
|
#
|
||||||
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
# SOFTWARE.
|
||||||
|
|
||||||
|
import os
|
||||||
|
import shutil
|
||||||
|
from kas import kas
|
||||||
|
|
||||||
|
import pytest # noqa: F401; flake8 'pytest' imported but unused
|
||||||
|
|
||||||
|
|
||||||
|
def test_patch(tmpdir):
|
||||||
|
tdir = str(tmpdir.mkdir('test_patch'))
|
||||||
|
shutil.rmtree(tdir, ignore_errors=True)
|
||||||
|
shutil.copytree('tests/test_patch', tdir)
|
||||||
|
os.chdir(tdir)
|
||||||
|
kas.kas(['shell', 'test.yml', '-c', 'true'])
|
3
tests/test_patch/oe-init-build-env
Executable file
3
tests/test_patch/oe-init-build-env
Executable file
@ -0,0 +1,3 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
true
|
8
tests/test_patch/patches/hello/001.patch
Normal file
8
tests/test_patch/patches/hello/001.patch
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
diff --git a/Makefile b/Makefile
|
||||||
|
--- a/Makefile
|
||||||
|
+++ b/Makefile
|
||||||
|
@@ -1,1 +1,4 @@
|
||||||
|
all: hello
|
||||||
|
+
|
||||||
|
+clean:
|
||||||
|
+ rm -f hello
|
8
tests/test_patch/patches/hello/quilt/001.patch
Normal file
8
tests/test_patch/patches/hello/quilt/001.patch
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
diff --git a/Makefile b/Makefile
|
||||||
|
--- a/Makefile
|
||||||
|
+++ b/Makefile
|
||||||
|
@@ -1,4 +1,1 @@
|
||||||
|
all: hello
|
||||||
|
-
|
||||||
|
-clean:
|
||||||
|
- rm -f hello
|
8
tests/test_patch/patches/hello/quilt/002.patch
Normal file
8
tests/test_patch/patches/hello/quilt/002.patch
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
diff --git a/Makefile b/Makefile
|
||||||
|
--- a/Makefile
|
||||||
|
+++ b/Makefile
|
||||||
|
@@ -1,1 +1,4 @@
|
||||||
|
all: hello
|
||||||
|
+
|
||||||
|
+clean:
|
||||||
|
+ rm -f hello
|
4
tests/test_patch/patches/hello/quilt/series
Normal file
4
tests/test_patch/patches/hello/quilt/series
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
# test comment
|
||||||
|
# this is a revert of the other 001 we applied without quilt
|
||||||
|
001.patch # first patch
|
||||||
|
002.patch
|
24
tests/test_patch/patches/kas/001.patch
Normal file
24
tests/test_patch/patches/kas/001.patch
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
diff --git a/CHANGELOG.md b/CHANGELOG.md
|
||||||
|
index 4b594e6..f1222ab 100644
|
||||||
|
--- a/CHANGELOG.md
|
||||||
|
+++ b/CHANGELOG.md
|
||||||
|
@@ -1,6 +1,3 @@
|
||||||
|
-1.0
|
||||||
|
-- isar: Take qemu-user-static from buster and adjust binfmt setup
|
||||||
|
-
|
||||||
|
0.20.1
|
||||||
|
- kas-docker: Restore KAS_PREMIRRORS support
|
||||||
|
|
||||||
|
diff --git a/kas/__version__.py b/kas/__version__.py
|
||||||
|
index 0ac2731..020cb6f 100644
|
||||||
|
--- a/kas/__version__.py
|
||||||
|
+++ b/kas/__version__.py
|
||||||
|
@@ -25,7 +25,7 @@
|
||||||
|
__license__ = 'MIT'
|
||||||
|
__copyright__ = 'Copyright (c) Siemens AG, 2017-2018'
|
||||||
|
|
||||||
|
-__version__ = '1.0'
|
||||||
|
+__version__ = '0.20.1'
|
||||||
|
|
||||||
|
# Please update docs/format-changelog.rst when changing the file version.
|
||||||
|
__file_version__ = 8
|
24
tests/test_patch/patches/kas/quilt/001.patch
Normal file
24
tests/test_patch/patches/kas/quilt/001.patch
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
diff --git a/CHANGELOG.md b/CHANGELOG.md
|
||||||
|
index f1222ab..4b594e6 100644
|
||||||
|
--- a/CHANGELOG.md
|
||||||
|
+++ b/CHANGELOG.md
|
||||||
|
@@ -1,3 +1,6 @@
|
||||||
|
+1.0
|
||||||
|
+- isar: Take qemu-user-static from buster and adjust binfmt setup
|
||||||
|
+
|
||||||
|
0.20.1
|
||||||
|
- kas-docker: Restore KAS_PREMIRRORS support
|
||||||
|
|
||||||
|
diff --git a/kas/__version__.py b/kas/__version__.py
|
||||||
|
index 020cb6f..0ac2731 100644
|
||||||
|
--- a/kas/__version__.py
|
||||||
|
+++ b/kas/__version__.py
|
||||||
|
@@ -25,7 +25,7 @@
|
||||||
|
__license__ = 'MIT'
|
||||||
|
__copyright__ = 'Copyright (c) Siemens AG, 2017-2018'
|
||||||
|
|
||||||
|
-__version__ = '0.20.1'
|
||||||
|
+__version__ = '1.0'
|
||||||
|
|
||||||
|
# Please update docs/format-changelog.rst when changing the file version.
|
||||||
|
__file_version__ = 8
|
24
tests/test_patch/patches/kas/quilt/002.patch
Normal file
24
tests/test_patch/patches/kas/quilt/002.patch
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
diff --git a/CHANGELOG.md b/CHANGELOG.md
|
||||||
|
index 4b594e6..f1222ab 100644
|
||||||
|
--- a/CHANGELOG.md
|
||||||
|
+++ b/CHANGELOG.md
|
||||||
|
@@ -1,6 +1,3 @@
|
||||||
|
-1.0
|
||||||
|
-- isar: Take qemu-user-static from buster and adjust binfmt setup
|
||||||
|
-
|
||||||
|
0.20.1
|
||||||
|
- kas-docker: Restore KAS_PREMIRRORS support
|
||||||
|
|
||||||
|
diff --git a/kas/__version__.py b/kas/__version__.py
|
||||||
|
index 0ac2731..020cb6f 100644
|
||||||
|
--- a/kas/__version__.py
|
||||||
|
+++ b/kas/__version__.py
|
||||||
|
@@ -25,7 +25,7 @@
|
||||||
|
__license__ = 'MIT'
|
||||||
|
__copyright__ = 'Copyright (c) Siemens AG, 2017-2018'
|
||||||
|
|
||||||
|
-__version__ = '1.0'
|
||||||
|
+__version__ = '0.20.1'
|
||||||
|
|
||||||
|
# Please update docs/format-changelog.rst when changing the file version.
|
||||||
|
__file_version__ = 8
|
4
tests/test_patch/patches/kas/quilt/series
Normal file
4
tests/test_patch/patches/kas/quilt/series
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
# test comment
|
||||||
|
# this is a revert of the other 001 we applied without quilt
|
||||||
|
001.patch # first patch
|
||||||
|
002.patch
|
28
tests/test_patch/test.yml
Normal file
28
tests/test_patch/test.yml
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
header:
|
||||||
|
version: 8
|
||||||
|
|
||||||
|
repos:
|
||||||
|
this:
|
||||||
|
|
||||||
|
kas:
|
||||||
|
url: https://github.com/siemens/kas.git
|
||||||
|
refspec: 907816a5c4094b59a36aec12226e71c461c05b77
|
||||||
|
patches:
|
||||||
|
plain:
|
||||||
|
repo: this
|
||||||
|
path: patches/kas/001.patch
|
||||||
|
quilt:
|
||||||
|
repo: this
|
||||||
|
path: patches/kas/quilt/
|
||||||
|
|
||||||
|
hello:
|
||||||
|
url: https://www.mercurial-scm.org/repo/hello/
|
||||||
|
refspec: 82e55d328c8c
|
||||||
|
type: hg
|
||||||
|
patches:
|
||||||
|
plain:
|
||||||
|
repo: this
|
||||||
|
path: patches/hello/001.patch
|
||||||
|
quilt:
|
||||||
|
repo: this
|
||||||
|
path: patches/hello/quilt/
|
Loading…
Reference in New Issue
Block a user