[27510] trunk/base/portmgr/packaging/PortIndex2MySQL.tcl
source_changes at macosforge.org
source_changes at macosforge.org
Mon Aug 6 00:19:46 PDT 2007
Revision: 27510
http://trac.macosforge.org/projects/macports/changeset/27510
Author: jmpp at macports.org
Date: 2007-08-06 00:19:46 -0700 (Mon, 06 Aug 2007)
Log Message:
-----------
Comments++ && Grammar++;
Modified Paths:
--------------
trunk/base/portmgr/packaging/PortIndex2MySQL.tcl
Modified: trunk/base/portmgr/packaging/PortIndex2MySQL.tcl
===================================================================
--- trunk/base/portmgr/packaging/PortIndex2MySQL.tcl 2007-08-05 19:38:36 UTC (rev 27509)
+++ trunk/base/portmgr/packaging/PortIndex2MySQL.tcl 2007-08-06 07:19:46 UTC (rev 27510)
@@ -37,15 +37,16 @@
# POSSIBILITY OF SUCH DAMAGE.
+# Load macports1.0 so that we can use some of its procs and the portinfo array.
catch {source \
[file join "@TCL_PACKAGE_DIR@" macports1.0 macports_fastload.tcl]}
package require macports
-# Initialize the MacPorts system to find the sources.conf file, wherefrom we'll be
-# getting the PortIndex file that'll feed the database, and initialize the portinfo
-# array for each port.
+# Initialize MacPorts to find the sources.conf file, wherefrom we'll
+# get the PortIndex that'll feed the database.
mportinit
+
# Procedure to catch the database password from a protected file.
proc getpasswd {passwdfile} {
if {[catch {open $passwdfile r} passwdfile_fd]} {
@@ -60,7 +61,6 @@
return $passwd
}
-
# Needed escaping for some strings output as sql statements.
proc sql_escape {str} {
regsub -all -- {'} $str {\\'} str
@@ -110,11 +110,15 @@
puts $sqlfile_fd "DROP TABLE IF EXISTS platforms"
puts $sqlfile_fd "CREATE TABLE platforms (portfile VARCHAR(255), platform VARCHAR(255))"
+
+# Load every port in the index through a search matching everything.
if {[catch {set ports [mportsearch ".+"]} errstr]} {
ui_error "port search failed: $errstr"
exit 1
}
+# Iterate over each matching port, extracting its information from the
+# portinfo array.
foreach {name array} $ports {
array unset portinfo
@@ -212,7 +216,8 @@
}
-# Pipe the contents of the generated sql file to the database command:
+# Pipe the contents of the generated sql file to the database command,
+# reading from the file descriptor for the raw sql file to assure completeness.
if {[catch {seek $sqlfile_fd 0 start} errstr]} {
ui_error "${::errorCode}: $errstr"
exit 1
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macports-changes/attachments/20070806/5a9ca069/attachment.html
More information about the macports-changes
mailing list