function make_tar

8.0.x make.utilities.inc make_tar($build_path)
6.x make.utilities.inc make_tar($build_path)
7.x make.utilities.inc make_tar($build_path)
5.x make.utilities.inc make_tar($build_path)
master make.utilities.inc make_tar($build_path)

@todo drush_archive_dump() also makes a tar. Consolidate?

1 call to make_tar()
drush_make in commands/make/make.drush.inc
Drush callback; make based on the makefile.

File

commands/make/make.utilities.inc, line 458
General utility functions for Drush Make.

Code

function make_tar($build_path) {
  $tmp_path = make_tmp();

  drush_mkdir(dirname($build_path));
  $filename = basename($build_path);
  $dirname = basename($build_path, '.tar.gz');
  // Move the build directory to a more human-friendly name, so that tar will
  // use it instead.
  drush_move_dir($tmp_path . DIRECTORY_SEPARATOR . '__build__', $tmp_path . DIRECTORY_SEPARATOR . $dirname, TRUE);
  // Only move the tar file to it's final location if it's been built
  // successfully.
  if (drush_shell_exec("%s -C %s -Pczf %s %s", drush_get_tar_executable(), $tmp_path, $tmp_path . '/' . $filename, $dirname)) {
    drush_move_dir($tmp_path . DIRECTORY_SEPARATOR . $filename, $build_path, TRUE);
  }
  // Move the build directory back to it's original location for consistency.
  drush_move_dir($tmp_path . DIRECTORY_SEPARATOR . $dirname, $tmp_path . DIRECTORY_SEPARATOR . '__build__');
}