schema/spacewalk/postgres/procs/empty_blob.sql | 1
schema/spacewalk/postgres/procs/timestamp_minus_int.sql | 1
schema/spacewalk/postgres/tables/dual.sql | 2
schema/spacewalk/schema-source-sanity-check.pl | 54 +++++++++-------
4 files changed, 35 insertions(+), 23 deletions(-)
New commits:
commit 38e7f4f97f014c782744e642187151c89af35446
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Mon Sep 27 16:35:25 2010 +0200
Marked PostgreSQL schema sources that are PostgreSQL-specific.
Also changed the sanity check script to report any such cases
as errors in the future.
diff --git a/schema/spacewalk/postgres/procs/empty_blob.sql
b/schema/spacewalk/postgres/procs/empty_blob.sql
index 4af10bf..a308ae7 100644
--- a/schema/spacewalk/postgres/procs/empty_blob.sql
+++ b/schema/spacewalk/postgres/procs/empty_blob.sql
@@ -1,3 +1,4 @@
+-- oracle equivalent source none
--
-- Copyright (c) 2009 Red Hat, Inc.
--
diff --git a/schema/spacewalk/postgres/procs/timestamp_minus_int.sql
b/schema/spacewalk/postgres/procs/timestamp_minus_int.sql
index 360bb2c..7e76f64 100644
--- a/schema/spacewalk/postgres/procs/timestamp_minus_int.sql
+++ b/schema/spacewalk/postgres/procs/timestamp_minus_int.sql
@@ -1,3 +1,4 @@
+-- oracle equivalent source none
--
-- Copyright (c) 2009 Red Hat, Inc.
--
diff --git a/schema/spacewalk/postgres/tables/dual.sql
b/schema/spacewalk/postgres/tables/dual.sql
index 2f4afd9..fd93f11 100644
--- a/schema/spacewalk/postgres/tables/dual.sql
+++ b/schema/spacewalk/postgres/tables/dual.sql
@@ -1,3 +1,5 @@
+-- oracle equivalent source none
+
create table dual ( dummy char );
insert into dual values ( 'X' );
diff --git a/schema/spacewalk/schema-source-sanity-check.pl
b/schema/spacewalk/schema-source-sanity-check.pl
index b33e422..48aeb9b 100644
--- a/schema/spacewalk/schema-source-sanity-check.pl
+++ b/schema/spacewalk/schema-source-sanity-check.pl
@@ -49,34 +49,42 @@ for my $c (sort keys %{ $files{oracle} }) {
for my $c (sort keys %{ $files{postgres} }) {
next unless $c =~ /\.sql$/;
- if (not exists $files{oracle}{$c}) {
- print "Postgres file [$c] is not in oracle (ignoring for now)\n" if
$show_ignored;
- # $error = 1;
- } else {
- local *FILE;
- open FILE, "postgres/$c" or do {
- print "Error reading postgres/$c: $!\n";
+ local *FILE;
+ open FILE, "postgres/$c" or do {
+ print "Error reading postgres/$c: $!\n";
+ $error = 1;
+ next;
+ };
+ my $first_line = <FILE>;
+ close FILE;
+ if ($first_line =~ /^-- oracle equivalent source (?:(none)|sha1 ([0-9a-f]{40}))$/) {
+ my $oracle_sha1 = $2;
+ if (defined $1 and $1 eq 'none') {
+ # the PostgreSQL source says there is no Oracle equivalent
+ if (exists $files{oracle}{$c}) {
+ print "PostgreSQL file [$c] claims it has no Oracle equivalent, but it
exists\n";
+ $error = 1;
+ }
+ next;
+ }
+ open FILE, "oracle/$c" or do {
+ print "Error reading oracle/$c to verify SHA1: $!\n";
$error = 1;
next;
};
- my $first_line = <FILE>;
+ my $sha1 = new Digest::SHA1;
+ $sha1->addfile(\*FILE);
+ my $sha1_hex = $sha1->hexdigest();
close FILE;
- if ($first_line =~ /^-- oracle equivalent source sha1 ([0-9a-f]{40})$/) {
- my $oracle_sha1 = $1;
- open FILE, "oracle/$c" or do {
- print "Error reading oracle/$c to verify SHA1: $!\n";
- $error = 1;
- next;
- };
- my $sha1 = new Digest::SHA1;
- $sha1->addfile(\*FILE);
- my $sha1_hex = $sha1->hexdigest();
- close FILE;
- if ($oracle_sha1 ne $sha1_hex) {
- print "File postgres/$c says SHA1 of Oracle source should be [$oracle_sha1] but
it is [$sha1_hex]\n";
- $error = 1;
- }
+ if ($oracle_sha1 ne $sha1_hex) {
+ print "File postgres/$c says SHA1 of Oracle source should be [$oracle_sha1] but
it is [$sha1_hex]\n";
+ $error = 1;
}
+ next;
+ }
+ if (not exists $files{oracle}{$c}) {
+ print "Postgres file [$c] is not in oracle\n";
+ $error = 1;
}
}