Index: openacs-4/packages/acs-tcl/tcl/apm-install-procs-oracle.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/apm-install-procs-oracle.xql,v
diff -u -r1.4 -r1.5
--- openacs-4/packages/acs-tcl/tcl/apm-install-procs-oracle.xql	30 Aug 2002 11:48:46 -0000	1.4
+++ openacs-4/packages/acs-tcl/tcl/apm-install-procs-oracle.xql	23 Jan 2003 11:24:21 -0000	1.5
@@ -258,6 +258,12 @@
       </querytext>
 </fullquery>
 
+ <fullquery name="apm_dependency_provided_p.version_greater_p">      
+      <querytext>
+        select apm_package_version.version_name_greater(:provided_version, :dependency_version) from dual
+      </querytext>
+</fullquery>
+
 <fullquery name="apm_package_install.version_exists_p">      
       <querytext>
       
Index: openacs-4/packages/acs-tcl/tcl/apm-install-procs-postgresql.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/apm-install-procs-postgresql.xql,v
diff -u -r1.10 -r1.11
--- openacs-4/packages/acs-tcl/tcl/apm-install-procs-postgresql.xql	1 Jan 2003 09:49:01 -0000	1.10
+++ openacs-4/packages/acs-tcl/tcl/apm-install-procs-postgresql.xql	23 Jan 2003 11:24:21 -0000	1.11
@@ -234,6 +234,12 @@
       </querytext>
 </fullquery>
 
+ <fullquery name="apm_dependency_provided_p.version_greater_p">      
+      <querytext>
+        select apm_package_version__version_name_greater(:provided_version, :dependency_version)
+      </querytext>
+</fullquery>
+
 <fullquery name="apm_package_install.version_exists_p">      
       <querytext>
       
Index: openacs-4/packages/acs-tcl/tcl/apm-install-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/apm-install-procs.tcl,v
diff -u -r1.24 -r1.25
--- openacs-4/packages/acs-tcl/tcl/apm-install-procs.tcl	22 Jan 2003 18:36:16 -0000	1.24
+++ openacs-4/packages/acs-tcl/tcl/apm-install-procs.tcl	23 Jan 2003 11:24:21 -0000	1.25
@@ -80,15 +80,7 @@
     set old_version_p 0
     set found_p 0
     ns_log Debug "Scanning for $dependency_uri version $dependency_version"
-    db_foreach apm_dependency_check {
-	select apm_package_version.version_name_greater(service_version, :dependency_version) as version_p
-	from apm_package_dependencies d, apm_package_types a, apm_package_versions v
-	where d.dependency_type = 'provides'
-	and d.version_id = v.version_id
-	and d.service_uri = :dependency_uri
-	and v.installed_p = 't'
-	and a.package_key = v.package_key
-    } {
+    db_foreach apm_dependency_check {} {
 	if { $version_p >= 0 } {
 	    ns_log Debug "Dependency satisfied by previously installed package"
 	    set found_p 1
@@ -105,19 +97,17 @@
     if { ![empty_string_p $dependency_list] } {
 	# They provided a list of provisions.
 	foreach prov $dependency_list {
-	    if {![string compare $dependency_uri [lindex $prov 0]] } {
-		if { $dependency_version <= [lindex $prov 1] } {
+	    if { [string equal $dependency_uri [lindex $prov 0]] } {
+
+                set provided_version [lindex $prov 1]
+                set provided_p [db_string version_greater_p {}]
+
+                if { $provided_p >= 0 } {
 		    ns_log Debug "Dependency satisfied in list of provisions."
-		    return 1
-		} else {
-		    if [catch {
-			if { $dependency_version > [lindex $prov 1] } {
-			    set old_version_p 1
-			}
-		    } errmsg] {
-			ns_log Error "Error processing dependencies: $errmsg"
-		    }
-		}
+                    return 1
+                } else { 
+                    set old_version_p 1
+                }
 	    }
 	}
     }