if m.group('name').lower() == 'ignore-patches':
dataitems = m.group('args').strip().split()
ignorepatch = sorted([int(num) for num in dataitems])
+ elif m.group('name').lower() == 'patch-macros':
+ ret['patchmacrostart'] = lineobj
else:
gbp.log.info("Found unrecognized Gbp tag on line %s: "
"'%s'" % (i, line))
"git-buildpackage:\n")
# Determine where to add %patch macro lines
- if last_removed_macro_line:
+ if 'patchmacrostart' in loc:
+ gbp.log.debug("Adding patch macros after the start marker")
+ line = loc['patchmacrostart']
+ elif last_removed_macro_line:
gbp.log.debug("Adding patch macros in place of the removed macros")
line = last_removed_macro_line
elif 'lastpatchmacro' in loc:
spec = SpecFile(tmp_spec)
spec.update_patches(['new.patch'])
spec.write_spec_file()
+ assert filecmp.cmp(tmp_spec, reference_spec) is True
+ # Test a second spec file
+ shutil.copy2(os.path.join(SPEC_DIR, 'gbp-test2.spec'), tmp_spec)
+ reference_spec = os.path.join(SPEC_DIR, 'gbp-test2-reference.spec')
+ spec = SpecFile(tmp_spec)
+ spec.update_patches(['new.patch'])
+ spec.write_spec_file()
assert filecmp.cmp(tmp_spec, reference_spec) is True
def test_quirks(self):
%patch
%patch -P 10 -p1
+echo "Do things"
+
+# Gbp-Patch-Macros
%build
make
--- /dev/null
+Name: gbp-test2
+Summary: Test package 2 for git-buildpackage
+Epoch: 2
+Version: 3.0
+Release: 0
+Group: Development/Libraries
+License: GPLv2
+Source10: ftp://ftp.host.com/%{name}-%{version}.tar.gz
+Source: foo.txt
+Source20: bar.tar.gz
+# Gbp-Ignore-Patches: 0
+Patch: my.patch
+# Patches auto-generated by git-buildpackage:
+Patch1: new.patch
+Packager: Markus Lehtonen <markus.lehtonen@linux.intel.com>
+
+%description
+Package for testing the RPM functionality of git-buildpackage.
+
+
+%prep
+%setup -T -n %{name}-%{version} -c -a 10
+
+%patch
+
+echo "Do things"
+
+# Gbp-Patch-Macros
+# new.patch
+%patch1 -p1
+
+%build
+make
+
+
+%install
+rm -rf %{buildroot}
+mkdir -p %{buildroot}/%{_datadir}/%{name}
+cp -R * %{buildroot}/%{_datadir}/%{name}
+install %{SOURCE0} %{buildroot}/%{_datadir}/%{name}
+
+
+
+%files
+%defattr(-,root,root,-)
+%dir %{_datadir}/%{name}
+%{_datadir}/%{name}