[66868] trunk/base/src/port/portindex.tcl

jmr at macports.org jmr at macports.org
Sat Apr 24 07:33:20 PDT 2010


Revision: 66868
          http://trac.macports.org/changeset/66868
Author:   jmr at macports.org
Date:     2010-04-24 07:33:14 -0700 (Sat, 24 Apr 2010)
Log Message:
-----------
portindex: add -p option to generate an index for use on a different platform

Modified Paths:
--------------
    trunk/base/src/port/portindex.tcl

Modified: trunk/base/src/port/portindex.tcl
===================================================================
--- trunk/base/src/port/portindex.tcl	2010-04-24 12:40:16 UTC (rev 66867)
+++ trunk/base/src/port/portindex.tcl	2010-04-24 14:33:14 UTC (rev 66868)
@@ -21,6 +21,7 @@
 array set ui_options        [list]
 array set global_options    [list]
 array set global_variations [list]
+set port_options            [list]
 
 # Pass global options into mportinit
 mportinit ui_options global_options global_variations
@@ -28,16 +29,17 @@
 # Standard procedures
 proc print_usage args {
     global argv0
-    puts "Usage: $argv0 \[-ad\] \[-o output directory\] \[directory\]"
+    puts "Usage: $argv0 \[-adf\] \[-p plat_ver_arch\] \[-o output directory\] \[directory\]"
     puts "-a:\tArchive port directories (for remote sites). Requires -o option"
     puts "-o:\tOutput all files to specified directory"
     puts "-d:\tOutput debugging information"
     puts "-f:\tDo a full re-index instead of updating"
+    puts "-p:\tPretend to be on another platform"
 }
 
 proc pindex {portdir} {
     global target oldfd oldmtime qindex fd directory archive outdir stats full_reindex
-    global macports::prefix ui_options
+    global macports::prefix ui_options port_options
     set save_prefix $prefix
     set prefix {\${prefix}}
 
@@ -68,7 +70,7 @@
         }
     }
 
-    if {[catch {set interp [mportopen file://[file join $directory $portdir]]} result]} {
+    if {[catch {set interp [mportopen file://[file join $directory $portdir] $port_options]} result]} {
         puts stderr "Failed to parse file $portdir/Portfile: $result"
         # revert the prefix.
         set prefix $save_prefix
@@ -128,6 +130,13 @@
             } elseif {$arg == "-o"} { # Set output directory
                 incr i
                 set outdir [lindex $argv $i]
+            } elseif {$arg == "-p"} { # Set platform
+                incr i
+                set platlist [split [lindex $argv $i] _]
+                set os_platform [lindex $platlist 0]
+                set os_major [lindex $platlist 1]
+                set os_arch [lindex $platlist 2]
+                lappend port_options os.platform $os_platform os.major $os_major os.arch $os_arch
             } elseif {$arg == "-f"} { # Completely rebuild index
                 set full_reindex yes
             } else {
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20100424/d887d1e3/attachment.html>


More information about the macports-changes mailing list