From 9338e1ad88baa74e63dc24fad3b775784af6db86 Mon Sep 17 00:00:00 2001 From: Andrew Yates <ayates@ebi.ac.uk> Date: Fri, 13 Jan 2012 14:26:12 +0000 Subject: [PATCH] Applying a fix for when the schema patcher is run from the misc-scripts directory and now default it to the current directory if no directory is extracted from __FILE__. We also have improved the warning about missing directories --- misc-scripts/schema_patcher.pl | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/misc-scripts/schema_patcher.pl b/misc-scripts/schema_patcher.pl index 66002e51b6..94c0918a0a 100755 --- a/misc-scripts/schema_patcher.pl +++ b/misc-scripts/schema_patcher.pl @@ -238,7 +238,7 @@ foreach my $thing ( [ 'ensembl', 'core', 'table.sql' ], my $sql_dir = _sql_dir($cvs_module, $schema_file); if(! defined $sql_dir) { if ( !$opt_quiet ) { - warn('No SQL directory found for CVS module '.$cvs_module); + warn(printf("No SQL directory found for CVS module %s\n", $cvs_module)); } next; } @@ -432,7 +432,6 @@ while ( $sth->fetch() ) { sprintf( "Can not determine species from '%s'\n", $database ) ); } } - if ( $schema_version_ok && $schema_type_ok && @@ -459,6 +458,9 @@ while ( $sth->fetch() ) { $database, $db_patches, $opt_release, $release_patches); } } + if($schema_type_ok && ! exists $patches{$schema_type}) { + printf("\t%s patches could not be found. Check your --cvsdir option and try again\n", $schema_type); + } } next; } @@ -592,14 +594,16 @@ sub _sql_dir { } else { my ($volume, $directories, $file) = splitpath(__FILE__); + $directories = curdir() unless $directories; $cvs_dir = catdir($directories, updir(), updir()); } my $sql_dir = rel2abs(canonpath( catdir( $cvs_dir, $cvs_module, 'sql' ) )); my $schema_location = catfile($sql_dir, $schema_file); if(! -f $schema_location) { - warn(sprintf("Could not find the schema file '%s'. Computed SQL dir was '%s'", $schema_location, $sql_dir)); - warn('Check your --cvsdir option is correct') if $opt_cvsdir; - warn('Try using --cvsdir if your checkouts are in a non-standard location') if $opt_cvsdir; + if($opt_verbose) { + printf("Could not find the schema file '%s' for E! module %s", $schema_location, $cvs_module); + printf("\tTry using --cvsdir if your checkouts are in a non-standard location\n") if $opt_cvsdir; + } return; } printf("Using '%s' as our SQL directory\n", $sql_dir); -- GitLab