diff --git a/pisi/cli/commands.py b/pisi/cli/commands.py index ae05e0c8..cc62a695 100644 --- a/pisi/cli/commands.py +++ b/pisi/cli/commands.py @@ -452,6 +452,8 @@ to be downloaded from a repository containing sources. default=False, help=_("Do not install build dependencies, fail if a build dependency is present")) group.add_option("-F", "--package-format", action="store", default='1.1', help=_("PiSi binary package formats: '1.0', '1.1' (default)")) + group.add_option("--use-quilt", action="store_true", + default=False, help=_("Use quilt patch management system instead of GNU patch")) def add_steps_options(self): group = OptionGroup(self.parser, _("build steps")) diff --git a/pisi/constants.py b/pisi/constants.py index 619ce2fd..d2be3af3 100644 --- a/pisi/constants.py +++ b/pisi/constants.py @@ -64,6 +64,7 @@ class Constants: self.__c.work_dir_suffix = "/work" # these, too, because we might wanna change 'em self.__c.install_dir_suffix = "/install" self.__c.debug_dir_suffix = "/debug" + self.__c.quilt_dir_suffix = "/patches" # file/directory names #note: these don't seem very well, constants are used diff --git a/pisi/util.py b/pisi/util.py index 50879540..beebd384 100644 --- a/pisi/util.py +++ b/pisi/util.py @@ -488,7 +488,19 @@ def do_patch(sourceDir, patchFile, level = 0): level = 0 check_file(patchFile) - (ret, out, err) = run_batch("patch -p%d < %s" % + + if ctx.get_option('use_quilt'): + patchesDir = join_path(sourceDir, ctx.const.quilt_dir_suffix) + # Make sure sourceDir/patches directory exists and if not create one! + if not os.path.exists(patchesDir): + os.makedirs(patchesDir) + # Import original patch into quilt tree + (ret, out, err) = run_batch('quilt import -p %d -n %s %s' % (level, os.path.basename(patchFile), patchFile)) + # run quilt push to apply original patch into tree + (ret, out, err) = run_batch('quilt push') + else: + # run GNU patch to apply original patch into tree + (ret, out, err) = run_batch("patch -p%d < %s" % (level, patchFile)) if ret: if out is None and err is None: