Example #1
0
    def start(self):
        assert not self.pakfire.initialized, "Pakfire has already been initialized"

        # Unshare namepsace.
        # If this fails because the kernel has no support for CLONE_NEWIPC or CLONE_NEWUTS,
        # we try to fall back to just set CLONE_NEWNS.
        try:
            _pakfire.unshare(_pakfire.SCHED_CLONE_NEWNS | _pakfire.SCHED_CLONE_NEWIPC | _pakfire.SCHED_CLONE_NEWUTS)
        except RuntimeError, e:
            _pakfire.unshare(_pakfire.SCHED_CLONE_NEWNS)
Example #2
0
    def start(self):
        assert not self.pakfire.initialized, "Pakfire has already been initialized"

        # Unshare namepsace.
        # If this fails because the kernel has no support for CLONE_NEWIPC or CLONE_NEWUTS,
        # we try to fall back to just set CLONE_NEWNS.
        try:
            _pakfire.unshare(_pakfire.SCHED_CLONE_NEWNS
                             | _pakfire.SCHED_CLONE_NEWIPC
                             | _pakfire.SCHED_CLONE_NEWUTS)
        except RuntimeError, e:
            _pakfire.unshare(_pakfire.SCHED_CLONE_NEWNS)
Example #3
0
        except OSError, e:
            if e.errno == 30:  # Read-only FS
                raise BuildError, "Buildroot is read-only: %s" % self.pakfire.path

            # Raise all other errors.
            raise

        # Lock the build environment.
        self.lock()

        # Initialize pakfire instance.
        self.pakfire.initialize()

        # Optionally enable private networking.
        if self.settings.get("private_network", None):
            _pakfire.unshare(_pakfire.SCHED_CLONE_NEWNET)

        # Populate /dev.
        self.populate_dev()

        # Setup domain name resolution in chroot.
        self.setup_dns()

        # Extract all needed packages.
        self.extract()

    def stop(self):
        if self.cgroup:
            # Move the builder process out of the cgroup.
            self.cgroup.migrate_task(self.cgroup.parent, os.getpid())
Example #4
0
        except OSError, e:
            if e.errno == 30:  # Read-only FS
                raise BuildError, "Buildroot is read-only: %s" % self.pakfire.path

                # Raise all other errors.
            raise

            # Lock the build environment.
        self.lock()

        # Initialize pakfire instance.
        self.pakfire.initialize()

        # Optionally enable private networking.
        if self.settings.get("private_network", None):
            _pakfire.unshare(_pakfire.SCHED_CLONE_NEWNET)

            # Populate /dev.
        self.populate_dev()

        # Setup domain name resolution in chroot.
        self.setup_dns()

        # Extract all needed packages.
        self.extract()

    def stop(self):
        if self.cgroup:
            # Move the builder process out of the cgroup.
            self.cgroup.migrate_task(self.cgroup.parent, os.getpid())