示例#1
0
    def _unpack_exit(self, unpack_phase):

        if self._default_exit(unpack_phase) != os.EX_OK:
            self.wait()
            return

        ebuild_phases = TaskSequence(scheduler=self.scheduler)

        pkg = self.pkg
        phases = self._phases
        eapi = pkg.eapi
        if not eapi_has_src_prepare_and_src_configure(eapi):
            # skip src_prepare and src_configure
            phases = phases[2:]

        for phase in phases:
            ebuild_phases.add(
                EbuildPhase(
                    background=self.background,
                    phase=phase,
                    scheduler=self.scheduler,
                    settings=self.settings,
                ))

        self._start_task(ebuild_phases, self._default_final_exit)
示例#2
0
    def _start(self):
        if isinstance(self.commands, list):
            cmds = [({}, self.commands)]
        else:
            cmds = list(self.commands)

        if 'selinux' not in self.settings.features:
            cmds = [(kwargs, commands) for kwargs, commands in cmds
                    if not kwargs.get('selinux_only')]

        tasks = TaskSequence()
        for kwargs, commands in cmds:
            # Select args intended for MiscFunctionsProcess.
            kwargs = dict((k, v) for k, v in kwargs.items()
                          if k in ('ld_preload_sandbox', ))
            tasks.add(
                MiscFunctionsProcess(background=self.background,
                                     commands=commands,
                                     fd_pipes=self.fd_pipes,
                                     logfile=self.logfile,
                                     phase=self.phase,
                                     scheduler=self.scheduler,
                                     settings=self.settings,
                                     **kwargs))

        self._start_task(tasks, self._commands_exit)
示例#3
0
	def _build_exit(self, build):
		if self._default_exit(build) != os.EX_OK:
			self._unlock_builddir()
			self.wait()
			return

		buildpkg = self._buildpkg

		if not buildpkg:
			self._final_exit(build)
			self.wait()
			return

		if self._issyspkg:
			msg = ">>> This is a system package, " + \
				"let's pack a rescue tarball.\n"
			self.scheduler.output(msg,
				log_path=self.settings.get("PORTAGE_LOG_FILE"))

		binpkg_tasks = TaskSequence()
		requested_binpkg_formats = self.settings.get("PORTAGE_BINPKG_FORMAT", "tar").split()
		for pkg_fmt in portage.const.SUPPORTED_BINPKG_FORMATS:
			if pkg_fmt in requested_binpkg_formats:
				if pkg_fmt == "rpm":
					binpkg_tasks.add(EbuildPhase(background=self.background,
						phase="rpm", scheduler=self.scheduler,
						settings=self.settings))
				else:
					binpkg_tasks.add(EbuildBinpkg(background=self.background,
						pkg=self.pkg, scheduler=self.scheduler,
						settings=self.settings))

		self._start_task(binpkg_tasks, self._buildpkg_exit)
示例#4
0
    def _unpack_exit(self, unpack_phase):

        if self._default_exit(unpack_phase) != os.EX_OK:
            self.wait()
            return

        ebuild_phases = TaskSequence(scheduler=self.scheduler)

        pkg = self.pkg
        phases = self._phases
        eapi = pkg.metadata["EAPI"]
        if eapi in ("0", "1"):
            # skip src_prepare and src_configure
            phases = phases[2:]

        for phase in phases:
            ebuild_phases.add(
                EbuildPhase(background=self.background,
                            pkg=self.pkg,
                            phase=phase,
                            scheduler=self.scheduler,
                            settings=self.settings,
                            tree=self._tree))

        self._start_task(ebuild_phases, self._default_final_exit)
示例#5
0
    def _build_exit(self, build):
        if self._default_exit(build) != os.EX_OK:
            self._async_unlock_builddir(returncode=self.returncode)
            return

        buildpkg = self._buildpkg

        if not buildpkg:
            self._final_exit(build)
            self.wait()
            return

        if self._issyspkg:
            msg = ">>> This is a system package, " + "let's pack a rescue tarball.\n"
            self.scheduler.output(msg, log_path=self.settings.get("PORTAGE_LOG_FILE"))

        binpkg_tasks = TaskSequence()
        requested_binpkg_formats = self.settings.get(
            "PORTAGE_BINPKG_FORMAT", "tar"
        ).split()
        for pkg_fmt in portage.const.SUPPORTED_BINPKG_FORMATS:
            if pkg_fmt in requested_binpkg_formats:
                if pkg_fmt == "rpm":
                    binpkg_tasks.add(
                        EbuildPhase(
                            background=self.background,
                            phase="rpm",
                            scheduler=self.scheduler,
                            settings=self.settings,
                        )
                    )
                else:
                    task = EbuildBinpkg(
                        background=self.background,
                        pkg=self.pkg,
                        scheduler=self.scheduler,
                        settings=self.settings,
                    )
                    binpkg_tasks.add(task)
                    # Guarantee that _record_binpkg_info is called
                    # immediately after EbuildBinpkg. Note that
                    # task.addExitListener does not provide the
                    # necessary guarantee (see bug 578204).
                    binpkg_tasks.add(
                        self._RecordBinpkgInfo(ebuild_binpkg=task, ebuild_build=self)
                    )

        if binpkg_tasks:
            self._start_task(binpkg_tasks, self._buildpkg_exit)
            return

        self._final_exit(build)
        self.wait()
示例#6
0
	def _unpack_exit(self, unpack_phase):

		if self._default_exit(unpack_phase) != os.EX_OK:
			self.wait()
			return

		ebuild_phases = TaskSequence(scheduler=self.scheduler)

		pkg = self.pkg
		phases = self._phases
		eapi = pkg.metadata["EAPI"]
		if not eapi_has_src_prepare_and_src_configure(eapi):
			# skip src_prepare and src_configure
			phases = phases[2:]

		for phase in phases:
			ebuild_phases.add(EbuildPhase(background=self.background,
				phase=phase, scheduler=self.scheduler,
				settings=self.settings))

		self._start_task(ebuild_phases, self._default_final_exit)
示例#7
0
	def _start(self):
		if isinstance(self.commands, list):
			cmds = [({}, self.commands)]
		else:
			cmds = list(self.commands)

		if 'selinux' not in self.settings.features:
			cmds = [(kwargs, commands) for kwargs, commands in
				cmds if not kwargs.get('selinux_only')]

		tasks = TaskSequence()
		for kwargs, commands in cmds:
			# Select args intended for MiscFunctionsProcess.
			kwargs = dict((k, v) for k, v in kwargs.items()
				if k in ('ld_preload_sandbox',))
			tasks.add(MiscFunctionsProcess(background=self.background,
				commands=commands, fd_pipes=self.fd_pipes,
				logfile=self.logfile, phase=self.phase,
				scheduler=self.scheduler, settings=self.settings, **kwargs))

		self._start_task(tasks, self._default_final_exit)
	def _unpack_exit(self, unpack_phase):

		if self._default_exit(unpack_phase) != os.EX_OK:
			self.wait()
			return

		ebuild_phases = TaskSequence(scheduler=self.scheduler)

		pkg = self.pkg
		phases = self._phases
		eapi = pkg.metadata["EAPI"]
		if eapi in ("0", "1"):
			# skip src_prepare and src_configure
			phases = phases[2:]

		for phase in phases:
			ebuild_phases.add(EbuildPhase(background=self.background,
				pkg=self.pkg, phase=phase, scheduler=self.scheduler,
				settings=self.settings, tree=self._tree))

		self._start_task(ebuild_phases, self._install_exit)
示例#9
0
	def _build_exit(self, build):
		if self._default_exit(build) != os.EX_OK:
			self._unlock_builddir()
			self.wait()
			return

		buildpkg = self._buildpkg

		if not buildpkg:
			self._final_exit(build)
			self.wait()
			return

		if self._issyspkg:
			msg = ">>> This is a system package, " + \
				"let's pack a rescue tarball.\n"
			self.scheduler.output(msg,
				log_path=self.settings.get("PORTAGE_LOG_FILE"))

		binpkg_tasks = TaskSequence()
		requested_binpkg_formats = self.settings.get("PORTAGE_BINPKG_FORMAT", "tar").split()
		for pkg_fmt in portage.const.SUPPORTED_BINPKG_FORMATS:
			if pkg_fmt in requested_binpkg_formats:
				if pkg_fmt == "rpm":
					binpkg_tasks.add(EbuildPhase(background=self.background,
						phase="rpm", scheduler=self.scheduler,
						settings=self.settings))
				else:
					task = EbuildBinpkg(
						background=self.background,
						pkg=self.pkg, scheduler=self.scheduler,
						settings=self.settings)
					binpkg_tasks.add(task)
					# Guarantee that _record_binpkg_info is called
					# immediately after EbuildBinpkg. Note that
					# task.addExitListener does not provide the
					# necessary guarantee (see bug 578204).
					binpkg_tasks.add(self._RecordBinpkgInfo(
						ebuild_binpkg=task, ebuild_build=self))

		if binpkg_tasks:
			self._start_task(binpkg_tasks, self._buildpkg_exit)
			return

		self._final_exit(build)
		self.wait()
示例#10
0
    def _build_exit(self, build):
        if self._default_exit(build) != os.EX_OK:
            self._unlock_builddir()
            self.wait()
            return

        buildpkg = self._buildpkg

        if not buildpkg:
            self._final_exit(build)
            self.wait()
            return

        if self._issyspkg:
            msg = ">>> This is a system package, " + \
             "let's pack a rescue tarball.\n"
            self.scheduler.output(
                msg, log_path=self.settings.get("PORTAGE_LOG_FILE"))

        binpkg_tasks = TaskSequence()
        requested_binpkg_formats = self.settings.get("PORTAGE_BINPKG_FORMAT",
                                                     "tar").split()
        for pkg_fmt in portage.const.SUPPORTED_BINPKG_FORMATS:
            if pkg_fmt in requested_binpkg_formats:
                if pkg_fmt == "rpm":
                    binpkg_tasks.add(
                        EbuildPhase(background=self.background,
                                    phase="rpm",
                                    scheduler=self.scheduler,
                                    settings=self.settings))
                else:
                    task = EbuildBinpkg(background=self.background,
                                        pkg=self.pkg,
                                        scheduler=self.scheduler,
                                        settings=self.settings)
                    binpkg_tasks.add(task)
                    task.addExitListener(self._record_binpkg_info)

        if binpkg_tasks:
            self._start_task(binpkg_tasks, self._buildpkg_exit)
            return

        self._final_exit(build)
        self.wait()