From 7f6b686835af559d2e7a8765f0e07e94560feaa9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fatih=20A=C5=9F=C4=B1c=C4=B1?= Date: Fri, 26 Jun 2009 05:47:55 +0000 Subject: [PATCH] Pass relative paths of patches to quilt. This makes the patches directory have the same structure as the files directory of package. --- ChangeLog | 5 +++++ pisi/operations/build.py | 5 +++-- pisi/util.py | 7 +++++-- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 84604c92..a01496d8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2009-06-26 Fatih Aşıcı + * Pass relative paths of patches to quilt. This makes the + patches directory have the same structure as the files + directory of package. + 2009-06-16 Fatih Aşıcı * Fix resetting of the environment. diff --git a/pisi/operations/build.py b/pisi/operations/build.py index cd20c86b..ca3704b6 100644 --- a/pisi/operations/build.py +++ b/pisi/operations/build.py @@ -596,14 +596,15 @@ class Builder: for patch in self.spec.source.patches: patchFile = pisi.util.join_path(files_dir, patch.filename) + relativePath = patch.filename if patch.compressionType: patchFile = pisi.util.uncompress(patchFile, compressType=patch.compressionType, targetDir=ctx.config.tmp_dir()) + relativePath = relativePath.rsplit(".%s" % patch.compressionType, 1)[0] ctx.ui.action(_("* Applying patch: %s") % patch.filename) - pisi.util.do_patch(self.srcDir, patchFile, level=patch.level) - return True + pisi.util.do_patch(self.srcDir, patchFile, level=patch.level, name=relativePath) return True def generate_static_package_object(self): diff --git a/pisi/util.py b/pisi/util.py index 80ce9bd0..6015b48d 100644 --- a/pisi/util.py +++ b/pisi/util.py @@ -443,7 +443,7 @@ def uncompress(patchFile, compressType="gz", targetDir=None): return filePath -def do_patch(sourceDir, patchFile, level = 0): +def do_patch(sourceDir, patchFile, level=0, name=None): """Apply given patch to the sourceDir.""" cwd = os.getcwd() os.chdir(sourceDir) @@ -451,6 +451,9 @@ def do_patch(sourceDir, patchFile, level = 0): if level == None: level = 0 + if name is None: + name = os.path.basename(patchFile) + check_file(patchFile) if ctx.get_option('use_quilt'): @@ -459,7 +462,7 @@ def do_patch(sourceDir, patchFile, level = 0): if not os.path.exists(patchesDir): os.makedirs(patchesDir) # Import original patch into quilt tree - (ret, out, err) = run_batch('quilt import -p %d -P %s \"%s\"' % (level, os.path.basename(patchFile), patchFile)) + (ret, out, err) = run_batch('quilt import -p %d -P %s \"%s\"' % (level, name, patchFile)) # run quilt push to apply original patch into tree (ret, out, err) = run_batch('quilt push') else: