2 commits - web/html web/modules
by Tomáš Kašpárek
web/html/network/systems/ssm/misc/reboot_confirm.pxt | 45 -------------------
web/html/network/systems/ssm/misc/reboot_systems.pxt | 42 -----------------
web/modules/sniglets/Sniglets/ServerActions.pm | 25 ----------
3 files changed, 112 deletions(-)
New commits:
commit 7017e0e6a9bc7ce9cc265c0cf698165035b40216
Author: Tomas Kasparek <tkasparek(a)redhat.com>
Date: Thu Aug 22 12:03:58 2013 +0200
removing old perl code associated with dead perl pages
diff --git a/web/modules/sniglets/Sniglets/ServerActions.pm b/web/modules/sniglets/Sniglets/ServerActions.pm
index 26480d5..41c31ff 100644
--- a/web/modules/sniglets/Sniglets/ServerActions.pm
+++ b/web/modules/sniglets/Sniglets/ServerActions.pm
@@ -55,7 +55,6 @@ sub register_callbacks {
# currently used for mass deletes, mass pkg/hw prof updates, etc...
$pxt->register_callback('rhn:reschedule_action_cb' => \&reschedule_action_cb);
- $pxt->register_callback('rhn:sscd_reboot_servers_cb' => \&sscd_reboot_servers_cb);
}
sub raw_script_output {
@@ -76,30 +75,6 @@ sub raw_script_output {
$pxt->print($output);
}
-sub sscd_reboot_servers_cb {
- my $pxt = shift;
-
- my $earliest_date = Sniglets::ServerActions->parse_date_pickbox($pxt);
-
- my $action_id;
-
- my $set_label = $pxt->dirty_param('set_label') || 'system_list';
- my $system_set = RHN::Set->lookup(-label => $set_label, -uid => $pxt->user->id);
-
- $action_id = RHN::Scheduler->sscd_schedule_reboot(-org_id => $pxt->user->org_id,
- -user_id => $pxt->user->id,
- -earliest => $earliest_date,
- -server_set => $system_set);
-
- my $system_count = $system_set->contents;
- my $message = sprintf(<<EOM, $system_count, $system_count == 1 ? '' : 's', $action_id);
-Reboot scheduled for <strong>%d</strong> system%s. To cancel the reboot, remove the desired systems from the <a href="/rhn/schedule/InProgressSystems.do?aid=%d"><strong>list of systems</strong></a> to be rebooted.
-EOM
- $pxt->push_message(site_info => $message);
-
- $pxt->redirect('/rhn/systems/ssm/misc/Index.do');
-}
-
sub schedule_action_interface {
my $pxt = shift;
my %params = @_;
commit 6427098d24409f5711d896f9d0d9dcdf04f007f2
Author: Tomas Kasparek <tkasparek(a)redhat.com>
Date: Thu Aug 22 12:02:28 2013 +0200
removing old perl pages
diff --git a/web/html/network/systems/ssm/misc/reboot_confirm.pxt b/web/html/network/systems/ssm/misc/reboot_confirm.pxt
deleted file mode 100644
index a667347..0000000
--- a/web/html/network/systems/ssm/misc/reboot_confirm.pxt
+++ /dev/null
@@ -1,45 +0,0 @@
-<?xml version="1.0" encoding="utf8"?>
-<pxt-passthrough>
-<pxt-use class="Grail::Frame" />
-<pxt-use class="Sniglets::Lists" />
-<pxt-use class="Sniglets::HTML" />
-<pxt-use class="Sniglets::ServerActions" />
-
-<grail-canvas-template base="/templates/c.pxt" mode="main_canvas">
-
- <h1><img src="/img/rhn-icon-system_group.gif" alt="system set" /> System Set Manager <rhn-help href="s1-sm-systems.jsp#s2-sm-ssm" /></h1>
-
- <rhn-navi-nav prefix="system_set_manager" depth="0"
- file="/nav/ssm.xml" style="contentnav" />
-
-<h2>Confirm System Reboots</h2>
-
-<div class="page-summary">
-<p>Schedule your reboot action below and click 'Confirm' to schedule this action.</p>
-</div>
-
-<pxt-include-late file="/network/components/message_queues/local.pxi" />
-
-<rhn-listview class="Sniglets::ListView::SystemList" mode="in_set">
-
- <formvars>
- <var name="target_set_label" type="literal">target_systems</var>
- </formvars>
-
- <column name="System" label="name" align="left">
- <url>/rhn/systems/details/Overview.do?sid={column:id}</url>
- </column>
- <column name="Base Channel" label="channel_labels" align="left" width="30%" />
-</rhn-listview>
-
-<pxt-form method="post">
-
-<rhn-schedule-action-interface action="sscd_confirm_system_reboot" callback="rhn:sscd_reboot_servers_cb" label="Confirm" />
-
- <input type="hidden" name="set_label" value="target_systems" />
-
-</pxt-form>
-
-</grail-canvas-template>
-</pxt-passthrough>
-
diff --git a/web/html/network/systems/ssm/misc/reboot_systems.pxt b/web/html/network/systems/ssm/misc/reboot_systems.pxt
deleted file mode 100644
index 05030c1..0000000
--- a/web/html/network/systems/ssm/misc/reboot_systems.pxt
+++ /dev/null
@@ -1,42 +0,0 @@
-<?xml version="1.0" encoding="utf8"?>
-<pxt-passthrough>
-<pxt-use class="Grail::Frame" />
-<pxt-use class="Sniglets::Lists" />
-<pxt-use class="Sniglets::HTML" />
-<pxt-use class="Sniglets::ServerActions" />
-
-<grail-canvas-template base="/templates/c.pxt" mode="main_canvas">
-
- <h1><img src="/img/rhn-icon-system_group.gif" alt="system set" /> System Set Manager <rhn-help href="s1-sm-systems.jsp#s2-sm-ssm" /></h1>
-
- <rhn-navi-nav prefix="system_set_manager" depth="0"
- file="/nav/ssm.xml" style="contentnav" />
-
-<h2>Confirm System Reboots</h2>
-
-<div class="page-summary">
-<p>Below is a list of the systems that can be rebooted using <pxt-config var="product_name" />.</p>
-<p>Select the systems you wish to reboot and click the button below.</p>
-</div>
-
-<pxt-include-late file="/network/components/message_queues/local.pxi" />
-
-<rhn-listview class="Sniglets::ListView::SystemList" mode="system_set_supports_reboot_expanded">
-
- <set name="target systems" label="target_systems" />
-
- <formvars>
- <var name="target_set_label" type="literal">target_systems</var>
- </formvars>
-
- <column name="System" label="name" align="left">
- <url>/rhn/systems/details/Overview.do?sid={column:id}</url>
- </column>
- <column name="Base Channel" label="channel_labels" align="left" width="30%"/>
-
- <action name="Schedule Reboot" url="reboot_confirm.pxt" />
-</rhn-listview>
-
-</grail-canvas-template>
-</pxt-passthrough>
-
10 years, 9 months
2 commits - java/code
by Tomáš Kašpárek
java/code/src/com/redhat/rhn/frontend/action/ssm/RebootSystemAction.java | 8 -
java/code/webapp/WEB-INF/pages/ssm/systems/misc/reboot-system.jsp | 44 +---------
2 files changed, 8 insertions(+), 44 deletions(-)
New commits:
commit 9940baacebe1886fea863e867dd63a991d71b0d2
Author: Tomas Kasparek <tkasparek(a)redhat.com>
Date: Thu Aug 22 09:44:34 2013 +0200
removing @Override annotation from method that isn't overriden
diff --git a/java/code/src/com/redhat/rhn/frontend/action/ssm/RebootSystemAction.java b/java/code/src/com/redhat/rhn/frontend/action/ssm/RebootSystemAction.java
index dabb509..962154f 100644
--- a/java/code/src/com/redhat/rhn/frontend/action/ssm/RebootSystemAction.java
+++ b/java/code/src/com/redhat/rhn/frontend/action/ssm/RebootSystemAction.java
@@ -135,7 +135,6 @@ public class RebootSystemAction
* @param context Request context.
* @return List of SystemOverview objects.
*/
- @Override
public List getResult(RequestContext context) {
List<SystemOverview> systems = SystemManager.inSet(context.getCurrentUser(),
RhnSetDecl.SYSTEMS.getLabel());
commit a27545f6cc548825023a65c1124eea2c14ad62cb
Author: Bo Maryniuk <bo(a)suse.de>
Date: Wed Aug 21 17:35:26 2013 +0200
SSM/Misc/Reboot: Standard system list, optimized action
diff --git a/java/code/src/com/redhat/rhn/frontend/action/ssm/RebootSystemAction.java b/java/code/src/com/redhat/rhn/frontend/action/ssm/RebootSystemAction.java
index 200c836..dabb509 100644
--- a/java/code/src/com/redhat/rhn/frontend/action/ssm/RebootSystemAction.java
+++ b/java/code/src/com/redhat/rhn/frontend/action/ssm/RebootSystemAction.java
@@ -140,12 +140,7 @@ public class RebootSystemAction
List<SystemOverview> systems = SystemManager.inSet(context.getCurrentUser(),
RhnSetDecl.SYSTEMS.getLabel());
for (Iterator<SystemOverview> itr = systems.iterator(); itr.hasNext();) {
- SystemOverview systemOverview = itr.next();
- systemOverview.setSelectable(1);
- systemOverview.setChannelLabels(SystemManager.lookupByIdAndUser(systemOverview
- .getId(), context.getCurrentUser()).getBaseChannel() == null ? null :
- SystemManager.lookupByIdAndUser(systemOverview.getId(),
- context.getCurrentUser()).getBaseChannel().getName());
+ itr.next().setSelectable(1);
}
return systems;
diff --git a/java/code/webapp/WEB-INF/pages/ssm/systems/misc/reboot-system.jsp b/java/code/webapp/WEB-INF/pages/ssm/systems/misc/reboot-system.jsp
index 1ce41e7..60dbdb6 100644
--- a/java/code/webapp/WEB-INF/pages/ssm/systems/misc/reboot-system.jsp
+++ b/java/code/webapp/WEB-INF/pages/ssm/systems/misc/reboot-system.jsp
@@ -5,56 +5,26 @@
--%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
-
+
<%@taglib uri="http://rhn.redhat.com/rhn" prefix="rhn" %>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@taglib uri="http://struts.apache.org/tags-html" prefix="html" %>
<%@taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>
<%@taglib uri="http://rhn.redhat.com/tags/list" prefix="rl" %>
-
+
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
-
+
<html:xhtml/>
<html>
<body>
<%@ include file="/WEB-INF/pages/common/fragments/ssm/header.jspf" %>
<h2><bean:message key="ssm.misc.reboot.header" /></h2>
<p><bean:message key="ssm.misc.reboot.summary" /></p>
-
- <rl:listset name="systemsListSet" legend="errata">
- <rhn:csrf />
- <rhn:submitted />
- <rl:list width="100%"
- dataset="pageList"
- name="systemList"
- styleclass="list"
- alphabarcolumn="name">
- <rl:decorator name="ElaborationDecorator"/>
- <rl:decorator name="PageSizeDecorator"/>
- <rl:decorator name="SelectableDecorator"/>
-
- <rl:selectablecolumn value="${current.id}"
- selected="${current.selected}"
- disabled="${not current.selectable}"
- styleclass="first-column"/>
- <rl:column headerkey="systemlist.jsp.system" bound="false" sortattr="name" sortable="true">
- <a href="/rhn/systems/details/Overview.do?sid=${current.id}">${current.name}</a>
- </rl:column>
- <rl:column headerkey="systemlist.jsp.channel" bound="false" sortattr="name" sortable="true" styleclass="last-column">
- <a href="/rhn/channels/ChannelDetail.do?cid=${current.channelId}">${current.channelLabels}</a>
- </rl:column>
- <rl:column headerkey="systemlist.jsp.entitlement" bound="false" sortattr="name" sortable="true" styleclass="last-column">
- <c:choose>
- <c:when test="${!empty current.addOnEntitlementLevel}">
- ${current.baseEntitlementLevel}, ${current.addOnEntitlementLevel}
- </c:when>
- <c:otherwise>
- ${current.baseEntitlementLevel}
- </c:otherwise>
- </c:choose>
- </rl:column>
- </rl:list>
+
+ <rl:listset name="systemsListSet" legend="system">
+ <c:set var="noCsv" value="1"/>
+ <%@ include file="/WEB-INF/pages/common/fragments/systems/system_listdisplay.jspf" %>
<div align="right">
<div align="left">
<p><bean:message key="installconfirm.jsp.widgetsummary"/></p>
10 years, 9 months
Changes to 'refs/tags/spacecmd-2.1.5-1'
by Dimitar Yordanov
Tag 'spacecmd-2.1.5-1' created by Dimitar Yordanov <dyordano(a)redhat.com> at 2013-08-21 20:26 +0000
Tagging package [spacecmd] version [2.1.5-1] in directory [spacecmd/].
Changes since spacewalk-backend-2.1.11-1:
Dimitar Yordanov (2):
Add new function system_listcrashedsystems
Automatic commit of package [spacecmd] release [2.1.5-1].
---
rel-eng/packages/spacecmd | 2 +-
spacecmd/spacecmd.spec | 5 ++++-
spacecmd/src/lib/system.py | 24 +++++++++++++++++++++---
3 files changed, 26 insertions(+), 5 deletions(-)
---
10 years, 9 months
rel-eng/packages spacecmd/spacecmd.spec
by Dimitar Yordanov
rel-eng/packages/spacecmd | 2 +-
spacecmd/spacecmd.spec | 5 ++++-
2 files changed, 5 insertions(+), 2 deletions(-)
New commits:
commit 441e6cfe173a552d95e0e0ae004dc6e936e51de7
Author: Dimitar Yordanov <dyordano(a)redhat.com>
Date: Wed Aug 21 22:26:24 2013 +0200
Automatic commit of package [spacecmd] release [2.1.5-1].
diff --git a/rel-eng/packages/spacecmd b/rel-eng/packages/spacecmd
index a94cf78..3169c49 100644
--- a/rel-eng/packages/spacecmd
+++ b/rel-eng/packages/spacecmd
@@ -1 +1 @@
-2.1.4-1 spacecmd/
+2.1.5-1 spacecmd/
diff --git a/spacecmd/spacecmd.spec b/spacecmd/spacecmd.spec
index 052483a..d6466dc 100644
--- a/spacecmd/spacecmd.spec
+++ b/spacecmd/spacecmd.spec
@@ -4,7 +4,7 @@
%endif
Name: spacecmd
-Version: 2.1.4
+Version: 2.1.5
Release: 1%{?dist}
Summary: Command-line interface to Spacewalk and Satellite servers
@@ -64,6 +64,9 @@ touch %{buildroot}/%{python_sitelib}/spacecmd/__init__.py
%doc %{_mandir}/man1/spacecmd.1.gz
%changelog
+* Wed Aug 21 2013 Dimitar Yordanov <dyordano(a)redhat.com> 2.1.5-1
+- Add new function system_listcrashedsystems
+
* Tue Aug 13 2013 Gregor Gruener <ggruner(a)redhat.com> 2.1.4-1
- add new function kickstart_getupdatetype
- add new function kickstart_setupdatetype
10 years, 9 months
spacecmd/src
by Dimitar Yordanov
spacecmd/src/lib/system.py | 24 +++++++++++++++++++++---
1 file changed, 21 insertions(+), 3 deletions(-)
New commits:
commit 13caaa66f51c2ffecaa737a05d4f3e718242370d
Author: Dimitar Yordanov <dyordano(a)redhat.com>
Date: Wed Aug 21 22:23:07 2013 +0200
Add new function system_listcrashedsystems
diff --git a/spacecmd/src/lib/system.py b/spacecmd/src/lib/system.py
index b57ff72..88ec973 100644
--- a/spacecmd/src/lib/system.py
+++ b/spacecmd/src/lib/system.py
@@ -168,8 +168,8 @@ def do_system_reboot(self, args):
else:
systems = self.expand_systems(args)
- print
-
+ print
+
print 'Systems'
print '-------'
print '\n'.join(sorted(systems))
@@ -383,7 +383,7 @@ def do_system_runscript(self, args):
print 'Script Contents'
print '---------------'
print script_contents
-
+
print 'Systems'
print '-------'
print '\n'.join(sorted(systems))
@@ -2069,6 +2069,24 @@ def do_system_addchildchannels(self, args):
####################
+def help_system_listcrashedsystems(self):
+ print "system_listcrashedsystems: List all systems that have experienced a crash and reported by spacewalk-abrt"
+ print 'usage: system_listcrashedsystems'
+ print
+
+
+def do_system_listcrashedsystems(self, args):
+ print
+ print 'Count | System ID | Profile Name'
+ print '--------------------------------'
+ res=self.client.system.listUserSystems(self.session)
+ for sys in res:
+ res_crash=self.client.system.crash.listSystemCrashes(self.session,sys['id'])
+ if len(res_crash) != 0:
+ print "%d : %s : %s" % (len(res_crash),sys['id'],sys['name'])
+
+####################
+
def help_system_removechildchannels(self):
print "system_removechildchannels: Remove child channels from a system"
print 'usage: system_removechildchannels <SYSTEMS> <CHANNEL ...>'
10 years, 9 months
Changes to 'refs/tags/spacewalk-backend-2.1.11-1'
by StephenHerr
Tag 'spacewalk-backend-2.1.11-1' created by Stephen Herr <sherr(a)redhat.com> at 2013-08-21 17:44 +0000
Tagging package [spacewalk-backend] version [2.1.11-1] in directory [backend/].
Changes since spacewalk-schema-2.1.13-1:
Stephen Herr (2):
960550 - completed checkbox was not checked on kickstarts that had no activation keys
Automatic commit of package [spacewalk-backend] release [2.1.11-1].
---
backend/server/rhnServer/server_kickstart.py | 7 ++++---
backend/spacewalk-backend.spec | 6 +++++-
rel-eng/packages/spacewalk-backend | 2 +-
3 files changed, 10 insertions(+), 5 deletions(-)
---
10 years, 9 months
2 commits - backend/server backend/spacewalk-backend.spec rel-eng/packages
by StephenHerr
backend/server/rhnServer/server_kickstart.py | 7 ++++---
backend/spacewalk-backend.spec | 6 +++++-
rel-eng/packages/spacewalk-backend | 2 +-
3 files changed, 10 insertions(+), 5 deletions(-)
New commits:
commit 8d2e5d63c1805d842387f13925c5cf457d84bdb5
Author: Stephen Herr <sherr(a)redhat.com>
Date: Wed Aug 21 13:44:35 2013 -0400
Automatic commit of package [spacewalk-backend] release [2.1.11-1].
diff --git a/backend/spacewalk-backend.spec b/backend/spacewalk-backend.spec
index 0060884..8cee3cf 100644
--- a/backend/spacewalk-backend.spec
+++ b/backend/spacewalk-backend.spec
@@ -12,7 +12,7 @@ Name: spacewalk-backend
Summary: Common programs needed to be installed on the Spacewalk servers/proxies
Group: Applications/Internet
License: GPLv2
-Version: 2.1.10
+Version: 2.1.11
Release: 1%{?dist}
URL: https://fedorahosted.org/spacewalk
Source0: https://fedorahosted.org/releases/s/p/spacewalk/%{name}-%{version}.tar.gz
@@ -639,6 +639,10 @@ rm -f %{rhnconf}/rhnSecret.py*
# $Id$
%changelog
+* Wed Aug 21 2013 Stephen Herr <sherr(a)redhat.com> 2.1.11-1
+- 960550 - completed checkbox was not checked on kickstarts that had no
+ activation keys
+
* Tue Aug 20 2013 Michael Mraka <michael.mraka(a)redhat.com> 2.1.10-1
- fixed satellite-sync man page
diff --git a/rel-eng/packages/spacewalk-backend b/rel-eng/packages/spacewalk-backend
index dea13ff..0dbd27f 100644
--- a/rel-eng/packages/spacewalk-backend
+++ b/rel-eng/packages/spacewalk-backend
@@ -1 +1 @@
-2.1.10-1 backend/
+2.1.11-1 backend/
commit fd20231f5167aaa44779834049e9a7032c208c35
Author: Stephen Herr <sherr(a)redhat.com>
Date: Wed Aug 21 13:44:28 2013 -0400
960550 - completed checkbox was not checked on kickstarts that had no activation keys
diff --git a/backend/server/rhnServer/server_kickstart.py b/backend/server/rhnServer/server_kickstart.py
index 4b60379..4e34bfb 100644
--- a/backend/server/rhnServer/server_kickstart.py
+++ b/backend/server/rhnServer/server_kickstart.py
@@ -321,9 +321,10 @@ def ks_activation_key_deploy_config(kickstart_session_id):
h = rhnSQL.prepare(_query_ak_deploy_config)
h.execute(session_id=kickstart_session_id)
rows = h.fetchall_dict()
- for row in rows:
- if row['deploy_configs'] and row['deploy_configs'] == 'Y':
- return True
+ if rows:
+ for row in rows:
+ if row['deploy_configs'] and row['deploy_configs'] == 'Y':
+ return True
return False
_query_schedule_config_files = rhnSQL.Statement("""
10 years, 9 months
Changes to 'refs/tags/spacewalk-schema-2.1.13-1'
by StephenHerr
Tag 'spacewalk-schema-2.1.13-1' created by Stephen Herr <sherr(a)redhat.com> at 2013-08-21 14:27 +0000
Tagging package [spacewalk-schema] version [2.1.13-1] in directory [schema/spacewalk/].
Changes since spacewalk-java-2.1.24-1:
Milan Zazrivec (1):
timestamps in oracle: don't shift the dates during schema upgrades
Silvio Moioli (1):
Allow Hibernate to distinguish packages with identical name,
Stephen Herr (4):
Revert "998424 - naming the file properly"
Revert "998424 - rpm version comparison function was broken for alphanumeric versions"
998424 - removing bad initial condition from max(evr_t)
Automatic commit of package [spacewalk-schema] release [2.1.13-1].
Tomas Lestach (1):
998961 - do not touch the DB after a hibernate exception but correctly
---
java/code/src/com/redhat/rhn/domain/rhnpackage/Package.java | 12
java/code/src/com/redhat/rhn/frontend/servlets/SessionFilter.java | 4
rel-eng/packages/spacewalk-schema | 2
schema/spacewalk/oracle/packages/rpm.pkb | 1
schema/spacewalk/postgres/class/evr_t.sql | 3
schema/spacewalk/postgres/packages/rpm.pkb | 3
schema/spacewalk/spacewalk-schema.spec | 9
schema/spacewalk/upgrade/spacewalk-schema-1.7-to-spacewalk-schema-1.8/132-tables-timestamps.sql.oracle | 5
schema/spacewalk/upgrade/spacewalk-schema-1.7-to-spacewalk-schema-1.8/132-tables-timestamps.sql.postgresql | 2
schema/spacewalk/upgrade/spacewalk-schema-2.0-to-spacewalk-schema-2.1/015-evr_t-max-replace.sql.oracle | 1
schema/spacewalk/upgrade/spacewalk-schema-2.0-to-spacewalk-schema-2.1/015-evr_t-max-replace.sql.postgresql | 108 ++++
schema/spacewalk/upgrade/spacewalk-schema-2.0-to-spacewalk-schema-2.1/015-rpm-rpmstrcmp.pkb.sql.oracle | 235 ----------
schema/spacewalk/upgrade/spacewalk-schema-2.0-to-spacewalk-schema-2.1/015-rpm-rpmstrcmp.pkb.sql.postgresql | 178 -------
13 files changed, 130 insertions(+), 433 deletions(-)
---
10 years, 9 months
rel-eng/packages schema/spacewalk
by StephenHerr
rel-eng/packages/spacewalk-schema | 2 +-
schema/spacewalk/spacewalk-schema.spec | 9 ++++++++-
2 files changed, 9 insertions(+), 2 deletions(-)
New commits:
commit 22df4e68add6ea5eb7233ae52821d38a31d0e43a
Author: Stephen Herr <sherr(a)redhat.com>
Date: Wed Aug 21 10:27:30 2013 -0400
Automatic commit of package [spacewalk-schema] release [2.1.13-1].
diff --git a/rel-eng/packages/spacewalk-schema b/rel-eng/packages/spacewalk-schema
index a663a87..c86cc3b 100644
--- a/rel-eng/packages/spacewalk-schema
+++ b/rel-eng/packages/spacewalk-schema
@@ -1 +1 @@
-2.1.12-1 schema/spacewalk/
+2.1.13-1 schema/spacewalk/
diff --git a/schema/spacewalk/spacewalk-schema.spec b/schema/spacewalk/spacewalk-schema.spec
index 2f01fc2..12d1d6e 100644
--- a/schema/spacewalk/spacewalk-schema.spec
+++ b/schema/spacewalk/spacewalk-schema.spec
@@ -4,7 +4,7 @@ Name: spacewalk-schema
Group: Applications/Internet
Summary: Oracle SQL schema for Spacewalk server
-Version: 2.1.12
+Version: 2.1.13
Release: 1%{?dist}
Source0: %{name}-%{version}.tar.gz
@@ -71,6 +71,13 @@ rm -rf $RPM_BUILD_ROOT
%{_mandir}/man1/spacewalk-sql*
%changelog
+* Wed Aug 21 2013 Stephen Herr <sherr(a)redhat.com> 2.1.13-1
+- 998424 - removing bad initial condition from max(evr_t)
+- Revert "998424 - rpm version comparison function was broken for alphanumeric
+ versions"
+- Revert "998424 - naming the file properly"
+- timestamps in oracle: don't shift the dates during schema upgrades
+
* Tue Aug 20 2013 Stephen Herr <sherr(a)redhat.com> 2.1.12-1
- 998424 - naming the file properly
10 years, 9 months
3 commits - schema/spacewalk
by StephenHerr
schema/spacewalk/oracle/packages/rpm.pkb | 1
schema/spacewalk/postgres/class/evr_t.sql | 3
schema/spacewalk/postgres/packages/rpm.pkb | 3
schema/spacewalk/upgrade/spacewalk-schema-2.0-to-spacewalk-schema-2.1/015-evr_t-max-replace.sql.oracle | 1
schema/spacewalk/upgrade/spacewalk-schema-2.0-to-spacewalk-schema-2.1/015-evr_t-max-replace.sql.postgresql | 108 ++++
schema/spacewalk/upgrade/spacewalk-schema-2.0-to-spacewalk-schema-2.1/015-rpm-rpmstrcmp.pkb.sql.oracle | 235 ----------
schema/spacewalk/upgrade/spacewalk-schema-2.0-to-spacewalk-schema-2.1/015-rpm-rpmstrcmp.pkb.sql.postgresql | 178 -------
7 files changed, 111 insertions(+), 418 deletions(-)
New commits:
commit c52d9433111063915f447e3175dcdf4463354f3e
Author: Stephen Herr <sherr(a)redhat.com>
Date: Wed Aug 21 10:20:06 2013 -0400
998424 - removing bad initial condition from max(evr_t)
diff --git a/schema/spacewalk/postgres/class/evr_t.sql b/schema/spacewalk/postgres/class/evr_t.sql
index 64f26f8..ee4d4dc 100644
--- a/schema/spacewalk/postgres/class/evr_t.sql
+++ b/schema/spacewalk/postgres/class/evr_t.sql
@@ -163,6 +163,5 @@ $$ language plpgsql immutable strict;
create aggregate max (
sfunc=evr_t_larger,
basetype=evr_t,
- stype=evr_t,
- initcond='(0,0,0)'
+ stype=evr_t
);
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-2.0-to-spacewalk-schema-2.1/015-evr_t-max-replace.sql.oracle b/schema/spacewalk/upgrade/spacewalk-schema-2.0-to-spacewalk-schema-2.1/015-evr_t-max-replace.sql.oracle
new file mode 100644
index 0000000..9b80e99
--- /dev/null
+++ b/schema/spacewalk/upgrade/spacewalk-schema-2.0-to-spacewalk-schema-2.1/015-evr_t-max-replace.sql.oracle
@@ -0,0 +1 @@
+-- file intentionally left empty
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-2.0-to-spacewalk-schema-2.1/015-evr_t-max-replace.sql.postgresql b/schema/spacewalk/upgrade/spacewalk-schema-2.0-to-spacewalk-schema-2.1/015-evr_t-max-replace.sql.postgresql
new file mode 100644
index 0000000..8283915
--- /dev/null
+++ b/schema/spacewalk/upgrade/spacewalk-schema-2.0-to-spacewalk-schema-2.1/015-evr_t-max-replace.sql.postgresql
@@ -0,0 +1,108 @@
+-- oracle equivalent source sha1 2e5804554aaeaa793761cd8a3f24cc1fbe7381de
+
+CREATE OR REPLACE VIEW
+rhnServerNeededView
+(
+ org_id,
+ server_id,
+ errata_id,
+ package_id,
+ package_name_id,
+ channel_id
+)
+AS
+select 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 from dual;
+
+create or replace view
+rhnChannelNewestPackageView
+as
+SELECT 1.0 as channel_id,
+ 1.0 as name_id,
+ 1.0 as evr_id,
+ 1.0 as package_arch_id,
+ 1.0 as package_id from dual;
+
+-- this is the part we actually care about, messing with the views
+-- is just a dance to get this to work
+drop aggregate if exists max(evr_t);
+
+create aggregate max (
+ sfunc=evr_t_larger,
+ basetype=evr_t,
+ stype=evr_t
+);
+
+-- replace the views back to what they actually should be
+CREATE OR REPLACE VIEW
+rhnServerNeededView
+(
+ org_id,
+ server_id,
+ errata_id,
+ package_id,
+ package_name_id,
+ channel_id
+)
+AS
+SELECT s.org_id,
+ sp.server_id,
+ x.errata_id,
+ up.id,
+ up.name_id,
+ x.channel_id
+ FROM rhnServer s
+ join (SELECT sp_sp.server_id, sp_sp.name_id, sp_sp.package_arch_id, max(sp_pe.evr) AS max_evr
+ FROM rhnServerPackage sp_sp
+ join rhnPackageEvr sp_pe ON sp_pe.id = sp_sp.evr_id
+ GROUP BY sp_sp.server_id, sp_sp.name_id, sp_sp.package_arch_id) sp ON sp.server_id = s.id
+ join rhnPackage up ON up.name_id = sp.name_id
+ join rhnPackageEvr upe ON upe.id = up.evr_id AND sp.max_evr < upe.evr
+ join rhnPackageUpgradeArchCompat puac ON puac.package_arch_id = sp.package_arch_id AND puac.package_upgrade_arch_id = up.package_arch_id
+ join rhnServerChannel sc ON sc.server_id = sp.server_id
+ join rhnChannelPackage cp ON cp.package_id = up.id AND cp.channel_id = sc.channel_id
+ left join
+ (SELECT ep.errata_id, cp.channel_id, ep.package_id
+ FROM rhnChannelErrata cp
+ join rhnErrataPackage ep ON ep.errata_id = cp.errata_id) x
+ ON x.channel_id = sc.channel_id AND x.package_id = cp.package_id
+;
+
+
+create or replace view
+rhnChannelNewestPackageView
+as
+SELECT channel_id,
+ name_id,
+ evr_id,
+ package_arch_id,
+ max(package_id) as package_id
+FROM (
+ SELECT m.channel_id as channel_id,
+ p.name_id as name_id,
+ p.evr_id as evr_id,
+ m.package_arch_id as package_arch_id,
+ p.id as package_id
+ FROM
+ (select max(pe.evr) AS max_evr,
+ cp.channel_id,
+ p.name_id,
+ p.package_arch_id
+ from rhnPackageEVR pe,
+ rhnPackage p,
+ rhnChannelPackage cp
+ where p.evr_id = pe.id
+ and cp.package_id = p.id
+ group by cp.channel_id, p.name_id, p.package_arch_id) m,
+ rhnPackageEVR pe,
+ rhnPackage p,
+ rhnChannelPackage chp
+ WHERE m.max_evr = pe.evr
+ AND m.name_id = p.name_id
+ AND m.package_arch_id = p.package_arch_id
+ AND p.evr_id = pe.id
+ AND chp.package_id = p.id
+ AND chp.channel_id = m.channel_id
+) latest_packages
+group by channel_id, name_id, evr_id, package_arch_id
+;
+
commit 87045dea1317ac9d209d43aa1bca997c6f63c3cc
Author: Stephen Herr <sherr(a)redhat.com>
Date: Wed Aug 21 09:25:30 2013 -0400
Revert "998424 - rpm version comparison function was broken for alphanumeric versions"
This reverts commit 94d95c3334ef62ade78c850a955a217d9a7df052.
diff --git a/schema/spacewalk/oracle/packages/rpm.pkb b/schema/spacewalk/oracle/packages/rpm.pkb
index 71ee594..6d45b30 100644
--- a/schema/spacewalk/oracle/packages/rpm.pkb
+++ b/schema/spacewalk/oracle/packages/rpm.pkb
@@ -115,7 +115,6 @@ CREATE OR REPLACE PACKAGE BODY rpm AS
/* segment and walk str1 and str2 to end of segment */
if str1 is not null and isdigit(str1)
- and str2 is not null and isdigit(str2)
then
str1 := ltrim(str1, digits);
str2 := ltrim(str2, digits);
diff --git a/schema/spacewalk/postgres/packages/rpm.pkb b/schema/spacewalk/postgres/packages/rpm.pkb
index 93a7141..21803d6 100644
--- a/schema/spacewalk/postgres/packages/rpm.pkb
+++ b/schema/spacewalk/postgres/packages/rpm.pkb
@@ -1,4 +1,4 @@
--- oracle equivalent source sha1 16cdee02a50a403e0a8ca17217f37f1291ae79a1
+-- oracle equivalent source sha1 625d2c9b448240a736f369e7b53a386ce9c1f28a
-- create schema rpm;
--update pg_setting
@@ -88,7 +88,6 @@ $$ language 'plpgsql';
str1 := one;
str2 := two;
if str1 <> '' and rpm.isdigit(str1)
- and str2 <> '' and rpm.isdigit(str2)
then
str1 := ltrim(str1, digits);
str2 := ltrim(str2, digits);
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-2.0-to-spacewalk-schema-2.1/015-rpm-rpmstrcmp.pkb.sql.oracle b/schema/spacewalk/upgrade/spacewalk-schema-2.0-to-spacewalk-schema-2.1/015-rpm-rpmstrcmp.pkb.sql.oracle
deleted file mode 100644
index 71ee594..0000000
--- a/schema/spacewalk/upgrade/spacewalk-schema-2.0-to-spacewalk-schema-2.1/015-rpm-rpmstrcmp.pkb.sql.oracle
+++ /dev/null
@@ -1,235 +0,0 @@
---
--- Copyright (c) 2008--2010 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.
---
---
---
---
--- PL/SQL version of rpmvercompare
-
-CREATE OR REPLACE PACKAGE BODY rpm AS
-
- FUNCTION isdigit(ch CHAR)
- RETURN BOOLEAN
- deterministic
- IS
- BEGIN
- if ascii(ch) between ascii('0') and ascii('9')
- then
- return TRUE;
- end if;
- return FALSE;
- END isdigit;
-
-
- FUNCTION isalpha(ch CHAR)
- RETURN BOOLEAN
- deterministic
- IS
- BEGIN
- if ascii(ch) between ascii('a') and ascii('z') or
- ascii(ch) between ascii('A') and ascii('Z')
- then
- return TRUE;
- end if;
- return FALSE;
- END isalpha;
-
-
- FUNCTION isalphanum(ch CHAR)
- RETURN BOOLEAN
- deterministic
- IS
- BEGIN
- if ascii(ch) between ascii('a') and ascii('z') or
- ascii(ch) between ascii('A') and ascii('Z') or
- ascii(ch) between ascii('0') and ascii('9')
- then
- return TRUE;
- end if;
- return FALSE;
- END isalphanum;
-
-
- FUNCTION rpmstrcmp (string1 IN VARCHAR2, string2 IN VARCHAR2)
- RETURN NUMBER
- deterministic
- IS
- digits CHAR(10) := '0123456789';
- lc_alpha CHAR(27) := 'abcdefghijklmnopqrstuvwxyz';
- uc_alpha CHAR(27) := 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
- alpha CHAR(54) := lc_alpha || uc_alpha;
- str1 VARCHAR2(32767) := string1;
- str2 VARCHAR2(32767) := string2;
- one VARCHAR2(32767);
- two VARCHAR2(32767);
- isnum BOOLEAN;
- BEGIN
- if str1 is NULL or str2 is NULL
- then
- raise VALUE_ERROR;
- end if;
- -- easy comparison to see if versions are identical
- if str1 = str2
- then
- return 0;
- end if;
- -- loop through each version segment of str1 and str2 and compare them
- one := str1;
- two := str2;
-
- <<segment_loop>>
- while one is not null and two is not null
- loop
- declare
- segm1 VARCHAR2(32767);
- segm2 VARCHAR2(32767);
- begin
- --DBMS_OUTPUT.PUT_LINE('Params: ' || one || ',' || two);
- -- Throw out all non-alphanum characters
- while one is not null and not isalphanum(one)
- loop
- one := substr(one, 2);
- end loop;
- while two is not null and not isalphanum(two)
- loop
- two := substr(two, 2);
- end loop;
- --DBMS_OUTPUT.PUT_LINE('new params: ' || one || ',' || two);
-
- str1 := one;
- str2 := two;
-
- /* grab first completely alpha or completely numeric segment */
- /* leave one and two pointing to the start of the alpha or numeric */
- /* segment and walk str1 and str2 to end of segment */
-
- if str1 is not null and isdigit(str1)
- and str2 is not null and isdigit(str2)
- then
- str1 := ltrim(str1, digits);
- str2 := ltrim(str2, digits);
- isnum := true;
- else
- str1 := ltrim(str1, alpha);
- str2 := ltrim(str2, alpha);
- isnum := false;
- end if;
-
- --DBMS_OUTPUT.PUT_LINE('Len: ' || length(str1) || ',' || length(str2));
- -- Oracle trats the length of an empty string as null
- if str1 is not null
- then segm1 := substr(one, 1, length(one) - length(str1));
- else segm1 := one;
- end if;
-
- if str2 is not null
- then segm2 := substr(two, 1, length(two) - length(str2));
- else segm2 := two;
- end if;
-
- --DBMS_OUTPUT.PUT_LINE('Segments: ' || segm1 || ',' || segm2);
- --DBMS_OUTPUT.PUT_LINE('Rest: ' || str1 || ',' || str2);
- /* take care of the case where the two version segments are */
- /* different types: one numeric and one alpha */
- if segm1 is null then return -1; end if; /* arbitrary */
- if segm2 is null then
- if isnum then
- return 1;
- else
- return -1;
- end if;
- end if;
-
- if isnum
- then
- /* this used to be done by converting the digit segments */
- /* to ints using atoi() - it's changed because long */
- /* digit segments can overflow an int - this should fix that. */
-
- /* throw away any leading zeros - it's a number, right? */
- segm1 := ltrim(segm1, '0');
- segm2 := ltrim(segm2, '0');
-
- /* whichever number has more digits wins */
- -- length of empty string is null
- if segm1 is null and segm2 is not null
- then
- return -1;
- end if;
- if segm1 is not null and segm2 is null
- then
- return 1;
- end if;
- if length(segm1) > length(segm2) then return 1; end if;
- if length(segm2) > length(segm1) then return -1; end if;
- end if;
-
- /* strcmp will return which one is greater - even if the two */
- /* segments are alpha or if they are numeric. don't return */
- /* if they are equal because there might be more segments to */
- /* compare */
-
- if segm1 < segm2 then return -1; end if;
- if segm1 > segm2 then return 1; end if;
-
- one := str1;
- two := str2;
- end;
- end loop segment_loop;
- /* this catches the case where all numeric and alpha segments have */
- /* compared identically but the segment sepparating characters were */
- /* different */
- if one is null and two is null then return 0; end if;
-
- /* whichever version still has characters left over wins */
- if one is null then return -1; end if;
- return 1;
- END rpmstrcmp;
-
-
- FUNCTION vercmp(
- e1 VARCHAR2, v1 VARCHAR2, r1 VARCHAR2,
- e2 VARCHAR2, v2 VARCHAR2, r2 VARCHAR2)
- RETURN NUMBER
- IS
- rc NUMBER;
- BEGIN
- DECLARE
- ep1 NUMBER;
- ep2 NUMBER;
- BEGIN
- if e1 is null then
- ep1 := 0;
- else
- ep1 := TO_NUMBER(e1);
- end if;
- if e2 is null then
- ep2 := 0;
- else
- ep2 := TO_NUMBER(e2);
- end if;
- -- Epochs are non-null; compare them
- if ep1 < ep2 then return -1; end if;
- if ep1 > ep2 then return 1; end if;
- rc := rpmstrcmp(v1, v2);
- if rc != 0 then return rc; end if;
- return rpmstrcmp(r1, r2);
- END;
-
- END vercmp;
-
-END rpm;
-/
-SHOW ERRORS;
-
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-2.0-to-spacewalk-schema-2.1/015-rpm-rpmstrcmp.pkb.sql.postgres b/schema/spacewalk/upgrade/spacewalk-schema-2.0-to-spacewalk-schema-2.1/015-rpm-rpmstrcmp.pkb.sql.postgres
deleted file mode 100644
index 4079e2a..0000000
--- a/schema/spacewalk/upgrade/spacewalk-schema-2.0-to-spacewalk-schema-2.1/015-rpm-rpmstrcmp.pkb.sql.postgres
+++ /dev/null
@@ -1,178 +0,0 @@
--- oracle equivalent source sha1 16cdee02a50a403e0a8ca17217f37f1291ae79a1
--- create schema rpm;
-
---update pg_setting
-update pg_settings set setting = 'rpm,' || setting where name = 'search_path';
-
-create or replace function isdigit(ch CHAR)
- RETURNS BOOLEAN as $$
- BEGIN
- if ascii(ch) between ascii('0') and ascii('9')
- then
- return TRUE;
- end if;
- return FALSE;
- END ;
-$$ language 'plpgsql';
-
-
- create or replace FUNCTION isalpha(ch CHAR)
- RETURNS BOOLEAN as $$
- BEGIN
- if ascii(ch) between ascii('a') and ascii('z') or
- ascii(ch) between ascii('A') and ascii('Z')
- then
- return TRUE;
- end if;
- return FALSE;
- END;
-$$ language 'plpgsql';
-
-
- create or replace FUNCTION isalphanum(ch CHAR)
- RETURNS BOOLEAN as $$
- BEGIN
- if ascii(ch) between ascii('a') and ascii('z') or
- ascii(ch) between ascii('A') and ascii('Z') or
- ascii(ch) between ascii('0') and ascii('9')
- then
- return TRUE;
- end if;
- return FALSE;
- END;
- $$ language 'plpgsql';
-
-
- create or replace FUNCTION rpmstrcmp (string1 IN VARCHAR, string2 IN VARCHAR)
- RETURNS INTEGER as $$
- declare
- str1 VARCHAR := string1;
- str2 VARCHAR := string2;
- digits VARCHAR(10) := '0123456789';
- lc_alpha VARCHAR(27) := 'abcdefghijklmnopqrstuvwxyz';
- uc_alpha VARCHAR(27) := 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
- alpha VARCHAR(54) := lc_alpha || uc_alpha;
- one VARCHAR;
- two VARCHAR;
- isnum BOOLEAN;
- BEGIN
- if str1 is NULL or str2 is NULL
- then
- RAISE EXCEPTION 'VALUE_ERROR.';
- end if;
-
- if str1 = str2
- then
- return 0;
- end if;
- one := str1;
- two := str2;
-
- <<segment_loop>>
- while one <> '' and two <> ''
- loop
- declare
- segm1 VARCHAR;
- segm2 VARCHAR;
- begin
- --DBMS_OUTPUT.PUT_LINE('Params: ' || one || ',' || two);
- -- Throw out all non-alphanum characters
- while one <> '' and not rpm.isalphanum(one)
- loop
- one := substr(one, 2);
- end loop;
- while two <> '' and not rpm.isalphanum(two)
- loop
- two := substr(two, 2);
- end loop;
- str1 := one;
- str2 := two;
- if str1 <> '' and rpm.isdigit(str1)
- and str2 <> '' and rpm.isdigit(str2)
- then
- str1 := ltrim(str1, digits);
- str2 := ltrim(str2, digits);
- isnum := true;
- else
- str1 := ltrim(str1, alpha);
- str2 := ltrim(str2, alpha);
- isnum := false;
- end if;
- if str1 <> ''
- then segm1 := substr(one, 1, length(one) - length(str1));
- else segm1 := one;
- end if;
-
- if str2 <> ''
- then segm2 := substr(two, 1, length(two) - length(str2));
- else segm2 := two;
- end if;
- if segm1 = '' then return -1; end if; /* arbitrary */
- if segm2 = '' then
- if isnum then
- return 1;
- else
- return -1;
- end if;
- end if;
- if isnum
- then
-
- segm1 := ltrim(segm1, '0');
- segm2 := ltrim(segm2, '0');
-
- if segm1 = '' and segm2 <> ''
- then
- return -1;
- end if;
- if segm1 <> '' and segm2 = ''
- then
- return 1;
- end if;
- if length(segm1) > length(segm2) then return 1; end if;
- if length(segm2) > length(segm1) then return -1; end if;
- end if;
- if segm1 < segm2 then return -1; end if;
- if segm1 > segm2 then return 1; end if;
- one := str1;
- two := str2;
- end;
- end loop segment_loop;
-
- if one = '' then return -1; end if;
- return 1;
- END ;
-$$ language 'plpgsql';
-
-
-
- create or replace FUNCTION vercmp(
- e1 VARCHAR, v1 VARCHAR, r1 VARCHAR,
- e2 VARCHAR, v2 VARCHAR, r2 VARCHAR)
- RETURNS INTEGER as $$
- declare
- rc INTEGER;
- ep1 INTEGER;
- ep2 INTEGER;
- BEGIN
- if e1 is null or e1 = '' then
- ep1 := 0;
- else
- ep1 := e1::integer;
- end if;
- if e2 is null or e2 = '' then
- ep2 := 0;
- else
- ep2 := e2::integer;
- end if;
- -- Epochs are non-null; compare them
- if ep1 < ep2 then return -1; end if;
- if ep1 > ep2 then return 1; end if;
- rc := rpm.rpmstrcmp(v1, v2);
- if rc != 0 then return rc; end if;
- return rpm.rpmstrcmp(r1, r2);
- END;
- $$ language 'plpgsql';
-
--- restore the original setting
-update pg_settings set setting = overlay( setting placing '' from 1 for (length('rpm')+1) ) where name = 'search_path';
commit 85e77f54adb9f83d628c6d7873ad6f17e1876515
Author: Stephen Herr <sherr(a)redhat.com>
Date: Wed Aug 21 09:24:58 2013 -0400
Revert "998424 - naming the file properly"
This reverts commit c093eb247eb1267ab558780241c66ab240920449.
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-2.0-to-spacewalk-schema-2.1/015-rpm-rpmstrcmp.pkb.sql.postgres b/schema/spacewalk/upgrade/spacewalk-schema-2.0-to-spacewalk-schema-2.1/015-rpm-rpmstrcmp.pkb.sql.postgres
new file mode 100644
index 0000000..4079e2a
--- /dev/null
+++ b/schema/spacewalk/upgrade/spacewalk-schema-2.0-to-spacewalk-schema-2.1/015-rpm-rpmstrcmp.pkb.sql.postgres
@@ -0,0 +1,178 @@
+-- oracle equivalent source sha1 16cdee02a50a403e0a8ca17217f37f1291ae79a1
+-- create schema rpm;
+
+--update pg_setting
+update pg_settings set setting = 'rpm,' || setting where name = 'search_path';
+
+create or replace function isdigit(ch CHAR)
+ RETURNS BOOLEAN as $$
+ BEGIN
+ if ascii(ch) between ascii('0') and ascii('9')
+ then
+ return TRUE;
+ end if;
+ return FALSE;
+ END ;
+$$ language 'plpgsql';
+
+
+ create or replace FUNCTION isalpha(ch CHAR)
+ RETURNS BOOLEAN as $$
+ BEGIN
+ if ascii(ch) between ascii('a') and ascii('z') or
+ ascii(ch) between ascii('A') and ascii('Z')
+ then
+ return TRUE;
+ end if;
+ return FALSE;
+ END;
+$$ language 'plpgsql';
+
+
+ create or replace FUNCTION isalphanum(ch CHAR)
+ RETURNS BOOLEAN as $$
+ BEGIN
+ if ascii(ch) between ascii('a') and ascii('z') or
+ ascii(ch) between ascii('A') and ascii('Z') or
+ ascii(ch) between ascii('0') and ascii('9')
+ then
+ return TRUE;
+ end if;
+ return FALSE;
+ END;
+ $$ language 'plpgsql';
+
+
+ create or replace FUNCTION rpmstrcmp (string1 IN VARCHAR, string2 IN VARCHAR)
+ RETURNS INTEGER as $$
+ declare
+ str1 VARCHAR := string1;
+ str2 VARCHAR := string2;
+ digits VARCHAR(10) := '0123456789';
+ lc_alpha VARCHAR(27) := 'abcdefghijklmnopqrstuvwxyz';
+ uc_alpha VARCHAR(27) := 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
+ alpha VARCHAR(54) := lc_alpha || uc_alpha;
+ one VARCHAR;
+ two VARCHAR;
+ isnum BOOLEAN;
+ BEGIN
+ if str1 is NULL or str2 is NULL
+ then
+ RAISE EXCEPTION 'VALUE_ERROR.';
+ end if;
+
+ if str1 = str2
+ then
+ return 0;
+ end if;
+ one := str1;
+ two := str2;
+
+ <<segment_loop>>
+ while one <> '' and two <> ''
+ loop
+ declare
+ segm1 VARCHAR;
+ segm2 VARCHAR;
+ begin
+ --DBMS_OUTPUT.PUT_LINE('Params: ' || one || ',' || two);
+ -- Throw out all non-alphanum characters
+ while one <> '' and not rpm.isalphanum(one)
+ loop
+ one := substr(one, 2);
+ end loop;
+ while two <> '' and not rpm.isalphanum(two)
+ loop
+ two := substr(two, 2);
+ end loop;
+ str1 := one;
+ str2 := two;
+ if str1 <> '' and rpm.isdigit(str1)
+ and str2 <> '' and rpm.isdigit(str2)
+ then
+ str1 := ltrim(str1, digits);
+ str2 := ltrim(str2, digits);
+ isnum := true;
+ else
+ str1 := ltrim(str1, alpha);
+ str2 := ltrim(str2, alpha);
+ isnum := false;
+ end if;
+ if str1 <> ''
+ then segm1 := substr(one, 1, length(one) - length(str1));
+ else segm1 := one;
+ end if;
+
+ if str2 <> ''
+ then segm2 := substr(two, 1, length(two) - length(str2));
+ else segm2 := two;
+ end if;
+ if segm1 = '' then return -1; end if; /* arbitrary */
+ if segm2 = '' then
+ if isnum then
+ return 1;
+ else
+ return -1;
+ end if;
+ end if;
+ if isnum
+ then
+
+ segm1 := ltrim(segm1, '0');
+ segm2 := ltrim(segm2, '0');
+
+ if segm1 = '' and segm2 <> ''
+ then
+ return -1;
+ end if;
+ if segm1 <> '' and segm2 = ''
+ then
+ return 1;
+ end if;
+ if length(segm1) > length(segm2) then return 1; end if;
+ if length(segm2) > length(segm1) then return -1; end if;
+ end if;
+ if segm1 < segm2 then return -1; end if;
+ if segm1 > segm2 then return 1; end if;
+ one := str1;
+ two := str2;
+ end;
+ end loop segment_loop;
+
+ if one = '' then return -1; end if;
+ return 1;
+ END ;
+$$ language 'plpgsql';
+
+
+
+ create or replace FUNCTION vercmp(
+ e1 VARCHAR, v1 VARCHAR, r1 VARCHAR,
+ e2 VARCHAR, v2 VARCHAR, r2 VARCHAR)
+ RETURNS INTEGER as $$
+ declare
+ rc INTEGER;
+ ep1 INTEGER;
+ ep2 INTEGER;
+ BEGIN
+ if e1 is null or e1 = '' then
+ ep1 := 0;
+ else
+ ep1 := e1::integer;
+ end if;
+ if e2 is null or e2 = '' then
+ ep2 := 0;
+ else
+ ep2 := e2::integer;
+ end if;
+ -- Epochs are non-null; compare them
+ if ep1 < ep2 then return -1; end if;
+ if ep1 > ep2 then return 1; end if;
+ rc := rpm.rpmstrcmp(v1, v2);
+ if rc != 0 then return rc; end if;
+ return rpm.rpmstrcmp(r1, r2);
+ END;
+ $$ language 'plpgsql';
+
+-- restore the original setting
+update pg_settings set setting = overlay( setting placing '' from 1 for (length('rpm')+1) ) where name = 'search_path';
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-2.0-to-spacewalk-schema-2.1/015-rpm-rpmstrcmp.pkb.sql.postgresql b/schema/spacewalk/upgrade/spacewalk-schema-2.0-to-spacewalk-schema-2.1/015-rpm-rpmstrcmp.pkb.sql.postgresql
deleted file mode 100644
index 4079e2a..0000000
--- a/schema/spacewalk/upgrade/spacewalk-schema-2.0-to-spacewalk-schema-2.1/015-rpm-rpmstrcmp.pkb.sql.postgresql
+++ /dev/null
@@ -1,178 +0,0 @@
--- oracle equivalent source sha1 16cdee02a50a403e0a8ca17217f37f1291ae79a1
--- create schema rpm;
-
---update pg_setting
-update pg_settings set setting = 'rpm,' || setting where name = 'search_path';
-
-create or replace function isdigit(ch CHAR)
- RETURNS BOOLEAN as $$
- BEGIN
- if ascii(ch) between ascii('0') and ascii('9')
- then
- return TRUE;
- end if;
- return FALSE;
- END ;
-$$ language 'plpgsql';
-
-
- create or replace FUNCTION isalpha(ch CHAR)
- RETURNS BOOLEAN as $$
- BEGIN
- if ascii(ch) between ascii('a') and ascii('z') or
- ascii(ch) between ascii('A') and ascii('Z')
- then
- return TRUE;
- end if;
- return FALSE;
- END;
-$$ language 'plpgsql';
-
-
- create or replace FUNCTION isalphanum(ch CHAR)
- RETURNS BOOLEAN as $$
- BEGIN
- if ascii(ch) between ascii('a') and ascii('z') or
- ascii(ch) between ascii('A') and ascii('Z') or
- ascii(ch) between ascii('0') and ascii('9')
- then
- return TRUE;
- end if;
- return FALSE;
- END;
- $$ language 'plpgsql';
-
-
- create or replace FUNCTION rpmstrcmp (string1 IN VARCHAR, string2 IN VARCHAR)
- RETURNS INTEGER as $$
- declare
- str1 VARCHAR := string1;
- str2 VARCHAR := string2;
- digits VARCHAR(10) := '0123456789';
- lc_alpha VARCHAR(27) := 'abcdefghijklmnopqrstuvwxyz';
- uc_alpha VARCHAR(27) := 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
- alpha VARCHAR(54) := lc_alpha || uc_alpha;
- one VARCHAR;
- two VARCHAR;
- isnum BOOLEAN;
- BEGIN
- if str1 is NULL or str2 is NULL
- then
- RAISE EXCEPTION 'VALUE_ERROR.';
- end if;
-
- if str1 = str2
- then
- return 0;
- end if;
- one := str1;
- two := str2;
-
- <<segment_loop>>
- while one <> '' and two <> ''
- loop
- declare
- segm1 VARCHAR;
- segm2 VARCHAR;
- begin
- --DBMS_OUTPUT.PUT_LINE('Params: ' || one || ',' || two);
- -- Throw out all non-alphanum characters
- while one <> '' and not rpm.isalphanum(one)
- loop
- one := substr(one, 2);
- end loop;
- while two <> '' and not rpm.isalphanum(two)
- loop
- two := substr(two, 2);
- end loop;
- str1 := one;
- str2 := two;
- if str1 <> '' and rpm.isdigit(str1)
- and str2 <> '' and rpm.isdigit(str2)
- then
- str1 := ltrim(str1, digits);
- str2 := ltrim(str2, digits);
- isnum := true;
- else
- str1 := ltrim(str1, alpha);
- str2 := ltrim(str2, alpha);
- isnum := false;
- end if;
- if str1 <> ''
- then segm1 := substr(one, 1, length(one) - length(str1));
- else segm1 := one;
- end if;
-
- if str2 <> ''
- then segm2 := substr(two, 1, length(two) - length(str2));
- else segm2 := two;
- end if;
- if segm1 = '' then return -1; end if; /* arbitrary */
- if segm2 = '' then
- if isnum then
- return 1;
- else
- return -1;
- end if;
- end if;
- if isnum
- then
-
- segm1 := ltrim(segm1, '0');
- segm2 := ltrim(segm2, '0');
-
- if segm1 = '' and segm2 <> ''
- then
- return -1;
- end if;
- if segm1 <> '' and segm2 = ''
- then
- return 1;
- end if;
- if length(segm1) > length(segm2) then return 1; end if;
- if length(segm2) > length(segm1) then return -1; end if;
- end if;
- if segm1 < segm2 then return -1; end if;
- if segm1 > segm2 then return 1; end if;
- one := str1;
- two := str2;
- end;
- end loop segment_loop;
-
- if one = '' then return -1; end if;
- return 1;
- END ;
-$$ language 'plpgsql';
-
-
-
- create or replace FUNCTION vercmp(
- e1 VARCHAR, v1 VARCHAR, r1 VARCHAR,
- e2 VARCHAR, v2 VARCHAR, r2 VARCHAR)
- RETURNS INTEGER as $$
- declare
- rc INTEGER;
- ep1 INTEGER;
- ep2 INTEGER;
- BEGIN
- if e1 is null or e1 = '' then
- ep1 := 0;
- else
- ep1 := e1::integer;
- end if;
- if e2 is null or e2 = '' then
- ep2 := 0;
- else
- ep2 := e2::integer;
- end if;
- -- Epochs are non-null; compare them
- if ep1 < ep2 then return -1; end if;
- if ep1 > ep2 then return 1; end if;
- rc := rpm.rpmstrcmp(v1, v2);
- if rc != 0 then return rc; end if;
- return rpm.rpmstrcmp(r1, r2);
- END;
- $$ language 'plpgsql';
-
--- restore the original setting
-update pg_settings set setting = overlay( setting placing '' from 1 for (length('rpm')+1) ) where name = 'search_path';
10 years, 9 months