summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMarkus Lehtonen <markus.lehtonen@linux.intel.com>2013-05-15 09:51:54 +0300
committerMarkus Lehtonen <markus.lehtonen@linux.intel.com>2014-01-14 13:49:52 +0200
commit90e11ba1984dadb1641b4fcc2760df6803c1691c (patch)
treeaa383ddc047485d2b3d04a5d0853f70eb4766b32 /tests
parentea9e1dedca52eee7333bbfd28221b61c22c869bf (diff)
downloadgit-buildpackage-90e11ba1984dadb1641b4fcc2760df6803c1691c.tar.gz
git-buildpackage-90e11ba1984dadb1641b4fcc2760df6803c1691c.tar.bz2
git-buildpackage-90e11ba1984dadb1641b4fcc2760df6803c1691c.zip
rpm: give patches in the order they are applied in the spec
Fixes patch importing in situations when patch tag numbering in the spec differs from the order they are applied. Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/test_rpm.py24
-rw-r--r--tests/test_rpm_data/specs/gbp-test-quirks.spec12
2 files changed, 35 insertions, 1 deletions
diff --git a/tests/test_rpm.py b/tests/test_rpm.py
index 4fb3b0ca..0fae04fb 100644
--- a/tests/test_rpm.py
+++ b/tests/test_rpm.py
@@ -275,7 +275,29 @@ class TestSpecFile(object):
assert len(spec.patchseries(ignored=True)) == 1
series = spec.patchseries(unapplied=True, ignored=True)
assert len(series) == 2
- assert os.path.basename(series[-1].path) == '4.patch'
+ assert os.path.basename(series[-1].path) == '1.patch'
+
+ def test_patch_series_quirks(self):
+ """Patches are applied in order different from the patch numbering"""
+ spec_filepath = os.path.join(SPEC_DIR, 'gbp-test-quirks.spec')
+ spec = SpecFileTester(spec_filepath)
+
+ # Check series is returned in the order the patches are applied
+ files = [os.path.basename(patch.path) for patch in spec.patchseries()]
+ assert files == ['05.patch', '01.patch']
+ # Also ignored patches are returned in the correct order
+ files = [os.path.basename(patch.path) for patch in
+ spec.patchseries(ignored=True)]
+ assert files == ['05.patch', '02.patch', '01.patch']
+ # Unapplied patches are added to the end of the series
+ files = [os.path.basename(patch.path) for patch in
+ spec.patchseries(unapplied=True)]
+ assert files == ['05.patch', '01.patch', '03.patch']
+ # Return all patches (for which tag is found)
+ files = [os.path.basename(patch.path) for patch in
+ spec.patchseries(unapplied=True, ignored=True)]
+ assert files == ['05.patch', '02.patch', '01.patch', '03.patch',
+ '04.patch']
class TestUtilityFunctions(object):
diff --git a/tests/test_rpm_data/specs/gbp-test-quirks.spec b/tests/test_rpm_data/specs/gbp-test-quirks.spec
index 64db07fb..bb56b008 100644
--- a/tests/test_rpm_data/specs/gbp-test-quirks.spec
+++ b/tests/test_rpm_data/specs/gbp-test-quirks.spec
@@ -8,6 +8,12 @@ Version: 0.1
Release: 1.2
License: GPLv2
Source1: foobar.tar.gz
+# Gbp-Ignore-Patches: 2 4 888
+Patch1: 01.patch
+Patch2: 02.patch
+Patch3: 03.patch
+Patch4: 04.patch
+Patch5: 05.patch
%description
Spec for testing some quirks of spec parsing. No intended for building an RPM.
@@ -16,3 +22,9 @@ Spec for testing some quirks of spec parsing. No intended for building an RPM.
# We don't have Source0 so rpmbuild would fail, but gbp shouldn't crash
%setup -q
+# Patches are applied out-of-order wrt. numbering
+%patch5
+%patch2
+%patch1
+# Patch 999 does not exist, rpmbuild would fail but GBP should not
+%patch999