[56620] trunk/base/portmgr/jobs/PortIndex2MySQL.tcl
jmpp at macports.org
jmpp at macports.org
Sun Aug 30 19:52:07 PDT 2009
Revision: 56620
http://trac.macports.org/changeset/56620
Author: jmpp at macports.org
Date: 2009-08-30 19:52:04 -0700 (Sun, 30 Aug 2009)
Log Message:
-----------
Additions to the PortIndex2MySQL.tcl script to add licensing information to the ports.php page.
One problem and a small issue exists, though:
1) First and foremost, for some reason the portinfo tcl array is not providing any license information, so nothing is being inserted into the db at present
(quite strange, 'cause I have MacPorts 1.8.99 installed locally and commands such as 'port info gcc45' does return licensing information). I'd appreciate
other eyes looking into this, around line 335.
2) The create_tables variable should be set to false again once the revised script is run for the first time on the server.
Once item 1) above is worked out, populating the db with licensing information should work.
Modified Paths:
--------------
trunk/base/portmgr/jobs/PortIndex2MySQL.tcl
Modified: trunk/base/portmgr/jobs/PortIndex2MySQL.tcl
===================================================================
--- trunk/base/portmgr/jobs/PortIndex2MySQL.tcl 2009-08-31 00:53:39 UTC (rev 56619)
+++ trunk/base/portmgr/jobs/PortIndex2MySQL.tcl 2009-08-31 02:52:04 UTC (rev 56620)
@@ -73,7 +73,7 @@
set HEADERS "To: $SPAM_LOVERS\r\nFrom: $FROM\r\nSubject: $SUBJECT\r\n\r\n"
# handle command line arguments
-set create_tables false
+set create_tables true
if {[llength $argv]} {
if {[lindex $argv 0] == "--create-tables"} {
set create_tables true
@@ -260,6 +260,9 @@
puts $sqlfile_fd "DROP TABLE IF EXISTS platforms;"
puts $sqlfile_fd "CREATE TABLE platforms (portfile VARCHAR(255), platform VARCHAR(255)) DEFAULT CHARSET=utf8;"
+
+ puts $sqlfile_fd "DROP TABLE IF EXISTS licenses;"
+ puts $sqlfile_fd "CREATE TABLE licenses (portfile VARCHAR(255), license VARCHAR(255)) DEFAULT CHARSET=utf8;"
} else {
# if we are not creating tables from scratch, remove the old data
puts $sqlfile_fd "TRUNCATE log;"
@@ -269,6 +272,7 @@
puts $sqlfile_fd "TRUNCATE dependencies;"
puts $sqlfile_fd "TRUNCATE variants;"
puts $sqlfile_fd "TRUNCATE platforms;"
+ puts $sqlfile_fd "TRUNCATE licenses;"
}
# Iterate over each matching port, extracting its information from the
@@ -335,6 +339,11 @@
} else {
set platforms ""
}
+ if {[info exists portinfo(license)]} {
+ set licenses $portinfo(license)
+ } else {
+ set licenses ""
+ }
puts $sqlfile_fd "INSERT INTO portfiles VALUES ('$portname', '$portdir', '$portversion', '$description');"
@@ -387,6 +396,11 @@
puts $sqlfile_fd "INSERT INTO platforms VALUES ('$portname', '$platform');"
}
+ foreach license $licenses {
+ set license [sql_escape $license]
+ puts $sqlfile_fd "INSERT INTO licenses VALUES ('$portname', '$license');"
+ }
+
}
# Mark the db regen as done only once we're done processing all ports:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20090830/ad84f0c9/attachment.html>
More information about the macports-changes
mailing list