[jhbuild] [tarball] look for patch files in more places (GNOME #582829)



commit 1da636d535b4ebcd4fd66c7f533135a59a40c77f
Author: Frédéric Péters <fpeters 0d be>
Date:   Sat May 16 12:27:23 2009 +0200

    [tarball] look for patch files in more places (GNOME #582829)
---
 jhbuild/versioncontrol/tarball.py |   22 ++++++++++++++--------
 1 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/jhbuild/versioncontrol/tarball.py b/jhbuild/versioncontrol/tarball.py
index e91a172..2b44a58 100644
--- a/jhbuild/versioncontrol/tarball.py
+++ b/jhbuild/versioncontrol/tarball.py
@@ -36,9 +36,6 @@ from jhbuild.utils.unpack import unpack_archive
 from jhbuild.utils import httpcache
 from jhbuild.utils.sxml import sxml
 
-jhbuild_directory = os.path.abspath(os.path.join(os.path.dirname(__file__),
-                                                 '..', '..'))
-
 
 class TarballRepository(Repository):
     """A class representing a Tarball repository.
@@ -240,11 +237,20 @@ class TarballBranch(Branch):
                         continue
                     break
                 else:
-                    # not found, fallback to jhbuild provided patches
-                    patchfile = os.path.join(jhbuild_directory, 'patches', patch)
-            else:
-                # nothing else, use jbuild provided patches
-                patchfile = os.path.join(jhbuild_directory, 'patches', patch)
+                    patchfile = ''
+
+            if not patchfile:
+                # nothing else, use jhbuild provided patches
+                for dirname in (
+                        os.path.join(self.config.modulesets_dir, 'patches'),
+                        os.path.join(self.config.modulesets_dir, '../patches'),
+                        os.path.join(PKGDATADIR, 'patches', patch),
+                        os.path.join(SRCDIR, 'patches', patch)):
+                    patchfile = os.path.join(dirname, patch)
+                    if os.path.exists(patchfile):
+                        break
+                else:
+                    raise CommandError(_('Failed to find patch: %s') % patch)
 
             buildscript.set_action(_('Applying patch'), self, action_target=patch)
             buildscript.execute('patch -p%d < "%s"'



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]