control: tag -1 +patch On Wed, Aug 17, 2016 at 12:15:35PM +0300, Tzafrir Cohen wrote: > > When exporting a patch series using 'gbp pq-rpm export', spec is updated > to include them. However the patches are included with full pathes.
Patch attached: if patch file is under the working directory, a relative path is used. -- Tzafrir Cohen | tzaf...@jabber.org | VIM is http://tzafrir.org.il | | a Mutt's tzaf...@cohens.org.il | | best tzaf...@debian.org | | friend
>From 972edd2445c09544cb6c480daaada7b25211230c Mon Sep 17 00:00:00 2001 From: Tzafrir Cohen <tzaf...@debian.org> Date: Wed, 16 Nov 2016 18:15:14 +0200 Subject: [PATCH] rpm: pq-rpm export: relative patch names 'gbp pq-rpm export' will now create relative file names instead of absolute ones. --- gbp/rpm/__init__.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/gbp/rpm/__init__.py b/gbp/rpm/__init__.py index 5a9a668..2d37cca 100644 --- a/gbp/rpm/__init__.py +++ b/gbp/rpm/__init__.py @@ -678,11 +678,14 @@ class SpecFile(object): comment_text = "# Patches auto-generated by git-buildpackage:\n" tag_line = self._content.insert_after(tag_line, comment_text) for ind, patch in enumerate(patches): + patch_path = patch + if patch.find(os.getcwd()) == 0: + patch_path = os.path.relpath(patch) cmds = commands[patch] if patch in commands else {} patchnum = startnum + ind - tag_line = self._set_tag("Patch", patchnum, patch, tag_line) + tag_line = self._set_tag("Patch", patchnum, patch_path, tag_line) # Add '%patch' macro and a preceding comment line - comment_text = "# %s\n" % patch + comment_text = "# %s\n" % patch_path macro_line = self._content.insert_after(macro_line, comment_text) macro_line = self._set_special_macro('patch', patchnum, '-p1', macro_line) -- 2.10.2