29
0
mirror of https://github.com/joomla/joomla-cms.git synced 2024-06-26 07:13:21 +00:00
cms/build/build.php

553 lines
17 KiB
PHP
Raw Normal View History

2012-02-07 03:24:48 +00:00
<?php
/**
* Script used to build Joomla distribution archive packages
* 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
*/
use Joomla\CMS\Version;
const PHP_TAB = "\t";
function usage(string $command)
{
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;
}
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 -');
system('find . -name SECURITY.md | xargs rm -rf -');
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);
}
$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);
$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';
$fullpath = $tmp . '/' . $time;
2012-02-07 03:24:48 +00:00
// Parse input options
$options = getopt('', ['help', 'remote::', 'exclude-zip', 'exclude-gzip', 'exclude-bzip2']);
$remote = $options['remote'] ?? false;
$excludeZip = isset($options['exclude-zip']);
$excludeGzip = isset($options['exclude-gzip']);
$excludeBzip2 = isset($options['exclude-bzip2']);
$showHelp = isset($options['help']);
if ($showHelp)
{
usage($argv[0]);
exit;
}
// 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);
system($systemGit . ' archive ' . $remote . ' | tar -x -C ' . $fullpath);
// Install PHP and NPM dependencies and compile required media assets, skip Composer autoloader until post-cleanup
chdir($fullpath);
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
// 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');
// Also cleanup the Node installation of the media manager
system('rm -rf administrator/components/com_media/node_modules');
echo "Workspace built.\n";
// 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');
system('mkdir packages');
2012-02-07 03:24:48 +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.
*/
$filesArray = array(
"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
);
/*
* 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
* Because this is a fresh copy from a git tag, local environment files may be ignored
*/
$doNotPackage = array(
'.appveyor.yml',
'.babelrc',
2016-10-18 21:36:36 +00:00
'.drone.yml',
'.eslintignore',
'.eslintrc',
'.editorconfig',
2016-02-20 15:47:26 +00:00
'.github',
'.gitignore',
2017-07-04 15:55:09 +00:00
'.hound.yml',
'.php_cs.dist',
'.travis.yml',
'acceptance.suite.yml',
'appveyor-phpunit.xml',
'build',
'build.js',
'build.xml',
'codeception.yml',
'composer.json',
'composer.lock',
'crowdin.yml',
'drone-package.json',
'Gemfile',
'Gemfile.lock',
'package.json',
'package-lock.json',
'phpunit.xml.dist',
'README.md',
'RoboFile.php',
'scss-lint.yml',
'tests',
'travisci-phpunit.xml',
[Testing] Add basic setup and sample tests for Codeception System Tests (#16743) * System tests with codeception 2.2 * System tests with codeception 2.2 * System tests with codeception 2.2 * System tests with codeception 2.2 * Instructions for testing * Instructions for testing * Remove useless header * [tests] new convention for locating elements Adds Gherkin Pages and Step Objects as sample of useage * Update Codeception to 2.2.1 * Writing new composer.lock file for update * Adding users.feature scenarios using gherkin * Adding content.feature scenarios using gherkin * Adding users.feature file * Adding scenarios for access level and user group * Adding Assert module for assertion * Implementing Pageobject * Passing $title and $content as a argument * Implement step and page object in users.feature file * Add missing pages * New approach to manage suite configuration * Fix the issue_#29 and issue_#31 * Fix the issue_#30 * Fix the issue #37 * Remove the commented code * Every page object have the $url property * Update Codeception to version 2.2.2 * Create a constant for waiting times * Adding project information in README.md * update readme * Update README.md for TIMEOUT * Checking if TIMEOUT is not already set Pull Request for Issue #45 . Update a constant for waiting times It contains fix related to #47 * Using contants for timeouts * Improvement in frontend feature * improve the scenario * correct typo and improvement * Implement user frontend scenarios * Updated travis to only run system tests and no unit tests * add how to create snippets * category Scenario for issue #35 * Fix missing call to Step object * Move administrator login to the current page object pattern * Move administrator login to the current page object pattern * Remove Given Joomla CMS is installed * Update composer * Fix LoginPage * Fix missing call to step object * Use genering url name for page variable * Simplify users manager table xpath * Fix typo error * Allow robo to run individual .feature tests (#58) * Allow robo tu run individual .feature tests * Improve running individuals tests documentation * Implement the categories scenario * slove xpath issue and implement frontend scenario * Handle waiting for iframe and menu edit view to save menu item * Updating selenium to 2.53.1 * Updated travis integration for running tests (#60) * Updated travis integration for running tests * Updated travis integration for running tests * Updated travis integration for running tests * Updated travis integration for running tests * Updated travis integration for running tests * Updated travis integration for running tests * Updated travis integration for running tests * Updated travis integration for running tests * Updated travis integration for running tests * Updated travis integration for running tests * Updated travis integration for running tests * Updated travis integration for running tests * Updated travis integration for running tests * Updated travis integration for running tests * Updated travis integration for running tests * Updated travis integration for running tests * Updated travis integration for running tests * Updated travis integration for running tests * Working on Travis * Working on Travis * Working on Travis * Working on Travis * Adding docblocks and code style improvements * Adding phpdoc header and code style improvement in acceptance tester * [dockblock] Adding in Admin page object * [dockblock] Adding dockblock in content manager page object * [code style] Improve name of variable * [dockblock] Adding dockblock in control panel page object * [dockblock] Using AcceptanceTester.Page as a subpackage * [dockblock] Adding dockblock in login page object * [dockblock] Adding docblock in user acl page object * [dockblock] Adding dockblock in user group page object * [dockblock] Adding dockblock in user manager page object * [code style] Adding code style improvement in acceptance tester class * [docblock] Adding docblock in acceptance helper class * [docblock] Adding docblock in functional and unit testing class * [docblock] Adding docblocks and code style improvements in site page objects * [code style] Adding docblock and code style improvements * [code style] Adding code style improvement in acceptance tester * [docblock] Adding docblock in content step object * [docblock] Adding docblock and code style improvement in category step object * Adding category feature execution using Robo * [docblock] Adding docblock and code style improvement for category and menu page objects * Rearrange tab based on latest joomla * [docblock] Adding docblock and code style improvement in login and user step objects * [docblock] Adding docblock and code style improvement in login and user step objects * [docblock] Adding docblock and code style improvement in user frontend step objects * Remove extra blank lines * Remove comments from robo * Using __DEPLOY_VERSION__ instead of static 3.7 * Forcing 127.0.0.1 for /etc/hosts in travis * [code optimize] code optimization and remove duplicate codes (#65) * [code optimize] Combine save method for category and content * Using page object dynamically * Revert "[code optimize] Combine save method for category and content" This reverts commit 82682c5d57a14707c191736a57f22011c2fd54be. * Usign dynamic wait for test string * [duplicate] Handle duplicate code for user form * Using common annotation for create new user * [duplicate] Using common annotation for login in frontend scenarios * [duplicate] Using page object method to have user with username * [duplicate] Using page object method to have category with given title * [duplicate] Using page object method to have article with given title * [optimize] Reusing code by using oop concept * Resolve error in creating instance * Reuse fill article form code * Create Admin step * Using common method to search and select * Using common method for see system message * Using common method for search * Remove duplicate code * Remove duplicate code for delete and empty * Using property from parent class * Using Admin step as a parent class * Cleanup acceptance tester * Using generic page object properties * Updating travis and Robo to the final structure * Updating and moving codeception-build script * Updating and moving codeception-build script * Updating and moving codeception-build script * Updating and moving codeception-build script * Updating and moving codeception-build script * Updating and moving codeception-build script * Updating and moving codeception-build script * change the tests with generic name (#68) * change the tests with generic name * Rename test user1 to User One * Rename the email and login name * Remove acceptance.suite.yml file from git list (#70) * Remove acceptance.suite.yml file from git list * Remove unnecessory _generated folder * Fix issue #57 Update frontend_user tests (#61) * Fix issue_#57 Update frontend_user tests as per commented in PR #51 * [codestyle] Adding docblock and code style improvement in Robo and user frontend * Verify in backend that user is created * Fix scenario in user_frontend.feature to proper English * Using alternative of system message container for assurance (#72) * Using alternative of system message container for assurance in article feature * Improve code and convert into page object * Convert system message checks in category feature * Convert system message container in user feature * Repair user scenarios * CodeStyle for the Tests (#74) * codestyle * Small tweeks to the RoboFile (#75) * robo * robo * Changed all references to /tests as the root directory to /tests/codeception. (#78) * Update README.md Changed all references to /tests as the root directory to /tests/codeception. * Update README.md Corrected errors in the first PR * Changed a AND into a WHEN in the file tests/codeception/acceptance/users_frontend.feature * Update README.md (#84) * Update README.md Corrected two typos and inserted a warning for Firefox version above 47 * Update README.md Corrected version numbers. In composer.json i found Selenium WebDriver 2.53.1 Before the current firefox version 49 there was version 45. With version 45.0.2 I have no problems. With version 49.0.1 I had problems. * Update README.md Corrections * correction language category feature - UK to en-GB (#85) * Update to latest selenium server standalone version (#87) * Add a scroll to a element out of fold (#88) * Updating the Login Step File removing hardcoded username * Updating the feature files background step * Updating the background step * This should take care of the failure * Updating the Login Step * Trying to add a wait * Opening the Account Details Tab * Updating Manager Page * Adding an Extension Manager Class * Adding reference * Adding Extension Step File * Adding Extension Feature file * Fixing another failure * Work out of the box on Windows... (#90) * Adding execution in Travis * This update was a must * Updating Robo File * Updating Robo * Adidng Banner Step * Adding Feature * Adding both the Tests * Removing Accept Popup, not sure why this stuff is needed * back to pavilion * Codestyle (#95) * Updating branch * I have to remove it now * Removing uninstall Extension * Tests now run in chrome, firefox, edge and IE (#96) * Now works on chrome, firefox, edge and IE * update branch * update branch * fix mac detection and codestyle * updating dependencies * Update composer lock (#100) * Remove curl check (#101) We don't need it. * Better wrapper method to display search tools (#102) * Feature/add database module (#99) * Add Database module # Conflicts: # tests/codeception/acceptance.suite.dist.yml * Add documentation * Remove dump configuration * Update db configuration * Create the test database before the tests * Revert old dependencies composer.lock (#104) * Fix typo (#109) * Fix typo * Code style * Add new line before try catch * Add a Joomla Database Helper (#108) * Add JoomlaDb Helper * Fix configuration * Update to latest joomlabrowser * Move AcceptanceHelper to the codeception default location for helpers (#111) * Use default path for the AcceptanceHelper * Use codeception defaults for helper files * Order enabled modules alphabetical * Remove old tests (#115) * Remove the UserLoginCest The UserLoginCest does not define any scenarios and is not used anywhere. * Remove UserCest It is not used anymore * Composer update (#118) Update selenium-server-standalone to version 3.0.1.2 for working on linux with chrome * update version number in composer.json for JoomlaBrowser (#121) * update version number in composer.json for JoomlaBrowser * composer.lock * Fix in the RoboFile in the env parameter * Update composer * Update to latest selenium server version in composer.json Updating dependencies in composer file * Working on clean test branch * Working on sample tests * bit cs * bit cs * Removed old steps * revert readme (#132) * revert readme * readme * Further cleanup * Cleanup * Cleanup * Thank you @brianteeman * Thank you @brianteeman
2017-06-18 11:43:38 +00:00
'codeception.yml',
'RoboFile.php',
'CODE_OF_CONDUCT.md',
// Remove the testing sample data from all packages
'installation/sql/mysql/sample_testing.sql',
'installation/sql/postgresql/sample_testing.sql',
);
/*
* 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(
'administrator/cache',
2016-05-11 21:20:18 +00:00
'administrator/logs',
'installation',
2015-01-23 15:19:17 +00:00
'images',
);
/*
* 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
$packageStability = str_replace(' ', '_', Version::DEV_STATUS);
2013-10-31 23:09:27 +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);
}
// 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--)
{
echo "Create version $num update packages.\n";
2012-02-07 03:24:48 +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;
$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
$deletedFiles = array();
2013-08-24 00:42:52 +00:00
$files = file('diffdocs/' . $version . '.' . $num);
2012-02-07 03:24:48 +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
{
$fileName = substr($file, 2);
2015-03-07 21:45:35 +00:00
$folderPath = explode('/', $fileName);
$baseFolderName = $folderPath[0];
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);
2015-03-07 21:45:35 +00:00
if ($doNotPackageFile || $doNotPatchFile || $doNotPackageBaseFolder || $doNotPatchBaseFolder)
{
2015-03-07 21:45:35 +00:00
continue;
}
// Act on the file based on the action
switch (substr($file, 0, 1))
2015-03-07 21:45:35 +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.
$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);
2013-01-18 17:03:57 +00:00
// Only create archives for 0 and most recent versions. Skip other update versions.
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;
}
2013-03-17 16:44:04 +00:00
$fromName = $num == 0 ? 'x' : $num;
2012-02-07 03:24:48 +00:00
// Create the diff archive packages using the file name list.
if (!$excludeBzip2)
{
$packageName = 'Joomla_' . $version . '.' . $fromName . '_to_' . $fullVersion . '-' . $packageStability . '-Patch_Package.tar.bz2';
system('tar --create --bzip2 --no-recursion --directory ' . $time . ' --file packages/' . $packageName . ' --files-from diffconvert/' . $version . '.' . $num . '> /dev/null');
$checksums[$packageName] = array();
}
if (!$excludeGzip)
{
$packageName = 'Joomla_' . $version . '.' . $fromName . '_to_' . $fullVersion . '-' . $packageStability . '-Patch_Package.tar.gz';
system('tar --create --gzip --no-recursion --directory ' . $time . ' --file packages/' . $packageName . ' --files-from diffconvert/' . $version . '.' . $num . '> /dev/null');
$checksums[$packageName] = array();
}
2012-02-07 03:24:48 +00:00
if (!$excludeZip)
{
$packageName = 'Joomla_' . $version . '.' . $fromName . '_to_' . $fullVersion . '-' . $packageStability . '-Patch_Package.zip';
chdir($time);
system('zip ../packages/' . $packageName . ' -@ < ../diffconvert/' . $version . '.' . $num . '> /dev/null');
chdir('..');
$checksums[$packageName] = array();
}
2012-02-07 03:24:48 +00:00
}
echo "Build full package files.\n";
chdir($time);
2012-02-07 03:24:48 +00:00
// Create full archive packages.
if (!$excludeBzip2)
{
$packageName = 'Joomla_' . $fullVersion . '-' . $packageStability . '-Full_Package.tar.bz2';
system('tar --create --bzip2 --file ../packages/' . $packageName . ' * > /dev/null');
$checksums[$packageName] = array();
}
2012-02-07 03:24:48 +00:00
if (!$excludeGzip)
{
$packageName = 'Joomla_' . $fullVersion . '-' . $packageStability . '-Full_Package.tar.gz';
system('tar --create --gzip --file ../packages/' . $packageName . ' * > /dev/null');
$checksums[$packageName] = array();
}
2012-02-07 03:24:48 +00:00
if (!$excludeZip)
{
$packageName = 'Joomla_' . $fullVersion . '-' . $packageStability . '-Full_Package.zip';
system('zip -r ../packages/' . $packageName . ' * > /dev/null');
$checksums[$packageName] = array();
}
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');
system('rm -r images/banners');
system('rm -r images/headers');
system('rm -r images/sampledata');
system('rm images/joomla_black.png');
system('rm images/powered_by.png');
2012-10-08 21:27:15 +00:00
if (!$excludeBzip2)
{
$packageName = 'Joomla_' . $fullVersion . '-' . $packageStability . '-Update_Package.tar.bz2';
system('tar --create --bzip2 --file ../packages/' . $packageName . ' * > /dev/null');
$checksums[$packageName] = array();
}
2012-10-08 21:27:15 +00:00
if (!$excludeGzip)
{
$packageName = 'Joomla_' . $fullVersion . '-' . $packageStability . '-Update_Package.tar.gz';
system('tar --create --gzip --file ../packages/' . $packageName . ' * > /dev/null');
$checksums[$packageName] = array();
}
2012-10-08 21:27:15 +00:00
if (!$excludeZip)
{
$packageName = 'Joomla_' . $fullVersion . '-' . $packageStability . '-Update_Package.zip';
system('zip -r ../packages/' . $packageName . ' * > /dev/null');
$checksums[$packageName] = array();
}
chdir('..');
foreach (array_keys($checksums) as $packageName)
{
echo "Generating checksums for $packageName\n";
foreach (array('md5', 'sha1') as $hash)
{
if (file_exists('packages/' . $packageName))
{
$checksums[$packageName][$hash] = hash_file($hash, 'packages/' . $packageName);
}
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";
}
2012-02-07 03:24:48 +00:00
file_put_contents('checksums.txt', $checksumsContent);
2013-08-24 00:42:52 +00:00
echo "Build of version $fullVersion complete!\n";