From ea028f7d8b74474101e410612258262887d8327b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fatih=20A=C5=9F=C4=B1c=C4=B1?= Date: Mon, 21 Jun 2010 09:35:04 +0000 Subject: [PATCH] delta: Add an option to specify the format of delta package --- pisi/cli/delta.py | 16 ++++++++++++++++ pisi/operations/delta.py | 3 ++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/pisi/cli/delta.py b/pisi/cli/delta.py index 8155a06d..f3fbd971 100644 --- a/pisi/cli/delta.py +++ b/pisi/cli/delta.py @@ -16,6 +16,7 @@ import gettext __trans = gettext.translation('pisi', fallback=True) _ = __trans.ugettext +import pisi import pisi.cli.command as command import pisi.context as ctx @@ -52,11 +53,26 @@ class Delta(command.Command): default=None, help=_("Output directory for produced packages")) + group.add_option("-F", "--package-format", + action="store", + help=_("Create the binary package using the given " + "format. Use '-F help' to see a list of " + "supported formats.")) + def run(self): from pisi.operations.delta import create_delta_package self.init(database=False, write=False) + if self.options.package_format == "help": + ctx.ui.info(_("Supported package formats:")) + for format in pisi.package.Package.formats: + if format == pisi.package.Package.default_format: + ctx.ui.info(_(" %s (default)") % format) + else: + ctx.ui.info(" %s" % format) + return + if len(self.args) != 2: self.help() return diff --git a/pisi/operations/delta.py b/pisi/operations/delta.py index 760326da..2aa8c0d1 100644 --- a/pisi/operations/delta.py +++ b/pisi/operations/delta.py @@ -62,7 +62,8 @@ def create_delta_package(old_package, new_package): if outdir: deltaname = util.join_path(outdir, deltaname) - deltapkg = pisi.package.Package(deltaname, "w") + deltapkg = pisi.package.Package(deltaname, "w", + format=ctx.get_option("package_format")) c = os.getcwd() os.chdir(newpkg_path)