Esempio n. 1
0
 def _create_product(self):
     packagebuild = PackageBuild()
     resources = self._copy_scripts()
     app_pkg_name = self._package_name('.pkg')
     app_pkg = os.path.join(self.tmp, app_pkg_name)
     packagebuild.create_package(self.approot,
                                 self.package.identifier(),
                                 self.package.version,
                                 self.package.shortdesc,
                                 app_pkg,
                                 '/Applications',
                                 scripts_path=resources)
     self.package.packages = [(self.package.name, True, True)]
     m.action(_("Creating Distribution.xml for package %s " % self.package))
     distro = DistributionXML(self.package,
                              self.store,
                              self.tmp, {self.package: app_pkg_name},
                              self.store.get_package_deps(self.package),
                              PackageType.RUNTIME,
                              self.config.target_arch,
                              home_folder=False)
     distro_path = tempfile.NamedTemporaryFile().name
     distro.write(distro_path)
     output_file = os.path.join(self.output_dir, self._package_name('.pkg'))
     output_file = os.path.abspath(output_file)
     pb = ProductBuild()
     pb.create_package(distro_path, output_file,
                       [self.package.relative_path('.'), self.tmp])
     return output_file
Esempio n. 2
0
 def _create_package(self, package_type, output_dir, force):
     self.package.set_mode(package_type)
     files = self.files_list(package_type, force)
     output_file = os.path.join(output_dir, '%s-%s-%s.pkg' %
             (self.package.name, self.version, self.config.target_arch))
     tmp, root, resources = self._create_bundle(files, package_type)
     packagebuild = PackageBuild()
     packagebuild.create_package(root, self.package.identifier(),
         self.package.version, self.package.shortdesc, output_file,
         self._get_install_dir(), scripts_path=resources)
     shutil.rmtree(tmp)
     return output_file
    def _create_package(self, output_dir, install_dir, version, root):
        output_file = os.path.join(output_dir, '%s-%s-%s.pkg' %
                (self.name, self.package.version,
                 self.config.target_arch))
        if not root:
            root = self.create_bundle()

        resources = tempfile.mkdtemp()
        if os.path.exists(self.package.resources_preinstall):
            shutil.copy(os.path.join(self.package.resources_preinstall),
                        os.path.join(resources, 'preinstall'))
        if os.path.exists(self.package.resources_postinstall):
            shutil.copy(os.path.join(self.package.resources_postinstall),
                        os.path.join(resources, 'postinstall'))
        packagebuild = PackageBuild()
        packagebuild.create_package(root, self.package.identifier(),
            self.package.version, self.title, output_file, install_dir,
            resources)
        shutil.rmtree(resources)
        return output_file