protected function initialize(InputInterface $input, OutputInterface $output) { $this->fs = new Filesystem(); $this->env = new ArrayCollection(); $this->output = $output; $directory = rtrim(trim($input->getArgument('package')), DIRECTORY_SEPARATOR); $this->baseDir = $this->fs->isAbsolutePath($directory) ? $directory : getcwd() . DIRECTORY_SEPARATOR . $directory; $repo = $this->getRepository(); $this->remoteFileUrl = $repo['glibc']; $projectName = str_replace(['.tar.gz', '.tar.bz2', '.tar.xz'], [''], basename($this->remoteFileUrl)); $this->projectName = $projectName; $this->projectDir = $this->baseDir . DIRECTORY_SEPARATOR . 'build' . DIRECTORY_SEPARATOR . $this->projectName; $this->downloadedFilePath = getcwd() . DIRECTORY_SEPARATOR . '.' . uniqid(time()) . DIRECTORY_SEPARATOR . $this->projectName; $this->env->set('_packageDir', $this->baseDir); if (!$this->fs->exists($cc = $input->getArgument('toolchain') . '-gcc')) { throw new \Exception(sprintf('Unable to find "%s" with toolchain suffix : %s', $cc, $input->getArgument('toolchain'))); } $this->env->set('_toolchainDir', dirname($input->getArgument('toolchain'))); $this->env->set('_toolchainName', $toolChainName = basename($input->getArgument('toolchain'))); $this->env->set('PATH', $_SERVER['PATH'] . ':' . $this->env->get('_toolchainDir')); }
protected function initialize(InputInterface $input, OutputInterface $output) { $this->loadLibrary(); $this->input = $input; $this->output = $output; $this->fs = new Filesystem(); $this->env = $this->getEnv(); $directory = rtrim(trim($input->getArgument('package')), DIRECTORY_SEPARATOR); $this->baseDir = $this->fs->isAbsolutePath($directory) ? $directory : getcwd() . DIRECTORY_SEPARATOR . $directory; $requireDirs = [$this->baseDir . '/build', $this->baseDir . '/source', $this->baseDir . '/rootfs', $this->baseDir . '/rootfs/include', $this->baseDir . '/rootfs/lib']; $this->findDirs = [$this->baseDir . '/rootfs/lib', $this->baseDir . '/rootfs/include', $this->baseDir . '/rootfs/usr/lib', $this->baseDir . '/rootfs/usr/include', $this->baseDir . '/rootfs/php/bin', $this->baseDir . '/rootfs/msmtp/bin', $this->baseDir . '/rootfs/lighttpd/sbin', $this->baseDir . '/rootfs/nginx/sbin']; $this->fs->mkdir($requireDirs); $this->fs->mkdir($this->findDirs); $yaml = new Parser(); try { $env = $yaml->parse(file_get_contents($this->baseDir . '/environment.yml')); } catch (ParseException $e) { throw new \Exception(sprintf('Unable to parse the YAML string: %s', $e->getMessage())); } $this->env = new ArrayCollection($env); $this->env->set('ROOTFS', $this->baseDir . '/rootfs'); }