2012-02-07 03:24:48 +00:00
< ? php
/**
* Script used to build Joomla distribution archive packages
2018-06-15 05:59:24 +00:00
* Builds packages in tmp / packages folder ( for example , 'build/tmp/packages' )
2012-02-07 03:24:48 +00:00
*
* Note : the new package must be tagged in your git repository BEFORE doing this
* It uses the git tag for the new version , not trunk .
*
* This script is designed to be run in CLI on Linux or Mac OS X .
* Make sure your default umask is 022 to create archives with correct permissions .
*
* Steps :
* 1. Tag new release in the local git repository ( for example , " git tag 2.5.1 " )
* 2. Set the $version and $release variables for the new version .
* 3. Run from CLI as : ' php build . php " from build directory.
* 4. Check the archives in the tmp directory .
*
2015-01-23 15:19:17 +00:00
* @ package Joomla . Build
2019-03-09 10:20:38 +00:00
* @ copyright Copyright ( C ) 2005 - 2019 Open Source Matters , Inc . All rights reserved .
2015-01-23 15:19:17 +00:00
* @ license GNU General Public License version 2 or later ; see LICENSE . txt
2012-02-07 03:24:48 +00:00
*/
2017-05-01 12:51:27 +00:00
use Joomla\CMS\Version ;
2018-04-04 11:52:22 +00:00
const PHP_TAB = " \t " ;
2018-07-28 00:17:32 +00:00
function usage ( string $command )
2018-04-04 11:52:22 +00:00
{
echo PHP_EOL ;
echo 'Usage: php ' . $command . ' [options]' . PHP_EOL ;
echo PHP_TAB . '[options]:' . PHP_EOL ;
echo PHP_TAB . PHP_TAB . '--remote <remote>:' . 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 . 'Exclude the generation of .zip packages' . PHP_EOL ;
echo PHP_TAB . PHP_TAB . '--exclude-gzip:' . PHP_TAB . PHP_TAB . 'Exclude the generation of .tar.gz packages' . PHP_EOL ;
echo PHP_TAB . PHP_TAB . '--exclude-bzip2:' . PHP_TAB . 'Exclude the generation of .tar.bz2 packages' . PHP_EOL ;
echo PHP_TAB . PHP_TAB . '--help:' . PHP_TAB . PHP_TAB . PHP_TAB . 'Show this help output' . PHP_EOL ;
echo PHP_EOL ;
}
2018-07-28 00:17:32 +00:00
function clean_checkout ( string $dir )
{
// Save the current working directory to restore when complete
$cwd = getcwd ();
chdir ( $dir );
echo " Cleaning checkout in $dir . \n " ;
// Removes .DS_Store; .git sources; testing, CI, and IDE configuration files; Changelogs; GitHub Meta; and README files
system ( 'find . -name .appveyor.yml | xargs rm -rf -' );
system ( 'find . -name .coveralls.yml | xargs rm -rf -' );
system ( 'find . -name .DS_Store | xargs rm -rf -' );
system ( 'find . -name .editorconfig | xargs rm -rf -' );
system ( 'find . -name .gitattributes | xargs rm -rf -' );
system ( 'find . -name .github | xargs rm -rf -' );
system ( 'find . -name .gitignore | xargs rm -rf -' );
system ( 'find . -name .gitmodules | xargs rm -rf -' );
system ( 'find . -name .php_cs | xargs rm -rf -' );
system ( 'find . -name .scrutinizer.yml | xargs rm -rf -' );
system ( 'find . -name .travis.yml | xargs rm -rf -' );
system ( 'find . -name appveyor.yml | xargs rm -rf -' );
system ( 'find . -name CHANGELOG.md | xargs rm -rf -' );
system ( 'find . -name CONTRIBUTING.md | xargs rm -rf -' );
system ( 'find . -name psalm.xml | xargs rm -rf -' );
system ( 'find . -name psalm.xml.dist | xargs rm -rf -' );
system ( 'find . -name phpcs.xml | xargs rm -rf -' );
system ( 'find . -name phpcs.xml.dist | xargs rm -rf -' );
system ( 'find . -name phpunit.xml | xargs rm -rf -' );
system ( 'find . -name phpunit.*.xml | xargs rm -rf -' );
system ( 'find . -name phpunit.xml.dist | xargs rm -rf -' );
system ( 'find . -name README.md | xargs rm -rf -' );
2018-12-31 17:08:53 +00:00
system ( 'find . -name SECURITY.md | xargs rm -rf -' );
2018-07-28 00:17:32 +00:00
echo " Cleaning vendors. \n " ;
// defuse/php-encryption
system ( 'rm -rf libraries/vendor/defuse/php-encryption/docs' );
// fig/link-util
system ( 'rm -rf libraries/vendor/fig/link-util/test' );
// google/recaptcha
system ( 'rm -rf libraries/vendor/google/recaptcha/examples' );
system ( 'rm -rf libraries/vendor/google/recaptcha/tests' );
// joomla/*
system ( 'rm -rf libraries/vendor/joomla/*/docs' );
system ( 'rm -rf libraries/vendor/joomla/*/tests' );
system ( 'rm -rf libraries/vendor/joomla/*/Tests' );
system ( 'rm -rf libraries/vendor/joomla/*/ruleset.xml' );
// paragonie/random_compat
system ( 'rm -rf libraries/vendor/paragonie/random_compat/other' );
system ( 'rm -rf libraries/vendor/paragonie/random_compat/build-phar.sh' );
system ( 'rm -rf libraries/vendor/paragonie/random_compat/psalm-autoload.php' );
// paragonie/sodium_compat
system ( 'rm -rf libraries/vendor/paragonie/sodium_compat/build-phar.sh' );
// phpmailer/phpmailer
system ( 'rm -rf libraries/vendor/phpmailer/phpmailer/language' );
system ( 'rm -rf libraries/vendor/phpmailer/phpmailer/get_oauth_token.php' );
system ( 'rm -rf libraries/vendor/phpmailer/phpmailer/SECURITY.md' );
// psr/log
system ( 'rm -rf libraries/vendor/psr/log/Psr/Log/Test' );
// symfony/*
system ( 'rm -rf libraries/vendor/symfony/*/Resources/doc' );
system ( 'rm -rf libraries/vendor/symfony/*/Tests' );
system ( 'rm -rf libraries/vendor/symfony/console/Resources' );
system ( 'rm -rf libraries/vendor/symfony/debug/Resources' );
system ( 'rm -rf libraries/vendor/symfony/polyfill-util/LegacyTestListener.php' );
system ( 'rm -rf libraries/vendor/symfony/polyfill-util/TestListener.php' );
system ( 'rm -rf libraries/vendor/symfony/polyfill-util/TestListenerTrait.php' );
// wamania/php-stemmer
system ( 'rm -rf libraries/vendor/wamania/php-stemmer/test' );
// zendframework/zend-diactoros
system ( 'rm -rf libraries/vendor/zendframework/zend-diactoros/CONDUCT.md' );
system ( 'rm -rf libraries/vendor/zendframework/zend-diactoros/mkdocs.yml' );
echo " Cleanup complete. \n " ;
chdir ( $cwd );
}
function clean_composer ( string $dir )
{
// Save the current working directory to restore when complete
$cwd = getcwd ();
chdir ( $dir );
echo " Cleaning Composer manifests in $dir . \n " ;
// Removes Composer manifests
system ( 'find . -name composer.json | xargs rm -rf -' );
system ( 'find . -name composer.lock | xargs rm -rf -' );
echo " Cleanup complete. \n " ;
chdir ( $cwd );
}
2018-04-04 11:52:22 +00:00
$time = time ();
2013-08-24 00:42:52 +00:00
// Set path to git binary (e.g., /usr/local/git/bin/git or /usr/bin/git)
ob_start ();
passthru ( 'which git' , $systemGit );
2016-07-31 17:37:52 +00:00
$systemGit = trim ( ob_get_clean ());
2012-02-07 03:24:48 +00:00
2013-08-24 00:42:52 +00:00
// Make sure file and folder permissions are set correctly
umask ( 022 );
2012-02-07 03:24:48 +00:00
2013-08-24 00:42:52 +00:00
// Shortcut the paths to the repository root and build folder
$repo = dirname ( __DIR__ );
$here = __DIR__ ;
2012-02-07 03:24:48 +00:00
2013-08-24 00:42:52 +00:00
// Set paths for the build packages
$tmp = $here . '/tmp' ;
2018-04-04 11:52:22 +00:00
$fullpath = $tmp . '/' . $time ;
2012-02-07 03:24:48 +00:00
2018-04-04 11:52:22 +00:00
// Parse input options
$options = getopt ( '' , [ 'help' , 'remote::' , 'exclude-zip' , 'exclude-gzip' , 'exclude-bzip2' ]);
2018-07-28 00:17:32 +00:00
$remote = $options [ 'remote' ] ? ? false ;
2018-04-04 11:52:22 +00:00
$excludeZip = isset ( $options [ 'exclude-zip' ]);
$excludeGzip = isset ( $options [ 'exclude-gzip' ]);
$excludeBzip2 = isset ( $options [ 'exclude-bzip2' ]);
$showHelp = isset ( $options [ 'help' ]);
if ( $showHelp )
{
usage ( $argv [ 0 ]);
2018-09-23 15:44:15 +00:00
exit ;
2018-04-04 11:52:22 +00:00
}
// If not given a remote, assume we are looking for the latest local tag
if ( ! $remote )
{
chdir ( $repo );
$tagVersion = system ( $systemGit . ' describe --tags `' . $systemGit . ' rev-list --tags --max-count=1`' , $tagVersion );
$remote = 'tags/' . $tagVersion ;
chdir ( $here );
}
echo " Start build for remote $remote . \n " ;
2012-02-07 03:24:48 +00:00
echo " Delete old release folder. \n " ;
system ( 'rm -rf ' . $tmp );
mkdir ( $tmp );
mkdir ( $fullpath );
echo " Copy the files from the git repository. \n " ;
chdir ( $repo );
2018-04-04 11:52:22 +00:00
system ( $systemGit . ' archive ' . $remote . ' | tar -x -C ' . $fullpath );
2018-07-28 00:17:32 +00:00
// Install PHP and NPM dependencies and compile required media assets, skip Composer autoloader until post-cleanup
chdir ( $fullpath );
2018-09-23 15:44:15 +00:00
system ( 'composer install --no-dev --no-autoloader --ignore-platform-reqs' , $composerReturnCode );
if ( $composerReturnCode !== 0 )
{
echo " `composer install` did not complete as expected. \n " ;
exit ( 1 );
}
system ( 'npm install --unsafe-perm' , $npmReturnCode );
if ( $npmReturnCode !== 0 )
{
echo " `npm install` did not complete as expected. \n " ;
exit ( 1 );
}
2018-07-27 13:18:14 +00:00
2018-07-28 00:17:32 +00:00
// Clean the checkout of extra resources
clean_checkout ( $fullpath );
// Regenerate the Composer autoloader without deleted files
system ( 'composer dump-autoload --no-dev --optimize --no-scripts' );
// Clean the Composer manifests now
clean_composer ( $fullpath );
// And cleanup the Node installation
system ( 'rm -rf node_modules' );
2018-07-31 23:37:07 +00:00
// Also cleanup the Node installation of the media manager
system ( 'rm -rf administrator/components/com_media/node_modules' );
2018-07-28 00:17:32 +00:00
echo " Workspace built. \n " ;
2018-04-04 11:52:22 +00:00
// Import the version class to set the version information
define ( 'JPATH_PLATFORM' , 1 );
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 ();
2012-02-07 03:24:48 +00:00
chdir ( $tmp );
system ( 'mkdir diffdocs' );
system ( 'mkdir diffconvert' );
2018-06-15 05:59:24 +00:00
system ( 'mkdir packages' );
2012-02-07 03:24:48 +00:00
2018-04-04 11:52:22 +00:00
echo " Create list of changed files from git repository for version $fullVersion . \n " ;
2012-02-07 03:24:48 +00:00
2013-08-24 00:42:52 +00:00
/*
* Here we force add every top - level directory and file in our diff archive , even if they haven ' t changed .
* This allows us to install these files from the Extension Manager .
* So we add the index file for each top - level directory .
* Note : If we add new top - level directories or files , be sure to include them here .
*/
2012-06-22 01:31:45 +00:00
$filesArray = array (
2014-01-31 00:51:26 +00:00
" administrator/index.php \n " => true ,
" cache/index.html \n " => true ,
" cli/index.html \n " => true ,
" components/index.html \n " => true ,
" images/index.html \n " => true ,
" includes/index.html \n " => true ,
" language/index.html \n " => true ,
" layouts/index.html \n " => true ,
" libraries/index.html \n " => true ,
" media/index.html \n " => true ,
" modules/index.html \n " => true ,
" plugins/index.html \n " => true ,
" templates/index.html \n " => true ,
" tmp/index.html \n " => true ,
" htaccess.txt \n " => true ,
" index.php \n " => true ,
" LICENSE.txt \n " => true ,
" README.txt \n " => true ,
" robots.txt.dist \n " => true ,
2016-03-28 20:51:15 +00:00
" web.config.txt \n " => true
2012-06-22 01:31:45 +00:00
);
2014-05-05 19:52:55 +00:00
/*
* Here we set the files / folders which should not be packaged at any time
* These paths are from the repository root without the leading slash
2018-07-28 00:17:32 +00:00
* Because this is a fresh copy from a git tag , local environment files may be ignored
2014-05-05 19:52:55 +00:00
*/
$doNotPackage = array (
2017-01-29 17:10:02 +00:00
'.appveyor.yml' ,
2018-07-28 00:17:32 +00:00
'.babelrc' ,
2016-10-18 21:36:36 +00:00
'.drone.yml' ,
2018-02-11 22:15:55 +00:00
'.eslintignore' ,
2018-07-28 00:17:32 +00:00
'.eslintrc' ,
2018-08-18 15:26:50 +00:00
'.editorconfig' ,
2016-02-20 15:47:26 +00:00
'.github' ,
2014-05-05 19:52:55 +00:00
'.gitignore' ,
2017-07-04 15:55:09 +00:00
'.hound.yml' ,
2018-08-20 15:58:47 +00:00
'.php_cs.dist' ,
2014-05-05 19:52:55 +00:00
'.travis.yml' ,
2017-11-25 10:45:09 +00:00
'acceptance.suite.yml' ,
2017-01-29 17:10:02 +00:00
'appveyor-phpunit.xml' ,
2014-05-05 19:52:55 +00:00
'build' ,
2018-06-18 18:39:47 +00:00
'build.js' ,
2018-07-28 00:17:32 +00:00
'build.xml' ,
'codeception.yml' ,
2014-05-05 19:52:55 +00:00
'composer.json' ,
'composer.lock' ,
2018-10-03 16:54:22 +00:00
'crowdin.yml' ,
2018-07-28 00:17:32 +00:00
'drone-package.json' ,
2017-04-21 22:43:28 +00:00
'Gemfile' ,
2018-07-28 00:17:32 +00:00
'Gemfile.lock' ,
'package.json' ,
'package-lock.json' ,
2014-05-05 19:52:55 +00:00
'phpunit.xml.dist' ,
2018-07-28 00:17:32 +00:00
'README.md' ,
'RoboFile.php' ,
2017-11-25 10:45:09 +00:00
'scss-lint.yml' ,
2014-05-05 19:52:55 +00:00
'tests' ,
'travisci-phpunit.xml' ,
2017-06-18 11:43:38 +00:00
'codeception.yml' ,
'RoboFile.php' ,
2018-08-03 11:52:48 +00:00
'CODE_OF_CONDUCT.md' ,
2016-07-23 08:35:26 +00:00
// Remove the testing sample data from all packages
'installation/sql/mysql/sample_testing.sql' ,
'installation/sql/postgresql/sample_testing.sql' ,
2014-05-05 19:52:55 +00:00
);
2014-05-19 20:52:38 +00:00
/*
* Here we set the files / folders which should not be packaged with patch packages only
* These paths are from the repository root without the leading slash
*/
$doNotPatch = array (
2018-04-10 16:40:03 +00:00
'administrator/cache' ,
2016-05-11 21:20:18 +00:00
'administrator/logs' ,
2014-05-19 20:52:38 +00:00
'installation' ,
2015-01-23 15:19:17 +00:00
'images' ,
2014-05-19 20:52:38 +00:00
);
2018-05-06 15:28:38 +00:00
/*
* This array will contain the checksums for all files which are created by this script .
* This is an associative array with the following structure :
* array (
* 'filename' => array (
* 'type1' => 'hash' ,
* 'type2' => 'hash' ,
* ),
* )
*/
$checksums = array ();
2013-10-31 23:09:27 +00:00
// For the packages, replace spaces in stability (RC) with underscores
2017-08-07 14:29:32 +00:00
$packageStability = str_replace ( ' ' , '_' , Version :: DEV_STATUS );
2013-10-31 23:09:27 +00:00
2018-07-28 00:17:32 +00:00
// Delete the files and folders we exclude from the packages (tests, docs, build, etc.).
echo " Delete folders not included in packages. \n " ;
foreach ( $doNotPackage as $removeFile )
{
system ( 'rm -rf ' . $time . '/' . $removeFile );
}
2012-06-22 01:31:45 +00:00
// Count down starting with the latest release and add diff files to this array
2013-08-24 00:42:52 +00:00
for ( $num = $release - 1 ; $num >= 0 ; $num -- )
{
2012-06-22 01:31:45 +00:00
echo " Create version $num update packages. \n " ;
2012-02-07 03:24:48 +00:00
2018-04-04 11:52:22 +00:00
// Here we get a list of all files that have changed between the two references ($previousTag and $remote) and save in diffdocs
2012-02-07 03:24:48 +00:00
$previousTag = $version . '.' . $num ;
2018-04-04 11:52:22 +00:00
$command = $systemGit . ' diff tags/' . $previousTag . ' ' . $remote . ' --name-status > diffdocs/' . $version . '.' . $num ;
2013-08-24 00:42:52 +00:00
2012-02-07 03:24:48 +00:00
system ( $command );
2013-08-24 00:42:52 +00:00
// $filesArray will hold the array of files to include in diff package
2012-03-29 18:48:24 +00:00
$deletedFiles = array ();
2013-08-24 00:42:52 +00:00
$files = file ( 'diffdocs/' . $version . '.' . $num );
2012-02-07 03:24:48 +00:00
2014-01-31 00:51:26 +00:00
// Loop through and add all files except: tests, installation, build, .git, .travis, travis, phpunit, .md, or images
2013-08-24 00:42:52 +00:00
foreach ( $files as $file )
2012-02-07 03:24:48 +00:00
{
2014-05-19 20:52:38 +00:00
$fileName = substr ( $file , 2 );
2015-03-07 21:45:35 +00:00
$folderPath = explode ( '/' , $fileName );
$baseFolderName = $folderPath [ 0 ];
2014-05-19 20:52:38 +00:00
2015-03-07 21:45:35 +00:00
$doNotPackageFile = in_array ( trim ( $fileName ), $doNotPackage );
$doNotPatchFile = in_array ( trim ( $fileName ), $doNotPatch );
$doNotPackageBaseFolder = in_array ( $baseFolderName , $doNotPackage );
$doNotPatchBaseFolder = in_array ( $baseFolderName , $doNotPatch );
2014-05-19 20:52:38 +00:00
2015-03-07 21:45:35 +00:00
if ( $doNotPackageFile || $doNotPatchFile || $doNotPackageBaseFolder || $doNotPatchBaseFolder )
2012-03-29 18:48:24 +00:00
{
2015-03-07 21:45:35 +00:00
continue ;
}
2016-07-31 17:37:52 +00:00
// Act on the file based on the action
switch ( substr ( $file , 0 , 1 ))
2015-03-07 21:45:35 +00:00
{
2016-07-31 17:37:52 +00:00
// This is a new case with git 2.9 to handle renamed files
case 'R' :
// Explode the file on the tab character; key 0 is the action (rename), key 1 is the old filename, and key 2 is the new filename
$renamedFileData = explode ( " \t " , $file );
// Add the new file for packaging
$filesArray [ $renamedFileData [ 2 ]] = true ;
// And flag the old file as deleted
$deletedFiles [] = $renamedFileData [ 1 ];
break ;
// Deleted files
case 'D' :
$deletedFiles [] = $fileName ;
break ;
// Regular additions and modifications
default :
$filesArray [ $fileName ] = true ;
break ;
2012-02-07 03:24:48 +00:00
}
}
// Write the file list to a text file.
2012-06-22 01:31:45 +00:00
$filePut = array_keys ( $filesArray );
sort ( $filePut );
2013-08-24 00:42:52 +00:00
file_put_contents ( 'diffconvert/' . $version . '.' . $num , implode ( '' , $filePut ));
file_put_contents ( 'diffconvert/' . $version . '.' . $num . '-deleted' , $deletedFiles );
2012-09-26 16:01:46 +00:00
2013-01-18 17:03:57 +00:00
// Only create archives for 0 and most recent versions. Skip other update versions.
2013-01-18 16:46:50 +00:00
if ( $num != 0 && ( $num != $release - 1 ))
{
2013-08-24 00:42:52 +00:00
echo " Skipping patch archive for version $version . $num\n " ;
2013-01-18 17:03:57 +00:00
continue ;
2012-06-22 01:31:45 +00:00
}
2013-03-17 16:44:04 +00:00
2013-02-02 22:01:51 +00:00
$fromName = $num == 0 ? 'x' : $num ;
2018-04-04 11:52:22 +00:00
2012-02-07 03:24:48 +00:00
// Create the diff archive packages using the file name list.
2018-04-04 11:52:22 +00:00
if ( ! $excludeBzip2 )
{
2018-05-06 15:28:38 +00:00
$packageName = 'Joomla_' . $version . '.' . $fromName . '_to_' . $fullVersion . '-' . $packageStability . '-Patch_Package.tar.bz2' ;
2018-06-15 05:59:24 +00:00
system ( 'tar --create --bzip2 --no-recursion --directory ' . $time . ' --file packages/' . $packageName . ' --files-from diffconvert/' . $version . '.' . $num . '> /dev/null' );
2018-05-06 15:28:38 +00:00
$checksums [ $packageName ] = array ();
2018-04-04 11:52:22 +00:00
}
if ( ! $excludeGzip )
{
2018-05-06 15:28:38 +00:00
$packageName = 'Joomla_' . $version . '.' . $fromName . '_to_' . $fullVersion . '-' . $packageStability . '-Patch_Package.tar.gz' ;
2018-06-15 05:59:24 +00:00
system ( 'tar --create --gzip --no-recursion --directory ' . $time . ' --file packages/' . $packageName . ' --files-from diffconvert/' . $version . '.' . $num . '> /dev/null' );
2018-05-06 15:28:38 +00:00
$checksums [ $packageName ] = array ();
2018-04-04 11:52:22 +00:00
}
2012-02-07 03:24:48 +00:00
2018-04-04 11:52:22 +00:00
if ( ! $excludeZip )
{
2018-05-06 15:28:38 +00:00
$packageName = 'Joomla_' . $version . '.' . $fromName . '_to_' . $fullVersion . '-' . $packageStability . '-Patch_Package.zip' ;
2018-04-04 11:52:22 +00:00
chdir ( $time );
2018-06-15 05:59:24 +00:00
system ( 'zip ../packages/' . $packageName . ' -@ < ../diffconvert/' . $version . '.' . $num . '> /dev/null' );
2018-04-04 11:52:22 +00:00
chdir ( '..' );
2018-05-06 15:28:38 +00:00
$checksums [ $packageName ] = array ();
2018-04-04 11:52:22 +00:00
}
2012-02-07 03:24:48 +00:00
}
echo " Build full package files. \n " ;
2018-04-04 11:52:22 +00:00
chdir ( $time );
2012-02-07 03:24:48 +00:00
// Create full archive packages.
2018-04-04 11:52:22 +00:00
if ( ! $excludeBzip2 )
{
2018-05-06 15:28:38 +00:00
$packageName = 'Joomla_' . $fullVersion . '-' . $packageStability . '-Full_Package.tar.bz2' ;
2018-06-15 05:59:24 +00:00
system ( 'tar --create --bzip2 --file ../packages/' . $packageName . ' * > /dev/null' );
2018-05-06 15:28:38 +00:00
$checksums [ $packageName ] = array ();
2018-04-04 11:52:22 +00:00
}
2012-02-07 03:24:48 +00:00
2018-04-04 11:52:22 +00:00
if ( ! $excludeGzip )
{
2018-05-06 15:28:38 +00:00
$packageName = 'Joomla_' . $fullVersion . '-' . $packageStability . '-Full_Package.tar.gz' ;
2018-06-15 05:59:24 +00:00
system ( 'tar --create --gzip --file ../packages/' . $packageName . ' * > /dev/null' );
2018-05-06 15:28:38 +00:00
$checksums [ $packageName ] = array ();
2018-04-04 11:52:22 +00:00
}
2012-02-07 03:24:48 +00:00
2018-04-04 11:52:22 +00:00
if ( ! $excludeZip )
{
2018-05-06 15:28:38 +00:00
$packageName = 'Joomla_' . $fullVersion . '-' . $packageStability . '-Full_Package.zip' ;
2018-06-15 05:59:24 +00:00
system ( 'zip -r ../packages/' . $packageName . ' * > /dev/null' );
2018-05-06 15:28:38 +00:00
$checksums [ $packageName ] = array ();
2018-04-04 11:52:22 +00:00
}
2012-02-07 03:24:48 +00:00
2016-05-11 21:20:18 +00:00
// Create full update file without the default logs directory, installation folder, or sample images.
2012-02-07 03:24:48 +00:00
echo " Build full update package. \n " ;
2016-05-11 21:20:18 +00:00
system ( 'rm -r administrator/logs' );
2012-02-07 03:24:48 +00:00
system ( 'rm -r installation' );
2014-01-31 00:51:26 +00:00
system ( 'rm -r images/banners' );
system ( 'rm -r images/headers' );
system ( 'rm -r images/sampledata' );
2015-03-18 22:56:56 +00:00
system ( 'rm images/joomla_black.png' );
2014-01-31 00:51:26 +00:00
system ( 'rm images/powered_by.png' );
2012-10-08 21:27:15 +00:00
2018-04-04 11:52:22 +00:00
if ( ! $excludeBzip2 )
{
2018-05-06 15:28:38 +00:00
$packageName = 'Joomla_' . $fullVersion . '-' . $packageStability . '-Update_Package.tar.bz2' ;
2018-06-15 05:59:24 +00:00
system ( 'tar --create --bzip2 --file ../packages/' . $packageName . ' * > /dev/null' );
2018-05-06 15:28:38 +00:00
$checksums [ $packageName ] = array ();
2018-04-04 11:52:22 +00:00
}
2012-10-08 21:27:15 +00:00
2018-04-04 11:52:22 +00:00
if ( ! $excludeGzip )
{
2018-05-06 15:28:38 +00:00
$packageName = 'Joomla_' . $fullVersion . '-' . $packageStability . '-Update_Package.tar.gz' ;
2018-06-15 05:59:24 +00:00
system ( 'tar --create --gzip --file ../packages/' . $packageName . ' * > /dev/null' );
2018-05-06 15:28:38 +00:00
$checksums [ $packageName ] = array ();
2018-04-04 11:52:22 +00:00
}
2012-10-08 21:27:15 +00:00
2018-04-04 11:52:22 +00:00
if ( ! $excludeZip )
{
2018-05-06 15:28:38 +00:00
$packageName = 'Joomla_' . $fullVersion . '-' . $packageStability . '-Update_Package.zip' ;
2018-06-15 05:59:24 +00:00
system ( 'zip -r ../packages/' . $packageName . ' * > /dev/null' );
2018-05-06 15:28:38 +00:00
$checksums [ $packageName ] = array ();
}
chdir ( '..' );
foreach ( array_keys ( $checksums ) as $packageName )
{
echo " Generating checksums for $packageName\n " ;
foreach ( array ( 'md5' , 'sha1' ) as $hash )
{
2018-06-15 05:59:24 +00:00
if ( file_exists ( 'packages/' . $packageName ))
2018-05-06 15:28:38 +00:00
{
2018-06-15 05:59:24 +00:00
$checksums [ $packageName ][ $hash ] = hash_file ( $hash , 'packages/' . $packageName );
2018-05-06 15:28:38 +00:00
}
else
{
echo " Package $packageName not found in build directories \n " ;
}
}
}
echo " Generating checksums.txt file \n " ;
$checksumsContent = '' ;
foreach ( $checksums as $packageName => $packageHashes )
{
$checksumsContent .= " Filename: $packageName\n " ;
foreach ( $packageHashes as $hashType => $hash )
{
$checksumsContent .= " $hashType : $hash\n " ;
}
$checksumsContent .= " \n " ;
2018-04-04 11:52:22 +00:00
}
2012-02-07 03:24:48 +00:00
2018-05-06 15:28:38 +00:00
file_put_contents ( 'checksums.txt' , $checksumsContent );
2013-08-24 00:42:52 +00:00
echo " Build of version $fullVersion complete! \n " ;