diff --git a/build/build.php b/build/build.php index 54777d842d148..10b6a21b45fc3 100644 --- a/build/build.php +++ b/build/build.php @@ -38,8 +38,8 @@ function usage(string $command) echo PHP_TAB . PHP_TAB . '--remote=:' . PHP_TAB . PHP_TAB . 'The git remote reference to build from (ex: `tags/3.8.6`, `4.0-dev`), defaults to the most recent tag for the repository' . PHP_EOL; echo PHP_TAB . PHP_TAB . '--exclude-zip:' . PHP_TAB . PHP_TAB . PHP_TAB . 'Exclude the generation of .zip packages' . PHP_EOL; echo PHP_TAB . PHP_TAB . '--exclude-gzip:' . PHP_TAB . PHP_TAB . PHP_TAB . 'Exclude the generation of .tar.gz packages' . PHP_EOL; - echo PHP_TAB . PHP_TAB . '--exclude-bzip2:' . PHP_TAB . PHP_TAB . 'Exclude the generation of .tar.bz2 packages' . PHP_EOL; - echo PHP_TAB . PHP_TAB . '--include-zstd:' . PHP_TAB . PHP_TAB . PHP_TAB . 'Include the generation of .tar.zst packages' . PHP_EOL; + echo PHP_TAB . PHP_TAB . '--include-bzip2:' . PHP_TAB . PHP_TAB . 'Exclude the generation of .tar.bz2 packages' . PHP_EOL; + echo PHP_TAB . PHP_TAB . '--exclude-zstd:' . PHP_TAB . PHP_TAB . PHP_TAB . 'Include the generation of .tar.zst packages' . PHP_EOL; echo PHP_TAB . PHP_TAB . '--disable-patch-packages:' . PHP_TAB . 'Disable the generation of patch packages' . PHP_EOL; echo PHP_TAB . PHP_TAB . '--help:' . PHP_TAB . PHP_TAB . PHP_TAB . PHP_TAB . 'Show this help output' . PHP_EOL; echo PHP_EOL; @@ -237,8 +237,8 @@ function clean_composer(string $dir) $remote = $options['remote'] ?? false; $excludeZip = isset($options['exclude-zip']); $excludeGzip = isset($options['exclude-gzip']); -$excludeBzip2 = isset($options['exclude-bzip2']); -$excludeZstd = !isset($options['include-zstd']); +$excludeBzip2 = !isset($options['include-bzip2']); +$excludeZstd = isset($options['exclude-zstd']); $buildPatchPackages = false && !isset($options['disable-patch-packages']); $showHelp = isset($options['help']); @@ -332,9 +332,10 @@ function clean_composer(string $dir) require_once $fullpath . '/libraries/src/Version.php'; // Set version information for the build -$version = Version::MAJOR_VERSION . '.' . Version::MINOR_VERSION; -$release = Version::PATCH_VERSION; -$fullVersion = (new Version())->getShortVersion(); +$majorVersion = Version::MAJOR_VERSION; +$version = Version::MAJOR_VERSION . '.' . Version::MINOR_VERSION; +$release = Version::PATCH_VERSION; +$fullVersion = (new Version())->getShortVersion(); $previousRelease = Version::PATCH_VERSION - 1; @@ -541,10 +542,12 @@ function clean_composer(string $dir) $fromName = $num == 0 ? 'x' : $num; // Create the diff archive packages using the file name list. - if (!$excludeBzip2) { - $packageName = 'Joomla_' . $version . '.' . $fromName . '_to_' . $fullVersion . '-' . $packageStability . '-Patch_Package.tar.bz2'; + if (!$excludeZip) { + $packageName = 'Joomla_' . $version . '.' . $fromName . '_to_' . $fullVersion . '-' . $packageStability . '-Patch_Package.zip'; echo "Building " . $packageName . "... "; - system('tar --create --bzip2 --no-recursion --directory ' . $time . ' --file packages/' . $packageName . ' --files-from diffconvert/' . $version . '.' . $num . '> /dev/null'); + chdir($time); + system('zip ../packages/' . $packageName . ' -@ < ../diffconvert/' . $version . '.' . $num . '> /dev/null'); + chdir('..'); echo "done.\n"; $checksums[$packageName] = []; } @@ -557,12 +560,10 @@ function clean_composer(string $dir) $checksums[$packageName] = []; } - if (!$excludeZip) { - $packageName = 'Joomla_' . $version . '.' . $fromName . '_to_' . $fullVersion . '-' . $packageStability . '-Patch_Package.zip'; + if (!$excludeBzip2) { + $packageName = 'Joomla_' . $version . '.' . $fromName . '_to_' . $fullVersion . '-' . $packageStability . '-Patch_Package.tar.bz2'; echo "Building " . $packageName . "... "; - chdir($time); - system('zip ../packages/' . $packageName . ' -@ < ../diffconvert/' . $version . '.' . $num . '> /dev/null'); - chdir('..'); + system('tar --create --bzip2 --no-recursion --directory ' . $time . ' --file packages/' . $packageName . ' --files-from diffconvert/' . $version . '.' . $num . '> /dev/null'); echo "done.\n"; $checksums[$packageName] = []; } @@ -570,7 +571,7 @@ function clean_composer(string $dir) if (!$excludeZstd) { $packageName = 'Joomla_' . $version . '.' . $fromName . '_to_' . $fullVersion . '-' . $packageStability . '-Patch_Package.tar.zst'; echo "Building " . $packageName . "... "; - system('tar --create --use-compress-program=zstd --no-recursion --directory ' . $time . ' --file packages/' . $packageName . ' --files-from diffconvert/' . $version . '.' . $num . '> /dev/null'); + system('tar "-I zstd --ultra -22" --create --no-recursion --directory ' . $time . ' --file packages/' . $packageName . ' --files-from diffconvert/' . $version . '.' . $num . '> /dev/null'); echo "done.\n"; $checksums[$packageName] = []; } @@ -580,10 +581,10 @@ function clean_composer(string $dir) chdir($time); // Create full archive packages. -if (!$excludeBzip2) { - $packageName = 'Joomla_' . $fullVersion . '-' . $packageStability . '-Full_Package.tar.bz2'; +if (!$excludeZip) { + $packageName = 'Joomla_' . $fullVersion . '-' . $packageStability . '-Full_Package.zip'; echo "Building " . $packageName . "... "; - system('tar --create --bzip2 --file ../packages/' . $packageName . ' * > /dev/null'); + system('zip -r ../packages/' . $packageName . ' * > /dev/null'); echo "done.\n"; $checksums[$packageName] = []; } @@ -596,10 +597,10 @@ function clean_composer(string $dir) $checksums[$packageName] = []; } -if (!$excludeZip) { - $packageName = 'Joomla_' . $fullVersion . '-' . $packageStability . '-Full_Package.zip'; +if (!$excludeBzip2) { + $packageName = 'Joomla_' . $fullVersion . '-' . $packageStability . '-Full_Package.tar.bz2'; echo "Building " . $packageName . "... "; - system('zip -r ../packages/' . $packageName . ' * > /dev/null'); + system('tar --create --bzip2 --file ../packages/' . $packageName . ' * > /dev/null'); echo "done.\n"; $checksums[$packageName] = []; } @@ -607,7 +608,7 @@ function clean_composer(string $dir) if (!$excludeZstd) { $packageName = 'Joomla_' . $fullVersion . '-' . $packageStability . '-Full_Package.tar.zst'; echo "Building " . $packageName . "... "; - system('tar --create --use-compress-program=zstd --file ../packages/' . $packageName . ' * > /dev/null'); + system('tar "-I zstd --ultra -22" --create --file ../packages/' . $packageName . ' * > /dev/null'); echo "done.\n"; $checksums[$packageName] = []; } @@ -622,10 +623,10 @@ function clean_composer(string $dir) system('rm images/joomla_black.png'); system('rm images/powered_by.png'); -if (!$excludeBzip2) { - $packageName = 'Joomla_' . $fullVersion . '-' . $packageStability . '-Update_Package.tar.bz2'; +if (!$excludeZip) { + $packageName = 'Joomla_' . $fullVersion . '-' . $packageStability . '-Update_Package.zip'; echo "Building " . $packageName . "... "; - system('tar --create --bzip2 --file ../packages/' . $packageName . ' * > /dev/null'); + system('zip -r ../packages/' . $packageName . ' * > /dev/null'); echo "done.\n"; $checksums[$packageName] = []; } @@ -638,10 +639,10 @@ function clean_composer(string $dir) $checksums[$packageName] = []; } -if (!$excludeZip) { - $packageName = 'Joomla_' . $fullVersion . '-' . $packageStability . '-Update_Package.zip'; +if (!$excludeBzip2) { + $packageName = 'Joomla_' . $fullVersion . '-' . $packageStability . '-Update_Package.tar.bz2'; echo "Building " . $packageName . "... "; - system('zip -r ../packages/' . $packageName . ' * > /dev/null'); + system('tar --create --bzip2 --file ../packages/' . $packageName . ' * > /dev/null'); echo "done.\n"; $checksums[$packageName] = []; } @@ -649,7 +650,7 @@ function clean_composer(string $dir) if (!$excludeZstd) { $packageName = 'Joomla_' . $fullVersion . '-' . $packageStability . '-Update_Package.tar.zst'; echo "Building " . $packageName . "... "; - system('tar --create --use-compress-program=zstd --file ../packages/' . $packageName . ' * > /dev/null'); + system('tar "-I zstd --ultra -22" --create --file ../packages/' . $packageName . ' * > /dev/null'); echo "done.\n"; $checksums[$packageName] = []; } @@ -689,7 +690,6 @@ function clean_composer(string $dir) echo "Generating github_release.txt file\n"; $githubContent = []; - $githubText = ''; $releaseText = [ 'FULL' => 'New Joomla! Installations ', 'POINT' => 'Update from Joomla! ' . $version . '.' . $previousRelease . ' ', @@ -697,10 +697,6 @@ function clean_composer(string $dir) 'UPGRADE' => 'Update from Joomla! 3.10 ', ]; - if (!$buildPatchPackages) { - $releaseText['UPGRADE'] = 'Update from a previous version of Joomla! '; - } - $githubLink = 'https://github.com/joomla/joomla-cms/releases/download/' . $tagVersion . '/'; foreach ($checksums as $packageName => $packageHashes) { @@ -718,19 +714,12 @@ function clean_composer(string $dir) $type = 'UPGRADE'; } - $githubContent[$type][] = '[' . substr($packageName, strpos($packageName, 'Package') + 7) . '](' . $githubLink . $packageName . ')'; + $githubContent[$type][$packageName] = $packageHashes; } - foreach ($releaseText as $type => $text) { - if (empty($githubContent[$type])) { - continue; - } - - $githubText .= $text; - $githubText .= implode(" | ", $githubContent[$type]); - - $githubText .= "\n"; - } + ob_start(); + require __DIR__ . '/layouts/github.php'; + $githubText = ob_get_clean(); file_put_contents('github_release.txt', $githubText); } diff --git a/build/layouts/github.php b/build/layouts/github.php new file mode 100644 index 0000000000000..2913bc0cb5891 --- /dev/null +++ b/build/layouts/github.php @@ -0,0 +1,115 @@ + $hashes) { + if (str_ends_with($packageName, '.zip')) { + $table[$type] .= "| [ZIP Archive (.zip)]"; + } else if (str_ends_with($packageName, '.tar.gz')) { + $table[$type] .= "| [GNU Zip Archive (.tar.gz)]"; + } else if (str_ends_with($packageName, '.tar.bz2')) { + $table[$type] .= "| [Bzip2 Archive (.tar.zst)]"; + } else if (str_ends_with($packageName, '.tar.zst')) { + $table[$type] .= "| [Zstandard Archive (.tar.zst)]"; + } else { + // Unknown file types + continue; + } + $table[$type] .= "({$githubDownloadLink}{$packageName}) | `" . $hashes['sha256'] . "` |\n"; + } +} + +$echo = function($item) use ($table) { + return $table[$item] ?? ''; +}; + + +// Release Information +$output = << [!NOTE] +> Userfacing information about this Joomla! release can be found on the [release page]({$releasePage}) + +MD; + +// Installation Packages +if (!empty($table['FULL'])): + +$output .= << Additional and a second source of checksums can be found at our official [download page]({$releaseDownloadPage}). If you need further information on how to validate a release package please visit our [documentation](https://docs.joomla.org/How_to_determine_a_package_checksum). + +MD; + +endif; + +// Update Packages +if (!empty($table['UPGRADE'])): + +$output .= << [!IMPORTANT] +> Don't update directly from a version lower than 4.4 it is important that you first update to 4.4 and then update to 5.x + +| Update from a previous version | SHA-256 Checksums | +|--------------------------------|-------------------| +{$echo('UPGRADE')} +> Additional and a second source of checksums can be found at our official [download page]({$releaseDownloadPage}). If you need further information on how to validate a release package please visit our [documentation](https://docs.joomla.org/How_to_determine_a_package_checksum). + +MD; +endif; + +// Github autogenerated content, icon tempaltes +$output .= <<