Skip to content

Commit 1c78eef

Browse files
authored
Make sure the text files are only generated when needed (#34341)
* Make sure the text files are only generated when needed * dont generate the hashes for now too
1 parent 1866a0e commit 1c78eef

File tree

1 file changed

+71
-60
lines changed

1 file changed

+71
-60
lines changed

build/build.php

Lines changed: 71 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@ function usage($command)
7171
$excludeBzip2 = isset($options['exclude-bzip2']);
7272
$showHelp = isset($options['help']);
7373

74+
// Disable the generation of extra text files
75+
$includeExtraTextfiles = false;
76+
7477
if ($showHelp)
7578
{
7679
usage($argv[0]);
@@ -84,6 +87,9 @@ function usage($command)
8487
$tagVersion = system($systemGit . ' describe --tags `' . $systemGit . ' rev-list --tags --max-count=1`', $tagVersion);
8588
$remote = 'tags/' . $tagVersion;
8689
chdir($here);
90+
91+
// We are in release mode so we need the extra text files
92+
$includeExtraTextfiles = true;
8793
}
8894

8995
echo "Start build for remote $remote.\n";
@@ -392,93 +398,98 @@ function usage($command)
392398

393399
chdir('..');
394400

395-
foreach (array_keys($checksums) as $packageName)
401+
// Thats only needed when we release a version
402+
if ($includeExtraTextfiles)
396403
{
397-
echo "Generating checksums for $packageName\n";
398404

399-
foreach (array('sha256', 'sha384', 'sha512') as $hash)
405+
foreach (array_keys($checksums) as $packageName)
400406
{
401-
if (file_exists('packages/' . $packageName))
402-
{
403-
$checksums[$packageName][$hash] = hash_file($hash, 'packages/' . $packageName);
404-
}
405-
else
407+
echo "Generating checksums for $packageName\n";
408+
409+
foreach (array('sha256', 'sha384', 'sha512') as $hash)
406410
{
407-
echo "Package $packageName not found in build directories\n";
411+
if (file_exists('packages/' . $packageName))
412+
{
413+
$checksums[$packageName][$hash] = hash_file($hash, 'packages/' . $packageName);
414+
}
415+
else
416+
{
417+
echo "Package $packageName not found in build directories\n";
418+
}
408419
}
409420
}
410-
}
411421

412-
echo "Generating checksums.txt file\n";
422+
echo "Generating checksums.txt file\n";
413423

414-
$checksumsContent = '';
415-
416-
foreach ($checksums as $packageName => $packageHashes)
417-
{
418-
$checksumsContent .= "Filename: $packageName\n";
424+
$checksumsContent = '';
419425

420-
foreach ($packageHashes as $hashType => $hash)
426+
foreach ($checksums as $packageName => $packageHashes)
421427
{
422-
$checksumsContent .= "$hashType: $hash\n";
423-
}
428+
$checksumsContent .= "Filename: $packageName\n";
424429

425-
$checksumsContent .= "\n";
426-
}
430+
foreach ($packageHashes as $hashType => $hash)
431+
{
432+
$checksumsContent .= "$hashType: $hash\n";
433+
}
427434

428-
file_put_contents('checksums.txt', $checksumsContent);
435+
$checksumsContent .= "\n";
436+
}
429437

430-
echo "Generating github_release.txt file\n";
438+
file_put_contents('checksums.txt', $checksumsContent);
431439

432-
$githubContent = array();
433-
$githubText = '';
434-
$releaseText = array(
435-
'FULL' => 'New Joomla! Installations ',
436-
'POINT' => 'Update from Joomla! ' . $version . '.' . $previousRelease . ' ',
437-
'MINOR' => 'Update from Joomla! ' . $version . '.x ',
438-
'UPGRADE' => 'Update from Joomla! 2.5 or previous 3.x releases ',
439-
);
440-
$githubLink = 'https://github.com/joomla/joomla-cms/releases/download/' . $tagVersion . '/';
440+
echo "Generating github_release.txt file\n";
441441

442-
foreach ($checksums as $packageName => $packageHashes)
443-
{
444-
$type = '';
442+
$githubContent = array();
443+
$githubText = '';
444+
$releaseText = array(
445+
'FULL' => 'New Joomla! Installations ',
446+
'POINT' => 'Update from Joomla! ' . $version . '.' . $previousRelease . ' ',
447+
'MINOR' => 'Update from Joomla! ' . $version . '.x ',
448+
'UPGRADE' => 'Update from Joomla! 2.5 or previous 3.x releases ',
449+
);
450+
$githubLink = 'https://github.com/joomla/joomla-cms/releases/download/' . $tagVersion . '/';
445451

446-
if (strpos($packageName, 'Full_Package') !== false)
447-
{
448-
$type = 'FULL';
449-
}
450-
elseif (strpos($packageName, 'Patch_Package') !== false)
452+
foreach ($checksums as $packageName => $packageHashes)
451453
{
452-
if (strpos($packageName, '.x_to') !== false)
454+
$type = '';
455+
456+
if (strpos($packageName, 'Full_Package') !== false)
453457
{
454-
$type = 'MINOR';
458+
$type = 'FULL';
455459
}
456-
else
460+
elseif (strpos($packageName, 'Patch_Package') !== false)
461+
{
462+
if (strpos($packageName, '.x_to') !== false)
463+
{
464+
$type = 'MINOR';
465+
}
466+
else
467+
{
468+
$type = 'POINT';
469+
}
470+
}
471+
elseif (strpos($packageName, 'Update_Package') !== false)
457472
{
458-
$type = 'POINT';
473+
$type = 'UPGRADE';
459474
}
475+
476+
$githubContent[$type][] = '[' . substr($packageName, strpos($packageName, 'Package') + 7) . '](' . $githubLink . $packageName . ')';
460477
}
461-
elseif (strpos($packageName, 'Update_Package') !== false)
478+
479+
foreach ($releaseText as $type => $text)
462480
{
463-
$type = 'UPGRADE';
464-
}
481+
if (empty($githubContent[$type]))
482+
{
483+
continue;
484+
}
465485

466-
$githubContent[$type][] = '[' . substr($packageName, strpos($packageName, 'Package') + 7) . '](' . $githubLink . $packageName . ')';
467-
}
486+
$githubText .= $text;
487+
$githubText .= implode(" | ", $githubContent[$type]);
468488

469-
foreach ($releaseText as $type => $text)
470-
{
471-
if (empty($githubContent[$type]))
472-
{
473-
continue;
489+
$githubText .= "\n";
474490
}
475491

476-
$githubText .= $text;
477-
$githubText .= implode(" | ", $githubContent[$type]);
478-
479-
$githubText .= "\n";
492+
file_put_contents('github_release.txt', $githubText);
480493
}
481494

482-
file_put_contents('github_release.txt', $githubText);
483-
484495
echo "Build of version $fullVersion complete!\n";

0 commit comments

Comments
 (0)