delta: Add an option to specify the format of delta package
This commit is contained in:
@@ -16,6 +16,7 @@ import gettext
|
|||||||
__trans = gettext.translation('pisi', fallback=True)
|
__trans = gettext.translation('pisi', fallback=True)
|
||||||
_ = __trans.ugettext
|
_ = __trans.ugettext
|
||||||
|
|
||||||
|
import pisi
|
||||||
import pisi.cli.command as command
|
import pisi.cli.command as command
|
||||||
import pisi.context as ctx
|
import pisi.context as ctx
|
||||||
|
|
||||||
@@ -52,11 +53,26 @@ class Delta(command.Command):
|
|||||||
default=None,
|
default=None,
|
||||||
help=_("Output directory for produced packages"))
|
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):
|
def run(self):
|
||||||
from pisi.operations.delta import create_delta_package
|
from pisi.operations.delta import create_delta_package
|
||||||
|
|
||||||
self.init(database=False, write=False)
|
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:
|
if len(self.args) != 2:
|
||||||
self.help()
|
self.help()
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -62,7 +62,8 @@ def create_delta_package(old_package, new_package):
|
|||||||
if outdir:
|
if outdir:
|
||||||
deltaname = util.join_path(outdir, deltaname)
|
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()
|
c = os.getcwd()
|
||||||
os.chdir(newpkg_path)
|
os.chdir(newpkg_path)
|
||||||
|
|||||||
Reference in New Issue
Block a user