fix: PHP_BINARY quoting in exec calls #218
+19
-19
@@ -66,7 +66,7 @@ if (empty($stability) || empty($token)) {
|
||||
}
|
||||
|
||||
$cli = __DIR__;
|
||||
$php = escapeshellarg(PHP_BINARY);
|
||||
$php = '"' . PHP_BINARY . '"';
|
||||
$giteaUrl = rtrim($giteaUrl, '/');
|
||||
|
||||
// Auto-detect org/repo from git remote if not set
|
||||
@@ -123,7 +123,7 @@ if ($bumpType !== 'none') {
|
||||
$bumpFlag = $bumpType === 'minor' ? '--minor' : '';
|
||||
echo "\n--- Step 1: Version bump ({$bumpType}) ---\n";
|
||||
if (!$dryRun) {
|
||||
passthru($php . ' ' . $cli . '/version_bump.php --path " . escapeshellarg($path) . " {$bumpFlag} 2>&1");
|
||||
passthru("{$php} {$cli}/version_bump.php --path " . escapeshellarg($path) . " {$bumpFlag} 2>&1");
|
||||
} else {
|
||||
echo "[DRY-RUN] Would run version_bump.php {$bumpFlag}\n";
|
||||
}
|
||||
@@ -132,7 +132,7 @@ if ($bumpType !== 'none') {
|
||||
// -- Step 2: Read version and set stability suffix --
|
||||
echo "\n--- Step 2: Set version suffix ---\n";
|
||||
$versionOutput = [];
|
||||
exec($php . ' ' . $cli . '/version_read.php --path " . escapeshellarg($path) . " 2>/dev/null", $versionOutput);
|
||||
exec("{$php} {$cli}/version_read.php --path " . escapeshellarg($path) . " 2>/dev/null", $versionOutput);
|
||||
$version = trim($versionOutput[0] ?? '');
|
||||
if (empty($version)) {
|
||||
fwrite(STDERR, "No version found\n");
|
||||
@@ -142,11 +142,11 @@ if (empty($version)) {
|
||||
$baseVersion = preg_replace('/(-(dev|alpha|beta|rc))+$/', '', $version);
|
||||
|
||||
if (!$dryRun) {
|
||||
passthru($php . ' ' . $cli . '/version_set_platform.php --path " . escapeshellarg($path)
|
||||
passthru("{$php} {$cli}/version_set_platform.php --path " . escapeshellarg($path)
|
||||
. " --version " . escapeshellarg($baseVersion)
|
||||
. " --branch " . escapeshellarg($branch)
|
||||
. " --stability " . escapeshellarg($stability) . " 2>&1");
|
||||
passthru($php . ' ' . $cli . '/version_check.php --path " . escapeshellarg($path) . " --fix 2>/dev/null");
|
||||
passthru("{$php} {$cli}/version_check.php --path " . escapeshellarg($path) . " --fix 2>/dev/null");
|
||||
}
|
||||
|
||||
$releaseVersion = $baseVersion . $suffixMap[$stability];
|
||||
@@ -154,12 +154,12 @@ echo "Release version: {$releaseVersion}\n";
|
||||
|
||||
// -- Step 2b: Update badges and changelog --
|
||||
if (!$dryRun) {
|
||||
passthru($php . ' ' . $cli . '/badge_update.php --path " . escapeshellarg($path) . " --version " . escapeshellarg($baseVersion) . " 2>/dev/null");
|
||||
passthru("{$php} {$cli}/badge_update.php --path " . escapeshellarg($path) . " --version " . escapeshellarg($baseVersion) . " 2>/dev/null");
|
||||
|
||||
$changelogFile = realpath($path) . '/CHANGELOG.md';
|
||||
if (file_exists($changelogFile)) {
|
||||
passthru($php . ' ' . $cli . '/changelog_promote.php --path " . escapeshellarg($path) . " --version " . escapeshellarg($baseVersion) . " 2>/dev/null");
|
||||
passthru($php . ' ' . $cli . '/changelog_prune.php --path " . escapeshellarg($path) . " --keep 5 2>/dev/null");
|
||||
passthru("{$php} {$cli}/changelog_promote.php --path " . escapeshellarg($path) . " --version " . escapeshellarg($baseVersion) . " 2>/dev/null");
|
||||
passthru("{$php} {$cli}/changelog_prune.php --path " . escapeshellarg($path) . " --keep 5 2>/dev/null");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -178,12 +178,12 @@ if (!$dryRun) {
|
||||
@shell_exec("cd " . escapeshellarg($root) . " && git checkout -B " . escapeshellarg($branch) . " FETCH_HEAD 2>/dev/null");
|
||||
|
||||
// Re-apply version changes on the checked-out branch
|
||||
passthru($php . ' ' . $cli . '/version_set_platform.php --path " . escapeshellarg($path)
|
||||
passthru("{$php} {$cli}/version_set_platform.php --path " . escapeshellarg($path)
|
||||
. " --version " . escapeshellarg($baseVersion)
|
||||
. " --branch " . escapeshellarg($branch)
|
||||
. " --stability " . escapeshellarg($stability) . " 2>/dev/null");
|
||||
passthru($php . ' ' . $cli . '/version_check.php --path " . escapeshellarg($path) . " --fix 2>/dev/null");
|
||||
passthru($php . ' ' . $cli . '/badge_update.php --path " . escapeshellarg($path) . " --version " . escapeshellarg($baseVersion) . " 2>/dev/null");
|
||||
passthru("{$php} {$cli}/version_check.php --path " . escapeshellarg($path) . " --fix 2>/dev/null");
|
||||
passthru("{$php} {$cli}/badge_update.php --path " . escapeshellarg($path) . " --version " . escapeshellarg($baseVersion) . " 2>/dev/null");
|
||||
|
||||
$diffCheck = trim((string) @shell_exec("cd " . escapeshellarg($root) . " && git diff --quiet && git diff --cached --quiet 2>&1 && echo clean || echo dirty"));
|
||||
if ($diffCheck === 'dirty') {
|
||||
@@ -203,7 +203,7 @@ $sha256 = '';
|
||||
|
||||
if (!$dryRun) {
|
||||
// Create release
|
||||
passthru($php . ' ' . $cli . '/release_create.php --path " . escapeshellarg($path)
|
||||
passthru("{$php} {$cli}/release_create.php --path " . escapeshellarg($path)
|
||||
. " --version " . escapeshellarg($releaseVersion)
|
||||
. " --tag " . escapeshellarg($releaseTag)
|
||||
. " --token " . escapeshellarg($token)
|
||||
@@ -213,7 +213,7 @@ if (!$dryRun) {
|
||||
|
||||
// Build and upload package
|
||||
$packageOutput = [];
|
||||
exec($php . ' ' . $cli . '/release_package.php --path " . escapeshellarg($path)
|
||||
exec("{$php} {$cli}/release_package.php --path " . escapeshellarg($path)
|
||||
. " --version " . escapeshellarg($releaseVersion)
|
||||
. " --tag " . escapeshellarg($releaseTag)
|
||||
. " --token " . escapeshellarg($token)
|
||||
@@ -252,13 +252,13 @@ for ($i = 0; $i < $stabilityIndex; $i++) {
|
||||
|
||||
if (!$dryRun) {
|
||||
// Set version to lesser stream's suffixed version in source files
|
||||
passthru($php . ' ' . $cli . '/version_set_platform.php --path " . escapeshellarg($path)
|
||||
passthru("{$php} {$cli}/version_set_platform.php --path " . escapeshellarg($path)
|
||||
. " --version " . escapeshellarg($baseVersion)
|
||||
. " --branch " . escapeshellarg($lesserStability)
|
||||
. " --stability " . escapeshellarg($lesserStability) . " 2>/dev/null");
|
||||
|
||||
// Create release tag
|
||||
passthru($php . ' ' . $cli . '/release_create.php --path " . escapeshellarg($path)
|
||||
passthru("{$php} {$cli}/release_create.php --path " . escapeshellarg($path)
|
||||
. " --version " . escapeshellarg($lesserVersion)
|
||||
. " --tag " . escapeshellarg($lesserTag)
|
||||
. " --token " . escapeshellarg($token)
|
||||
@@ -267,7 +267,7 @@ for ($i = 0; $i < $stabilityIndex; $i++) {
|
||||
. " --branch " . escapeshellarg($branch) . " 2>&1");
|
||||
|
||||
// Build and upload package (ZIP will contain the lesser version)
|
||||
passthru($php . ' ' . $cli . '/release_package.php --path " . escapeshellarg($path)
|
||||
passthru("{$php} {$cli}/release_package.php --path " . escapeshellarg($path)
|
||||
. " --version " . escapeshellarg($lesserVersion)
|
||||
. " --tag " . escapeshellarg($lesserTag)
|
||||
. " --token " . escapeshellarg($token)
|
||||
@@ -281,7 +281,7 @@ for ($i = 0; $i < $stabilityIndex; $i++) {
|
||||
|
||||
// Restore primary release version in source files
|
||||
if (!$dryRun && $stabilityIndex > 0) {
|
||||
passthru($php . ' ' . $cli . '/version_set_platform.php --path " . escapeshellarg($path)
|
||||
passthru("{$php} {$cli}/version_set_platform.php --path " . escapeshellarg($path)
|
||||
. " --version " . escapeshellarg($baseVersion)
|
||||
. " --branch " . escapeshellarg($branch)
|
||||
. " --stability " . escapeshellarg($stability) . " 2>/dev/null");
|
||||
@@ -298,7 +298,7 @@ foreach ($streamsToWrite as $stream) {
|
||||
|
||||
echo " Writing {$stream} stream: {$streamVersion}\n";
|
||||
if (!$dryRun) {
|
||||
passthru($php . ' ' . $cli . '/updates_xml_build.php --path " . escapeshellarg($path)
|
||||
passthru("{$php} {$cli}/updates_xml_build.php --path " . escapeshellarg($path)
|
||||
. " --version " . escapeshellarg($streamVersion)
|
||||
. " --stability " . escapeshellarg($stream)
|
||||
. " --gitea-url " . escapeshellarg($giteaUrl)
|
||||
@@ -323,7 +323,7 @@ if (!$dryRun) {
|
||||
}
|
||||
|
||||
// Sync to all branches
|
||||
passthru($php . ' ' . $cli . '/updates_xml_sync.php --path " . escapeshellarg($path)
|
||||
passthru("{$php} {$cli}/updates_xml_sync.php --path " . escapeshellarg($path)
|
||||
. " --current " . escapeshellarg($branch) . " --all"
|
||||
. " --version " . escapeshellarg($releaseVersion)
|
||||
. " --token " . escapeshellarg($token)
|
||||
|
||||
@@ -63,7 +63,7 @@ if (array_key_exists($branch, $stabilityMap)) {
|
||||
}
|
||||
|
||||
$cli = __DIR__;
|
||||
$php = escapeshellarg(PHP_BINARY);
|
||||
$php = '"' . PHP_BINARY . '"';
|
||||
|
||||
// Auto-detect watch path from manifest.xml if not provided
|
||||
if (empty($watchPath)) {
|
||||
@@ -98,14 +98,14 @@ if (!$shouldBump) {
|
||||
|
||||
// Step 1: Patch bump
|
||||
$bumpOutput = [];
|
||||
exec($php . ' ' . $cli . '/version_bump.php --path " . escapeshellarg($path) . " 2>&1", $bumpOutput, $bumpRc);
|
||||
exec("{$php} {$cli}/version_bump.php --path " . escapeshellarg($path) . " 2>&1", $bumpOutput, $bumpRc);
|
||||
foreach ($bumpOutput as $line) {
|
||||
echo "{$line}\n";
|
||||
}
|
||||
|
||||
// Step 2: Read version
|
||||
$versionOutput = [];
|
||||
exec($php . ' ' . $cli . '/version_read.php --path " . escapeshellarg($path) . " 2>&1", $versionOutput, $versionRc);
|
||||
exec("{$php} {$cli}/version_read.php --path " . escapeshellarg($path) . " 2>&1", $versionOutput, $versionRc);
|
||||
$version = trim($versionOutput[0] ?? '');
|
||||
|
||||
if (empty($version)) {
|
||||
@@ -116,7 +116,7 @@ if (empty($version)) {
|
||||
echo "Version: {$version} | Branch: {$branch} | Stability: {$stability}\n";
|
||||
|
||||
// Step 3: Set platform version with stability suffix
|
||||
exec($php . ' ' . $cli . '/version_set_platform.php --path " . escapeshellarg($path)
|
||||
exec("{$php} {$cli}/version_set_platform.php --path " . escapeshellarg($path)
|
||||
. " --version " . escapeshellarg($version)
|
||||
. " --branch " . escapeshellarg($branch)
|
||||
. " --stability " . escapeshellarg($stability) . " 2>&1", $setPlatOutput);
|
||||
@@ -125,7 +125,7 @@ foreach ($setPlatOutput as $line) {
|
||||
}
|
||||
|
||||
// Step 4: Version consistency check and fix
|
||||
exec($php . ' ' . $cli . '/version_check.php --path " . escapeshellarg($path) . " --fix 2>&1", $checkOutput);
|
||||
exec("{$php} {$cli}/version_check.php --path " . escapeshellarg($path) . " --fix 2>&1", $checkOutput);
|
||||
|
||||
// Re-read version (now includes suffix from version_set_platform)
|
||||
$suffixMap = [
|
||||
|
||||
Reference in New Issue
Block a user