Diff

Differences From Artifact [92bcf20d68]:

To Artifact [3c4d307b06]:


    14     14   set queue "${queue}.old"
    15     15   
    16     16   set fd [open $queue r]
    17     17   set data [read $fd]
    18     18   close $fd
    19     19   
    20     20   set ::env(TCLKIT) "/home/rkeene/bin/tclkit"
           21  +
           22  +proc handleSDK {workdir input output} {
           23  +	set workdir [file join $workdir "sdk-rewrite"]
           24  +	set dirNewName [regsub {\.tar\.gz$} [file tail $output] {}]
           25  +
           26  +	file mkdir $workdir
           27  +	exec gzip -dc $input | tar -C $workdir -xf -
           28  +
           29  +	set dirName [glob -nocomplain -directory $workdir *]
           30  +	if {[llength $dirName] != 1} {
           31  +		return -code error "Multiple directories found: $dirName"
           32  +	}
           33  +
           34  +	set dirName [lindex $dirName 0]
           35  +
           36  +	file rename $dirName [file join $workdir $dirNewName]
           37  +	exec tar -C $workdir -cf - $dirNewName | gzip -9c > [file join $workdir sdk.tar.gz]
           38  +
           39  +	file copy [file join $workdir sdk.tar.gz] $output
           40  +}
    21     41   
    22     42   foreach line [split $data "\n"] {
    23     43   	if {$line == ""} {
    24     44   		continue
    25     45   	}
    26     46   
    27     47   	unset -nocomplain buildinfo
           48  +	unset -nocomplain outsdkfile
    28     49   
    29     50   	array set buildinfo $line
    30     51   
    31     52   	set outfile [file join $outdir $buildinfo(key) $buildinfo(filename)]
           53  +	if {[info exists buildinfo(sdkfilename)]} {
           54  +		set outsdkfile [file join $outdir $buildinfo(key) $buildinfo(sdkfilename)]
           55  +	}
    32     56   
    33     57   	# Skip if build completed
    34     58   	if {[file exists $outfile]} {
    35     59   		continue
    36     60   	}
    37     61   
    38     62   	# Skip if build failed
................................................................................
   159    183   	}
   160    184   
   161    185   	catch {
   162    186   		exec grep ^ {*}[lsort -dictionary [glob */build.log]] >> "${outfile}.log"
   163    187   	}
   164    188   
   165    189   	foreach file [list tclkit-$buildinfo(tcl_version) {*}[glob -nocomplain libtclkit*]] {
          190  +		set isSDK false
   166    191   		switch -glob -- $file {
   167    192   			"*.dylib" - "*.so" - "*.sl" - "*.dll" { }
   168    193   			"tclkit-*" {}
          194  +			"libtclkit-sdk-*.tar.gz" {
          195  +				set isSDK true
          196  +			}
   169    197   			default {
   170    198   				continue
   171    199   			}
   172    200   		}
          201  +
          202  +		if {$isSDK} {
          203  +			if {[info exists outsdkfile]} {
          204  +				if {[catch {
          205  +					handleSDK $workdir $file $outsdkfile
          206  +				}]} {
          207  +					puts stderr "Error creating SDK: $::errorInfo"
          208  +				}
          209  +			}
          210  +
          211  +			continue
          212  +		}
   173    213   
   174    214   		if {[file exists $file]} {
   175    215   			file rename $file $outfile
   176    216   
   177    217   			break
   178    218   		}
   179    219   	}