Пример #1
0
 def __init__(self,
              recipes,
              cookbook,
              force=False,
              no_deps=False,
              missing_files=False,
              dry_run=False,
              deps_only=False,
              jobs=None):
     if isinstance(recipes, Recipe):
         recipes = [recipes]
     self.recipes = recipes
     self.cookbook = cookbook
     self.force = force
     self.no_deps = no_deps
     self.missing_files = missing_files
     self.config = cookbook.get_config()
     self.interactive = self.config.interactive
     self.deps_only = deps_only
     shell.DRY_RUN = dry_run
     self.jobs = jobs
     if not self.jobs:
         self.jobs = determine_num_of_cpus()
     if self.config.platform == Platform.WINDOWS:
         self._build_lock = asyncio.Semaphore(self.jobs / 2)
     else:
         self._build_lock = asyncio.Semaphore(2)
     # Can't install in parallel because of the risk of two recipes writing
     # to the same file at the same time. TODO: Need to use DESTDIR + prefix
     # merging + file list tracking for collision detection before we can
     # enable this.
     self._install_lock = asyncio.Lock()
Пример #2
0
from pathlib import Path, PurePath
from distutils.version import StrictVersion

from cerbero.enums import Platform
from cerbero.utils import _, system_info, to_unixpath, determine_num_of_cpus, CerberoSemaphore
from cerbero.utils import messages as m
from cerbero.errors import CommandError, FatalError

PATCH = 'patch'
TAR = 'tar'
TARBALL_SUFFIXES = ('tar.gz', 'tgz', 'tar.bz2', 'tbz2', 'tar.xz')
SUBPROCESS_EXCEPTIONS = (FileNotFoundError, PermissionError,
                         subprocess.CalledProcessError)

PLATFORM = system_info()[0]
CPU_BOUND_SEMAPHORE = CerberoSemaphore(determine_num_of_cpus())
NON_CPU_BOUND_SEMAPHORE = CerberoSemaphore(2)
DRY_RUN = False


def _fix_mingw_cmd(path):
    reserved = ['/', ' ', '\\', ')', '(', '"']
    l_path = list(path)
    for i in range(len(path)):
        if path[i] == '\\':
            if i + 1 == len(path) or path[i + 1] not in reserved:
                l_path[i] = '/'
    return ''.join(l_path)


def _resolve_cmd(cmd, env):
Пример #3
0
import asyncio
import tempfile
import shutil

from cerbero.commands import Command, register_command
from cerbero.build.cookbook import CookBook
from cerbero.enums import LibraryType
from cerbero.errors import FatalError
from cerbero.packages.packagesstore import PackagesStore
from cerbero.utils import _, N_, ArgparseArgument, remove_list_duplicates, git, shell, determine_num_of_cpus, run_until_complete
from cerbero.utils import messages as m
from cerbero.build.source import Tarball
from cerbero.config import Distro

NUMBER_OF_JOBS_IF_UNUSED = 2
NUMBER_OF_JOBS_IF_USED = 2 * determine_num_of_cpus()


class Fetch(Command):
    def __init__(self, args=[]):
        args.append(
            ArgparseArgument('--reset-rdeps',
                             action='store_true',
                             default=False,
                             help=_('reset the status of reverse '
                                    'dependencies too')))
        args.append(
            ArgparseArgument('--print-only',
                             action='store_true',
                             default=False,
                             help=_('print all source URLs to stdout')))