Commit 8586a7ba authored by ergonlogic's avatar ergonlogic

Issue #2036333: Remove CVS deploy code.

parent 19fd107e
<?php
/**
* @file
*
* This include file is based on the cvs_deploy module by Derek Wright.
* @author Derek Wright ("dww") http://drupal.org/user/46549
*/
/**
* Used by provision to hook into the cvs_deploy system.
*/
function _provision_cvs_deploy(&$file) {
$file->filename = realpath($file->filename);
$project = (isset($file->info['project'])) ? $file->info['project'] : _provision_cvs_deploy_get_project_name($file);
$file->project = $project;
_provision_cvs_deploy_version_alter($file->info['version'], $file);
$file->version = $file->info['version'];
}
/**
* Private helper to alter the 'project' of a module based on what directory
* in the CVS repository the module has been checked out from.
*/
function _provision_cvs_deploy_get_project_name($file) {
static $projects = array();
$name = $file->name;
if (empty($projects[$name])) {
// TODO: cache this in {cache}, too?
$cvs_dir = dirname($file->filename) .'/CVS';
if (is_dir($cvs_dir)) {
$repository = '';
if (file_exists($cvs_dir .'/Repository')) {
$repo_file = trim(file_get_contents($cvs_dir .'/Repository'));
if ($repo_file) {
$parts = explode('/', $repo_file);
if ($parts[0] == 'drupal') {
$projects[$name] = $parts[0];
}
else {
$projects[$name] = $parts[2];
}
}
}
}
}
return (isset($projects[$name]) ? $projects[$name] : '');
}
/**
* Private helper to alter the version of a module based on what we can figure
* out about the CVS tag in use.
*/
function _provision_cvs_deploy_version_alter(&$version, $file) {
static $available = array();
$match = array();
if (empty($version)) {
// The .info file contains no version data. Find the version based
// on the sticky tag in the local workspace (the CVS/Tag file).
$cvs_dir = dirname($file->filename) .'/CVS';
if (is_dir($cvs_dir)) {
$tag = ''; // If there's no Tag file, there's no tag, a.k.a. HEAD.
if (file_exists($cvs_dir .'/Tag')) {
$tag_file = trim(file_get_contents($cvs_dir .'/Tag'));
if ($tag_file) {
// Get the sticky tag for this workspace: strip off the leading 'T'.
$tag = preg_replace('@^(T|N)@', '', $tag_file);
}
}
$version = _provision_cvs_deploy_version_from_tag($tag);
}
}
// The weird concatenation prevents CVS from 'expanding' this $Name.
elseif (preg_match('/\$'.'Name: (.*?)\$/', $version, $match)) {
$version = _provision_cvs_deploy_version_from_tag(trim($match[1]));
}
}
/**
* Returns the human-readable version string from a given CVS tag.
*/
function _provision_cvs_deploy_version_from_tag($tag) {
// If there's nothing, it must be a HEAD checkout, and therefore,
// we have no idea what the version is.
if (!$tag || $tag == 'HEAD') {
$version = drush_drupal_major_version() . '.x-dev';
}
// See if it's a Drupal core release
elseif (preg_match('@^DRUPAL-(\d+)-(\d+)$@', $tag, $match)) {
$version = $match[1] . '.' . $match[2];
}
// See if it's a full, official release from a tag:
elseif (preg_match('@^DRUPAL-(\d+)--(\d+)-(\d+)(-.+)?@', $tag, $match)) {
$version = $match[1] .'.x-'. $match[2] .'.'. $match[3];
if (isset($match[4])) {
// This version's tag has 'extra', so clean that up.
$version .= '-'. preg_replace('/[_-]/', '', strtolower($match[4]));
}
}
// If not, see if it's from a branch (like a development snapshot).
elseif (preg_match('@^DRUPAL-(\d+)(--(\d+))?@', $tag, $match)) {
$version = $match[1] .'.x-'. (isset($match[3]) ? $match[3] : '1') .'.x-dev';
}
return $version;
}
......@@ -38,7 +38,6 @@ function _provision_drupal_find_themes($scope, $key = '') {
$files[$name]->template = TRUE;
}
}
_provision_cvs_deploy($files[$name]);
}
return $files;
}
......@@ -122,7 +121,6 @@ function _provision_system_query($type) {
function _provision_drupal_system_map() {
$profiles = _provision_find_profiles();
foreach ($profiles as $profile => $info) {
_provision_cvs_deploy($info);
if (!$info->version) {
$info->version = drush_drupal_version();
}
......@@ -152,7 +150,6 @@ function _provision_drupal_system_map() {
$module->platform = -1;
}
_provision_cvs_deploy($module);
$module->filename = realpath($module->filename);
if ($module->schema_version == -1) {
$module->schema_version = 0;
......@@ -171,7 +168,6 @@ function _provision_drupal_system_map() {
}
$info_file = sprintf("%s/%s.info", dirname($theme->filename), $theme->name);
$theme->info = provision_parse_info_file($info_file);
_provision_cvs_deploy($theme);
$theme->filename = realpath($theme->filename);
if ($theme->schema_version == -1) {
......
......@@ -39,7 +39,6 @@ function _provision_drupal_find_themes($scope, $key = '') {
$files[$name]->template = TRUE;
}
}
_provision_cvs_deploy($files[$name]);
}
return $files;
}
......@@ -125,7 +124,6 @@ function _provision_system_query($type) {
function _provision_drupal_system_map() {
$profiles = _provision_find_profiles();
foreach ($profiles as $profile => $info) {
_provision_cvs_deploy($info);
if (!$info->version) {
$info->version = drush_drupal_version();
}
......@@ -155,7 +153,6 @@ function _provision_drupal_system_map() {
$module->platform = -1;
}
_provision_cvs_deploy($module);
$module->filename = realpath($module->filename);
if ($module->schema_version == -1) {
$module->schema_version = 0;
......@@ -174,7 +171,6 @@ function _provision_drupal_system_map() {
}
$info_file = sprintf("%s/%s.info", dirname($theme->filename), $theme->name);
$theme->info = provision_parse_info_file($info_file);
_provision_cvs_deploy($theme);
$theme->filename = realpath($theme->filename);
if ($theme->schema_version == -1) {
......
......@@ -39,7 +39,6 @@ function _provision_drupal_find_themes($scope, $key = '') {
$files[$name]->template = TRUE;
}
}
_provision_cvs_deploy($files[$name]);
}
return $files;
}
......@@ -50,7 +49,6 @@ function _provision_drupal_find_themes($scope, $key = '') {
function _provision_drupal_system_map() {
$profiles = _provision_find_profiles();
foreach ($profiles as $profile => $info) {
_provision_cvs_deploy($info);
if (!$info->version) {
$info->version = drush_drupal_version();
}
......@@ -82,7 +80,6 @@ function _provision_system_query($type) {
$packages->platform = -1;
}
/*_provision_cvs_deploy($module);*/
$package->filename = realpath($package->filename);
if ($type == 'module') {
......
......@@ -398,8 +398,6 @@ function _provision_find_profiles() {
$profile->name = $name;
$profile->filename = $file;
_provision_cvs_deploy($profile);
$profile->info = array();
if (drush_drupal_major_version() >= 8) {
......@@ -479,23 +477,6 @@ function provision_drupal_find_sites() {
return $sites;
}
function _provision_drupal_get_cvs_versions($files) {
foreach ($files as $modulename => $file) {
$project = array();
$project['filename'] = $file->filename;
$project['name'] = $file->name;
$file->info['description'] = str_replace("\n", "", $file->info['description']);
if (!isset($project['project'])) {
$project['project'] = cvs_deploy_get_project_name($project);
}
_cvs_deploy_version_alter($file->info['version'], $project);
$name = !empty($project['project']) ? $project['project'] : $modulename;
$files[$name] = $file;
}
return $files;
}
/**
* Retrieve a list of aliases for the curent site.
*/
......@@ -580,8 +561,6 @@ function _provision_drupal_delete_aliases() {
}
}
require_once(dirname(__FILE__) . '/cvs_deploy.inc');
function provision_find_packages() {
// Load the version specific include files.
drush_include_engine('drupal', 'packages', drush_drupal_major_version());
......@@ -599,7 +578,6 @@ function provision_find_packages() {
// Iterate through the install profiles, finding the profile specific packages
foreach ($profiles as $profile => $info) {
_provision_cvs_deploy($info);
if (!$info->version) {
$info->version = drush_drupal_version();
}
......@@ -717,7 +695,6 @@ function _provision_drupal_find_modules($scope, $key = '') {
}
}
$files[$name]->schema_version = $schema_version;
_provision_cvs_deploy($files[$name]);
}
return $files;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment