From 448a0b6829955fcf9c968c3413f2dc89748b8554 Mon Sep 17 00:00:00 2001 From: blackice2999 Date: Sun, 10 Oct 2010 13:33:14 +0200 Subject: [PATCH 1/3] fixed multiple api version usage if path fserver/MACHINE_NAME/all --- views/fserver-updatexml.tpl.php | 14 +------------- views/fserver_plugin_style_updatexml.inc | 24 ++++++++++++++++++++++-- 2 files changed, 23 insertions(+), 15 deletions(-) diff --git a/views/fserver-updatexml.tpl.php b/views/fserver-updatexml.tpl.php index 60eb773..5827329 100644 --- a/views/fserver-updatexml.tpl.php +++ b/views/fserver-updatexml.tpl.php @@ -5,36 +5,26 @@ <?php print $project['title'] ?> - - 1 - - Projects - - - - - published - @@ -46,12 +36,10 @@ Security update - - - + \ No newline at end of file diff --git a/views/fserver_plugin_style_updatexml.inc b/views/fserver_plugin_style_updatexml.inc index 9d27f5d..c33075c 100644 --- a/views/fserver_plugin_style_updatexml.inc +++ b/views/fserver_plugin_style_updatexml.inc @@ -95,6 +95,8 @@ class fserver_plugin_style_updatexml extends views_plugin_style { } } } + // @TODO: need to correct the api version in project tag, if we have multiple api versions + // we need the key "all" instead of 5.x / 6.x / 7.x /... // If this is a legacy project and has a redirect URL use it immediately. if (!empty($project['redirect'])) { @@ -112,6 +114,10 @@ class fserver_plugin_style_updatexml extends views_plugin_style { $releases = array(); $project['recommended_major'] = ''; $project['supported_majors'] = array(); + + // Helper array for detecting multiple API Versions... (not the best way?) + $multiple_api_versions = array(); + foreach ($vars['rows'] as $num => $row) { foreach ($vars['options']['release'] as $element => $field) { $alias = $fields[$field]->field_alias; @@ -131,7 +137,15 @@ class fserver_plugin_style_updatexml extends views_plugin_style { } } } - + + // manual mapping from project api field to release api field + $project_api_version_mapping = $fields[$vars['options']['project']['api_version']]->field_alias; + if(isset($row->{$project_api_version_mapping})) { + $releases[$num]['api_version'] = $fields[$vars['options']['project']['api_version']]->theme($row); + // add current version to helper array... + $multiple_api_versions[$releases[$num]['api_version']] = $releases[$num]['api_version']; + } + if ($releases[$num]['recommended']) { // Use the first major version for the project major. // The list is sorted by "major desc", this way the latest branch will be @@ -144,7 +158,7 @@ class fserver_plugin_style_updatexml extends views_plugin_style { } // Version - $releases[$num]['version'] = "{$project['api_version']}-{$releases[$num]['version_major']}.{$releases[$num]['version_patch']}"; + $releases[$num]['version'] = "{$releases[$num]['api_version']}-{$releases[$num]['version_major']}.{$releases[$num]['version_patch']}"; if (!empty($releases[$num]['version_extra'])) { $releases[$num]['version'] .= "-{$releases[$num]['version_extra']}"; } @@ -158,8 +172,14 @@ class fserver_plugin_style_updatexml extends views_plugin_style { // Download link $releases[$num]['download_link'] = file_create_url($releases[$num]['download_link']); } + sort($project['supported_majors']); $project['supported_majors'] = implode(",", $project['supported_majors']); + + // overwrite projects api version if we have multiple versions to "all" + if (count($multiple_api_versions) > 1) { + $project['api_version'] = 'all'; + } // Finalize $vars['project'] = $project; From 6bc23111e82c437232e75e1d3e42ff4e13e8361f Mon Sep 17 00:00:00 2001 From: blackice2999 Date: Mon, 15 Nov 2010 15:07:43 +0100 Subject: [PATCH 2/3] changed fixed callback names to new drush command hook system... wtf... --- fserver.drush.inc | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/fserver.drush.inc b/fserver.drush.inc index 99885a3..511430d 100644 --- a/fserver.drush.inc +++ b/fserver.drush.inc @@ -22,15 +22,12 @@ function fserver_drush_command() { $items = array(); $items['fserver-status'] = array( - 'callback' => 'fserver_drush_status', 'description' => 'Determine the packaging status of a project.', ); $items['fserver-package'] = array( - 'callback' => 'fserver_drush_package', 'description' => 'Update packaging for a project.', ); $items['fserver-distro'] = array( - 'callback' => 'fserver_drush_distro', 'description' => 'Update packaging for a distribution.', ); return $items; @@ -53,7 +50,7 @@ function fserver_drush_help($section) { /** * Package new releases for a specified project or all. */ -function fserver_drush_package() { +function drush_fserver_package() { if (!drush_get_option('uri') && !drush_get_option('l')) { drush_die('You must use the --uri option to specify the location of this site.'); } @@ -94,7 +91,7 @@ function fserver_drush_package() { /** * Display project packaging status. */ -function fserver_drush_status() { +function drush_fserver_status() { $projects = _fserver_drush_get_projects(); // Filter the project list by the argument. @@ -564,7 +561,7 @@ function fserver_posix_groupname() { return NULL; } -function fserver_drush_distro() { +function drush_fserver_distro() { if (!drush_get_option('version')) { drush_die('No version supplied, please use --version to specify a version for your release.'); } From c93f44afce207fb99d366aeff104036b89c08993 Mon Sep 17 00:00:00 2001 From: blackice2999 Date: Tue, 16 Nov 2010 14:01:56 +0100 Subject: [PATCH 3/3] added --work-tree={->path} to all git commands to prevent file creation in main paths... --- fserver.drush.inc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fserver.drush.inc b/fserver.drush.inc index 511430d..3493b50 100644 --- a/fserver.drush.inc +++ b/fserver.drush.inc @@ -346,7 +346,7 @@ class FserverProject_git { // Retrieve tag info _drush_shell_exec_output_set(' '); // Clear output cache. - drush_op('drush_shell_exec', "git --git-dir={$this->path}/.git show {$vc}"); + drush_op('drush_shell_exec', "git --git-dir={$this->path}/.git --work-tree={$this->path} show {$vc}"); $info = drush_shell_exec_output(); if ($info[0] == "tag {$vc}") { $info = implode("\n", $info); @@ -378,7 +378,7 @@ class FserverProject_git { // Create the directory if it doesn't exist. if (file_check_directory($file_path, TRUE)) { $vc = $tag['original']; - drush_op('drush_shell_exec', "git --git-dir={$this->path}/.git checkout {$vc}"); + drush_op('drush_shell_exec', "git --git-dir={$this->path}/.git --work-tree={$this->path} checkout {$vc}"); $this->FserverProject->write_package_info($tag, array('.git')); drush_op('drush_shell_exec', "tar -Pcf - --exclude='.git' --transform='s,{$this->path},{$this->FserverProject->name},' {$this->path} | gzip > {$file_path}/{$base}.tgz");