Skip to content
Snippets Groups Projects
Commit 5d7ae8f8 authored by Xavier Claessens's avatar Xavier Claessens
Browse files

package: Add --embed-deps command line option

When building tarball for a package, this option also pulls
all package's deps (recursively) files into the tarball.

https://bugzilla.gnome.org/show_bug.cgi?id=765554
parent 49ec6ce0
No related branches found
No related tags found
No related merge requests found
......@@ -45,6 +45,10 @@ class Package(Command):
default=False,
help=_('(only meaningfull when --tarball is set) Create one single '
'tarball with devel and runtime files')),
ArgparseArgument('-e', '--embed-deps', action='store_true',
default=False,
help=_('(only meaningfull when --tarball is set) Also copy'
'files from dependecies')),
ArgparseArgument('-f', '--force', action='store_true',
default=False, help=_('Delete any existing package file')),
ArgparseArgument('-d', '--no-devel', action='store_false',
......@@ -83,7 +87,8 @@ class Package(Command):
m.action(_("Creating package for %s") % p.name)
if args.tarball:
paths = pkg.pack(os.path.abspath(args.output_dir), args.no_devel,
args.force, args.keep_temp, split=not args.no_split)
args.force, args.keep_temp, split=not args.no_split,
embed_deps=args.embed_deps)
else:
paths = pkg.pack(os.path.abspath(args.output_dir), args.no_devel,
args.force, args.keep_temp)
......
......@@ -38,7 +38,8 @@ class PackagerBase(object):
self.package = package
self.store = store
def pack(self, output_dir, devel=True, force=False, keep_temp=False):
def pack(self, output_dir, devel=True, force=False, keep_temp=False,
embed_deps=False):
'''
Creates a package and puts it the the output directory
......@@ -50,6 +51,8 @@ class PackagerBase(object):
@type force: bool
@param keep_temp: do not delete temporary files
@type force: bool
@cvar embed_deps: include dependencies in the final package
@type embed_deps: boolean
@return: list of filenames for the packages created
@rtype: list
......@@ -60,12 +63,20 @@ class PackagerBase(object):
self.devel = devel
self.force = force
self.keep_temp = keep_temp
self.embed_deps=embed_deps
def files_list(self, package_type, force):
if package_type == PackageType.DEVEL:
files = self.package.devel_files_list()
else:
files = self.package.files_list()
files=[]
packages=[self.package]
if self.embed_deps:
packages.extend(self.store.get_package_deps(self.package,
recursive=True))
for p in packages:
if package_type == PackageType.DEVEL:
files.extend(p.devel_files_list())
else:
files.extend(p.files_list())
real_files = []
for f in files:
if os.path.exists(os.path.join(self.config.prefix, f)):
......
......@@ -37,7 +37,10 @@ class DistTarball(PackagerBase):
self.package_prefix = '%s-' % self.config.packages_prefix
def pack(self, output_dir, devel=True, force=False, keep_temp=False,
split=True, package_prefix=''):
split=True, package_prefix='', embed_deps=False):
super(DistTarball, self).pack(output_dir, devel, force, keep_temp,
embed_deps)
try:
dist_files = self.files_list(PackageType.RUNTIME, force)
except EmptyPackageError:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment