Revision
107435
Author
marius@macports.org
Date
2013-06-29 01:37:56 -0700 (Sat, 29 Jun 2013)

Log Message

Added port_index and set_dir to library.tcl.

Modified Paths

Diff

Modified: branches/gsoc13-tests/tests/test/library.tcl (107434 => 107435)


--- branches/gsoc13-tests/tests/test/library.tcl	2013-06-29 08:06:06 UTC (rev 107434)
+++ branches/gsoc13-tests/tests/test/library.tcl	2013-06-29 08:37:56 UTC (rev 107435)
@@ -1,3 +1,5 @@
+set autoconf "../../../Mk/macports.autoconf.mk"
+
 # Set of procs used for testing.
 
 # Sets $bindir variable from macports.autoconf.mk
@@ -5,6 +7,7 @@
 proc load_variables {} {
     global autoconf
     global bindir
+    global datadir
 
     if { [file exists $autoconf] == 0 } {
         puts "$autoconf does not exist."
@@ -18,8 +21,41 @@
     set bin [lrange [split $line "/"] 1 1]
 
     set bindir $prefix/$bin/
+    set datadir $prefix/share
+
+    #TO DO: Add PORTSRC var
 }
 
+# Sets initial directories
+proc set_dir {} {
+    global datadir
+    set path [pwd]
+
+    file delete -force /tmp/macports-tests/
+    file delete -force PortIndex PortIndex.quick
+
+    file mkdir /tmp/macports-tests/ports
+    file mkdir /tmp/macports-tests/opt/local/etc/macports/
+    file mkdir /tmp/macports-tests/opt/local/share/
+    file mkdir /tmp/macports-tests/opt/local/var/macports/receipts/
+    file mkdir /tmp/macports-tests/opt/local/var/macports/registry/
+    file mkdir /tmp/macports-tests/opt/local/var/macports/build/
+
+    file link -symbolic /tmp/macports-tests/opt/local/share/macports $datadir/macports
+    file link -symbolic /tmp/macports-tests/ports/test $path/test
+}
+
+# Run portindex
+proc port_index {} {
+  global bindir
+
+  set cmd "portindex"
+
+  file copy sources.conf /tmp/macports-tests/opt/local/etc/macports/
+  set result [exec $bindir$cmd 2>&1]
+  file copy PortIndex PortIndex.quick /tmp/macports-tests/ports/
+}
+
 # Executes port clean.
 proc port_clean {} {
     global bindir