Index: release/package-release-nodes.php =================================================================== RCS file: /Users/wright/drupal/local_repo/contributions/modules/project/release/package-release-nodes.php,v retrieving revision 1.68 diff -u -p -r1.68 package-release-nodes.php --- release/package-release-nodes.php 30 Jul 2010 20:42:27 -0000 1.68 +++ release/package-release-nodes.php 13 Nov 2010 01:50:23 -0000 @@ -79,6 +79,7 @@ $dest_rel = 'files/projects'; // the script will find these tools in your PATH. $tar = '/usr/bin/tar'; $gzip = '/usr/bin/gzip'; +$zip = '/usr/bin/zip'; $cvs = '/usr/bin/cvs'; $ln = '/bin/ln'; $rm = '/bin/rm'; @@ -314,7 +315,7 @@ function package_releases($type, $projec function package_release_core($type, $nid, $project_short_name, $version, $tag) { global $tmp_dir, $repositories, $dest_root, $dest_rel; - global $cvs, $tar, $gzip, $rm; + global $cvs, $tar, $gzip, $zip, $rm; if (!drupal_chdir($tmp_dir)) { return 'error'; @@ -324,6 +325,8 @@ function package_release_core($type, $ni $release_node_view_link = l(t('view'), 'node/' . $nid); $file_path_tgz = $dest_rel . '/' . $release_file_id . '.tar.gz'; $full_dest_tgz = $dest_root . '/' . $file_path_tgz; + $file_path_zip = $dest_rel . '/' . $release_file_id . '.zip'; + $full_dest_zip = $dest_root . '/' . $file_path_zip; // Remember if the tar.gz version of this release file already exists. $tgz_exists = is_file($full_dest_tgz); @@ -358,7 +361,12 @@ function package_release_core($type, $ni } $files[] = $file_path_tgz; - // As soon as the tarball exists, we want to update the DB about it. + if (!drupal_exec("$zip -rq $full_dest_zip $release_file_id")) { + return 'error'; + } + $files[] = $file_path_zip; + + // As soon as the files exist, we want to update the DB about it. package_release_update_node($nid, $files); if ($tgz_exists) { @@ -375,7 +383,7 @@ function package_release_core($type, $ni function package_release_contrib($type, $nid, $project_short_name, $version, $tag, $release_dir) { global $tmp_dir, $repositories, $dest_root, $dest_rel; - global $cvs, $tar, $gzip, $rm, $ln; + global $cvs, $tar, $gzip, $zip, $rm, $ln; global $drush, $drush_make_dir; global $license, $trans_install; @@ -395,6 +403,8 @@ function package_release_contrib($type, $release_node_view_link = l(t('view'), 'node/' . $nid); $file_path_tgz = $dest_rel . '/' . $release_file_id . '.tar.gz'; $full_dest_tgz = $dest_root . '/' . $file_path_tgz; + $file_path_zip = $dest_rel . '/' . $release_file_id . '.zip'; + $full_dest_zip = $dest_root . '/' . $file_path_zip; // Remember if the tar.gz version of this release file already exists. $tgz_exists = is_file($full_dest_tgz); @@ -438,8 +448,10 @@ function package_release_contrib($type, return 'error'; } // Do we want a subdirectory in the tarball or not? + $is_translation = FALSE; $tarball_needs_subdir = TRUE; if ($contrib_type == 'translations' && $project_short_name != 'drupal-pot') { + $is_translation = TRUE; // Translation projects are packaged differently based on core version. if (intval($version) > 5) { if (!($to_tar = package_release_contrib_d6_translation($project_short_name, $version, $release_node_view_link))) { @@ -470,6 +482,13 @@ function package_release_contrib($type, } $files[] = $file_path_tgz; + if (!$is_translation) { + if (!drupal_exec("$zip -rq $full_dest_zip $to_tar")) { + return 'error'; + } + $files[] = $file_path_zip; + } + // Start with no package contents, since this is only valid for profiles. $package_contents = array(); @@ -519,9 +538,12 @@ function package_release_contrib($type, // NO-CORE DISTRIBUTION. $no_core_id = "$release_file_id-no-core"; - // Build the drupal file path and the full file path. - $no_core_file_path = "$dest_rel/$no_core_id.tar.gz"; - $no_core_full_dest = "$dest_root/$no_core_file_path"; + + // Build the drupal file path and the full file path for tgz and zip. + $no_core_file_path_tgz = "$dest_rel/$no_core_id.tar.gz"; + $no_core_full_dest_tgz = "$dest_root/$no_core_file_path_tgz"; + $no_core_file_path_zip = "$dest_rel/$no_core_id.zip"; + $no_core_full_dest_zip = "$dest_root/$no_core_file_path_zip"; // Run drush_make to build the profile's contents. // --drupal-org: Invoke drupal.org specific validation/processing. @@ -551,10 +573,15 @@ function package_release_contrib($type, // Package the no-core distribution. // 'h' is for dereference, we want to include the files, not the links - if (!drupal_exec("$tar -ch --file=- $project_short_name | $gzip -9 --no-name > $no_core_full_dest")) { + if (!drupal_exec("$tar -ch --file=- $project_short_name | $gzip -9 --no-name > $no_core_full_dest_tgz")) { return 'error'; } - $files[] = $no_core_file_path; + $files[] = $no_core_file_path_tgz; + + if (!drupal_exec("$zip -rq $no_core_full_dest_tgz $project_short_name")) { + return 'error'; + } + $files[] = $no_core_file_path_zip; // CORE DISTRIBUTION. @@ -577,16 +604,24 @@ function package_release_contrib($type, } $core_id = "$release_file_id-core"; - // Build the drupal file path and the full file path. - $core_file_path = "$dest_rel/$core_id.tar.gz"; - $core_full_dest = "$dest_root/$core_file_path"; + + // Build the drupal file path and the full file path for tgz and zip. + $core_file_path_tgz = "$dest_rel/$core_id.tar.gz"; + $core_full_dest_tgz = "$dest_root/$core_file_path_tgz"; + $core_file_path_zip = "$dest_rel/$core_id.zip"; + $core_full_dest_zip = "$dest_root/$core_file_path_zip"; // Package the core distribution. // 'h' is for dereference, we want to include the files, not the links - if (!drupal_exec("$tar -ch --file=- $core_build_dir | $gzip -9 --no-name > $core_full_dest")) { + if (!drupal_exec("$tar -ch --file=- $core_build_dir | $gzip -9 --no-name > $core_full_dest_tgz")) { + return 'error'; + } + $files[] = $core_file_path_tgz; + + if (!drupal_exec("$zip -rq $core_full_dest_zip $core_build_dir")) { return 'error'; } - $files[] = $core_file_path; + $files[] = $core_file_path_zip; // Development releases may have changed package contents -- clear out // their package item summary so a fresh item summary will be inserted. @@ -624,7 +659,7 @@ function package_release_contrib($type, } } - // As soon as the tarball exists, update the DB + // Now that all the files exist, update the DB about them. package_release_update_node($nid, $files, $package_contents); if ($tgz_exists) {