From 5d9aef47949ff3539db40fc2316293888c91d77c Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Sat, 16 Oct 2010 23:01:03 +0200 Subject: [task/phing-build] Added a build.xml configuration for phing. The current state of the phing build script allowed the removal of some code from the old packaging process written entirely in PHP. Further simplifcations of the PHP code and additions to the phing build file will follow. PHPBB3-9849 --- build/package.php | 150 ++++-------------------------------------------------- 1 file changed, 11 insertions(+), 139 deletions(-) (limited to 'build/package.php') diff --git a/build/package.php b/build/package.php index a0da6404c6..2615d983b2 100755 --- a/build/package.php +++ b/build/package.php @@ -9,145 +9,24 @@ * */ -// The only thing i need to adjust. ;) -// Please always add the latest version number to the end -// Only have 5 releases here... -// If RC8 drops remove the install/data directory -//$versions = array('3.0.2', '3.0.3-RC1', '3.0.3', '3.0.4-RC1', '3.0.4', '3.0.5-RC1', '3.0.5', '3.0.6-RC1', '3.0.6-RC2', '3.0.6-RC3'); -//$versions = array('3.0.2', '3.0.3', '3.0.4', '3.0.5', '3.0.6', '3.0.7-RC1', '3.0.7'); -$versions = array('3.0.2', '3.0.3', '3.0.4', '3.0.5', '3.0.6', '3.0.7-RC1', '3.0.7-RC2', '3.0.7', '3.0.7-PL1'); -$verbose = false; +//$versions = array('3.0.2', '3.0.3', '3.0.4', '3.0.5', '3.0.6', '3.0.7-RC1', '3.0.7-RC2', '3.0.7', '3.0.7-PL1'); -require('build_helper.php'); - -$package = new build_package($versions, $verbose); - -echo "Building Release Packages\n"; -echo "Now all three package types (patch, files, release) are built as well as the update package (update).\n"; - -$package->begin_status('Remove temporary files'); - -// Cleanup... -$package->run_command('rm -Rv ' . $package->get('dest_dir')); -$package->run_command('rm -Rv ' . $package->get('diff_dir')); -$package->run_command('rm -Rv ' . $package->get('patch_directory')); -$package->run_command('rm -Rv ' . $package->get('files_directory')); -$package->run_command('rm -Rv ' . $package->get('update_directory')); -$package->run_command('rm -Rv ' . $package->get('release_directory')); - -$package->begin_status('Create new directories'); - -// Make sure the directories got removed -while (file_exists($package->get('update_directory'))) -{ - sleep(1); -} - -if (!file_exists($package->get('dest_dir'))) -{ - $package->run_command('mkdir ' . $package->get('dest_dir')); -} - -if (!file_exists($package->get('diff_dir'))) -{ - $package->run_command('mkdir ' . $package->get('diff_dir')); -} - -if (!file_exists($package->get('patch_directory'))) -{ - $package->run_command('mkdir ' . $package->get('patch_directory')); -} - -if (!file_exists($package->get('files_directory'))) -{ - $package->run_command('mkdir ' . $package->get('files_directory')); -} - -if (!file_exists($package->get('update_directory'))) -{ - $package->run_command('mkdir ' . $package->get('update_directory')); -} - -if (!file_exists($package->get('release_directory'))) -{ - $package->run_command('mkdir ' . $package->get('release_directory')); -} - -$package->begin_status('Copy release files to clean release directory'); - -// Create config.php file -$package->run_command('touch ' . $package->get('dest_dir') . '/config.php'); -//$package->run_command('sudo chown www-data:www-data ' . $package->get('dest_dir') . '/config.php'); - -// Create new directory structure -foreach ($package->clean_directory_structure as $dir => $dir_struct) -{ - $package->create_directory($package->get('dest_dir') . '/' . $dir, $dir_struct); -} - -// First step is to copy the new version over (clean structure) -foreach ($package->files_to_copy as $file) -{ - $source_file = $package->locations['new_version'] . $file; - $dest_file = $package->get('dest_dir') . '/' . $file; - - $package->run_command("cp -p $source_file $dest_file"); -} - -// fix line endings -chdir($package->get('dest_dir')); -$package->run_command($package->locations['new_version'] . 'develop/fix_files.sh'); - -// Now clean up the permissions -$package->begin_status('Adjust permissions'); - -$package->adjust_permissions($package->get('dest_dir')); - -// Now create a version for diffing the version - copy the tree over to old_versions... -$package->begin_status('Create diff directory for obtaining file differences'); - -$package->run_command('cp -Rp ' . $package->get('dest_dir') . '/* ' . $package->get('diff_dir')); -$package->run_command('cp -Rp ' . $package->get('dest_dir') . '/.htaccess ' . $package->get('diff_dir')); - -// Cleanup diff directory (only contents to diff) -foreach ($package->remove_from_diff_structure as $remove_dir) +if ($_SERVER['argc'] < 2) { - $package->run_command('rm -Rv ' . $package->get('diff_dir') . '/' . $remove_dir); + die("Please specify a list of versions as the first argument (e.g. package.php '1.0.0, 1.0.1, 1.0.2')."); } -// Now, first of all we need to rebuild all old packages we want to support -foreach ($package->old_packages as $package_name => $tag_name) -{ - $package->begin_status('Create old packages directory for diffing to ' . $package_name); - - chdir($package->locations['old_versions']); - - if (is_dir($package->locations['old_versions'] . $package_name)) - { - $package->run_command('rm -Rv ' . $package->locations['old_versions'] . $package_name); - } - - // Now, create a new one... - $tag_name = 'release_' . str_replace(array('.', '_to_'), array('_', ''), $tag_name); +$versions = explode(',', $_SERVER['argv'][1]); +$versions = array_map('trim', $versions); - $package->run_command('svn export --non-interactive http://code.phpbb.com/svn/phpbb/tags/' . $tag_name . '/phpBB/ ' . $package_name); +$verbose = true; - $location = $package->locations['old_versions'] . $package_name; - chdir($location . '/'); - - $package->run_command($package->locations['new_version'] . 'develop/fix_files.sh'); - - // Now clean up the permissions - $package->begin_status('Adjust permissions for package ' . $package_name); +require('build_helper.php'); - $package->adjust_permissions($location); +$package = new build_package($versions, $verbose); - // Cleanup diff directory (only contents to diff) - foreach ($package->remove_from_diff_structure as $remove_dir) - { - $package->run_command('rm -Rv ' . $location . '/' . $remove_dir); - } -} +echo "Building Release Packages\n"; +echo "Now all three package types (patch, files, release) are built as well as the update package (update).\n"; // Go trough all versions making a diff if we even have old versions // For phpBB 3.0.x we might choose a different update method, rendering the things below useless... @@ -160,10 +39,7 @@ if (sizeof($package->old_packages)) foreach ($package->old_packages as $_package_name => $dest_package_filename) { - $package->begin_status('Creating patch/diff files for phpBB-' . $dest_package_filename . $package->get('new_version_number')); - - $dest_package_filename = $package->get('patch_directory') . '/phpBB-' . $dest_package_filename . $package->get('new_version_number') . '.patch'; - $package->run_command('diff ' . $package->diff_options . ' ' . $_package_name . ' ' . $package->get('simple_name') . ' > ' . $dest_package_filename); + $package->begin_status('Parsing patch/diff files for phpBB-' . $dest_package_filename . $package->get('new_version_number')); // Parse this diff to determine file changes from the checked versions and save them $diff_file_changes[$_package_name] = $package->collect_diff_files($dest_package_filename, $_package_name); @@ -404,7 +280,6 @@ if (sizeof($package->old_packages)) foreach ($compress_programs as $extension => $compress_command) { $package->begin_status('Packaging phpBB Patch Files for ' . $extension); - $package->run_command('rm -v ../release_files/' . $package->get('release_filename') . '-patch.' . $extension); // Build Package $package->run_command($compress_command . ' ../release_files/' . $package->get('release_filename') . '-patch.' . $extension . ' *'); @@ -420,7 +295,6 @@ if (sizeof($package->old_packages)) { $package->begin_status('Packaging phpBB Files for ' . $extension); - $package->run_command('rm -v ../release_files/' . $package->get('release_filename') . '-files.' . $extension); $package->run_command('mkdir ' . $package->get('files_directory') . '/release'); $package->run_command('cp -Rp ' . $package->get('dest_dir') . '/docs ' . $package->get('files_directory') . '/release'); $package->run_command('cp -Rp ' . $package->get('dest_dir') . '/install ' . $package->get('files_directory') . '/release'); @@ -457,7 +331,6 @@ if (sizeof($package->old_packages)) $package->begin_status('Packaging phpBB Update for ' . $extension); - $package->run_command('rm -v ../release_files/' . $package->get('release_filename') . '-update.' . $extension); $package->run_command('mkdir ' . $package->get('update_directory') . '/release'); // Pack update files @@ -521,7 +394,6 @@ foreach ($compress_programs as $extension => $compress_command) // Microsoft Web PI packaging $package->begin_status('Packaging phpBB for Microsoft WebPI'); $file = './release_files/' . $package->get('release_filename') . '.webpi.zip'; -$package->run_command("rm -v $file"); $package->run_command('cp -p ./release_files/' . $package->get('release_filename') . ".zip $file"); $package->run_command('cd ./../webpi && ' . $compress_programs['zip'] . " ./../new_version/$file *"); $package->run_command("md5sum $file > $file.md5"); -- cgit v1.2.1