Beispiel #1
0
    def build_packages(self):
        """Build each package defined in PSPEC file. After this process there
        will be .pisi files hanging around, AS INTENDED ;)"""
        for package in self.spec.packages:

            # store additional files
            c = os.getcwd()
            os.chdir(self.pspecDir)
            install_dir = self.bctx.pkg_dir() + ctx.const.install_dir_suffix
            for afile in package.additionalFiles:
                src = os.path.join(ctx.const.files_dir, afile.filename)
                dest = os.path.join(install_dir + os.path.dirname(afile.target), os.path.basename(afile.target))
                util.copy_file(src, dest)
                if afile.permission:
                    os.chmod(dest, int(afile.permission) | 0777)

            os.chdir(c)

            name = util.package_name(package.name,
                                     self.spec.source.version,
                                     self.spec.source.release)
            
            ctx.ui.action(_("** Building package %s") % package.name);

            ctx.ui.action(_("Generating %s...") % ctx.const.files_xml)
            self.gen_files_xml(package)
            ctx.ui.info(_(" done."))
           
            ctx.ui.action(_("Generating %s...") % ctx.const.metadata_xml)
            self.gen_metadata_xml(package)
            ctx.ui.info(_(" done."))

            ctx.ui.action(_("Creating PISI package %s") % name)
            
            pkg = Package(name, 'w')

            # add comar files to package
            os.chdir(self.pspecDir)
            for pcomar in package.providesComar:
                fname = os.path.join(ctx.const.comar_dir,
                                     pcomar.script)
                pkg.add_to_package(fname)

            # add xmls and files
            os.chdir(self.bctx.pkg_dir())
        
            pkg.add_to_package(ctx.const.metadata_xml)
            pkg.add_to_package(ctx.const.files_xml)

            # Now it is time to add files to the packages using newly
            # created files.xml
            files = Files()
            files.read(ctx.const.files_xml)
            for finfo in files.list:
                pkg.add_to_package("install/" + finfo.path)

            pkg.close()
            os.chdir(c)
            self.set_state("buildpackages")
            util.xterm_title_reset()
Beispiel #2
0
 def close(self):
     util.xterm_title_reset()
Beispiel #3
0
 def close(self):
     util.xterm_title_reset()
Beispiel #4
0
    def build_packages(self):
        """Build each package defined in PSPEC file. After this process there
        will be .pisi files hanging around, AS INTENDED ;)"""

        # Strip install directory before building .pisi packages.
        self.strip_install_dir()

        for package in self.spec.packages:

            # store additional files
            c = os.getcwd()
            os.chdir(self.pspecDir)
            install_dir = self.bctx.pkg_dir() + ctx.const.install_dir_suffix
            for afile in package.additionalFiles:
                destdir = util.join_path(install_dir, os.path.dirname(afile.target))
                for src in glob.glob(util.join_path(ctx.const.files_dir, afile.filename)):
                    destfile = os.path.basename(afile.target)
                    if not destfile:
                        destfile = os.path.basename(src)
                    ctx.ui.debug(_("Copying additional file: '%s' to '%s' as '%s'") % (src, destdir, destfile))
                    util.copy_file(src, util.join_path(destdir, destfile))
                    if afile.permission:
                        # mode is octal!
                        os.chmod(util.join_path(destdir, destfile), int(afile.permission, 8))

            os.chdir(c)

            ctx.ui.action(_("** Building package %s") % package.name)

            ctx.ui.info(_("Generating %s,") % ctx.const.files_xml)
            self.gen_files_xml(package)

            ctx.ui.info(_("Generating %s,") % ctx.const.metadata_xml)
            self.gen_metadata_xml(package)

            ctx.ui.info(_("Creating PISI package %s.") % package.name)

            name = util.package_name(
                package.name, self.spec.source.version, self.spec.source.release, self.metadata.package.build
            )
            pkg = Package(name, "w")

            # add comar files to package
            os.chdir(self.pspecDir)
            for pcomar in package.providesComar:
                fname = util.join_path(ctx.const.comar_dir, pcomar.script)
                pkg.add_to_package(fname)

            # add xmls and files
            os.chdir(self.bctx.pkg_dir())

            pkg.add_to_package(ctx.const.metadata_xml)
            pkg.add_to_package(ctx.const.files_xml)

            # Now it is time to add files to the packages using newly
            # created files.xml
            files = Files()
            files.read(ctx.const.files_xml)
            for finfo in files.list:
                pkg.add_to_package("install/" + finfo.path)

            pkg.close()
            os.chdir(c)
            self.set_state("buildpackages")
            util.xterm_title_reset()
            ctx.ui.info(_("Done."))

        if ctx.config.values.general.autoclean is True:
            ctx.ui.info(_("Cleaning Build Directory..."))
            util.clean_dir(self.bctx.pkg_dir())
        else:
            ctx.ui.info(_("Keeping Build Directory"))