Ticket #2450: patch-port.tcl

File patch-port.tcl, 3.5 KB (added by jberry@…, 19 years ago)

Patch to base/src/port/port.tcl

Line 
1? config.log
2? config.status
3? Makefile
4? Mk/dports.autoconf.mk
5? doc/ports.conf
6? doc/prefix.mtree
7? src/config.h
8? src/darwinports1.0/Darwinports.dylib
9? src/darwinports1.0/darwinports_autoconf.tcl
10? src/darwinports1.0/darwinports_fastload.tcl
11? src/pextlib1.0/Pextlib.dylib
12? src/port/port
13? src/port/portall
14? src/port/portindex
15? src/programs/Makefile
16Index: src/port/port.tcl
17===================================================================
18RCS file: /Volumes/src/cvs/od/proj/darwinports/base/src/port/port.tcl,v
19retrieving revision 1.62
20diff -u -r1.62 port.tcl
21--- src/port/port.tcl   20 Oct 2004 21:34:36 -0000      1.62
22+++ src/port/port.tcl   4 Dec 2004 17:48:24 -0000
23@@ -421,6 +421,93 @@
24                        exit 1
25                }
26        }
27+       outdated {
28+               # If a port name was supplied, limit ourselves to that port, else check all installed ports
29+               if { [info exists portname] } {
30+                       if { [catch {set ilist [registry::installed $portname]} result] } {
31+                               puts "port outdated failed: $result"
32+                               exit 1
33+                       }
34+               } else {
35+                       if { [catch {set ilist [registry::installed]} result] } {
36+                               puts "port outdated failed: $result"
37+                               exit 1
38+                       }
39+               }
40+               
41+               if { [llength $ilist] > 0 } {
42+                       puts "The following installed ports seem to be outdated:"
43+                       
44+                       foreach i $ilist { 
45+
46+                               # Get information about the installed port
47+                               set portname                    [lindex $i 0]
48+                               set installed_version   [lindex $i 1]
49+                               set installed_revision  [lindex $i 2]
50+                               set installed_variants  [lindex $i 3]
51+                               set installed_compound  "${installed_version}_${installed_revision}"
52+                               set is_active                   [lindex $i 4]
53+                               if { $is_active == 0 } {
54+                                       continue
55+                               }
56+
57+                               # Get info about the port from the index
58+                               # Escape regex special characters
59+                               regsub -all "(\\(){1}|(\\)){1}|(\\{1}){1}|(\\+){1}|(\\{1}){1}|(\\{){1}|(\\}){1}|(\\^){1}|(\\$){1}|(\\.){1}|(\\\\){1}" $portname "\\\\&" search_string
60+                               if {[catch {set res [dportsearch ^$search_string\$]} result]} {
61+                                       puts "port search failed: $result"
62+                                       exit 1
63+                               }
64+                               if {[llength $res] < 2 && [ui_isset ports_verbose]} {
65+                                       puts "$portname ($installed_compound is installed; the port was not found in port index)"
66+                                       continue
67+                               }
68+                               array set portinfo [lindex $res 1]
69+                               set porturl $portinfo(porturl)
70+                               
71+                               # Get information about latest available version and revision
72+                               set latest_version $portinfo(version)
73+                               set latest_revision             0
74+                               if {[info exists portinfo(revision)] && $portinfo(revision) > 0} { 
75+                                       set latest_revision     $portinfo(revision)
76+                               }
77+                               
78+                               set latest_compound             "${latest_version}_${latest_revision}"
79+                               
80+                               # Compare versions for equality
81+                               set result [rpm-vercomp $installed_compound $latest_compound]
82+                               if { $result != 0 } {
83+                               
84+                                       # Form a relation between the versions
85+                                       set flag ""
86+                                       if { $result > 0 } {
87+                                               set relation ">"
88+                                               set flag "!"
89+                                       } else {
90+                                               set relation "<"
91+                                       }
92+                                       
93+                                       # Emit information
94+                                       if {[ui_isset ports_verbose] || $result < 0} {
95+                                               puts [format "%-30s %1s %s" $portname $flag "$installed_compound $relation $latest_compound"]
96+                                       }
97+                                       
98+                                       # Even more verbose explanation (disabled at present)
99+                                       if {false && [ui_isset ports_verbose]} {
100+                                               puts "  installed: $installed_compound"
101+                                               puts "  latest:    $latest_compound"
102+                                               # Warning for ports that are predated
103+                                               if { $result > 0 } {
104+                                                       puts "  (installed version is newer than port index version)"
105+                                               }
106+                                       }
107+                                       
108+                               }
109+                       }
110+               } else {
111+                       exit 1
112+               }
113+       }
114        contents {
115                # make sure a port was given on the command line
116                if {![info exists portname]} {