[70302] branches/gsoc10-mpwa/bin
jrozner at macports.org
jrozner at macports.org
Thu Aug 5 11:13:00 PDT 2010
Revision: 70302
http://trac.macports.org/changeset/70302
Author: jrozner at macports.org
Date: 2010-08-05 11:13:00 -0700 (Thu, 05 Aug 2010)
Log Message:
-----------
fixed name and removed unused flags from usage
Added Paths:
-----------
branches/gsoc10-mpwa/bin/new_ports
Removed Paths:
-------------
branches/gsoc10-mpwa/bin/new-ports
Deleted: branches/gsoc10-mpwa/bin/new-ports
===================================================================
--- branches/gsoc10-mpwa/bin/new-ports 2010-08-05 14:52:36 UTC (rev 70301)
+++ branches/gsoc10-mpwa/bin/new-ports 2010-08-05 18:13:00 UTC (rev 70302)
@@ -1,143 +0,0 @@
-#!/bin/sh
-# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:filetype=tcl:et:sw=4:ts=4:sts=4
-# Run the Tcl interpreter \
-exec /usr/bin/tclsh "$0" "$@"
-
-# Traverse through all ports, outputting out their info if they are older than a specified time
-# $Id: portindex.tcl 68413 2010-06-03 03:26:35Z jmr at macports.org $
-
-catch {source \
- [file join "/Library/Tcl" macports1.0 macports_fastload.tcl]}
-package require macports
-package require Pextlib
-
-# Globals
-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
-
-# Standard procedures
-proc print_usage args {
- global argv0
- puts "Usage: $argv0 \[-adf\] \[-p plat_ver_arch\] \[-o output directory\] \[directory\]"
- puts "-d:\tOutput debugging information"
- puts "-m:\tOutput ports newer than the given mtime"
-}
-
-proc pindex {portdir} {
- global target oldfd oldmtime qindex fd directory outdir \
- ui_options port_options
-
- # try to reuse the existing entry if it's still valid
- if {[info exists qindex([string tolower [file tail $portdir]])]} {
- try {
- set mtime [file mtime [file join $directory $portdir Portfile]]
- if {$oldmtime < $mtime} {
- set offset $qindex([string tolower [file tail $portdir]])
- seek $oldfd $offset
- gets $oldfd line
- set name [lindex $line 0]
- set len [lindex $line 1]
- set line [read $oldfd $len]
- array set portinfo $line
-
- if {[info exists ui_options(ports_debug)]} {
- puts "Found entry for $portdir"
- }
-
- foreach field [array names portinfo] {
- puts $fd "${field}: $portinfo($field)"
- }
- puts $fd ""
-
- return
- }
- } catch {*} {
- ui_warn "failed to open entry for ${portdir}"
- }
- }
-}
-
-if {[expr $argc > 4]} {
- print_usage
- exit 1
-}
-
-for {set i 0} {$i < $argc} {incr i} {
- set arg [lindex $argv $i]
- switch -regex -- $arg {
- {^-.+} {
- if {$arg == "-d"} { # Turn on debug output
- set ui_options(ports_debug) yes
- } elseif {$arg == "-m"} { # output ports newer than mtime
- incr i
- set oldmtime [lindex $argv $i]
- } else {
- puts stderr "Unknown option: $arg"
- print_usage
- exit 1
- }
- }
- default {
- set directory [file join [pwd] $arg]
- }
- }
-}
-
-if {![info exists directory]} {
- set directory .
-}
-
-if {![info exists oldmtime]} {
- set oldmtime 0
-}
-
-# cd to input directory
-if {[catch {cd $directory} result]} {
- puts stderr "$result"
- exit 1
-} else {
- set directory [pwd]
-}
-
-# Set output directory to full path
-if {[info exists outdir]} {
- if {[catch {file mkdir $outdir} result]} {
- puts stderr "$result"
- exit 1
- }
- if {[catch {cd $outdir} result]} {
- puts stderr "$result"
- exit 1
- } else {
- set outdir [pwd]
- }
-} else {
- set outdir $directory
-}
-
-set outpath [file join $outdir PortIndex]
-# open old index for comparison
-if {[file isfile $outpath] && [file isfile ${outpath}.quick]} {
- if {![catch {set oldfd [open $outpath r]}] && ![catch {set quickfd [open ${outpath}.quick r]}]} {
- if {![catch {set quicklist [read $quickfd]}]} {
- foreach entry [split $quicklist "\n"] {
- set qindex([lindex $entry 0]) [lindex $entry 1]
- }
- }
- close $quickfd
- }
-} else {
- set newest 0
-}
-
-set fd stdout
-mporttraverse pindex $directory
-if {[info exists oldfd]} {
- close $oldfd
-}
-close $fd
Copied: branches/gsoc10-mpwa/bin/new_ports (from rev 69308, branches/gsoc10-mpwa/bin/new-ports)
===================================================================
--- branches/gsoc10-mpwa/bin/new_ports (rev 0)
+++ branches/gsoc10-mpwa/bin/new_ports 2010-08-05 18:13:00 UTC (rev 70302)
@@ -0,0 +1,143 @@
+#!/bin/sh
+# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:filetype=tcl:et:sw=4:ts=4:sts=4
+# Run the Tcl interpreter \
+exec /usr/bin/tclsh "$0" "$@"
+
+# Traverse through all ports, outputting out their info if they are older than a specified time
+# $Id: portindex.tcl 68413 2010-06-03 03:26:35Z jmr at macports.org $
+
+catch {source \
+ [file join "/Library/Tcl" macports1.0 macports_fastload.tcl]}
+package require macports
+package require Pextlib
+
+# Globals
+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
+
+# Standard procedures
+proc print_usage args {
+ global argv0
+ puts "Usage: $argv0 \[-dm\] \[directory\]"
+ puts "-d:\tOutput debugging information"
+ puts "-m:\tOutput ports newer than the given mtime"
+}
+
+proc pindex {portdir} {
+ global target oldfd oldmtime qindex fd directory outdir \
+ ui_options port_options
+
+ # try to reuse the existing entry if it's still valid
+ if {[info exists qindex([string tolower [file tail $portdir]])]} {
+ try {
+ set mtime [file mtime [file join $directory $portdir Portfile]]
+ if {$oldmtime < $mtime} {
+ set offset $qindex([string tolower [file tail $portdir]])
+ seek $oldfd $offset
+ gets $oldfd line
+ set name [lindex $line 0]
+ set len [lindex $line 1]
+ set line [read $oldfd $len]
+ array set portinfo $line
+
+ if {[info exists ui_options(ports_debug)]} {
+ puts "Found entry for $portdir"
+ }
+
+ foreach field [array names portinfo] {
+ puts $fd "${field}: $portinfo($field)"
+ }
+ puts $fd ""
+
+ return
+ }
+ } catch {*} {
+ ui_warn "failed to open entry for ${portdir}"
+ }
+ }
+}
+
+if {[expr $argc > 4]} {
+ print_usage
+ exit 1
+}
+
+for {set i 0} {$i < $argc} {incr i} {
+ set arg [lindex $argv $i]
+ switch -regex -- $arg {
+ {^-.+} {
+ if {$arg == "-d"} { # Turn on debug output
+ set ui_options(ports_debug) yes
+ } elseif {$arg == "-m"} { # output ports newer than mtime
+ incr i
+ set oldmtime [lindex $argv $i]
+ } else {
+ puts stderr "Unknown option: $arg"
+ print_usage
+ exit 1
+ }
+ }
+ default {
+ set directory [file join [pwd] $arg]
+ }
+ }
+}
+
+if {![info exists directory]} {
+ set directory .
+}
+
+if {![info exists oldmtime]} {
+ set oldmtime 0
+}
+
+# cd to input directory
+if {[catch {cd $directory} result]} {
+ puts stderr "$result"
+ exit 1
+} else {
+ set directory [pwd]
+}
+
+# Set output directory to full path
+if {[info exists outdir]} {
+ if {[catch {file mkdir $outdir} result]} {
+ puts stderr "$result"
+ exit 1
+ }
+ if {[catch {cd $outdir} result]} {
+ puts stderr "$result"
+ exit 1
+ } else {
+ set outdir [pwd]
+ }
+} else {
+ set outdir $directory
+}
+
+set outpath [file join $outdir PortIndex]
+# open old index for comparison
+if {[file isfile $outpath] && [file isfile ${outpath}.quick]} {
+ if {![catch {set oldfd [open $outpath r]}] && ![catch {set quickfd [open ${outpath}.quick r]}]} {
+ if {![catch {set quicklist [read $quickfd]}]} {
+ foreach entry [split $quicklist "\n"] {
+ set qindex([lindex $entry 0]) [lindex $entry 1]
+ }
+ }
+ close $quickfd
+ }
+} else {
+ set newest 0
+}
+
+set fd stdout
+mporttraverse pindex $directory
+if {[info exists oldfd]} {
+ close $oldfd
+}
+close $fd
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20100805/9b7f3ade/attachment.html>
More information about the macports-changes
mailing list