delta: Add an option to specify the format of delta package

This commit is contained in:
Fatih Aşıcı
2010-06-21 09:35:04 +00:00
parent ce80458eed
commit ea028f7d8b
2 changed files with 18 additions and 1 deletions
+16
View File
@@ -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
+2 -1
View File
@@ -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)