summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMarkus Lehtonen <markus.lehtonen@linux.intel.com>2013-01-11 16:36:28 +0200
committerMarkus Lehtonen <markus.lehtonen@linux.intel.com>2014-01-14 13:48:23 +0200
commit559487815391f87835a69419e3646659eef8a5f1 (patch)
tree7726b29027e1ca4a2826c3c2d0771ea985952fcb /tests
parent61d4311e1edeb58d9b72b52c95d18e0baa236572 (diff)
downloadgit-buildpackage-559487815391f87835a69419e3646659eef8a5f1.tar.gz
git-buildpackage-559487815391f87835a69419e3646659eef8a5f1.tar.bz2
git-buildpackage-559487815391f87835a69419e3646659eef8a5f1.zip
rpm helpers: yet another fix to patch numbering
'Patch:' does not indicate "patch number 0". Patch: and 'Patch0:' can both be present in the same spec file. Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/test_rpm.py8
-rw-r--r--tests/test_rpm_data/rpmbuild/SPECS/gbp-test2.spec2
-rw-r--r--tests/test_rpm_data/specs/gbp-test-tags.spec3
-rw-r--r--tests/test_rpm_data/specs/gbp-test-updates-reference.spec4
-rw-r--r--tests/test_rpm_data/specs/gbp-test-updates.spec6
-rw-r--r--tests/test_rpm_data/specs/gbp-test2-reference.spec6
-rw-r--r--tests/test_rpm_data/specs/gbp-test2-reference2.spec6
7 files changed, 19 insertions, 16 deletions
diff --git a/tests/test_rpm.py b/tests/test_rpm.py
index ad4525b8..3e04fcd8 100644
--- a/tests/test_rpm.py
+++ b/tests/test_rpm.py
@@ -197,8 +197,8 @@ class TestSpecFile(object):
prev = spec.protected('_delete_tag')('Vendor', None)
spec.protected('_set_tag')('License', None, 'new license', prev)
spec.protected('_delete_tag')('source', 0)
- spec.protected('_delete_tag')('patch', 1)
spec.protected('_delete_tag')('patch', 0)
+ spec.protected('_delete_tag')('patch', -1)
prev = spec.protected('_delete_tag')('invalidtag', None)
with assert_raises(GbpError):
@@ -209,9 +209,9 @@ class TestSpecFile(object):
spec.set_tag('invalidtag', None, 'value')
# Mangle macros
- prev = spec.protected('_delete_special_macro')('patch', 0)
+ prev = spec.protected('_delete_special_macro')('patch', -1)
spec.protected('_delete_special_macro')('patch', 123)
- spec.protected('_set_special_macro')('patch', 1, 'my new args', prev)
+ spec.protected('_set_special_macro')('patch', 0, 'my new args', prev)
with assert_raises(GbpError):
spec.protected('_delete_special_macro')('invalidmacro', 0)
with assert_raises(GbpError):
@@ -249,6 +249,8 @@ class TestSpecFile(object):
(name, val['value'], rval))
assert spec.ignorepatches == []
+ assert spec.patches.keys() == [0, -1]
+
class TestUtilityFunctions(object):
"""Test utility functions of L{gbp.rpm}"""
diff --git a/tests/test_rpm_data/rpmbuild/SPECS/gbp-test2.spec b/tests/test_rpm_data/rpmbuild/SPECS/gbp-test2.spec
index 4180a877..dd9e2ec2 100644
--- a/tests/test_rpm_data/rpmbuild/SPECS/gbp-test2.spec
+++ b/tests/test_rpm_data/rpmbuild/SPECS/gbp-test2.spec
@@ -8,7 +8,7 @@ License: GPLv2
Source10: ftp://ftp.host.com/%{name}-%{version}.tar.gz
Source: foo.txt
Source20: bar.tar.gz
-# Gbp-Ignore-Patches: 0
+# Gbp-Ignore-Patches: -1
Patch: my.patch
Patch10: my2.patch
Patch20: my3.patch
diff --git a/tests/test_rpm_data/specs/gbp-test-tags.spec b/tests/test_rpm_data/specs/gbp-test-tags.spec
index 9841a39e..47421a9d 100644
--- a/tests/test_rpm_data/specs/gbp-test-tags.spec
+++ b/tests/test_rpm_data/specs/gbp-test-tags.spec
@@ -27,7 +27,8 @@ Packager: my_packager
Url: my_url
Vcs: my_vcs
Source: my_source
-Patch0: my_patch
+Patch: my_patch
+Patch0: my_patch0
Nosource: 0
Nopatch: 0
#Icon: my_icon
diff --git a/tests/test_rpm_data/specs/gbp-test-updates-reference.spec b/tests/test_rpm_data/specs/gbp-test-updates-reference.spec
index eae2739a..ff56f589 100644
--- a/tests/test_rpm_data/specs/gbp-test-updates-reference.spec
+++ b/tests/test_rpm_data/specs/gbp-test-updates-reference.spec
@@ -16,7 +16,7 @@ Packager: my_packager
Url: my_url
Vcs: my_vcs
Nosource: 0
-Nopatch: 1
+Nopatch: 0
BuildRoot: my_buildroot
Provides: my_provides
Requires: my_requires
@@ -37,7 +37,7 @@ Package for testing GBP.
%prep
%setup -n my_prefix
-%patch1 my new args
+%patch0 my new args
%build
diff --git a/tests/test_rpm_data/specs/gbp-test-updates.spec b/tests/test_rpm_data/specs/gbp-test-updates.spec
index 0bc15712..dc8ffbf9 100644
--- a/tests/test_rpm_data/specs/gbp-test-updates.spec
+++ b/tests/test_rpm_data/specs/gbp-test-updates.spec
@@ -18,9 +18,9 @@ Url: my_url
Vcs: my_vcs
Source: my_source
Patch: my_%patch_fn_base
-Patch1: my_%{patch_fn_base}1
+Patch0: my_%{patch_fn_base}0
Nosource: 0
-Nopatch: 1
+Nopatch: 0
BuildRoot: my_buildroot
Provides: my_provides
Requires: my_requires
@@ -42,7 +42,7 @@ Package for testing GBP.
%setup -n my_prefix
%patch -b my_patch
-%patch -P1 -b my_patch0
+%patch -P0 -b my_patch0
%build
diff --git a/tests/test_rpm_data/specs/gbp-test2-reference.spec b/tests/test_rpm_data/specs/gbp-test2-reference.spec
index fbb7ad82..e31930d7 100644
--- a/tests/test_rpm_data/specs/gbp-test2-reference.spec
+++ b/tests/test_rpm_data/specs/gbp-test2-reference.spec
@@ -8,10 +8,10 @@ License: GPLv2
Source10: ftp://ftp.host.com/%{name}-%{version}.tar.gz
Source: foo.txt
Source20: bar.tar.gz
-# Gbp-Ignore-Patches: 0
+# Gbp-Ignore-Patches: -1
Patch: my.patch
# Patches auto-generated by git-buildpackage:
-Patch1: new.patch
+Patch0: new.patch
Packager: Markus Lehtonen <markus.lehtonen@linux.intel.com>
%description
@@ -27,7 +27,7 @@ echo "Do things"
# Gbp-Patch-Macros
# new.patch
-%patch1 -p1
+%patch0 -p1
%build
make
diff --git a/tests/test_rpm_data/specs/gbp-test2-reference2.spec b/tests/test_rpm_data/specs/gbp-test2-reference2.spec
index 02356d0a..095600d3 100644
--- a/tests/test_rpm_data/specs/gbp-test2-reference2.spec
+++ b/tests/test_rpm_data/specs/gbp-test2-reference2.spec
@@ -8,10 +8,10 @@ License: GPLv2
Source10: ftp://ftp.host.com/%{name}-%{version}.tar.gz
Source: foo.txt
Source20: bar.tar.gz
-# Gbp-Ignore-Patches: 0
+# Gbp-Ignore-Patches: -1
Patch: my.patch
# Patches auto-generated by git-buildpackage:
-Patch1: new.patch
+Patch0: new.patch
Packager: Markus Lehtonen <markus.lehtonen@linux.intel.com>
VCS: myvcstag
@@ -28,7 +28,7 @@ echo "Do things"
# Gbp-Patch-Macros
# new.patch
-%patch1 -p1
+%patch0 -p1
%build
make