aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Lehtonen <markus.lehtonen@linux.intel.com>2012-01-12 15:40:54 +0200
committerGuido Günther <agx@sigxcpu.org>2012-02-20 15:43:08 +0100
commit20819006d71274bd809cf3e1aee62382e24200cb (patch)
tree22e43307f13a7c9ec0b6a2d47d0d0807617bb12a
parent8acec833e27892f74d10811cf95516b4380234ba (diff)
gbp-pq: refactor args of write_patch()
Allows defining the formerly hardcoded patch_dir. This makes write_patch() re-usable in the upcoming RPM-tools. Signed-off-by: Guido Günther <agx@sigxcpu.org>
-rwxr-xr-xgbp/scripts/pq.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/gbp/scripts/pq.py b/gbp/scripts/pq.py
index ec9ae6d..ad94525 100755
--- a/gbp/scripts/pq.py
+++ b/gbp/scripts/pq.py
@@ -72,10 +72,10 @@ def pq_branch_base(pq_branch):
if is_pq_branch(pq_branch):
return pq_branch[len(PQ_BRANCH_PREFIX):]
-def write_patch(patch, options):
+def write_patch(patch, patch_dir, options):
"""Write the patch exported by 'git-format-patch' to it's final location
(as specified in the commit)"""
- oldname = patch[len(PATCH_DIR):]
+ oldname = os.path.basename(patch)
newname = oldname
tmpname = patch + ".gbp"
old = file(patch, 'r')
@@ -101,9 +101,9 @@ def write_patch(patch, options):
newname = m.group('name')
if topic:
- topicdir = os.path.join(PATCH_DIR, topic)
+ topicdir = os.path.join(patch_dir, topic)
else:
- topicdir = PATCH_DIR
+ topicdir = patch_dir
if not os.path.isdir(topicdir):
os.makedirs(topicdir, 0755)
@@ -139,7 +139,7 @@ def export_patches(repo, branch, options):
f = file(SERIES_FILE, 'w')
gbp.log.info("Regenerating patch queue in '%s'." % PATCH_DIR)
for patch in patches:
- filename = write_patch(patch, options)
+ filename = write_patch(patch, PATCH_DIR, options)
f.write(filename[len(PATCH_DIR):] + '\n')
f.close()