Ticket #2481: patch-port.tcl

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

Patch to base/src/port/port.tcl

Line 
1Index: base/src/port/port.tcl
2===================================================================
3RCS file: /Volumes/src/cvs/od/proj/darwinports/base/src/port/port.tcl,v
4retrieving revision 1.64
5diff -u -r1.64 port.tcl
6--- base/src/port/port.tcl      12 Dec 2004 01:12:27 -0000      1.64
7+++ base/src/port/port.tcl      12 Dec 2004 01:51:14 -0000
8@@ -463,6 +463,10 @@
9                }
10        }
11        installed {
12+               # Look for recreate mode
13+               set recreate [info exists options(ports_installed_recreate)]
14+               
15+               # If a port name is given, only look for that one, else consider all installed ports
16         if { [info exists portname] } {
17             if { [catch {set ilist [registry::installed $portname]} result] } {
18                 if {$result == "Registry error: $portname not registered as installed."} {
19@@ -492,11 +496,25 @@
20                 set irevision [lindex $i 2]
21                 set ivariants [lindex $i 3]
22                 set iactive [lindex $i 4]
23-                if { $iactive == 0 } {
24-                    puts "  $iname ${iversion}_${irevision}${ivariants}"
25-                } elseif { $iactive == 1 } {
26-                    puts "  $iname ${iversion}_${irevision}${ivariants} (active)"
27-                }
28+               
29+                if {$recreate} {
30+                       # In recreate mode we emit a sequence of commands sufficient to reinstall the
31+                       # installed ports
32+                       
33+                       # !!! Need to handle direct mode here, where active is always false !!!
34+                       # !!! Or else (better?) the registry should be changed to know that such ports are always active !!!
35+                       if { $iactive == 1 } {
36+                               set variants [regsub -all {([-+])} $ivariants { \1}]
37+                               puts "port install $iname$variants # ${iversion}_${irevision}"
38+                       }
39+                } else {
40+                       # Report on the port
41+                                       if { $iactive == 0 } {
42+                                               puts "  $iname ${iversion}_${irevision}${ivariants}"
43+                                       } elseif { $iactive == 1 } {
44+                                               puts "  $iname ${iversion}_${irevision}${ivariants} (active)"
45+                                       }
46+                               }
47             }
48         } else {
49             exit 1