Branch 'pgsql' - 5 commits - schema/spacewalk schema/util
by Jeff Ortel
schema/spacewalk/Makefile | 21
schema/spacewalk/Makefile.schema | 203 --------
schema/spacewalk/common/data/rhnVersionInfo.pre | 22
schema/spacewalk/genmain | 501 ++++++++++++++++++++++
schema/spacewalk/oracle/Makefile | 23 -
schema/spacewalk/oracle/data/rhnVersionInfo.pre | 22
schema/spacewalk/postgres/Makefile | 23 -
schema/spacewalk/postgres/data/rhnVersionInfo.pre | 22
schema/spacewalk/spacewalk-schema.spec | 9
schema/util/genmain | 501 ----------------------
10 files changed, 596 insertions(+), 751 deletions(-)
New commits:
commit 51ce08930387886ef8e7ae0fb7a76cc7e20fbe70
Author: Jeff Ortel <jortel(a)redhat.com>
Date: Wed Apr 29 14:52:13 2009 -0400
Update oracle and postgres makefiles to use cameleon instead of dogchow
diff --git a/schema/spacewalk/oracle/Makefile b/schema/spacewalk/oracle/Makefile
index 48717ea..46eb7a1 100644
--- a/schema/spacewalk/oracle/Makefile
+++ b/schema/spacewalk/oracle/Makefile
@@ -25,16 +25,16 @@
#
# It uses the following tools:
#
-# dogchow - A common DDL -> oracle DDL generator installed via rpm
-# installed via (yum install dogchow) from fedora extras.
+# cameleon - A common DDL -> oracle DDL generator installed via rpm
+# installed via (yum install cameleon) from fedora extras.
# genmain - A tool used to process the .deps files to produce
# the main.sql. It will inject the contents of a file
# named "start.sql" at the beginning if it exits.
#
# The build steps are as follows:
#
-# - Populate tables/common from ../common/tables using dogchow.
-# - Populate data/common from ../data/tables using dogchow.
+# - Populate tables/common from ../common/tables using cameleon.
+# - Populate data/common from ../data/tables using cameleon.
# - Populate views/common from ../views/tables
# - Generate the main.sql using genmain.py.
#
@@ -46,11 +46,11 @@ ifndef SQLUSER
SQLUSER := spacewalk/spacewalk@xe
endif
-DOGCHOW := dogchow -FH ../header.txt -s oracle
-DIRS := class types tables procs packages views triggers data
-GENMAIN := ../genmain -s oracle $(DIRS)
-REPLTBS := sed -re "s/\[\[[^]]+\]\]/$(TBS)/g"
-TMPMAIN := /tmp/main.sql
+CAMELEON := cameleon -F -H ../header.txt -s oracle
+DIRS := class types tables procs packages views triggers data
+GENMAIN := ../genmain -s oracle $(DIRS)
+REPLTBS := sed -re "s/\[\[[^]]+\]\]/$(TBS)/g"
+TMPMAIN := /tmp/main.sql
main : clean tables views data
@@ -65,7 +65,7 @@ devel : clean tables views data
tables : FORCE
mkdir -p tables/common
cp ../common/tables/*.deps tables/common
- $(DOGCHOW) -o tables/common ../common/tables/*.sql
+ $(CAMELEON) -o tables/common ../common/tables/*.sql
views : FORCE
mkdir views/common
@@ -75,7 +75,7 @@ views : FORCE
data : FORCE
mkdir -p data/common
cp ../common/data/*.deps data/common
- $(DOGCHOW) -o data/common ../common/data/*.sql
+ $(CAMELEON) -o data/common ../common/data/*.sql
install : main
sqlplus $(SQLUSER) @main
diff --git a/schema/spacewalk/postgres/Makefile b/schema/spacewalk/postgres/Makefile
index 7fcbd09..76efac4 100644
--- a/schema/spacewalk/postgres/Makefile
+++ b/schema/spacewalk/postgres/Makefile
@@ -17,16 +17,16 @@
#
# It uses the following tools:
#
-# dogchow - A common DDL -> postgres DDL generator installed via rpm
-# installed via (yum install dogchow) from fedora extras.
-# genmain - A tool used to process the .deps files to produce
-# the main.sql. It will inject the contents of a file
-# named "start.sql" at the beginning if it exits.
+# cameleon - A common DDL -> postgres DDL generator installed via rpm
+# installed via (yum install cameleon) from fedora extras.
+# genmain - A tool used to process the .deps files to produce
+# the main.sql. It will inject the contents of a file
+# named "start.sql" at the beginning if it exits.
#
# The build steps are as follows:
#
-# - Populate tables/common from ../common/tables using dogchow.
-# - Populate data/common from ../data/tables using dogchow.
+# - Populate tables/common from ../common/tables using cameleon.
+# - Populate data/common from ../data/tables using cameleon.
# - Populate views/common from ../views/tables
# - Generate the main.sql using genmain.py.
#
@@ -35,7 +35,7 @@ ifndef SQLUSER
SQLUSER := spacewalk
endif
-DOGCHOW := dogchow -FH ../header.txt -s postgres -O best
+CAMELEON := cameleon -F -H ../header.txt -s postgres -O best
DIRS := class types tables procs packages views triggers data
GENMAIN := ../genmain -s postgres $(DIRS)
@@ -49,7 +49,7 @@ devel: clean tables views data
tables : FORCE
mkdir -p tables/common
cp ../common/tables/*.deps tables/common
- $(DOGCHOW) -o tables/common ../common/tables/*.sql
+ $(CAMELEON) -o tables/common ../common/tables/*.sql
views : FORCE
mkdir views/common
@@ -59,7 +59,7 @@ views : FORCE
data : FORCE
mkdir -p data/common
cp ../common/data/*.deps data/common
- $(DOGCHOW) -o data/common ../common/data/*.sql
+ $(CAMELEON) -o data/common ../common/data/*.sql
install : main
psql -d $(SQLUSER) -f main.sql -v ON_ERROR_STOP=
commit 1531cb90f749057b0e48724f65b782463cd97e0c
Author: Jeff Ortel <jortel(a)redhat.com>
Date: Mon Apr 20 16:21:07 2009 -0400
Remove cruft from schema top level makefiles. Need to update spacewalk-setup and (maybe) upstream build scripts to work with this.
diff --git a/schema/spacewalk/Makefile b/schema/spacewalk/Makefile
index 153fab3..f38bdd1 100644
--- a/schema/spacewalk/Makefile
+++ b/schema/spacewalk/Makefile
@@ -1,25 +1,14 @@
-
include ../../rel-eng/Makefile
-
-# support for
-# make satellite-clean satellite-release TBS=USERS SQLUSER=spacewalk/spacewalk@xe
-
-UNIVERSE := universe.satellite.sql
-TOP := .
SPECFILE := $(firstword $(wildcard *.spec))
NAME := $(shell rpm -q --qf '%{name}\n' --specfile $(SPECFILE))
VERSION := $(shell rpm -q --qf '%{version}\n' --specfile $(SPECFILE))
RELEASE := $(shell rpm -q --qf '%{release}\n' --specfile $(SPECFILE))
-spacewalk-clean satellite-clean : schema-make-clean test-make-clean
-
-spacewalk-release satellite-release : schema-make-release test-make-release
-
-
-%-make-clean :
- $(MAKE) -f $(TOP)/Makefile.$* UNIVERSE=$(UNIVERSE) TOP=$(TOP) SCHEMA=$(NAME) VERSION=$(VERSION) RELEASE=$(RELEASE) clean
+spacewalk-clean satellite-clean : FORCE
+ $(MAKE) -f $(TOP)/Makefile.schema clean
-%-make-release :
- $(MAKE) -f $(TOP)/Makefile.$* UNIVERSE=$(UNIVERSE) TOP=$(TOP) SCHEMA=$(NAME) VERSION=$(VERSION) RELEASE=$(RELEASE) all
+spacewalk-release satellite-release : FORCE
+ $(MAKE) -f $(TOP)/Makefile.schema SCHEMA=$(NAME) VERSION=$(VERSION) RELEASE=$(RELEASE) all
+FORCE :
diff --git a/schema/spacewalk/Makefile.schema b/schema/spacewalk/Makefile.schema
index 95fa95e..3e59053 100644
--- a/schema/spacewalk/Makefile.schema
+++ b/schema/spacewalk/Makefile.schema
@@ -1,7 +1,10 @@
#
# Process the .pre files
# Then, build the oracle and postgres schemas
-#
+# Expected Args:
+# SCHEMA
+# VERSION
+# RELEASE
PRE_FILES := $(shell find . -name \*.pre)
POST_FILES := $(addsuffix .sql,$(basename $(PRE_FILES)))
commit 5dcb6f6a030c5bc4f5676d7bd33a4199ee891ddf
Author: Jeff Ortel <jortel(a)redhat.com>
Date: Mon Apr 20 16:00:43 2009 -0400
Fix perms and remove (-d) in %files for oracle.sql and postgres.sql
diff --git a/schema/spacewalk/spacewalk-schema.spec b/schema/spacewalk/spacewalk-schema.spec
index 61e8471..e6ac4da 100644
--- a/schema/spacewalk/spacewalk-schema.spec
+++ b/schema/spacewalk/spacewalk-schema.spec
@@ -31,8 +31,8 @@ pod2man spacewalk-schema-upgrade spacewalk-schema-upgrade.1
%install
rm -rf $RPM_BUILD_ROOT
install -m 0755 -d $RPM_BUILD_ROOT%{rhnroot}
-install -m 0755 -d oracle.sql $RPM_BUILD_ROOT%{rhnroot}
-install -m 0755 -d postgres.sql $RPM_BUILD_ROOT%{rhnroot}
+install -m 0644 oracle.sql $RPM_BUILD_ROOT%{rhnroot}
+install -m 0644 postgres.sql $RPM_BUILD_ROOT%{rhnroot}
install -m 0755 -d $RPM_BUILD_ROOT%{_bindir}
install -m 0755 %{name}-upgrade $RPM_BUILD_ROOT%{_bindir}
install -m 0755 -d $RPM_BUILD_ROOT%{rhnroot}/schema-upgrade
commit 415cd9b22b440beb7078dac6e72af6b749564d67
Author: Jeff Ortel <jortel(a)redhat.com>
Date: Mon Apr 20 15:55:44 2009 -0400
Move rhnVersionInfo.pre to oracle and copy to postgres.
diff --git a/schema/spacewalk/common/data/rhnVersionInfo.pre b/schema/spacewalk/common/data/rhnVersionInfo.pre
deleted file mode 100644
index d2c5ba0..0000000
--- a/schema/spacewalk/common/data/rhnVersionInfo.pre
+++ /dev/null
@@ -1,22 +0,0 @@
---
--- this populates rhnVersionInfo. It needs to be run through cpp
--- during build. see Makefile.schema
---
-
-DELETE FROM rhnVersionInfo
-WHERE label = 'schema' and
- name_id = lookup_package_name(SCHEMA_NAME);
-
-INSERT INTO rhnVersionInfo
-(
- label,
- name_id,
- evr_id
-)
-( SELECT 'schema',
- lookup_package_name(SCHEMA_NAME),
- lookup_evr(NULL, SCHEMA_VERSION , SCHEMA_RELEASE )
- FROM dual
-);
-commit;
-
diff --git a/schema/spacewalk/oracle/data/rhnVersionInfo.pre b/schema/spacewalk/oracle/data/rhnVersionInfo.pre
new file mode 100644
index 0000000..d9cd447
--- /dev/null
+++ b/schema/spacewalk/oracle/data/rhnVersionInfo.pre
@@ -0,0 +1,22 @@
+--
+-- this populates rhnVersionInfo. It needs to be run through cpp
+-- during build. see Makefile.schema
+--
+
+DELETE FROM rhnVersionInfo
+WHERE label = 'schema' and
+ name_id = lookup_package_name(SCHEMA_NAME);
+
+INSERT INTO rhnVersionInfo
+(
+ label,
+ name_id,
+ evr_id
+)
+( SELECT 'schema',
+ lookup_package_name(SCHEMA_NAME),
+ lookup_evr(NULL, SCHEMA_VERSION , SCHEMA_RELEASE )
+ FROM dual
+);
+commit;
+
diff --git a/schema/spacewalk/postgres/data/rhnVersionInfo.pre b/schema/spacewalk/postgres/data/rhnVersionInfo.pre
new file mode 100644
index 0000000..d9cd447
--- /dev/null
+++ b/schema/spacewalk/postgres/data/rhnVersionInfo.pre
@@ -0,0 +1,22 @@
+--
+-- this populates rhnVersionInfo. It needs to be run through cpp
+-- during build. see Makefile.schema
+--
+
+DELETE FROM rhnVersionInfo
+WHERE label = 'schema' and
+ name_id = lookup_package_name(SCHEMA_NAME);
+
+INSERT INTO rhnVersionInfo
+(
+ label,
+ name_id,
+ evr_id
+)
+( SELECT 'schema',
+ lookup_package_name(SCHEMA_NAME),
+ lookup_evr(NULL, SCHEMA_VERSION , SCHEMA_RELEASE )
+ FROM dual
+);
+commit;
+
commit a7a09a2696bda797e92ff0af7fcc8e98f13f4968
Author: Jeff Ortel <jortel(a)redhat.com>
Date: Mon Apr 20 15:34:21 2009 -0400
Update spec to install oracle & postgres schema files. Move genmain so it will be included in the tarball.
diff --git a/schema/spacewalk/Makefile.schema b/schema/spacewalk/Makefile.schema
index 41235ea..95fa95e 100644
--- a/schema/spacewalk/Makefile.schema
+++ b/schema/spacewalk/Makefile.schema
@@ -1,195 +1,27 @@
-# This file includes the sql file handling rules and functions needed
-# to generate various universe.sql files
#
-# $Id$
-
-# safety rule in case we're included before any other universes are defined
-UNIVERSE?= no-universe
-
-all :: $(UNIVERSE)
-all :: $(if $(filter-out satellite, $(SCHEMA)), $(UNIVERSE)-synonyms)
-
-# eliminate empty lines and comments from sql file
-define print-sql-file
-{ \
- echo "select '$(1)' sql_file from dual;" ; \
- echo "-- SQL relevant contents from file $(1)" ; \
- cat $(1) | sed -e 's/^[[:space:]]*--.*$$//' | awk '/^[ \t]*$$/ { next; } { print; }' ; \
- echo ; \
-} >> $(UNIVERSE).tmp
-endef
-
-define print-syn-file
-{ \
- echo "select '$(1)' sql_file from dual;" ; \
- echo "-- SQL relevant contents from file $(1)" ; \
- cat $(1) | sed -e 's/^[[:space:]]*--.*$$//' | awk '/^[ \t]*$$/ { next; } { print; }' ; \
- echo ; \
-} >> $(UNIVERSE)-synonyms.tmp
-endef
-
-# check if we need to include a SQL file
-check-sql-file = $(shell egrep -i \
- '^--[[:space:]]*EXCLUDE:[[:space:]]*(all|$(SCHEMA))' \
- $(file) >/dev/null 2>&1 || echo $(file))
-
-# how to get sql files
-define get-sql-files
-$(wildcard $(TOP)/rhnsat/synonyms/*.sql) \
-$(wildcard $(TOP)/rhnsat/types/*.sql) \
-$(wildcard $(TOP)/rhnsat/tables/*.sql) \
-$(wildcard $(TOP)/rhnsat/class/*.sql) \
-$(wildcard $(TOP)/rhnsat/views/*.sql) \
-$(wildcard $(TOP)/rhnsat/procs/*.sql)
-endef
-# how do we get the package files
-define get-package-headers
-$(wildcard $(TOP)/rhnsat/packages/*.pks)
-endef
-define get-package-bodies
-$(wildcard $(TOP)/rhnsat/packages/*.pkb)
-endef
-# how to get the files that need preprocessing
-define get-pre-files
-$(wildcard $(TOP)/rhnsat/tables/*.pre)
-endef
-
-# LIST SQL FILES
-#
-# XXX: this makes the Makefile initialization take a long time, but
-# optimizing it would only make this Makefile even more complex
-ALL_SQL_FILES := $(get-sql-files)
-SQL_FILES := $(filter-out %_synonyms.sql, $(ALL_SQL_FILES))
-SQL_FILES := $(foreach file,$(SQL_FILES),$(check-sql-file))
-SQL_OBJECTS := $(basename $(notdir $(SQL_FILES)))
-SYN_FILES := $(filter %_synonyms.sql, $(ALL_SQL_FILES))
-SYN_FILES := $(foreach file,$(SYN_FILES),$(check-sql-file))
-SYN_OBJECTS := $(basename $(notdir $(SYN_FILES)))
-# packages are a little bit special
-ALL_PKG_HEADERS := $(get-package-headers)
-PKG_HEADERS := $(foreach file,$(ALL_PKG_HEADERS), $(check-sql-file))
-PKG_HEAD_TMP := $(basename $(notdir $(PKG_HEADERS)))
-PKG_HEADER_OBJS := $(sort $(foreach file,$(PKG_HEAD_TMP),$(file)_HEAD))
-ALL_PKG_BODIES := $(get-package-bodies)
-PKG_BODIES := $(foreach file,$(ALL_PKG_BODIES),$(check-sql-file))
-PKG_BODY_OBJS := $(sort $(basename $(notdir $(PKG_BODIES))))
-# SQL files that need preprocessing are nasty and special
-# PRE_OBJECTS are e.g. "rhnVersionInfo_data", but we generate
-# rhnVersionInfo.sql from the .pre; this is we can have a .sql file
-# to give to the upgrade scripts
-ALL_PRE_FILES := $(get-pre-files)
-PRE_FILES_TMP := $(addsuffix .sql,$(basename $(ALL_PRE_FILES)))
-PRE_FILES := $(foreach file,$(PRE_FILES_TMP),$(check-sql-file))
-PRE_OBJECTS := $(basename $(notdir $(PRE_FILES)))
-
-# Now the main targets
-no-universe ::
- @echo "Apparently you don't know what you're doing..."
- @exit -1
-
-$(UNIVERSE) :: $(TOP)/rhnsat/start.sql $(PKG_HEADER_OBJS) $(SQL_OBJECTS) $(PKG_BODY_OBJS) $(PRE_OBJECTS) $(TOP)/rhnsat/quit.sql
- @mv $(UNIVERSE).tmp $(UNIVERSE)
- @echo "$@ finished building"
-
-$(UNIVERSE)-synonyms :: syn_start $(SYN_OBJECTS) syn_end
- @mv $(UNIVERSE)-synonyms.tmp $(UNIVERSE)-synonyms
- @echo "$@ finished building"
-
-clean ::
- @rm -fv $(UNIVERSE) $(UNIVERSE).tmp .build/*.sql
- @rm -fv $(UNIVERSE)-synonyms $(UNIVERSE)-synonyms.tmp
- @rm -fv $(PRE_FILES_TMP)
-
-# DEPENDENCIES - import them all
-include $(TOP)/rhnsat/synonyms/Makefile.deps
-include $(TOP)/rhnsat/types/Makefile.deps
-include $(TOP)/rhnsat/tables/Makefile.deps
-include $(TOP)/rhnsat/class/Makefile.deps
-include $(TOP)/rhnsat/views/Makefile.deps
-include $(TOP)/rhnsat/procs/Makefile.deps
-include $(TOP)/rhnsat/packages/Makefile.deps
-
-# STATIC PATTERN RULES
-# -- they rule
-
-# We have to have the SQL objects rules before the file rules...
-$(filter %_data, $(SQL_OBJECTS)) :: %_data : %
-$(filter %_satdata, $(SQL_OBJECTS)) :: %_satdata : %
-$(filter %_grants, $(SQL_OBJECTS)) :: %_grants : %
-$(filter %_indexes, $(SQL_OBJECTS)) :: %_indexes : %
-$(filter %_triggers, $(SQL_OBJECTS)) :: %_triggers : %
-$(filter %_sequences, $(SQL_OBJECTS)) :: %_sequences : %
-$(filter %_constraints, $(SQL_OBJECTS)) :: %_constraints : %
-
-$(filter %_synonyms, $(SYN_OBJECTS)) :: %_synonyms :
-
-# Just like above, but for the PRE ones. Add as needed.
-$(filter %_data, $(PRE_OBJECTS)) :: %_data : %
-$(filter %_satdata, $(PRE_OBJECTS)) :: %_satdata : %
+# Process the .pre files
+# Then, build the oracle and postgres schemas
+#
-# Cardinal rule that links an object to its file - one of these rules
-# will match one of the objects needed to build the target
-$(basename $(notdir $(filter $(TOP)/rhnsat/synonyms/%,$(SQL_FILES)))) :: % : $(TOP)/rhnsat/synonyms/%.sql
-$(basename $(notdir $(filter $(TOP)/rhnsat/types/%,$(SQL_FILES)))) :: % : $(TOP)/rhnsat/types/%.sql
-$(basename $(notdir $(filter $(TOP)/rhnsat/tables/%,$(SQL_FILES)))) :: % : $(TOP)/rhnsat/tables/%.sql
-$(basename $(notdir $(filter $(TOP)/rhnsat/views/%, $(SQL_FILES)))) :: % : $(TOP)/rhnsat/views/%.sql
-$(basename $(notdir $(filter $(TOP)/rhnsat/class/%, $(SQL_FILES)))) :: % : $(TOP)/rhnsat/class/%.sql
-$(basename $(notdir $(filter $(TOP)/rhnsat/procs/%, $(SQL_FILES)))) :: % : $(TOP)/rhnsat/procs/%.sql
+PRE_FILES := $(shell find . -name \*.pre)
+POST_FILES := $(addsuffix .sql,$(basename $(PRE_FILES)))
-$(basename $(notdir $(filter $(TOP)/rhnsat/synonyms/%, $(SYN_FILES)))) :: % : $(TOP)/rhnsat/synonyms/%.sql
-$(basename $(notdir $(filter $(TOP)/rhnsat/types/%, $(SYN_FILES)))) :: % : $(TOP)/rhnsat/types/%.sql
-$(basename $(notdir $(filter $(TOP)/rhnsat/tables/%, $(SYN_FILES)))) :: % : $(TOP)/rhnsat/tables/%.sql
-$(basename $(notdir $(filter $(TOP)/rhnsat/views/%, $(SYN_FILES)))) :: % : $(TOP)/rhnsat/views/%.sql
-$(basename $(notdir $(filter $(TOP)/rhnsat/class/%, $(SYN_FILES)))) :: % : $(TOP)/rhnsat/class/%.sql
-$(basename $(notdir $(filter $(TOP)/rhnsat/procs/%, $(SYN_FILES)))) :: % : $(TOP)/rhnsat/procs/%.sql
+all : $(POST_FILES) oracle postgres
-$(PKG_HEADER_OBJS) :: %_HEAD : $(TOP)/rhnsat/packages/%.pks
+oracle postgres : FORCE
+ $(MAKE) -C $@ -f Makefile
-$(PKG_BODY_OBJS) :: % : $(TOP)/rhnsat/packages/%.pks $(TOP)/rhnsat/packages/%.pkb
+clean : FORCE
+ echo rm -f $(POST_FILES)
-# for .pre files, generate a .sql from the .pre, then satisfy the dep with
-# the .sql
-$(PRE_FILES) :: %.sql : %.pre
+%.sql : %.pre
@{ \
- echo "select '$(1)' sql_file from dual;" ; \
- echo "-- preprocessed SQL contents from $(1)" ; \
- cpp -D SCHEMA_NAME=\'$(SCHEMA)\' \
- -D SCHEMA_VERSION=\'$(VERSION)\' \
- -D SCHEMA_RELEASE=\'$(RELEASE)\' \
- -P -o - $< ; \
+ cpp -D SCHEMA_NAME=\'$(SCHEMA)\' \
+ -D SCHEMA_VERSION=\'$(VERSION)\' \
+ -D SCHEMA_RELEASE=\'$(RELEASE)\' \
+ -P -o - $< ; \
echo ; \
} > $@
-$(basename $(notdir $(filter $(TOP)/rhnsat/tables/%, $(PRE_FILES)))) :: % : $(TOP)/rhnsat/tables/%.sql
-
-# this makes sure the package definitions are always built before
-# their bodies
-$(filter %.pkb, $(PKG_BODIES)) :: %.pkb : %.pks
-
-# the king rule for SQL files...
-$(TOP)/rhnsat/start.sql $(PKG_HEADERS) $(SQL_FILES) $(PKG_BODIES) $(PRE_FILES) $(TOP)/rhnsat/quit.sql ::
- @echo $@
- @$(call print-sql-file,$@)
-
-# syn files get their own rule, or else we need to make print-sql-file take a "which file" arg
-syn_start :
- @echo $@
- @$(call print-syn-file,$(TOP)/rhnsat/start.sql)
-
-syn_end :
- @echo $@
- @$(call print-syn-file,$(TOP)/rhnsat/quit.sql)
-
-$(SYN_FILES) ::
- @echo $@
- @$(call print-syn-file,$@)
-
-# just to be pedantic
-.PHONY:: all clean no-universe
+FORCE:
-# objects are not real targets
-.PHONY:: $(SQL_OBJECTS) $(PKG_HEADER_OBJS) $(PKG_BODY_OBJS) $(PRE_OBJECTS) $(SYN_OBJECTS)
-# make sure we declare ALL SQL files as phony targets so we can raise
-# dependency errors if somebody gets overzealous excluding files from
-# a certain target
-.PHONY:: $(ALL_SQL_FILES) $(ALL_PKG_HEADERS) $(ALL_PKG_BODIES) $(ALL_PRE_FILES)
diff --git a/schema/spacewalk/genmain b/schema/spacewalk/genmain
new file mode 100755
index 0000000..d69cf8b
--- /dev/null
+++ b/schema/spacewalk/genmain
@@ -0,0 +1,501 @@
+#!/usr/bin/env python
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the (LGPL) GNU Lesser General Public License as
+# published by the Free Software Foundation; either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Library Lesser General Public License for more details at
+# ( http://www.gnu.org/licenses/lgpl.html ).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+import sys, os, re
+from getopt import getopt, GetoptError
+
+verbose = False
+
+#
+# CLASSES
+#
+
+class Name:
+
+ @classmethod
+ def qualify(cls, nss, fn):
+ names = []
+ if cls.qualified(fn):
+ for bn in cls.basenames(fn):
+ names.append(bn)
+ return tuple(names)
+ if not isinstance(nss, (tuple,list)):
+ nss = (nss,)
+ for ns in nss:
+ for bn in cls.basenames(fn):
+ name = '%s/%s' % (ns, bn)
+ names.append(name)
+ return tuple(names)
+
+ @classmethod
+ def basenames(cls, fn):
+ names = [fn]
+ try:
+ basename, ext = fn.rsplit('.', 1)
+ names.append(basename)
+ except:
+ pass
+ return names
+
+ @classmethod
+ def qualified(cls, name):
+ return ( '/' in name )
+
+ @classmethod
+ def unqualified(cls, name):
+ return ( not cls.qualified(name) )
+
+
+class DepTab:
+
+ class Options(object):
+ def __setitem__(self, k, v):
+ setattr(self, k, v)
+
+ class Entry:
+ def __init__(self, tab, info, subject):
+ self.tab = tab
+ self.info = info
+ self.subject = subject
+ self.deps = ()
+ self.hits = 0
+
+ def __iter__(self):
+ expanded = self.expanded([])
+ return iter(expanded)
+
+ def expanded(self, history):
+ deps = []
+ for keyset in self.deps:
+ keyset, expanded = self.tab.expand(keyset, history)
+ if len(keyset):
+ deps.append(tuple(keyset))
+ deps += expanded
+ return deps
+
+
+ def __repr__(self):
+ s = []
+ s.append(self.subject)
+ s.append('::')
+ s.append(str(self.deps))
+ s.append('@')
+ s.append(self.info)
+ s.append('/%d' % self.hits)
+ return ''.join(s)
+
+ pattern = re.compile('[,\s]+')
+
+ def __init__(self):
+ self.content = []
+ self.index = {}
+ self.options = self.Options()
+ self.aliases = None
+
+ def read(self, ns, path):
+ fp = open(path)
+ self.options.path = (ns,)
+ for line in self.lines(fp):
+ if self.setoption(ns, line[1]):
+ continue
+ parts = line[1].split('::', 1)
+ if len(parts) < 2:
+ continue
+ info = '%s:%d' % (path, line[0])
+ subject = parts[0].strip()
+ entry = self.Entry(self, info, subject)
+ parts[1] = parts[1].replace('\\', '')
+ deps = []
+ for dep in self.values(parts[1]):
+ dep = dep.strip()
+ if not len(dep):
+ continue
+ qnames = []
+ for qn in Name.qualify(self.options.path, dep):
+ qnames.append(qn)
+ deps.append(tuple(qnames))
+ entry.deps = tuple(deps)
+ self.content.append(entry)
+ for key in Name.qualify(ns, subject):
+ self.index[key] = entry
+ fp.close()
+
+ def setoption(self, ns, line):
+ parts = line.split('=', 1)
+ if len(parts) == 2:
+ tag = parts[0].strip()
+ if tag == 'path':
+ values = []
+ for v in self.values(parts[1]):
+ if v == '.':
+ v = ns
+ values.append(v)
+ self.options[tag] = values
+ return True
+ return False
+
+ def values(self, line):
+ return self.pattern.split(line.strip())
+
+ def lines(self, fp):
+ ln = 0
+ lines = []
+ append = False
+ for line in fp.readlines():
+ ln += 1
+ if not len(line):
+ continue
+ if line[0] == '#':
+ continue
+ if len(lines) and lines[-1][1].endswith('\\\n'):
+ last = lines.pop()[1][:-2]
+ joined = ' '.join((last, line))
+ lines.append((ln, joined))
+ else:
+ lines.append((ln, line))
+ return lines
+
+ def find(self, ns, fn):
+ result = ()
+ for key in Name.qualify(ns, fn):
+ entry = self.index.get(key)
+ if entry is None:
+ continue
+ entry.hits += 1
+ result = entry
+ break
+ return result
+
+ def expand(self, keyset, history):
+ result = ([],[])
+ for key in keyset:
+ if key in history:
+ print 'circular (alias) reference:%s' % history
+ continue
+ alias = self.aliases.get(key)
+ if alias is None:
+ result[0].append(key)
+ continue
+ history.append(key)
+ alias.hits += 1
+ for deps in alias.expanded(history):
+ result[1].append(deps)
+ if len(result[1]):
+ result = ([], result[1])
+ return result
+
+ def findaliases(self):
+ self.aliases = {}
+ for s,e in self.index.items():
+ if e.hits == 0:
+ self.aliases[s] = e
+ return self
+
+class Reader:
+
+ EXT = ['sql', 'pks', 'pkb']
+
+ def __init__(self):
+ self.deptab = DepTab()
+ self.deplist = DepList()
+ self.overrides = []
+
+ def read(self, directories):
+ self.opendeptabs(directories)
+ self.getfiles(directories)
+ self.deptab.findaliases()
+ return self
+
+ def sort(self):
+ sorted = self.deplist.sort()
+ return [x[2] for x in sorted]
+
+
+ def opendeptabs(self, directories):
+ for d in directories:
+ for fn, path in self.files(d, ('deps',)):
+ self.deptab.read(d, path)
+ return self
+
+ def getfiles(self, directories):
+ for d in directories:
+ for fn, path in self.files(d, self.EXT):
+ entry = self.deptab.find(d, fn)
+ keys = Name.qualify(d, fn)
+ found = self.deplist.find(keys[0])
+ if found is None:
+ self.deplist.add(keys, entry, path)
+ continue
+ pk = found[2]
+ self.overrides.append((path, pk))
+ return self
+
+ def path(self, d, fn):
+ return '%s/%s' % (d, fn)
+
+ def fsort(self, a, b):
+ try:
+ A = a.rsplit('.', 1)
+ B = b.rsplit('.', 1)
+ BC = cmp(A[0], B[0])
+ if BC:
+ return BC
+ IA = self.EXT.index(A[1])
+ IB = self.EXT.index(B[1])
+ return cmp(IA, IB)
+ except:
+ return 0
+
+ def files(self, d, extensions):
+ files = []
+ for n in sorted(os.walk(d)):
+ for fn in sorted(n[2], self.fsort):
+ parts = fn.rsplit('.', 1)
+ if len(parts) != 2:
+ continue
+ if parts[1] in extensions:
+ path = self.path(n[0], fn)
+ files.append((fn, path))
+ return files
+
+
+class Writer:
+
+ comment = """
+\n--------------------------------------------------------------------------------
+-- Source: %s
+--------------------------------------------------------------------------------
+ """
+
+ def __init__(self, aggregated=True):
+ self.aggregated = aggregated
+
+ def write(self, sorted, output):
+ self.start(output)
+ for p in sorted:
+ f = open(p)
+ output.write(self.comment % p)
+ for line in f.readlines():
+ if line.startswith('--'):
+ continue
+ output.write(line)
+ f.close()
+
+ def start(self, output):
+ if os.path.exists('start.sql'):
+ f = open('start.sql')
+ content = f.read()
+ output.write(content)
+ f.close()
+
+
+class Oracle(Writer):
+
+ def write(self, sorted, output):
+ if self.aggregated:
+ Writer.write(self, sorted, output)
+ return
+ self.start(output)
+ for p in sorted:
+ entry = '@%s' % p
+ output.write('\n')
+ output.write(entry)
+
+
+class Postgres(Writer):
+
+ def write(self, sorted, output):
+ if self.aggregated:
+ Writer.write(self, sorted, output)
+ return
+ self.start(output)
+ for p in sorted:
+ entry = '\\i %s' % p
+ output.write('\n')
+ output.write(entry)
+
+
+
+class DepList:
+
+ def __init__(self):
+ """ """
+ self.unsorted = []
+ self.index = {}
+ self.reset()
+
+ def reset(self):
+ self.stack = []
+ self.pushed = set()
+ self.sorted = []
+ self.unfound = []
+
+ def add(self, keys, deps, *payload):
+ item = [keys, deps]
+ item += payload
+ item = tuple(item)
+ self.unsorted.append(item)
+ for key in keys:
+ self.index[key] = item
+ return self
+
+ def sort(self):
+ self.reset()
+ for item in self.unsorted:
+ popped = []
+ self.push(item)
+ while len(self.stack):
+ try:
+ top = self.top()
+ ref = top[1].next()
+ refd = self.find(ref)
+ if refd is None:
+ info = top[0][1].info
+ self.unfound.append((ref, info))
+ continue
+ self.push(refd)
+ except StopIteration:
+ popped.append(self.pop())
+ continue
+ for p in popped:
+ self.sorted.append(p)
+ self.unsorted = self.sorted
+ return self.sorted
+
+ def find(self, key):
+ if not isinstance(key, (tuple,list)):
+ key = (key,)
+ for k in key:
+ v = self.index.get(k)
+ if v is not None:
+ return v
+ return None
+
+ def top(self):
+ return self.stack[-1]
+
+ def push(self, item):
+ if item in self.pushed:
+ return
+ frame = (item, iter(item[1]))
+ self.stack.append(frame)
+ self.pushed.add(item)
+
+ def pop(self):
+ try:
+ frame = self.stack.pop()
+ return frame[0]
+ except:
+ pass
+
+#
+# FUNCTIONS
+#
+
+def generate(path, reader, writer, output, directories):
+ os.chdir(path)
+ out = open(output, 'w')
+ ds = []
+ for fn in directories:
+ if os.path.isdir(fn):
+ ds.append(fn)
+ reader.read(ds)
+ sorted = reader.sort()
+ overrides = reader.overrides
+ print '\nOVERRIDES (%d):' % len(overrides)
+ for entry in overrides:
+ print '\t"%s" overridden by "%s"' % entry
+ unused = \
+ [x for x in reader.deptab.content if x.hits == 0]
+ print '\nUNUSED RULES (%d):' % len(unused)
+ for entry in unused:
+ if entry.hits == 0:
+ print '\t%s @%s' % (entry.subject,entry.info)
+ unfound = reader.deplist.unfound
+ print '\nUNFOUND (rule) REFERENCES (%d):' % len(unfound)
+ for unf in unfound:
+ print '\t"%s" @%s' % unf
+ if verbose:
+ ln = 1
+ print '\n\nFILES (%d):' % len(sorted)
+ for p in sorted:
+ print '\t%d %s' % (ln, p)
+ ln += 1
+ writer.write(sorted, out)
+ out.close()
+
+def usage():
+ s = []
+ s.append('Usage mkmain: [OPTIONS]')
+ s.append(' Options:')
+ s.append(' -h, --help')
+ s.append(' Show usage information.')
+ s.append(' -v, --verbose')
+ s.append(' Show extra processing information.')
+ s.append(' -s, --style')
+ s.append(' The output style (oracle|postres ).')
+ s.append(' -o, --output')
+ s.append(' The output file path.')
+ s.append(' -d, --directory')
+ s.append(' The working directory to process.')
+ print '\n'.join(s)
+
+def main(argv):
+ path = '.'
+ global verbose
+ reader = Reader()
+ writer = Oracle()
+ output = 'main.sql'
+ flags = 'vhd:o:s:'
+ keywords = [
+ '--help',
+ '--verbose',
+ '--directory',
+ '--output',
+ '--style',
+ ]
+ try:
+ opts, args = getopt(argv, flags, keywords)
+ for opt, arg in opts:
+ if opt in ('-h', '--help'):
+ usage()
+ sys.exit(0)
+ if opt in ('-v', '--verbose'):
+ verbose = True
+ continue
+ if opt in ('-o', '--output'):
+ output = arg
+ continue
+ if opt in ('-d', '--directory'):
+ path = arg
+ continue
+ if opt in ('-s', '--style'):
+ if arg == 'oracle':
+ writer = Oracle()
+ continue
+ if arg == 'postgres':
+ writer = Postgres()
+ continue
+ raise Exception('style "%s" not valid' % arg)
+ generate(path, reader, writer, output, args)
+ except GetoptError, e:
+ print e
+ usage()
+ sys.exit(2)
+
+if __name__ == '__main__':
+ main(sys.argv[1:])
+
diff --git a/schema/spacewalk/oracle/Makefile b/schema/spacewalk/oracle/Makefile
index 1acd830..48717ea 100644
--- a/schema/spacewalk/oracle/Makefile
+++ b/schema/spacewalk/oracle/Makefile
@@ -48,13 +48,14 @@ endif
DOGCHOW := dogchow -FH ../header.txt -s oracle
DIRS := class types tables procs packages views triggers data
-GENMAIN := ../../util/genmain -s oracle $(DIRS)
+GENMAIN := ../genmain -s oracle $(DIRS)
REPLTBS := sed -re "s/\[\[[^]]+\]\]/$(TBS)/g"
TMPMAIN := /tmp/main.sql
main : clean tables views data
$(GENMAIN)
+ cp main.sql ../oracle.sql
devel : clean tables views data
$(GENMAIN)
diff --git a/schema/spacewalk/postgres/Makefile b/schema/spacewalk/postgres/Makefile
index 8b1c365..7fcbd09 100644
--- a/schema/spacewalk/postgres/Makefile
+++ b/schema/spacewalk/postgres/Makefile
@@ -37,10 +37,11 @@ endif
DOGCHOW := dogchow -FH ../header.txt -s postgres -O best
DIRS := class types tables procs packages views triggers data
-GENMAIN := ../../util/genmain -s postgres $(DIRS)
+GENMAIN := ../genmain -s postgres $(DIRS)
main : clean tables views data
$(GENMAIN)
+ cp main.sql ../postgres.sql
devel: clean tables views data
$(GENMAIN)
diff --git a/schema/spacewalk/spacewalk-schema.spec b/schema/spacewalk/spacewalk-schema.spec
index 4171655..61e8471 100644
--- a/schema/spacewalk/spacewalk-schema.spec
+++ b/schema/spacewalk/spacewalk-schema.spec
@@ -15,7 +15,6 @@ Obsoletes: rhn-satellite-schema <= 5.1.0
%define rhnroot /etc/sysconfig/rhn/
-%define universe universe.satellite.sql
%description
rhn-satellite-schema is the Oracle SQL schema for the Spacewalk server.
@@ -26,16 +25,14 @@ Oracle tablespace name conversions have NOT been applied.
%setup -q
%build
-make -f Makefile.schema \
- UNIVERSE=%{universe} TOP=. SCHEMA=%{name} VERSION=%{version} RELEASE=%{release} \
- all
+make -f Makefile.schema
pod2man spacewalk-schema-upgrade spacewalk-schema-upgrade.1
%install
rm -rf $RPM_BUILD_ROOT
install -m 0755 -d $RPM_BUILD_ROOT%{rhnroot}
-install -m 0644 %{universe} $RPM_BUILD_ROOT%{rhnroot}
-
+install -m 0755 -d oracle.sql $RPM_BUILD_ROOT%{rhnroot}
+install -m 0755 -d postgres.sql $RPM_BUILD_ROOT%{rhnroot}
install -m 0755 -d $RPM_BUILD_ROOT%{_bindir}
install -m 0755 %{name}-upgrade $RPM_BUILD_ROOT%{_bindir}
install -m 0755 -d $RPM_BUILD_ROOT%{rhnroot}/schema-upgrade
diff --git a/schema/util/genmain b/schema/util/genmain
deleted file mode 100755
index bc0b315..0000000
--- a/schema/util/genmain
+++ /dev/null
@@ -1,501 +0,0 @@
-#!/usr/bin/env python
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the (LGPL) GNU Lesser General Public License as
-# published by the Free Software Foundation; either version 3 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Library Lesser General Public License for more details at
-# ( http://www.gnu.org/licenses/lgpl.html ).
-#
-# You should have received a copy of the GNU Lesser General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-import sys, os, re
-from getopt import getopt, GetoptError
-
-verbose = False
-
-#
-# CLASSES
-#
-
-class Name:
-
- @classmethod
- def qualify(cls, nss, fn):
- names = []
- if cls.qualified(fn):
- for bn in cls.basenames(fn):
- names.append(bn)
- return tuple(names)
- if not isinstance(nss, (tuple,list)):
- nss = (nss,)
- for ns in nss:
- for bn in cls.basenames(fn):
- name = '%s/%s' % (ns, bn)
- names.append(name)
- return tuple(names)
-
- @classmethod
- def basenames(cls, fn):
- names = [fn]
- try:
- basename, ext = fn.rsplit('.', 1)
- names.append(basename)
- except:
- pass
- return names
-
- @classmethod
- def qualified(cls, name):
- return ( '/' in name )
-
- @classmethod
- def unqualified(cls, name):
- return ( not cls.qualified(name) )
-
-
-class DepTab:
-
- class Options(object):
- def __setitem__(self, k, v):
- setattr(self, k, v)
-
- class Entry:
- def __init__(self, tab, info, subject):
- self.tab = tab
- self.info = info
- self.subject = subject
- self.deps = ()
- self.hits = 0
-
- def __iter__(self):
- expanded = self.expanded([])
- return iter(expanded)
-
- def expanded(self, history):
- deps = []
- for keyset in self.deps:
- keyset, expanded = self.tab.expand(keyset, history)
- if len(keyset):
- deps.append(tuple(keyset))
- deps += expanded
- return deps
-
-
- def __repr__(self):
- s = []
- s.append(self.subject)
- s.append('::')
- s.append(str(self.deps))
- s.append('@')
- s.append(self.info)
- s.append('/%d' % self.hits)
- return ''.join(s)
-
- pattern = re.compile('[,\s]+')
-
- def __init__(self):
- self.content = []
- self.index = {}
- self.options = self.Options()
- self.aliases = None
-
- def read(self, ns, path):
- fp = open(path)
- self.options.path = (ns,)
- for line in self.lines(fp):
- if self.setoption(ns, line[1]):
- continue
- parts = line[1].split('::', 1)
- if len(parts) < 2:
- continue
- info = '%s:%d' % (path, line[0])
- subject = parts[0].strip()
- entry = self.Entry(self, info, subject)
- parts[1] = parts[1].replace('\\', '')
- deps = []
- for dep in self.values(parts[1]):
- dep = dep.strip()
- if not len(dep):
- continue
- qnames = []
- for qn in Name.qualify(self.options.path, dep):
- qnames.append(qn)
- deps.append(tuple(qnames))
- entry.deps = tuple(deps)
- self.content.append(entry)
- for key in Name.qualify(ns, subject):
- self.index[key] = entry
- fp.close()
-
- def setoption(self, ns, line):
- parts = line.split('=', 1)
- if len(parts) == 2:
- tag = parts[0].strip()
- if tag == 'path':
- values = []
- for v in self.values(parts[1]):
- if v == '.':
- v = ns
- values.append(v)
- self.options[tag] = values
- return True
- return False
-
- def values(self, line):
- return self.pattern.split(line.strip())
-
- def lines(self, fp):
- ln = 0
- lines = []
- append = False
- for line in fp.readlines():
- ln += 1
- if not len(line):
- continue
- if line[0] == '#':
- continue
- if len(lines) and lines[-1][1].endswith('\\\n'):
- last = lines.pop()[1][:-2]
- joined = ' '.join((last, line))
- lines.append((ln, joined))
- else:
- lines.append((ln, line))
- return lines
-
- def find(self, ns, fn):
- result = ()
- for key in Name.qualify(ns, fn):
- entry = self.index.get(key)
- if entry is None:
- continue
- entry.hits += 1
- result = entry
- break
- return result
-
- def expand(self, keyset, history):
- result = ([],[])
- for key in keyset:
- if key in history:
- print 'circular (alias) reference:%s' % history
- continue
- alias = self.aliases.get(key)
- if alias is None:
- result[0].append(key)
- continue
- history.append(key)
- alias.hits += 1
- for deps in alias.expanded(history):
- result[1].append(deps)
- if len(result[1]):
- result = ([], result[1])
- return result
-
- def findaliases(self):
- self.aliases = {}
- for s,e in self.index.items():
- if e.hits == 0:
- self.aliases[s] = e
- return self
-
-class Reader:
-
- EXT = ['sql', 'pks', 'pkb']
-
- def __init__(self):
- self.deptab = DepTab()
- self.deplist = DepList()
- self.overrides = []
-
- def read(self, directories):
- self.opendeptabs(directories)
- self.getfiles(directories)
- self.deptab.findaliases()
- return self
-
- def sort(self):
- sorted = self.deplist.sort()
- return [x[2] for x in sorted]
-
-
- def opendeptabs(self, directories):
- for d in directories:
- for fn, path in self.files(d, ('deps',)):
- self.deptab.read(d, path)
- return self
-
- def getfiles(self, directories):
- for d in directories:
- for fn, path in self.files(d, self.EXT):
- entry = self.deptab.find(d, fn)
- keys = Name.qualify(d, fn)
- found = self.deplist.find(keys[0])
- if found is None:
- self.deplist.add(keys, entry, path)
- continue
- pk = found[2]
- self.overrides.append((path, pk))
- return self
-
- def path(self, d, fn):
- return '%s/%s' % (d, fn)
-
- def fsort(self, a, b):
- try:
- A = a.rsplit('.', 1)
- B = b.rsplit('.', 1)
- BC = cmp(A[0], B[0])
- if BC:
- return BC
- IA = self.EXT.index(A[1])
- IB = self.EXT.index(B[1])
- return cmp(IA, IB)
- except:
- return 0
-
- def files(self, d, extensions):
- files = []
- for n in sorted(os.walk(d)):
- for fn in sorted(n[2], self.fsort):
- parts = fn.rsplit('.', 1)
- if len(parts) != 2:
- continue
- if parts[1] in extensions:
- path = self.path(n[0], fn)
- files.append((fn, path))
- return files
-
-
-class Writer:
-
- comment = """
-\n--------------------------------------------------------------------------------
--- Source: %s
---------------------------------------------------------------------------------\n
- """
-
- def __init__(self, aggregated=True):
- self.aggregated = aggregated
-
- def write(self, sorted, output):
- self.start(output)
- for p in sorted:
- f = open(p)
- output.write(self.comment % p)
- for line in f.readlines():
- if line.startswith('--'):
- continue
- output.write(line)
- f.close()
-
- def start(self, output):
- if os.path.exists('start.sql'):
- f = open('start.sql')
- content = f.read()
- output.write(content)
- f.close()
-
-
-class Oracle(Writer):
-
- def write(self, sorted, output):
- if self.aggregated:
- Writer.write(self, sorted, output)
- return
- self.start(output)
- for p in sorted:
- entry = '@%s' % p
- output.write('\n')
- output.write(entry)
-
-
-class Postgres(Writer):
-
- def write(self, sorted, output):
- if self.aggregated:
- Writer.write(self, sorted, output)
- return
- self.start(output)
- for p in sorted:
- entry = '\\i %s' % p
- output.write('\n')
- output.write(entry)
-
-
-
-class DepList:
-
- def __init__(self):
- """ """
- self.unsorted = []
- self.index = {}
- self.reset()
-
- def reset(self):
- self.stack = []
- self.pushed = set()
- self.sorted = []
- self.unfound = []
-
- def add(self, keys, deps, *payload):
- item = [keys, deps]
- item += payload
- item = tuple(item)
- self.unsorted.append(item)
- for key in keys:
- self.index[key] = item
- return self
-
- def sort(self):
- self.reset()
- for item in self.unsorted:
- popped = []
- self.push(item)
- while len(self.stack):
- try:
- top = self.top()
- ref = top[1].next()
- refd = self.find(ref)
- if refd is None:
- info = top[0][1].info
- self.unfound.append((ref, info))
- continue
- self.push(refd)
- except StopIteration:
- popped.append(self.pop())
- continue
- for p in popped:
- self.sorted.append(p)
- self.unsorted = self.sorted
- return self.sorted
-
- def find(self, key):
- if not isinstance(key, (tuple,list)):
- key = (key,)
- for k in key:
- v = self.index.get(k)
- if v is not None:
- return v
- return None
-
- def top(self):
- return self.stack[-1]
-
- def push(self, item):
- if item in self.pushed:
- return
- frame = (item, iter(item[1]))
- self.stack.append(frame)
- self.pushed.add(item)
-
- def pop(self):
- try:
- frame = self.stack.pop()
- return frame[0]
- except:
- pass
-
-#
-# FUNCTIONS
-#
-
-def generate(path, reader, writer, output, directories):
- os.chdir(path)
- out = open(output, 'w')
- ds = []
- for fn in directories:
- if os.path.isdir(fn):
- ds.append(fn)
- reader.read(ds)
- sorted = reader.sort()
- overrides = reader.overrides
- print '\nOVERRIDES (%d):' % len(overrides)
- for entry in overrides:
- print '\t"%s" overridden by "%s"' % entry
- unused = \
- [x for x in reader.deptab.content if x.hits == 0]
- print '\nUNUSED RULES (%d):' % len(unused)
- for entry in unused:
- if entry.hits == 0:
- print '\t%s @%s' % (entry.subject,entry.info)
- unfound = reader.deplist.unfound
- print '\nUNFOUND (rule) REFERENCES (%d):' % len(unfound)
- for unf in unfound:
- print '\t"%s" @%s' % unf
- if verbose:
- ln = 1
- print '\n\nFILES (%d):' % len(sorted)
- for p in sorted:
- print '\t%d %s' % (ln, p)
- ln += 1
- writer.write(sorted, out)
- out.close()
-
-def usage():
- s = []
- s.append('Usage mkmain: [OPTIONS]')
- s.append(' Options:')
- s.append(' -h, --help')
- s.append(' Show usage information.')
- s.append(' -v, --verbose')
- s.append(' Show extra processing information.')
- s.append(' -s, --style')
- s.append(' The output style (oracle|postres ).')
- s.append(' -o, --output')
- s.append(' The output file path.')
- s.append(' -d, --directory')
- s.append(' The working directory to process.')
- print '\n'.join(s)
-
-def main(argv):
- path = '.'
- global verbose
- reader = Reader()
- writer = Oracle()
- output = 'main.sql'
- flags = 'vhd:o:s:'
- keywords = [
- '--help',
- '--verbose',
- '--directory',
- '--output',
- '--style',
- ]
- try:
- opts, args = getopt(argv, flags, keywords)
- for opt, arg in opts:
- if opt in ('-h', '--help'):
- usage()
- sys.exit(0)
- if opt in ('-v', '--verbose'):
- verbose = True
- continue
- if opt in ('-o', '--output'):
- output = arg
- continue
- if opt in ('-d', '--directory'):
- path = arg
- continue
- if opt in ('-s', '--style'):
- if arg == 'oracle':
- writer = Oracle()
- continue
- if arg == 'postgres':
- writer = Postgres()
- continue
- raise Exception('style "%s" not valid' % arg)
- generate(path, reader, writer, output, args)
- except GetoptError, e:
- print e
- usage()
- sys.exit(2)
-
-if __name__ == '__main__':
- main(sys.argv[1:])
-
15 years
Branch 'pgsql' - 3 commits - schema/spacewalk
by Tom Lane
schema/spacewalk/postgres/class/evr_t.sql | 10 ++--
schema/spacewalk/postgres/packages/rhn_channel.pkb | 18 ++++----
schema/spacewalk/postgres/packages/rhn_date_manip.pkb | 10 +---
schema/spacewalk/postgres/packages/rhn_date_manip.pks | 8 +--
schema/spacewalk/postgres/procs/rhn_prepare_install.sql | 3 -
schema/spacewalk/postgres/procs/timestamp_minus_int.sql | 35 ++++++++++++++++
6 files changed, 58 insertions(+), 26 deletions(-)
New commits:
commit 92ca307286d6ec2cc31fce178c1e66c410f8bb59
Author: Tom Lane <tgl(a)redhat.com>
Date: Wed Apr 29 13:00:26 2009 -0400
Clean up some date-versus-timestamp confusion.
Per discussion with Jeff, the nearest equivalent in Postgres
to Oracle's DATE type is not DATE but TIMESTAMP WITH TIME ZONE,
aka TIMESTAMPTZ.
diff --git a/schema/spacewalk/postgres/packages/rhn_channel.pkb b/schema/spacewalk/postgres/packages/rhn_channel.pkb
index 6c58f59..8e70432 100644
--- a/schema/spacewalk/postgres/packages/rhn_channel.pkb
+++ b/schema/spacewalk/postgres/packages/rhn_channel.pkb
@@ -180,7 +180,7 @@ update pg_settings set setting = 'rhn_channel,' || setting where name = 'search_
from rhnChannel c
where c.id = channel_id_in
);
- UPDATE rhnServer SET channels_changed = current_date WHERE id = server_id_in;
+ UPDATE rhnServer SET channels_changed = current_timestamp WHERE id = server_id_in;
INSERT INTO rhnServerChannel (server_id, channel_id) VALUES (server_id_in, channel_id_in);
perform rhn_channel.update_family_counts(channel_family_id_val, server_org_id_val);
@@ -616,7 +616,7 @@ update pg_settings set setting = 'rhn_channel,' || setting where name = 'search_
where c.id = channel_id_in
);
- UPDATE rhnServer SET channels_changed = current_date WHERE id = server_id_in;
+ UPDATE rhnServer SET channels_changed = current_timestamp WHERE id = server_id_in;
end if;
DELETE FROM rhnServerChannel WHERE server_id = server_id_in AND channel_id = channel_id_in;
@@ -1077,7 +1077,7 @@ update pg_settings set setting = 'rhn_channel,' || setting where name = 'search_
declare
channel_name varchar(64);
priority numeric;
- end_of_life_val date;
+ end_of_life_val timestamptz;
org_id_val numeric;
BEGIN
@@ -1222,16 +1222,16 @@ update pg_settings set setting = 'rhn_channel,' || setting where name = 'search_
insert into rhnChannelNewestPackageAudit (channel_id, caller)
values (channel_id_in, caller_in);
update rhnChannel
- set last_modified = greatest(current_date, last_modified + 1/86400)
+ set last_modified = greatest(current_timestamp, last_modified + interval '1 second')
where id = channel_id_in;
end$$ language plpgsql;
create or replace function update_channel ( channel_id_in in numeric, invalidate_ss in numeric default 0,
- date_to_use in date default current_date ) returns void
+ date_to_use in timestamptz default current_timestamp ) returns void
as $$
declare
- channel_last_modified date;
- last_modified_value date;
+ channel_last_modified timestamptz;
+ last_modified_value timestamptz;
snapshots cursor for
select snapshot_id id
@@ -1264,7 +1264,7 @@ update pg_settings set setting = 'rhn_channel,' || setting where name = 'search_
end$$ language plpgsql;
- create or replace function update_channels_by_package ( package_id_in in numeric, date_to_use in date default current_date ) returns void
+ create or replace function update_channels_by_package ( package_id_in in numeric, date_to_use in timestamptz default current_timestamp ) returns void
as $$
declare
channels cursor for
@@ -1282,7 +1282,7 @@ update pg_settings set setting = 'rhn_channel,' || setting where name = 'search_
end$$ language plpgsql;
- create or replace function update_channels_by_errata ( errata_id_in numeric, date_to_use in date default current_date ) returns void
+ create or replace function update_channels_by_errata ( errata_id_in numeric, date_to_use in timestamptz default current_timestamp ) returns void
as $$
declare
channels cursor for
diff --git a/schema/spacewalk/postgres/packages/rhn_date_manip.pkb b/schema/spacewalk/postgres/packages/rhn_date_manip.pkb
index 65b3bb2..deaeef0 100644
--- a/schema/spacewalk/postgres/packages/rhn_date_manip.pkb
+++ b/schema/spacewalk/postgres/packages/rhn_date_manip.pkb
@@ -4,11 +4,11 @@
update pg_settings set setting = 'rhn_date_manip,' || setting where name = 'search_path';
create or replace function get_reporting_period_start()
- returns date as $$
+ returns timestamptz as $$
declare
months_ago numeric;
weeks_ago numeric;
- target_date date;
+ target_date timestamptz;
day_number numeric;
periods_ago numeric;
begin
@@ -30,11 +30,11 @@ create or replace function get_reporting_period_start()
create or replace function get_reporting_period_end()
- returns date as $$
+ returns timestamptz as $$
declare
months_ago numeric;
weeks_ago numeric;
- target_date date;
+ target_date timestamptz;
day_number numeric;
periods_ago numeric;
begin
@@ -55,7 +55,5 @@ create or replace function get_reporting_period_start()
$$ language 'plpgsql';
-
-- restore the original setting
update pg_settings set setting = overlay( setting placing '' from 1 for (length('rhn_date_manip')+1) ) where name = 'search_path';
-
diff --git a/schema/spacewalk/postgres/packages/rhn_date_manip.pks b/schema/spacewalk/postgres/packages/rhn_date_manip.pks
index 66c2cc0..36c4e0b 100644
--- a/schema/spacewalk/postgres/packages/rhn_date_manip.pks
+++ b/schema/spacewalk/postgres/packages/rhn_date_manip.pks
@@ -4,20 +4,20 @@ create schema rhn_date_manip;
update pg_settings set setting = 'rhn_date_manip,' || setting where name = 'search_path';
create or replace function get_reporting_period_start()
-returns date
+returns timestamptz
as $$
begin
raise exception 'Stub called, must be replace by .pkb';
- return current_date;
+ return current_timestamp;
end;
$$ language 'plpgsql';
create or replace function get_reporting_period_end()
-returns date as
+returns timestamptz as
$$
begin
raise exception 'Stub called, must be replace by .pkb';
- return current_date;
+ return current_timestamp;
end;
$$ language 'plpgsql';
diff --git a/schema/spacewalk/postgres/procs/rhn_prepare_install.sql b/schema/spacewalk/postgres/procs/rhn_prepare_install.sql
index 8288788..9e8f9a3 100644
--- a/schema/spacewalk/postgres/procs/rhn_prepare_install.sql
+++ b/schema/spacewalk/postgres/procs/rhn_prepare_install.sql
@@ -55,8 +55,7 @@ begin
command_instance_id,
install_command,
null, /* no notes */
- -- TODO: verify the results of below date arithmetic
- current_timestamp + ((stale_after_minutes :: real/(60*24))||' minutes')::interval,
+ current_timestamp + stale_after_minutes * '1 minute'::interval,
null, /* no notification email */
max_execution_time_seconds,
current_timestamp,
commit ed909c190a20e4fbe0c4e4f2156656941401b773
Author: Tom Lane <tgl(a)redhat.com>
Date: Wed Apr 29 12:59:00 2009 -0400
trivial cleanups
diff --git a/schema/spacewalk/postgres/class/evr_t.sql b/schema/spacewalk/postgres/class/evr_t.sql
index 512afd1..10aaf42 100644
--- a/schema/spacewalk/postgres/class/evr_t.sql
+++ b/schema/spacewalk/postgres/class/evr_t.sql
@@ -130,7 +130,7 @@ create or replace function evr_t_as_vre( a evr_t ) returns varchar as $$
begin
return a.version || '-' || a.release || ':' || a.epoch;
end;
-$$ language plpgsql; -- TODO: Can this be made IMMUTABLE STRICT?
+$$ language plpgsql immutable strict;
create or replace function evr_t_as_vre_simple( a evr_t ) returns varchar as $$
declare
@@ -143,9 +143,9 @@ begin
end if;
return vre_out;
end;
-$$ language plpgsql; -- TODO: Can this be made IMMUTABLE STRICT?
+$$ language plpgsql immutable strict;
-create or replace function evr_t_max(a evr_t, b evr_t)
+create or replace function evr_t_larger(a evr_t, b evr_t)
returns evr_t
as $$
begin
@@ -156,10 +156,10 @@ begin
return b;
end if;
end;
-$$ language plpgsql;
+$$ language plpgsql immutable strict;
create aggregate max (
- sfunc=evr_t_max,
+ sfunc=evr_t_larger,
basetype=evr_t,
stype=evr_t,
initcond='(0,0,0)'
commit 24c1013b5cb094f879bc953d37adcc48abfc7f17
Author: Tom Lane <tgl(a)redhat.com>
Date: Wed Apr 29 12:56:02 2009 -0400
Add an Oracle-ish timestamp minus integer operator.
diff --git a/schema/spacewalk/postgres/procs/timestamp_minus_int.sql b/schema/spacewalk/postgres/procs/timestamp_minus_int.sql
new file mode 100644
index 0000000..360bb2c
--- /dev/null
+++ b/schema/spacewalk/postgres/procs/timestamp_minus_int.sql
@@ -0,0 +1,35 @@
+--
+-- Copyright (c) 2009 Red Hat, Inc.
+--
+-- This software is licensed to you under the GNU General Public License,
+-- version 2 (GPLv2). There is NO WARRANTY for this software, express or
+-- implied, including the implied warranties of MERCHANTABILITY or FITNESS
+-- FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
+-- along with this software; if not, see
+-- http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
+--
+-- Red Hat trademarks are not licensed under GPLv2. No permission is
+-- granted to use or replicate Red Hat trademarks that are incorporated
+-- in this software or its documentation.
+--
+--
+--
+--
+
+
+--
+-- Temporary(?) hack to support expressions like CURRENT_TIMESTAMP - 1000
+-- which we want to be interpreted as minus 1000 days, since Oracle
+-- interprets SYSDATE - 1000 that way.
+--
+
+create or replace function timestamptz_minus_int(timestamptz, integer)
+returns timestamptz as
+$$ select $1 - $2 * interval '1 day' $$
+language sql;
+
+create operator - (
+ leftarg = timestamptz,
+ rightarg = integer,
+ procedure = timestamptz_minus_int
+);
15 years
Branch 'VADER' - proxy/installer
by Justin Sherrill
proxy/installer/configure-proxy.sh | 2 ++
1 file changed, 2 insertions(+)
New commits:
commit 8fa51a2314583e9143d8021b957b2553debaf4ce
Author: Justin Sherrill <jsherril(a)redhat.com>
Date: Wed Apr 29 14:31:51 2009 -0400
219179 - adding a missing redirect for cobbler
diff --git a/proxy/installer/configure-proxy.sh b/proxy/installer/configure-proxy.sh
index cb97725..7e4adf5 100755
--- a/proxy/installer/configure-proxy.sh
+++ b/proxy/installer/configure-proxy.sh
@@ -258,6 +258,8 @@ echo "ProxyPass /cobbler_api $PROTO://$RHN_PARENT/cobbler_api" > $HTTPDCONFD_DIR
echo "ProxyPassReverse /cobbler_api $PROTO://$RHN_PARENT/cobbler_api" >> $HTTPDCONFD_DIR/cobbler-proxy.conf
echo "ProxyPass /cblr $PROTO://$RHN_PARENT/cblr" >> $HTTPDCONFD_DIR/cobbler-proxy.conf
echo "ProxyPassReverse /cblr $PROTO://$RHN_PARENT/cblr" >> $HTTPDCONFD_DIR/cobbler-proxy.conf
+echo "ProxyPass /cobbler $PROTO://$RHN_PARENT/cobbler" >> $HTTPDCONFD_DIR/cobbler-proxy.conf
+echo "ProxyPassReverse /cobbler $PROTO://$RHN_PARENT/cobbler" >> $HTTPDCONFD_DIR/cobbler-proxy.conf
15 years
proxy/installer
by Justin Sherrill
proxy/installer/configure-proxy.sh | 2 ++
1 file changed, 2 insertions(+)
New commits:
commit fc9707d4659b4fb82c6c8191d6f9f3e0dc039d36
Author: Justin Sherrill <jsherril(a)redhat.com>
Date: Wed Apr 29 14:31:51 2009 -0400
219179 - adding a missing redirect for cobbler
diff --git a/proxy/installer/configure-proxy.sh b/proxy/installer/configure-proxy.sh
index de09ce1..34ca067 100755
--- a/proxy/installer/configure-proxy.sh
+++ b/proxy/installer/configure-proxy.sh
@@ -260,6 +260,8 @@ echo "ProxyPass /cobbler_api $PROTO://$RHN_PARENT/cobbler_api" > $HTTPDCONFD_DIR
echo "ProxyPassReverse /cobbler_api $PROTO://$RHN_PARENT/cobbler_api" >> $HTTPDCONFD_DIR/cobbler-proxy.conf
echo "ProxyPass /cblr $PROTO://$RHN_PARENT/cblr" >> $HTTPDCONFD_DIR/cobbler-proxy.conf
echo "ProxyPassReverse /cblr $PROTO://$RHN_PARENT/cblr" >> $HTTPDCONFD_DIR/cobbler-proxy.conf
+echo "ProxyPass /cobbler $PROTO://$RHN_PARENT/cobbler" >> $HTTPDCONFD_DIR/cobbler-proxy.conf
+echo "ProxyPassReverse /cobbler $PROTO://$RHN_PARENT/cobbler" >> $HTTPDCONFD_DIR/cobbler-proxy.conf
15 years
Branch 'VADER' - java/code
by Justin Sherrill
java/code/src/com/redhat/rhn/domain/kickstart/KickstartSession.java | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
New commits:
commit 396e579aa8408376fb18107f378fc53a8d77e977
Author: Justin Sherrill <jsherril(a)redhat.com>
Date: Wed Apr 29 14:14:07 2009 -0400
497867 - fixed bug in logic after changing hibernate mappings
diff --git a/java/code/src/com/redhat/rhn/domain/kickstart/KickstartSession.java b/java/code/src/com/redhat/rhn/domain/kickstart/KickstartSession.java
index 71f1c0b..bc27c8b 100644
--- a/java/code/src/com/redhat/rhn/domain/kickstart/KickstartSession.java
+++ b/java/code/src/com/redhat/rhn/domain/kickstart/KickstartSession.java
@@ -16,7 +16,6 @@ package com.redhat.rhn.domain.kickstart;
import com.redhat.rhn.common.security.SessionSwap;
import com.redhat.rhn.domain.action.Action;
-import com.redhat.rhn.domain.action.ActionFactory;
import com.redhat.rhn.domain.common.CommonFactory;
import com.redhat.rhn.domain.common.TinyUrl;
import com.redhat.rhn.domain.org.Org;
@@ -446,12 +445,9 @@ public class KickstartSession {
*/
public void markFailed(String messageIn) {
if (this.action != null) {
- Long parentId = this.action.getPrerequisite().getId();
Action parentAction = this.action;
-
- while (parentId != null) {
- parentAction = ActionFactory.lookupById(parentId);
- parentId = parentAction.getPrerequisite().getId();
+ while (parentAction.getPrerequisite() != null) {
+ parentAction = this.action.getPrerequisite();
}
if (this.currentServer() != null) {
ActionManager.
15 years
java/code
by Justin Sherrill
java/code/src/com/redhat/rhn/domain/kickstart/KickstartSession.java | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
New commits:
commit bb2b4d9931898b8c68767c368dfffba6f610d561
Author: Justin Sherrill <jsherril(a)redhat.com>
Date: Wed Apr 29 14:14:07 2009 -0400
497867 - fixed bug in logic after changing hibernate mappings
diff --git a/java/code/src/com/redhat/rhn/domain/kickstart/KickstartSession.java b/java/code/src/com/redhat/rhn/domain/kickstart/KickstartSession.java
index 71f1c0b..bc27c8b 100644
--- a/java/code/src/com/redhat/rhn/domain/kickstart/KickstartSession.java
+++ b/java/code/src/com/redhat/rhn/domain/kickstart/KickstartSession.java
@@ -16,7 +16,6 @@ package com.redhat.rhn.domain.kickstart;
import com.redhat.rhn.common.security.SessionSwap;
import com.redhat.rhn.domain.action.Action;
-import com.redhat.rhn.domain.action.ActionFactory;
import com.redhat.rhn.domain.common.CommonFactory;
import com.redhat.rhn.domain.common.TinyUrl;
import com.redhat.rhn.domain.org.Org;
@@ -446,12 +445,9 @@ public class KickstartSession {
*/
public void markFailed(String messageIn) {
if (this.action != null) {
- Long parentId = this.action.getPrerequisite().getId();
Action parentAction = this.action;
-
- while (parentId != null) {
- parentAction = ActionFactory.lookupById(parentId);
- parentId = parentAction.getPrerequisite().getId();
+ while (parentAction.getPrerequisite() != null) {
+ parentAction = this.action.getPrerequisite();
}
if (this.currentServer() != null) {
ActionManager.
15 years
java/code
by Justin Sherrill
java/code/webapp/WEB-INF/pages/errata/packages/list.jsp | 1 +
1 file changed, 1 insertion(+)
New commits:
commit 744cbd587416aa5d3b2df5ef5491b7b82c86c37c
Author: Justin Sherrill <jsherril(a)redhat.com>
Date: Wed Apr 29 14:10:58 2009 -0400
497917 - fixing issue where select all did not work on errata list/remove packages
diff --git a/java/code/webapp/WEB-INF/pages/errata/packages/list.jsp b/java/code/webapp/WEB-INF/pages/errata/packages/list.jsp
index 2284749..e5ad6f4 100644
--- a/java/code/webapp/WEB-INF/pages/errata/packages/list.jsp
+++ b/java/code/webapp/WEB-INF/pages/errata/packages/list.jsp
@@ -38,6 +38,7 @@
</rhn:listdisplay>
</rhn:list>
+<rhn:submitted/>
<input type="hidden" name="eid" value="<c:out value="${param.eid}"/>" />
</form>
15 years
Branch 'VADER' - java/code
by Justin Sherrill
java/code/webapp/WEB-INF/pages/errata/packages/list.jsp | 1 +
1 file changed, 1 insertion(+)
New commits:
commit 863c4874173d78a9b4572f867572dbd27984156e
Author: Justin Sherrill <jsherril(a)redhat.com>
Date: Wed Apr 29 14:10:58 2009 -0400
497917 - fixing issue where select all did not work on errata list/remove packages
diff --git a/java/code/webapp/WEB-INF/pages/errata/packages/list.jsp b/java/code/webapp/WEB-INF/pages/errata/packages/list.jsp
index 2284749..e5ad6f4 100644
--- a/java/code/webapp/WEB-INF/pages/errata/packages/list.jsp
+++ b/java/code/webapp/WEB-INF/pages/errata/packages/list.jsp
@@ -38,6 +38,7 @@
</rhn:listdisplay>
</rhn:list>
+<rhn:submitted/>
<input type="hidden" name="eid" value="<c:out value="${param.eid}"/>" />
</form>
15 years
Branch 'VADER' - schema/spacewalk
by Milan Zazrivec
schema/spacewalk/upgrade/spacewalk-schema-0.5-to-spacewalk-schema-0.6/100-rhnServerNeededCache_indexes.sql | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
New commits:
commit e32967b7d235e163b354c29faa0cd49b3a739498
Author: Milan Zazrivec <mzazrivec(a)redhat.com>
Date: Wed Apr 29 18:26:30 2009 +0200
alter index needs to be run via execute immediate
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-0.5-to-spacewalk-schema-0.6/100-rhnServerNeededCache_indexes.sql b/schema/spacewalk/upgrade/spacewalk-schema-0.5-to-spacewalk-schema-0.6/100-rhnServerNeededCache_indexes.sql
index 92c576f..d04697b 100644
--- a/schema/spacewalk/upgrade/spacewalk-schema-0.5-to-spacewalk-schema-0.6/100-rhnServerNeededCache_indexes.sql
+++ b/schema/spacewalk/upgrade/spacewalk-schema-0.5-to-spacewalk-schema-0.6/100-rhnServerNeededCache_indexes.sql
@@ -12,7 +12,7 @@ begin
nologging';
exception
when name_used then
- alter index rhn_snc_speid_idx noparallel;
+ execute immediate 'alter index rhn_snc_speid_idx noparallel';
end;
/
15 years
schema/spacewalk
by Milan Zazrivec
schema/spacewalk/upgrade/spacewalk-schema-0.5-to-spacewalk-schema-0.6/100-rhnServerNeededCache_indexes.sql | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
New commits:
commit 6333e7a98c56481f35f848c3e78f013c32ddf5a5
Author: Milan Zazrivec <mzazrivec(a)redhat.com>
Date: Wed Apr 29 18:26:30 2009 +0200
alter index needs to be run via execute immediate
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-0.5-to-spacewalk-schema-0.6/100-rhnServerNeededCache_indexes.sql b/schema/spacewalk/upgrade/spacewalk-schema-0.5-to-spacewalk-schema-0.6/100-rhnServerNeededCache_indexes.sql
index 92c576f..d04697b 100644
--- a/schema/spacewalk/upgrade/spacewalk-schema-0.5-to-spacewalk-schema-0.6/100-rhnServerNeededCache_indexes.sql
+++ b/schema/spacewalk/upgrade/spacewalk-schema-0.5-to-spacewalk-schema-0.6/100-rhnServerNeededCache_indexes.sql
@@ -12,7 +12,7 @@ begin
nologging';
exception
when name_used then
- alter index rhn_snc_speid_idx noparallel;
+ execute immediate 'alter index rhn_snc_speid_idx noparallel';
end;
/
15 years