private function git_run($command) { $git = escapeshellarg(pake_which('git')); if (self::$needs_work_tree_workaround === true) { $cmd = '(cd ' . escapeshellarg($this->repository_path) . ' && ' . $git . ' ' . $command . ')'; } else { $cmd = $git; $cmd .= ' ' . escapeshellarg('--git-dir=' . $this->repository_path . '/.git'); $cmd .= ' ' . escapeshellarg('--work-tree=' . $this->repository_path); $cmd .= ' ' . $command; } try { pake_sh($cmd); } catch (pakeException $e) { if (strpos($e->getMessage(), 'cannot be used without a working tree') !== false) { pake_echo_error('Your version of git is buggy. Using workaround'); self::$needs_work_tree_workaround = true; $this->git_run($command); } } }
// this is unfortunately a necessary hack: ideally we would always check for // proper pake version, but version 0.1 of this extension was // shipped with a faulty pake_version, so we cannot check for required version // when using the bundled pake. // To aggravate things, version 0.1 did not upgrade the bundled pake when // upgrading to a new script, so we can not be sure that, even if the end user // updates to a newer pakefile, the bundled pake will be upgraded // (it will only be when the user does two consecutive updates) // Last but not least, when using a pake version installed via composer, that // also does not come with proper version tag... if (!(isset($GLOBALS['internal_pake']) && $GLOBALS['internal_pake'])) { pake_require_version(eZPCPBuilder\Builder::MIN_PAKE_VERSION); } // this should not be strictly needed, but it does not hurt if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { pakeGit::$needs_work_tree_workaround = true; } // *** declaration of the pake tasks *** // NB: up to pake 1.99.1 this will not work //pake_task( 'eZExtBuilder\GenericTasks::default' ); function run_default($task = null, $args = array(), $cliopts = array()) { eZPCPBuilder\Tasks::run_default($task, $args, $cliopts); } pake_task('default'); pake_task('eZPCPBuilder\\Tasks::show-properties'); pake_task('eZPCPBuilder\\Tasks::init'); pake_task('eZPCPBuilder\\Tasks::init-ci-repo'); pake_task('eZPCPBuilder\\Tasks::build', 'init', 'init-ci-repo', 'generate-upgrade-instructions', 'generate-changelog', 'wait-for-changelog', 'update-ci-repo', 'wait-for-continue', 'run-jenkins-build4', 'run-jenkins-build5'); pake_task('eZPCPBuilder\\Tasks::update-source'); pake_task('eZPCPBuilder\\Tasks::display-source-revision');