# Usage
#
proc wokStoreUsage { } {
+ global env
puts stderr \
{
Usage : wstore is used to enqueue a report file, to get
(To update a workbench directly from a report see a the end of this help)
>wstore file : without option adds a report in the report's queue
- from <file> (created by wprepare).
+ from <file>.
Queue name is deduced from the name of the father
- workbench found in <file>.
+ workbench written in <file>. (created by wprepare).
To list all pending reports name and ID in a queue use the following command:
> wstore -wb name -ls
In the following syntaxes the option -wb is used to specify a workbench name.
(Use a full workbench path for the workbench name. <Factory:workshop:workbench>
Default is the current wb. <ID> is a report ID (see above)
- option -ls
>wstore [-rm|-cat] [-wb name] [ID]
(Default behavior: Creates a a subdirectory adm in directory created using -base option)
-welcome: If a report list new development units, by default store will refuse.
If you want wstore be quiet create the queue with -welcome option.
+ -trigger to specify the full path of a tcl file defining a tcl proc triggered after a
+ report has been enqueued. An example for such a file can be found in
+ $env(WOK_LIBRARY)/wstore_trigger.example.
To list all queues and their associated parameters:
set tblreq(-wb) value_required:string
set tblreq(-create) {}
- set tblreq(-queue) value_required:string
+
+ set tblreq(-queue) value_required:string
+ set tblreq(-trigger) value_required:string
+
set tblreq(-base) value_required:string
set tblreq(-type) value_required:string
set tblreq(-journal) value_required:string
if [info exists tabarg(-queue)] {
set queue $tabarg(-queue)
}
+ set trig {}
+ if [info exists tabarg(-trigger)] {
+ set trig $tabarg(-trigger)
+ }
set type SCCS
if [info exists tabarg(-type)] {
set type $tabarg(-type)
set journal [file join $commonbase adm wintegre.jnl]
}
wokStore:Report:Configure set \
- [wokStore:Report:FileAdm $curwb] $curwb $queue $base $type $counter $journal $welcome
+ [wokStore:Report:FileAdm $curwb] $curwb $queue $trig $base $type $counter $journal $welcome
if { $verbose } {
msgprint -c WOKVC -i "Reports queue created under $queue "
msgprint -c WOKVC -i "Repository ($type) created under $base "
msgprint -c WOKVC -i "Repository ([wokIntegre:BASE:GetType]) under [wokIntegre:BASE:GetRootName]"
msgprint -c WOKVC -i "Integration counter in : [wokIntegre:Number:GetName]"
msgprint -c WOKVC -i "Integration journal in : [wokIntegre:Journal:GetName]"
+ msgprint -c WOKVC -i "Trigger : [wokStore:Trigger:GetName]"
return
}
msgprint -c WOKVC -i "Storing report in queue of workbench ${shop}:$wbpere"
set frigo [file join [wokStore:Report:GetRootName] ${entry}]
wokStore:Report:Add $ID table $banner $notes $frigo
+ if { [set trig [wokStore:Trigger:Exists]] != {} } {
+ wokStore:Trigger:Invoke $trig $frigo
+ }
return
} else {
msgprint -c WOKVC -e "Report name $TID should not contains a comma."
if { $alert == 1 } {
msgprint -c WOKVC -e "File VCDEF.tcl not found in [file dirname $vc] of workbench $wb."
}
- wokStore:Report:Configure unset {} {} {} {} {} {} {} {}
+ wokStore:Report:Configure unset {} {} {} {} {} {} {} {} {}
return {}
}
} else {
msgprint -c WOKVC -e "Entity $wb is not a workbench."
- wokStore:Report:Configure unset {} {} {} {} {} {} {} {}
+ wokStore:Report:Configure unset {} {} {} {} {} {} {} {} {}
return {}
}
} else {
msgprint -c WOKVC -e "Entity $wb does not exists."
- wokStore:Report:Configure unset {} {} {} {} {} {} {} {}
+ wokStore:Report:Configure unset {} {} {} {} {} {} {} {} {}
return {}
}
}
;#
;# Ecrit dans diradm le fichier VCDEF.tcl contenant les definitions de la queue.
;#
-proc wokStore:Report:Configure { option fileadm wb queue base type counter journal welcome } {
+proc wokStore:Report:Configure { option fileadm wb queue trignam base type counter journal welcome } {
+ puts ccc
set proc_defined_in_VC [list \
wokStore:Report:GetRootName \
+ wokStore:Trigger:GetName \
wokIntegre:BASE:GetRootName \
wokIntegre:BASE:GetType \
wokIntegre:RefCopy:GetWB \
set {
wokStore:mkdir $queue ;# the hook for the queue
eval "proc wokStore:Report:GetRootName { } { return $queue }"
+ eval "proc wokStore:Trigger:GetName { } { return $trignam }"
wokStore:mkdir $base ;# the hook for the base
eval "proc wokIntegre:BASE:GetRootName { } { return $base }"
;# the type of the base
msgprint -c WOKVC -i "Repository ([wokIntegre:BASE:GetType]) under [wokIntegre:BASE:GetRootName]"
msgprint -c WOKVC -i "Integration counter in : [wokIntegre:Number:GetName]"
msgprint -c WOKVC -i "Integration journal in : [wokIntegre:Journal:GetName]"
+ msgprint -c WOKVC -i "Trigger : [wokStore:Trigger:GetName]"
puts ""
}
}
;#
;# Workbench KAS:C40:ros
;#wstore -create -wb :KAS:TEST:ros -base /adv_20/KAS/C40/SCCS/BASES -type SCCS -queue /adv_20/KAS/C40/SCCS/adm/C40/FRIGO -counter /adv_20/KAS/C40/SCCS/adm/C40/report.num -journal /adv_20/KAS/C40/SCCS/adm/C40/wintegre.jnl
+#;>
+# Check if file trigger exists
+#
+#;<
+proc wokStore:Trigger:Exists { } {
+ set trignam [wokStore:Trigger:GetName]
+ if { $trignam != {} } {
+ if { [file exists $trignam] } {
+ return $trignam
+ } else {
+ return {}
+ }
+ } else {
+ return {}
+ }
+}
+#;>
+# Invoke a trigger
+#;<
+proc wokStore:Trigger:Invoke { trignam report_path } {
+ uplevel #0 source $trignam
+ ;#msgprint -c WOKVC -i "Invoking file $trignam."
+ if { [catch { wstore_trigger $report_path } trigval ] == 0 } {
+ ;#msgprint -c WOKVC -i "Trigger $trignam successfully completed"
+ return $trigval
+ } else {
+ msgprint -c WOKVC -e "Error in trigger: $trigval"
+ return {}
+ }
+ return
+}
;#
-;# This proc is invoked by the command: wstore -trig <report>
-;# It should be placed in the Adm directory of the concerned shop,
-;# and the file should be named wstore_trigger.tcl
+;# This proc is invoked by wstore.
+;# To declare this trigger as activable use option -trigger while creating the queue.
+;# (wstore -create FAC:SHOP:WB -trigger /here/myfile.tcl -queue .. -type .. etc..)
+;# The proc name MUST be wstore_trigger as shown below.
+;# It receives report_path which actually is the root directory where stuff for this integration is
+;# placed. In this directory you can find :
+;# report-orig : the full original text of the user report.
+;# report-notes : Comments extracted.
+;# report-work : A pre-processed contents of the report file. You should not modify or reading it
+;# directly
+;# A list of names <Unit>.<t> where <Unit> is a unit name , <t> its wok short type.(ucreate)
+;# These names are directory names that contains files actually waiting for being integrated.
;#
-proc wstore_trigger { {action put} report_path } {
+proc wstore_trigger { report_path } {
set saved_wokcd [wokcd]
- switch -- $action {
+ some process here ...
- put {
- ;# in this case <report_path> is the full path of the report being processed.
- set saved_wokcd [wokcd]
- wokcd KERNEL:Ker6
- wstore $report_path
- }
-
- rm {
- ;# in this case <report_path> is a digit: The queue index of the report being deleted.
- }
-
- default {
- }
- }
-
wokcd $saved_wokcd
wokclose -a
return