summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMarkus Lehtonen <markus.lehtonen@linux.intel.com>2013-01-11 16:28:05 +0200
committerMarkus Lehtonen <markus.lehtonen@linux.intel.com>2014-01-14 13:48:22 +0200
commitf56cd8d277d93254a221176c85ed5be1ce4028dd (patch)
treecb94cce134f82e3f29b4222373cc88adebac245f /tests
parent63fb45285be7bf8fa701b9b266cebd13fae2de59 (diff)
downloadgit-buildpackage-f56cd8d277d93254a221176c85ed5be1ce4028dd.tar.gz
git-buildpackage-f56cd8d277d93254a221176c85ed5be1ce4028dd.tar.bz2
git-buildpackage-f56cd8d277d93254a221176c85ed5be1ce4028dd.zip
rpm helpers: implement _set/delete_special_macro() methods
Currently intended for updating '%patch' macros. Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/test_rpm.py12
-rw-r--r--tests/test_rpm_data/specs/gbp-test-updates-reference.spec3
-rw-r--r--tests/test_rpm_data/specs/gbp-test-updates.spec6
3 files changed, 19 insertions, 2 deletions
diff --git a/tests/test_rpm.py b/tests/test_rpm.py
index 88eb571f..ec2c834a 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):
@@ -208,6 +208,16 @@ class TestSpecFile(object):
# Check that setting invalid tag with public method fails
spec.set_tag('invalidtag', None, 'value')
+ # Mangle macros
+ prev = spec.protected('_delete_special_macro')('patch', 0)
+ spec.protected('_delete_special_macro')('patch', 123)
+ spec.protected('_set_special_macro')('patch', 1, 'my new args', prev)
+ with assert_raises(GbpError):
+ spec.protected('_delete_special_macro')('invalidmacro', 0)
+ with assert_raises(GbpError):
+ spec.protected('_set_special_macro')('invalidmacro', 0, 'args',
+ prev)
+
# Check resulting spec file
spec.write_spec_file()
assert filecmp.cmp(tmp_spec, reference_spec) is True
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 557f8b77..e6e6846c 100644
--- a/tests/test_rpm_data/specs/gbp-test-updates-reference.spec
+++ b/tests/test_rpm_data/specs/gbp-test-updates-reference.spec
@@ -33,6 +33,9 @@ Collections: my_collections
Package for testing GBP.
%prep
+%setup -n my_prefix
+
+%patch1 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 1cdcb212..19912442 100644
--- a/tests/test_rpm_data/specs/gbp-test-updates.spec
+++ b/tests/test_rpm_data/specs/gbp-test-updates.spec
@@ -18,7 +18,7 @@ Url: my_url
Vcs: my_vcs
Source: my_source
Patch: my_%patch_fn_base
-Patch0: my_%{patch_fn_base}0
+Patch1: my_%{patch_fn_base}1
BuildRoot: my_buildroot
Provides: my_provides
Requires: my_requires
@@ -37,6 +37,10 @@ Collections: my_collections
Package for testing GBP.
%prep
+%setup -n my_prefix
+
+%patch -b my_patch
+%patch -P1 -b my_patch0
%build