srcinc:::wbuild.xpm
srcinc:::work.xpm
srcinc:::workbench.xpm
+srcinc:::workbenchq.xpm
srcinc:::workbench_open.xpm
srcinc:::workshop.xpm
srcinc:::workshop_open.xpm
srcinc:::envir.xpm
srcinc:::envir_open.xpm
srcinc:::MdtvLogo33x120b.gif
+srcinc:::README
puts stderr { usage : wintegre [ <reportID> ]}
puts stderr { }
puts stderr { <reportID> is a number. The range of the report in the queue.}
- puts stderr { You get this number by using the command : wstore -ls }
- puts stderr { }
- puts stderr { -ref <Base-number> }
- puts stderr { Used to init version of elements in the repository.}
+ puts stderr { You get this number by using the command : wstore -wb <name> -ls }
+ puts stderr { where <name> is the workbench used a the storage reference.}
puts stderr { }
puts stderr { -all : Process all reports in the queue. }
puts stderr { }
- puts stderr { -norefcopy: Update the repository but don't update target workbench." }
- puts stderr { -nobase : Update the target workbench but don't update the repository. }
- puts stderr { These 2 previous options are mutually exclusive. }
- puts stderr { -ws Shop : Use Shop as working shop. Shop has the form Factory:shop. }
- puts stderr { Default is the current workshop. }
- puts stderr { -root wb : Use wb as the target workbench. }
+ puts stderr { -wb Wbnam : Use Wbnam as working workbench. }
+ puts stderr { Default is the current workbench. }
+ puts stderr { -trig file : Use trigger defined in <file>. Trigger must be a Tcl proc }
+ puts stderr { whose name and definition is wintegre_trigger { table notes num } }
+ puts stderr { This proc is invoked for each integration and receive 3 arguments: }
+ puts stderr { table reflects the contents of the integration. (units and files) }
+ puts stderr { notes contains comments of integration }
+ puts stderr { num the integration number. }
+ puts stderr { }
puts stderr { -param : Show the current value of parameters. }
return
}
proc wintegre { args } {
set tblreq(-h) {}
- set tblreq(-ref) value_required:number
set tblreq(-all) {}
- set tblreq(-norefcopy) {}
- set tblreq(-nobase) {}
- set tblreq(-ws) value_required:string
- set tblreq(-root) value_required:string
- set tblreq(-V) {}
+ set tblreq(-wb) value_required:string
+ set tblreq(-v) {}
+ set tblreq(-trig) value_required:file
set tblreq(-param) {}
- set disallow(-nobase) {-norefcopy}
- set disallow(-norefcopy) {-nobase}
-
set param {}
if { [wokUtils:EASY:GETOPT param tabarg tblreq wokIntegreUsage $args] == -1 } return
- if { [wokUtils:EASY:DISOPT tabarg disallow wokIntegreUsage ] == -1 } return
- set VERBOSE [info exists tabarg(-V)]
+ set VERBOSE [info exists tabarg(-v)]
- if { $VERBOSE } {
- puts "param = $param"
- catch {parray tabarg}
+ if { [set trig [info exists tabarg(-trig)]] } {
+ if { [file exists [set trigfile $tabarg(-trig)]] } {
+ uplevel #0 source $trigfile
+ if { "[info procs wintegre_trigger]" == "wintegre_trigger" } {
+ set trig 1
+ } else {
+ msgprint -c WOKVC -e "Sourcing $trigfile does not create proc named wintegre_trigger. Ignored"
+ set trig 0
+ }
+ } else {
+ msgprint -c WOKVC -e "File $trigfile not found. Ignored"
+ set trig 0
+ }
+ } else {
+ set trig 0
}
-
+
if { [info exists tabarg(-h)] } {
wokIntegreUsage
return
}
- if [info exists tabarg(-ws)] {
- set fshop $tabarg(-ws)
+ if [info exists tabarg(-wb)] {
+ set curwb $tabarg(-wb)
} else {
- set fshop [Sinfo -s]
+ if { [set curwb [wokinfo -w [wokcd]]] == {} } {
+ msgprint -c WOKVC -e "Current location [wokcd] is not a workbench."
+ return
+ }
}
- if { [info exists tabarg(-param)] } {
- wokIntegre:BASE:GetType $fshop 1
+ if { [wokStore:Report:SetQName $curwb] == {} } {
return
}
+ if { [info exists tabarg(-param)] } {
+ msgprint -c WOKVC -i "Workbench $curwb :"
+ msgprint -c WOKVC -i "Welcome new units ?: [wokIntegre:RefCopy:Welcome]"
+ msgprint -c WOKVC -i "Reports queue under [wokStore:Report:GetRootName]"
+ 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]"
- set vc [file join [wokinfo -pAdmDir:. $fshop] VC.tcl]
- if [file exists $vc] {
- source $vc
- } else {
- msgprint -c WOKVC -e "Pas de fichier VC.tcl dans adm de ${fshop} ."
- return -1
- }
-
- if { [set refer [info exists tabarg(-ref)]] } {
- set vrsref $tabarg(-ref)
- }
-
- set refcopy [expr ![info exists tabarg(-norefcopy)]]
- set nobase [info exists tabarg(-nobase)]
-
- if [info exists tabarg(-root)] {
- set wbtop $tabarg(-root)
- msgprint -c WOKVC -i "Using $wbtop as target workbench."
- } else {
- set wbtop [wokIntegre:RefCopy:GetWB]
+ return
}
if { [info exists tabarg(-all)] } {
- set LISTREPORT [wokStore:Report:Get all $fshop ]
+ set LISTREPORT [wokStore:Report:Get all]
} else {
if { [llength $param] == 1 } {
set ID [lindex $param 0]
- set LISTREPORT [wokStore:Report:Get $ID $fshop ]
+ set LISTREPORT [wokStore:Report:Get $ID]
} else {
wokIntegreUsage
return -1
}
}
- ;# fin analyse des arguments
-
- if { $VERBOSE } {
- puts stderr "refer = $refer"
- if { $refer } { puts stderr " vrsref = $vrsref" }
- puts stderr "refcopy = $refcopy"
- puts stderr "nobase = $nobase"
- puts stderr "fshop = $fshop"
- puts stderr "wbtop = $wbtop"
- puts stderr "LISTREPORT = $LISTREPORT"
+ if { [set BTYPE [wokIntegre:BASE:InitFunc]] == {} } {
+ return -1
}
- if { [set BTYPE [wokIntegre:BASE:InitFunc $fshop]] == {} } {
+ if { ![file exists [set broot [wokIntegre:BASE:GetRootName]]] } {
+ msgprint -c WOKVC -e "The repository does not exists."
return -1
}
- ;#
- ;# ClearCase : La base n'est pas geree par WOK
- ;#
- if { "$BTYPE" == "ClearCase" } {
- wokIntegreClearCase
- return
- }
- ;#
- ;# Autre : SCCS, RCS, NOBASE, SIMPLE geree par WOK
- ;#
- set broot [wokIntegre:BASE:GetRootName $fshop 1]
+
if ![file writable $broot] {
msgprint -c WOKVC -e "You cannot write in $broot."
return -1
}
-
- set ros [wokIntegre:RefCopy:OpenWB]
- set los [wokIntegre:RefCopy:OpenUD]
+ wokIntegrebase
- if { "$BTYPE" == "NOBASE" } {
- wokIntegrenobase
- } else {
- if { $nobase } {
- wokIntegrenobase
- } else {
- wokIntegrebase
- }
- }
return
}
#;>
uplevel {
foreach REPORT $LISTREPORT {
if { $VERBOSE } { msgprint -c WOKVC -i "Processing report in $REPORT" }
- set num [wokIntegre:Number:Get $fshop 1]
- if { [wokUtils:FILES:dirtmp [set dirtmp /tmp/wintegre[id process]]] == -1 } {
+ set num [wokIntegre:Number:Get]
+ if { [wokUtils:FILES:dirtmp [set dirtmp /tmp/wintegre[pid]]] == -1 } {
msgprint -c WOKVC -e "Unable to create working directory"
return -1
}
set jnltmp $dirtmp/wintegre.jnl
set jnlid [open $jnltmp w]
- set comment [wokIntegre:Journal:Mark [wokinfo -n [wokinfo -s $fshop]] $num rep]
+ set comment [wokIntegre:Journal:Mark $curwb $num rep]
;#
;# Lecture du report
;#
- set mode normal
- if { $refer } { set mode ref }
- catch {unset table}
- set stat [wokStore:Report:Process $mode $REPORT table info notes]
+ set stat [wokStore:Report:Process normal $REPORT table info notes]
if { $stat == -1 } {
wokIntegreCleanup $broot table [list $jnlid] $dirtmp
return -1
}
- ;#
- ;# Recup version associee a l'ilot et Inits
- ;#
- if { $refer } {
- set version [wokIntegre:Version:Check $fshop $vrsref]
- set func wokIntegre:BASE:InitRef
- } else {
- set version [wokIntegre:Version:Get $fshop]
- set func wokIntegre:BASE:UpdateRef
- }
-
- if { $version == {} } {
- msgprint -c WOKVC -e "Unable to get base version for $fshop"
- wokIntegreCleanup $broot table [list $jnlid] $dirtmp
+ wokPrepare:Report:ReadInfo $info workshop wmaster workbench
+ if ![info exists workbench] {
+ msgprint -c WOKVC -e "Old format report. Use wprepare to create a new one."
return -1
}
- ;#
+
+ set version [wokIntegre:Version:Get]
+
;# 1. Bases temporaires : Ecriture de la commande
;#
set cmdtmp $dirtmp/wintegre.cmd
set cmdid [open $cmdtmp w]
- $func $broot table $version $comment $cmdid
+ wokIntegre:BASE:UpdateRef $broot table $version $comment $cmdid
wokIntegre:BASE:EOF $cmdid ; close $cmdid
;#
;# 1 bis. Tester [id user] peut ecrire dans le workbench qui sert de REFCOPY
;#
- if { $refcopy == 1 } {
- set write_ok [wokIntegre:RefCopy:Writable $fshop table $wbtop $ros $los]
- if { $write_ok == -1 } {
- msgprint -c WOKVC -e "You cannot write or create units in the workbench $wbtop"
- wokIntegreCleanup $broot table [list $cmdid $jnlid] $dirtmp
- return -1
- }
- }
+ set write_ok [wokIntegre:RefCopy:Writable table $curwb]
+ if { $write_ok == -1 } {
+ msgprint -c WOKVC -e "You cannot write or create units in the workbench $curwb"
+ wokIntegreCleanup $broot table [list $cmdid $jnlid] $dirtmp
+ return -1
+ }
;#
;# 2. Bases temporaires : Execution et ecriture journal temporaire
;#
- wokPrepare:Report:ReadInfo $info station workshop workbench
- wokIntegre:Journal:WriteHeader rep $num $workbench $station $jnlid
+ wokIntegre:Journal:WriteHeader rep $num $workbench xxxxx $jnlid
set statx [wokIntegre:BASE:Execute $VERBOSE $cmdtmp $jnlid]
if { $statx != 1 } {
msgprint -c WOKVC -i [format "Updating unit %s in repository" $UD]
wokIntegre:BASE:Fill $broot/$UD [wokIntegre:BASE:BTMPCreate $broot $UD 0]
}
-
-
;#
;# 4. Fermer le journal temporaire
;#
wokIntegre:Journal:WriteNotes $notes $jnlid ; close $jnlid
-
+ set saved_notes $notes
;#
- ;# 5. Mettre a jour le journal , le scoop et le compteur et le numero de version si -ref
+ ;# 5. Mettre a jour le journal , le scoop et le compteur
;#
- wokUtils:FILES:concat [wokIntegre:Journal:GetName $fshop 1] $jnltmp
- wokIntegre:Scoop:Create $fshop $jnltmp
+ wokUtils:FILES:concat [wokIntegre:Journal:GetName] $jnltmp
+ wokIntegre:Scoop:Create $jnltmp
- if { [wokIntegre:Number:Put $fshop [wokIntegre:Number:Incr $fshop]] == {} } {
+ if { [wokIntegre:Number:Put [wokIntegre:Number:Incr ]] == {} } {
msgprint -c WOKVC -e "during update of counter."
wokIntegreCleanup $broot table [list $cmdid $jnlid] $dirtmp
return -1
}
- if { $refer } {
- wokIntegre:Version:Put $fshop $version
+ ;#
+ ;# 6. Mise a jour de CURWB et appel trigger.
+ ;#
+ catch {unset table}
+ wokIntegre:Journal:PickReport $jnltmp table notes $num
+ wokIntegre:RefCopy:GetPathes table $curwb
+ set dirtmpu /tmp/wintegrecreateunits[pid]
+ catch {
+ rmdir -nocomplain $dirtmpu
+ mkdir -path $dirtmpu
+ }
+ set chkout $dirtmpu/checkout.cmd
+ set chkid [open $chkout w]
+ wokIntegre:RefCopy:FillRef table $chkid
+ wokIntegre:BASE:EOF $chkid
+ close $chkid
+ msgprint -c WOKVC -i "Updating units in workbench $curwb"
+ set statx [wokIntegre:BASE:Execute $VERBOSE $chkout]
+ if { $statx != 1 } {
+ msgprint -c WOKVC -e "during checkout(Get). The report has not been removed."
+ wokIntegreCleanup $broot table [list $chkid] [list $dirtmpu]
+ return -1
}
-
+
;#
- ;# 6. Si refcopy = 1 Mise a jour de WBTOP
+ ;# 8. Activate trigger if any.
;#
- if { $refcopy == 1 } {
- catch {unset table}
- wokIntegre:Journal:PickReport $jnltmp table notes $num
- wokIntegre:RefCopy:GetPathes $fshop table $wbtop $ros $los
- set dirtmpu /tmp/wintegrecreateunits[id process]
- catch {
- rmdir -nocomplain $dirtmpu
- mkdir -path $dirtmpu
+ if { $trig } {
+ msgprint -c WOKVC -i "Invoking trigger file $trigfile"
+ catch {
+ wokIntegre:Journal:Slice $jnltmp $num $num wintegre_trigger {}
+ rename wintegre_trigger {}
+ } status
+ if { $status != {} } {
+ msgprint -c WOKVC -w "Trigger status = $status"
}
- set chkout $dirtmpu/checkout.cmd
- set chkid [open $chkout w]
- wokIntegre:RefCopy:FillRef $fshop table $chkid
- wokIntegre:BASE:EOF $chkid
- close $chkid
- msgprint -c WOKVC -i "Updating units in target workbench(es) $wbtop $ros"
- set statx [wokIntegre:BASE:Execute $VERBOSE $chkout]
- if { $statx != 1 } {
- msgprint -c WOKVC -e "during checkout(Get). The report has not been removed."
- wokIntegreCleanup $broot table [list $chkid] [list $dirtmpu]
- return -1
- }
- wokIntegreCleanup $broot table [list $chkid] [list $dirtmpu]
}
+
+ wokIntegreCleanup $broot table [list $chkid] [list $dirtmpu]
;#
- ;# 8. Detruire le report et menage
+ ;# 9. Detruire le report et menage
;#
- wokStore:Report:Del $REPORT 1
+ wokStore:Report:Del $REPORT
wokIntegreCleanup $broot table [list $cmdid $jnlid] [list $dirtmp]
- }
- }
-}
-#;>
-# Miscellaneous: Assemblage traitement sans mise a jour de la base.
-#;<
-proc wokIntegrenobase { } {
- uplevel {
- foreach REPORT $LISTREPORT {
- if { $VERBOSE } {msgprint -c WOKVC -i "Processing report in $REPORT"}
- set num [wokIntegre:Number:Get $fshop 1]
- if { [wokUtils:FILES:dirtmp [set dirtmp /tmp/wintegre[id process]]] == -1 } {
- msgprint -c WOKVC -e "Unable to create working directory"
- return -1
- }
- set jnltmp $dirtmp/wintegre.jnl
- set jnlid [open $jnltmp w]
- set comment [wokIntegre:Journal:Mark [wokinfo -n [wokinfo -s $fshop]] $num rep]
- ;#
- ;# Lecture du report
- ;#
- catch {unset table}
- set stat [wokStore:Report:Process normal $REPORT table info notes]
- if { $stat == -1 } {
- wokIntegreCleanup $broot table [list $jnlid] $dirtmp
- return -1
- }
-
- set write_ok [wokIntegre:RefCopy:Writable $fshop table $wbtop $ros $los]
- if { $write_ok == -1 } {
- msgprint -c WOKVC -e "You cannot write or create units in the workbench $wbtop"
- wokIntegreCleanup $broot table [list $jnlid] $dirtmp
- return -1
- }
- set pathes_ok [wokIntegre:RefCopy:GetPathes $fshop table $wbtop $ros $los]
- if { $write_ok == -1 } {
- wokIntegreCleanup $broot table [list $jnlid] $dirtmp
- return -1
- }
-
- wokPrepare:Report:ReadInfo $info station workshop workbench
- wokIntegre:Journal:WriteHeader rep $num $workbench $station $jnlid
-
- set copy_ok [wokIntegre:RefCopy:Copy $VERBOSE table $jnlid]
- if { $copy_ok == -1 } {
- wokIntegreCleanup $broot table [list $jnlid] $dirtmp
- return -1
- }
- wokIntegre:Journal:WriteNotes $notes $jnlid ; close $jnlid
- wokUtils:FILES:concat [wokIntegre:Journal:GetName $fshop 1] $jnltmp
- if { [wokIntegre:Number:Put $fshop [wokIntegre:Number:Incr $fshop]] == {} } {
- msgprint -c WOKVC -e "during update of counter."
- wokIntegreCleanup $broot table [list $jnlid] $dirtmp
- return -1
- }
- wokStore:Report:Del $REPORT 1
- wokIntegreCleanup $broot table [list $jnlid] $dirtmp
}
}
}
# Se fait en fonction du type de repository code dans le parametre VC_TYPE
#
#;<
-proc wokIntegre:BASE:InitFunc { fshop } {
+proc wokIntegre:BASE:InitFunc { } {
global env
set wdir $env(WOK_LIBRARY)
- set type [wokIntegre:BASE:GetType $fshop ]
+ set type [wokIntegre:BASE:GetType]
if { $type != {} } {
set interface $wdir/WOKVC.$type
if [file exist $interface] {
}
}
#;>
-# Retourne le type de la base courante. {} sinon => utiliser ca pour savoir si il y en une !!
-#;<
-proc wokIntegre:BASE:GetType { fshop {dump 0} } {
- set lvc [wokparam -l VC $fshop]
- if { $lvc != {} } {
- if { [lsearch -regexp $lvc %VC_TYPE=*] != -1 } {
- if { $dump } {
- foreach dir [wokparam -L $fshop] {
- if [file exists $dir/VC.edl] {
- msgprint -c WOKVC -i "Following definitions in file : $dir/VC.edl"
- break
- }
- }
- msgprint -c WOKVC -i "Repository root : [wokparam -e %VC_ROOT $fshop]"
- msgprint -c WOKVC -i "Repository type : [wokparam -e %VC_TYPE $fshop]"
- msgprint -c WOKVC -i "Default update done in : [wokIntegre:RefCopy:GetWB]"
- msgprint -c WOKVC -i "OpenSource workbench : [wokIntegre:RefCopy:OpenWB]"
- msgprint -c WOKVC -i "List units in there with : OS -u list"
- }
- return [wokparam -e %VC_TYPE $fshop]
- } else {
- return {}
- }
- } else {
- return {}
- }
-}
-#;>
#######################################################################
# Updater la reference : Ecriture du fichier de commande base temporaire
#
puts $fileid [format "cd %s" $tmpud]
set root $broot/$UD
foreach ELM $TLOC($UD) {
- set mark _[lindex $ELM 0]
+ set mark [lindex $ELM 0]
set F [lindex $ELM 1]
set bna [file tail $F]
set sfl $root/[wokIntegre:BASE:ftos $bna $vrs]
- switch $mark {
+ switch -- $mark {
- _+ {
+ + {
if [file exists $sfl] {
;#puts "Coucou: reapparition de $sfl"
wokIntegre:BASE:UpdateFile $sfl $vrs $comment $F $fileid
}
}
- _# {
+ # {
if [file exists $sfl] {
wokIntegre:BASE:UpdateFile $sfl $vrs $comment $F $fileid
} else {
}
}
- _- {
+ - {
wokIntegre:BASE:DeleteFile $bna $fileid
}
}
catch { frename $e $bdir/$bna }
} elseif { [file isdirectory $e] } {
set dl {}
- foreach f [readdir $e] {
+ foreach f [wokUtils:EASY:readdir $e] {
lappend dl $e/$f
}
wokIntegre:BASE:Fill $broot $dl $action
#;>
# Detruit une base Bname.
#;<
-proc wokIntegre:BASE:Delete { fshop Bname } {
- if [catch { exec rm -rf [wokIntegre:BASE:GetRootName $fshop]/$Bname } status ] {
+proc wokIntegre:BASE:Delete { Bname } {
+ if [catch { exec rm -rf [wokIntegre:BASE:GetRootName]/$Bname } status ] {
msgprint -c WOKVC -e "BASE:Delete $status"
return -1
}
return 1
}
-
-#;>
-# retourne le nom de la racine ou les bases sont accrochees.
-# Il y a une etage de plus par rapport aux anciennes bases pour faciliter
-# les tests et la sauvegarde.
-#;<
-proc wokIntegre:BASE:GetRootName { fshop {create 0} } {
- set diradm [wokparam -e %VC_ROOT $fshop]/BASES
- if [file exists $diradm] {
- return $diradm
- } else {
- if { $create } {
- msgprint -c WOKVC -i "Creating file $diradm"
- mkdir -path $diradm
- chmod 0755 $diradm
- return $diradm
- } else {
- return {}
- }
- }
-}
#;>
# retourne 1 si le user courant peut ecrire dans les base de l'atelier courant
#;<
-proc wokIntegre:BASE:Writable { fshop } {
- return [file writable [wokIntegre:BASE:GetRootName $fshop]]
+proc wokIntegre:BASE:Writable { } {
+ return [file writable [wokIntegre:BASE:GetRootName]]
}
#;>
# retourne la liste des bases sous la forme { {name ext} ... {name ext} }
#;<
-proc wokIntegre:BASE:LS { fshop } {
+proc wokIntegre:BASE:LS { } {
set l {}
- set r [wokIntegre:BASE:GetRootName $fshop]
+ set r [wokIntegre:BASE:GetRootName ]
if [file exists $r] {
- foreach e [lsort [readdir $r]] {
+ foreach e [lsort [wokUtils:EASY:readdir $r]] {
if { [string compare [file type $r/$e] file] != 0 } {
lappend l [list [file root $e] [file extension $e]]
}
return $l
}
#;>
-# retourne la liste des bases ayant une base temporaire
-#;<
-proc wokIntegre:BASE:BTMPLS { fshop } {
- set l {}
- set r [wokIntegre:BASE:GetRootName $fshop]
- if [file exists $r] {
- foreach e [lsort [readdir $r]] {
- if [file exists $r/$e/tmp] {
- lappend l $e
- }
- }
- }
- return $l
-}
-#;>
# retourne le nom de la base temporaire associee a une Unit. Si create la cree
#;<
proc wokIntegre:BASE:BTMPCreate { broot Unit {create 0} } {
proc wokIntegre:BASE:BTMPDelete { broot Unit } {
set R $broot/$Unit/tmp
if [file exists $R] {
- foreach f [readdir $R] {
+ foreach f [wokUtils:EASY:readdir $R] {
unlink $R/$f
}
rmdir -nocomplain $R
#;>
# Check owner et fait ucreate si necessaire des UDs de table
# 1. ucreate -p workbench:NTD si owner OK
-# workbench est celui dans lequel on integre sauf si UD est dans
-# la liste $los auquel cas l'integration se fait dans ros
-#;<
-proc wokIntegre:RefCopy:Writable { fshop table workbench ros los} {
+#;<
+proc wokIntegre:RefCopy:Writable { table workbench } {
upvar $table TLOC
-
foreach UD [array names TLOC] {
regexp {(.*)\.(.*)} $UD ignore name type
- if { [lsearch $los $name] != -1 } {
- set destwb $ros
- } else {
- set destwb $workbench
- }
- if { [lsearch [w_info -l ${fshop}:${destwb}] $name ] == -1 } {
- ucreate -$type ${fshop}:${destwb}:${name}
+ if { [lsearch [w_info -l ${workbench}] $name ] == -1 } {
+ ucreate -$type ${workbench}:${name}
}
- set dirsrc [wokinfo -p source:. ${fshop}:${destwb}:${name}]
- ;#puts " writable dirsrc = $dirsrc"
+ set dirsrc [wokinfo -p source:. ${workbench}:${name}]
if ![file writable $dirsrc] {
- msgprint -c WOKVC -e "You cannot write in workbench $destwb ($dirsrc)"
+ msgprint -c WOKVC -e "You cannot write in directory $dirsrc"
return -1
}
}
# Input: table(NTD.p) = { {toto.c 2.1} {titi.c 4.3} }
# Output: table(NTD.p) = { /home/wb/qqchose/NTD/src {toto.c 2.1} {titi.c 4.3} }
#;<
-proc wokIntegre:RefCopy:GetPathes { fshop table workbench ros los} {
+proc wokIntegre:RefCopy:GetPathes { table workbench } {
upvar $table TLOC
- ;#puts "-------------AVANT getpathes ----------------"
- ;#parray TLOC
foreach UD [array names TLOC] {
regexp {(.*)\.(.*)} $UD ignore name type
- if { [lsearch $los $name] != -1 } {
- set destwb $ros
- } else {
- set destwb $workbench
- }
- if { [lsearch [w_info -l ${fshop}:$destwb] $name ] != -1 } {
+ if { [lsearch [w_info -l $workbench] $name ] != -1 } {
set lsf $TLOC($UD)
- set TLOC($UD) [linsert $lsf 0 [wokparam -e %${name}_Src ${fshop}:${destwb}:${name}]]
+ set TLOC($UD) [linsert $lsf 0 [wokinfo -p source:. ${workbench}:${name}]]
} else {
- msgprint -c WOKVC -e "(GetPathes) Unit $name not found in $destwb"
+ msgprint -c WOKVC -e "(GetPathes) Unit $name not found in $workbench"
return -1
}
}
- ;#puts "-------------APRES----------------"
- ;#parray TLOC
return 1
}
#;>
-# Copy les elements de table (liste) dans le repertoire associe
-# Utilise par wintegre -nobase
-# Input: table(NTD.p) = { /home/wb/qqchose/NTD/src {flag1 path1} {flag2 path2} }
-# path : adresse du fichier dans le frigo.
-# Retour: { ... {p1 p2} ... } si OK {} sinon
+# Modifie si c'est possible les protections des elements de table (liste)
+# si ils appartiennent a <user>
+# Utilise par wget en reference
+# Input: table(NTD.p) = { /home/wb/qqchose/NTD/src {toto.c 2.1} {titi.c 4.3} }
#;<
-proc wokIntegre:RefCopy:Copy { VERBOSE table {fileid stdout} } {
+proc wokIntegre:RefCopy:SetWritable { table user } {
upvar $table TLOC
-
- catch { unset err }
- set LUD [lsort [array names TLOC]]
- foreach ud $LUD {
- set lret {}
- set dirsrc [lindex $TLOC($ud) 0]
- foreach e [lrange $TLOC($ud) 1 end] {
- if { "[lindex $e 0]" != "-" } {
- set fromp [lindex $e 1]
- set file [file tail $fromp]
- set destp $dirsrc/$file
- if { [file exists $fromp] } {
- if { [file exists $destp] } {
- if { [file owned $destp] } {
- lappend lret [list [format " Modified : %s -.-" $file] $fromp $destp]
- } else {
- msgprint -c WOKVC -e "Protection of $destp cannot be modified (not owner)."
- set err 1
- break
- }
- } else {
- if { [file writable [file dirname $destp]] } {
- lappend lret [list [format " Added : %s -.-" $file] $fromp $destp]
- } else {
- msgprint -c WOKVC -e "File $destp cannot be created (permission denied)."
- set err 1
- break
- }
- }
- } else {
- msgprint -c WOKVC -e "File $fromp doesnt not exists."
- set err 1
- break
- }
- }
- }
- if [info exists err ] { break }
- set TLOC($ud) $lret
- }
-
- if [info exists err] {
- msgprint -c WOKVC -i "No file copied."
- return -1
- }
-
- foreach ud $LUD {
- puts $fileid [format "\n %s (Updated) : \n----" $ud]
- msgprint -c WOKVC -i [format " %s (Updated) : \n----" $ud]
- foreach d $TLOC($ud) {
- set straff [lindex $d 0]
- set fromp [lindex $d 1]
- set destp [lindex $d 2]
- msgprint -c WOKVC -i $straff
- puts $fileid $straff
- if { [file exists $destp] } {
- chmod 0644 $destp
+ foreach UD [array names TLOC] {
+ set dirsrc [lindex $TLOC($UD) 0]
+ foreach e [lrange $TLOC($UD) 1 end] {
+ set file $dirsrc/[lindex $e 0]
+ if [file owned $file] {
+ chmod u+w $file
+ } else {
+ msgprint -c WOKVC -e "Protection of $file cannot be modified (File not found or not owner)."
+ return -1
}
- if { $VERBOSE } { msgprint -c WOKVC -i "Copying $fromp $destp"}
- wokUtils:FILES:copy $fromp $destp
- chmod 0444 $destp
}
}
-
return 1
}
#;>
# Si un fichier a creer existe deja et est writable, il est renomme en -sav
# Comportement correspondant au remplissage du workbench de reference
#;<
-proc wokIntegre:RefCopy:FillRef { fshop table {fileid stdout} } {
+proc wokIntegre:RefCopy:FillRef { table {fileid stdout} } {
upvar $table TLOC
foreach UD [array names TLOC] {
set lsf $TLOC($UD)
set dirsrc [lindex $lsf 0]
puts $fileid "cd $dirsrc"
- set root [wokIntegre:BASE:GetRootName $fshop]/$UD
+ set root [wokIntegre:BASE:GetRootName ]/$UD
set i [llength $lsf]
while { $i > 1 } {
set i [expr $i-1]
# Comportement correspondant au remplissage d'une UD avec wget.
# On change aussi la protection du fichier cree (writable pour le user)
#;<
-proc wokIntegre:RefCopy:FillUser { fshop table {force 0} {fileid stdout} {mask 644} } {
+proc wokIntegre:RefCopy:FillUser { table {force 0} {fileid stdout} {mask 644} } {
upvar $table TLOC
foreach UD [array names TLOC] {
set lsf $TLOC($UD)
set dirsrc [lindex $lsf 0]
puts $fileid "cd $dirsrc"
- set root [wokIntegre:BASE:GetRootName $fshop]/$UD
+ set root [wokIntegre:BASE:GetRootName ]/$UD
set i [llength $lsf]
while { $i > 1 } {
set i [expr $i-1]
return
}
#
-# ((((((((((((((((VERSION))))))))))))))))
-#
-#;>
-# Retourne le path du fichier version.sccs, si create = 1 le cree s'il n'existe pas.
-#;<
-proc wokIntegre:Version:GetTableName { fshop {create 0} } {
- set diradm [wokparam -e %VC_ROOT $fshop]/adm/version.sccs
- if [file exists $diradm] {
- return $diradm
- } else {
- if { $create } {
- msgprint -c WOKVC -i "Creating versions file in [file dirname $diradm]"
- catch { mkdir -path [file dirname $diradm] }
- wokUtils:FILES:ListToFile {} $diradm
- chmod 0777 $diradm
- return $diradm
- } else {
- return {}
- }
- }
-}
-#;>
-# Retourne la liste des ilots et leur numero associe.
-#;<
-proc wokIntegre:Version:Dump { fshop } {
- return [wokUtils:FILES:FileToList [wokIntegre:Version:GetTableName $fshop]]
-}
-#;>
-# Retourne le numero de version associe a l'ilot <shop> {} sinon
-#;<
-proc wokIntegre:Version:Get { fshop } {
- set f [wokIntegre:Version:GetTableName $fshop]
- if { $f != {} } {
- set str [wokinfo -n [wokinfo -s $fshop]]
- foreach e [wokUtils:FILES:FileToList $f] {
- if { $str == [lindex $e 0] } {
- return [lindex $e 1]
- }
- }
- }
- return {}
-}
-#;>
-# Ecrit dans version.sccs le numero de version <ver> associe a shop
-#;<
-proc wokIntegre:Version:Put { fshop ver } {
- set f [wokIntegre:Version:GetTableName $fshop]
- set l [wokUtils:FILES:FileToList $f]
- set str [wokinfo -n [wokinfo -s $fshop]]
- if { [lsearch $l [list $str $ver]] == -1 } {
- msgprint -c WOKVC -i "Registering the shop $str with version number $ver"
- lappend l [list $str $ver]
- wokUtils:FILES:copy $f ${f}-previous
- wokUtils:FILES:ListToFile $l $f
- }
- return $ver
-}
-#;>
-# retourne un entier utilisable pour initialiser un nouvel ilot
-#;<
-proc wokIntegre:Version:Next { fshop } {
- set mx 0
- foreach e [wokUtils:FILES:FileToList [wokIntegre:Version:GetTableName $fshop]] {
- set n [lindex $e 1]
- set mx [expr ( $mx > $n ) ? $mx : $n]
- }
- return [incr mx]
-}
-#
# ((((((((((((((((COMPTEUR-INTEGRATIONS))))))))))))))))
#
#;>
-# Retourne le nom du fichier contenant le compteur d'integration
-#;<
-proc wokIntegre:Number:GetName { fshop } {
- return [wokparam -e %VC_ROOT $fshop]/adm/[wokinfo -n [wokinfo -s $fshop]]/report.num
-}
-#;>
# Retourne le numero de l'integration suivante (celle a faire dans shop )
# Si Setup = 1 , met le compteur a 1
#;<
-proc wokIntegre:Number:Get { fshop {Setup 0} } {
- set diradm [wokIntegre:Number:GetName $fshop]
+proc wokIntegre:Number:Get { } {
+ set diradm [wokIntegre:Number:GetName]
if [file exists $diradm] {
return [wokUtils:FILES:FileToList $diradm]
} else {
- if { $Setup } {
- msgprint -c WOKVC -i "Creating file $diradm"
- catch { mkdir -path [file dirname $diradm] }
- wokUtils:FILES:ListToFile 1 $diradm
- chmod 0777 $diradm
- return 1
- } else {
- return {}
- }
+ return {}
}
}
#;>
# Ecrit number comme numero de l'integration suivante
#;<
-proc wokIntegre:Number:Put { fshop number } {
- set diradm [wokIntegre:Number:GetName $fshop]
+proc wokIntegre:Number:Put { number } {
+ set diradm [wokIntegre:Number:GetName]
if [file exists $diradm] {
wokUtils:FILES:ListToFile $number $diradm
return $number
#;>
# Incremente le numero de l'integration
#;<
-proc wokIntegre:Number:Incr { fshop } {
- set diradm [wokIntegre:Number:GetName $fshop]
+proc wokIntegre:Number:Incr { } {
+ set diradm [wokIntegre:Number:GetName]
if [file exists $diradm] {
set n [wokUtils:FILES:FileToList $diradm]
return [incr n]
wget [-f] [-ud <udname>] <filename> [-v <version>]
wget [-f] [-ud <udname>] <filename_1> ... <filename_N>
- wget [-f] -r <reportname>
-ud : Keyword used to specify a unit name
+ -wb : Specify the workbench repository to copy from.
+
-f : Force files to be overwritten if they already exist.
wget -l : List "gettable" files for the current unit (default)
set tblreq(-v) value_required:string
set tblreq(-ud) value_required:string
set tblreq(-r) value_required:string
- set tblreq(-ws) value_required:string
- set tblreq(-root) value_required:string
- set tblreq(-from) value_required:string
+ set tblreq(-wb) value_required:string
set param {}
if { [wokUtils:EASY:GETOPT param tabarg tblreq wokGetUsage $args] == -1 } return
set VERBOSE [info exists tabarg(-V)]
- if { $VERBOSE } {
- puts "param = $param"
- catch {parray tabarg}
- }
-
-
- if { [info exists tabarg(-h)] } {
- wokGetUsage
- return
- }
+ ;# recup 1 er workbench dans l'arbre"
+ ;#
- if [info exists tabarg(-ws)] {
- set fshop $tabarg(-ws)
+ if [info exists tabarg(-wb)] {
+ set fromwb $tabarg(-wb)
} else {
- set fshop [wokinfo -s [wokcd]]
+ msgprint -c WOKVC -e "Option -from is required."
+ return
}
- ;# name of target workbench
- ;#
- if [info exists tabarg(-root)] {
- set workbench $tabarg(-root)
+ if { "[wokinfo -t [wokinfo -w $fromwb]]" == "workbench" } {
+ if { [wokStore:Report:SetQName $fromwb] == {} } {
+ msgprint -c WOKVC -e "$fromwb has no repository. Copying from workbench $fromwb."
+ set directcp 1
+ }
} else {
- set workbench [wokinfo -n [wokinfo -w [wokcd]]]
+ msgprint -c WOKVC -e "$fromwb is not a workbench. Nothing done."
+ return
}
+
+ set workbench [wokinfo -n [wokinfo -w [wokcd]]]
+ if { "[wokinfo -n [wokinfo -w $fromwb]]" == "$workbench" } {
+ msgprint -c WOKVC -e "Cannot piss on my foot"
+ return
+ }
- ;#puts "fshop = $fshop workbench = $workbench"
-
- ;# name of source workbench from where the source file are to be copied.
- ;# only used in NOBASE case.
- ;#
+ set fshop [wokinfo -s [wokcd]]
+ if { $VERBOSE } {
+ puts "Copying from $fromwb "
+ }
if [info exists tabarg(-ud)] {
set ud $tabarg(-ud)
catch {unset listbase}
}
- if [info exists tabarg(-r)] {
- set ID $tabarg(-r)
- } else {
- catch {unset ID }
- }
-
- if { [set BTYPE [wokIntegre:BASE:InitFunc $fshop]] == {} } {
+ if { [set BTYPE [wokIntegre:BASE:InitFunc]] == {} } {
return -1
}
- set vc [file join [wokinfo -pAdmDir:. $fshop] VC.tcl]
- if [file exists $vc] {
- source $vc
- } else {
- msgprint -c WOKVC -e "Pas de fichier VC.tcl dans adm de ${fshop} ."
- return -1
- }
-
-
- if [info exists tabarg(-from)] {
- set fromwb $tabarg(-from)
- } else {
- set fromwb [wokIntegre:RefCopy:GetWB]
- }
-
-
- if { "$BTYPE" == "ClearCase" } {
- wokGetClearCase
- return
- }
-
- ;#
- ;# Autre : SCCS, RCS, NOBASE, SIMPLE geree par WOK
- ;#
-
- set broot [wokIntegre:BASE:GetRootName $fshop]
- if { $broot == {} } {
+ if { ![file exists [set broot [wokIntegre:BASE:GetRootName]]] } {
msgprint -c WOKVC -e "The repository does not exists."
- wokIntegre:BASE:GetType $fshop 1
return -1
}
- if { "$BTYPE" == "NOBASE" } {
- wokGetnobase
- } else {
- wokGetbase
- }
+ wokGetbase
return
}
;#
;#
proc wokGetbase { } {
uplevel {
- set actv [wokIntegre:Version:Get $fshop]
- if { $actv == {} } {
- msgprint -c WOKVC -e "The workshop $fshop has no entry in the repository."
- return -1
+ set actv [wokIntegre:Version:Get]
+ set listfileinbase [wokIntegre:BASE:List $ud $actv]
+ if [info exists listbase] {
+ if { $param == {} } {
+ foreach f [wokUtils:LIST:GM $listfileinbase *] {
+ puts $f
+ }
+ } else {
+ foreach f [wokUtils:LIST:GM $listfileinbase $param] {
+ puts $f
+ }
+ }
+ return
}
+ if { [set RES [wokUtils:LIST:GM $listfileinbase $param]] == {} } {
+ msgprint -c WOKVC -e "No match for $param in unit $ud."
+ return
+ }
+
if [info exists version] {
set vrs $version
} else {
set vrs last:${actv}
}
- if { $VERBOSE } { msgprint -c WOKVC -i "Checking out version : $vrs" }
-
- set listfileinbase [wokIntegre:BASE:List $fshop $ud $actv]
-
- if [info exists listbase] {
- set laff [wokUtils:LIST:GM $listfileinbase $param]
- foreach f $laff {
- puts $f
- }
+ if { $VERBOSE } { msgprint -c WOKVC -i "Checking out version : $vrs" }
+ if { [info exists version] && [llength $RES] > 1 } {
+ msgprint -c WOKVC -e "Option -v should be used with only one file to check out. Not done"
return
}
-
- if [info exists ID] {
- wokIntegre:Journal:Assemble /tmp/jnltmp $fshop
- if [regexp {^[0-9]+$} $ID] {
- wokIntegre:Journal:PickReport /tmp/jnltmp table notes $ID
- } else {
- puts "Not yet implemented"
- ;#set res [wokIntegre:Journal:PickMultReport /tmp/jnltmp $ID $ID]
- ;#puts $res
- }
- catch { unlink /tmp/jnltmp }
- } else {
- if { $param == {} } {
- foreach f $listfileinbase {
- puts $f
- }
- return
- }
- if { [set RES [wokUtils:LIST:GM $listfileinbase $param]] == {} } {
- msgprint -c WOKVC -e "No match for $param in unit $ud."
- }
-
- if { [info exists version] && [llength $RES] > 1 } {
- msgprint -c WOKVC -e "Option -v should be used with only one file to check out. Not done"
- return
- }
- set locud [woklocate -u $ud ${fshop}:${workbench}]
- if { $locud != {} } {
- set table(${ud}.[uinfo -c $locud]) [wokUtils:LIST:pair $RES $vrs 2]
- } else {
- msgprint -c WOKVC -e "Unit $ud not found. Cannot create a new one (Unknown type)."
- return -1
- }
- }
-
- if { [wokIntegre:RefCopy:Writable $fshop table $workbench {} {}] == -1 } {
+ set locud [woklocate -u $ud ${fshop}:${workbench}]
+ if { $locud != {} } {
+ set table(${ud}.[uinfo -c $locud]) [wokUtils:LIST:pair $RES $vrs 2]
+ } else {
+ msgprint -c WOKVC -e "Unit $ud not found. Cannot create a new one (Unknown type)."
return -1
}
- wokIntegre:RefCopy:GetPathes $fshop table $workbench {} {}
-
- if { [llength [w_info -A ${fshop}:$workbench]] == 1 } {
- msgprint -c WOKVC -w "You are working in the reference area."
+
+ if { [wokIntegre:RefCopy:Writable table $workbench] == -1 } {
return -1
}
+ wokIntegre:RefCopy:GetPathes table $workbench
- if { [wokUtils:FILES:dirtmp [set dirtmp /tmp/wintegrecreateunits[id process]]] == -1 } {
+ if { [wokUtils:FILES:dirtmp [set dirtmp /tmp/wintegrecreateunits[pid]]] == -1 } {
msgprint -c WOKVC -e "Unable to create working directory"
return -1
}
-
+
set chkout $dirtmp/checkout.cmd
set chkid [open $chkout w]
- wokIntegre:RefCopy:FillUser $fshop table $forced $chkid
+ wokIntegre:RefCopy:FillUser table $forced $chkid
wokIntegre:BASE:EOF $chkid
close $chkid
-
+
if { $VERBOSE } {
msgprint -c WOKVC -i "Send the following script:"
puts [exec cat $dirtmp/checkout.cmd]
}
-
+
set statx [wokIntegre:BASE:Execute $VERBOSE $chkout]
if { $statx != 1 } {
msgprint -c WOKVC -e "Error during checkout(Get)."
return $statx
}
}
-;#
-;#
-;#
-proc wokGetnobase { } {
- uplevel {
- if [wokUtils:WB:IsRoot $workbench] {
- msgprint -c WOKVC -e "You are working in the reference area. Use chmod and edit the file..."
- return -1
- }
-
- if [info exists version] {
- msgprint -c WOKVC -w "Value $version for option -v ignored in this context (NOBASE)."
- }
-
- set listfileinbase [wokIntegre:BASE:List $fshop $ud {}]
- if [info exists listbase] {
- set laff [wokUtils:LIST:GM $listfileinbase $param]
- foreach f $laff {
- puts $f
- }
- return
- }
-
- if [info exists ID] {
- msgprint -c WOKVC -w "Value $ID for option -r ignored in this context (NOBASE)."
- return
- } else {
- if { $param == {} } {
- foreach f $listfileinbase {
- puts $f
- }
- return
- }
- if { [set RES [wokUtils:LIST:GM $listfileinbase $param]] == {} } {
- msgprint -c WOKVC -e "No match for $param in unit $ud."
- }
- set locud [woklocate -u $ud]
- if { $locud != {} } {
- set table(${ud}.[uinfo -c $locud]) $RES
- } else {
- msgprint -c WOKVC -e "Unit $ud not found. Unknown type for creation."
- return -1
- }
- }
-
- foreach UD [array names table] {
- regexp {(.*)\.(.*)} $UD ignore name type
- if { [lsearch [w_info -l $workbench] $name ] == -1 } {
- ;# if workbench is writable ..
- ;#msgprint -c WOKVC -i "Creating unit ${workbench}:${name}"
- ucreate -$type ${workbench}:${name}
- }
- set dirsrc [wokinfo -p source:. ${workbench}:${name}]
- if ![file writable $dirsrc] {
- msgprint -c WOKVC -e "You cannot write in directory $dirsrc"
- return -1
- }
- set fromsrc [wokinfo -p source:. ${fromwb}:${name}]
- set table($UD) [list $fromsrc $dirsrc $table($UD)]
- }
- foreach UD [array names table] {
- set from [lindex $table($UD) 0]
- set dest [lindex $table($UD) 1]
- foreach file [lindex $table($UD) 2] {
- if [file exists $dest/$file] {
- if { $forced } {
- if { [file writable $dest/$file] } {
- frename $dest/$file $dest/${file}-sav
- msgprint -c WOKVC -i "File $dest/$file renamed ${file}-sav"
- wokUtils:FILES:copy $from/$file $dest/$file
- chmod 0644 $dest/$file
- } else {
- msgprint -c WOKVC -e "File $dest/$file is not writable. Cannot be overwritten."
- return -1
- }
- } else {
- msgprint -c WOKVC -e "File $dest/$file already exists. Not overwritten."
- }
- } else {
- wokUtils:FILES:copy $from/$file $dest/$file
- chmod 0644 $dest/$file
- }
- }
- }
- }
- return
-}
proc wnews { args } {
set tblreq(-h) {}
- set tblreq(-x) {}
+ set tblreq(-v) {}
+ set tblreq(-x) {}
set tblreq(-from) value_required:string
set tblreq(-to) value_required:string
set tblreq(-headers) {}
set tblreq(-cf) value_required:string
- set tblreq(-ls) default
+ set tblreq(-ls) {} ;#default
set tblreq(-bydate) {}
set tblreq(-admin) {}
set tblreq(-o) value_required:string
- set tblreq(-ws) value_required:string
+ set tblreq(-wb) value_required:string
set disallow(-x) {-set -ls -rm -admin -purge }
set disallow(-admin) {-set -ls -rm -purge }
if { [wokUtils:EASY:GETOPT param tabarg tblreq wokNewsUsage $args] == -1 } return
if { [wokUtils:EASY:DISOPT tabarg disallow wokNewsUsage ] == -1 } return
+
+ set VERBOSE [info exists tabarg(-v)]
+
if { $param != {} } {
wokNewsUsage
return
return
}
- if [info exists tabarg(-ws)] {
- set fshop $tabarg(-ws)
+ if [info exists tabarg(-wb)] {
+ set curwb $tabarg(-wb)
} else {
- set fshop [wokinfo -s [wokcd]]
+ if { [set curwb [wokinfo -w [wokcd]]] == {} } {
+ msgprint -c WOKVC -e "Current location [wokcd] is not a workbench."
+ return
+ }
}
- if { [set journal [wokIntegre:Journal:GetName $fshop]] == {} } {
- msgprint -c WOKVC -e "Journal file not found in workshop $fshop."
+ if { [wokStore:Report:SetQName $curwb] == {} } {
+ return
+ }
+
+ if { ![file exists [set journal [wokIntegre:Journal:GetName]]] } {
+ msgprint -c WOKVC -e "Journal file [wokIntegre:Journal:GetName] not found."
return
}
}
}
- set end [expr { [wokIntegre:Number:Get $fshop] - 1 } ]
+ set end [expr { [wokIntegre:Number:Get] - 1 } ]
set mark_from 1
if [info exists tabarg(-from)] {
if { [string toupper $tabarg(-from)] == "END" } {
if [info exists tabarg(-at)] {
set mark_value $tabarg(-at)
} else {
- set mark_value [wokIntegre:Number:Get $fshop]
+ set mark_value [wokIntegre:Number:Get]
}
if { $journal != {} } {
if { [wokIntegre:Mark:GetTableName $journal 1] != {} } {
if [info exists tabarg(-admin)] {
puts stdout "\n Journal file in directory [file dirname $journal] \n"
- foreach j [wokIntegre:Journal:List $fshop] {
+ foreach j [wokIntegre:Journal:List] {
puts stdout [format "%15s %-9d" [file tail $j] [file size $j]]
}
set t [fmtclock [file mtime $journal]]
puts stdout \
[format "%15s %-8d(Last modified %s)" [file tail $journal] [file size $journal] $t]
- set scoop [wokIntegre:Scoop:Read $fshop]
+ set scoop [wokIntegre:Scoop:Read ]
if { $scoop != {} } {
puts stdout "\n Last integration: \n\n $scoop "
}
puts stdout "\n Marks: \n"
- wnews -ls -ws $fshop
+ wnews -ls -wb $curwb
return
}
if [info exists tabarg(-purge)] {
- wokIntegre:Journal:Purge $fshop
+ wokIntegre:Journal:Purge
return
}
set n1 [wokIntegre:Mark:Trn $journal $mark_from]
set n2 [wokIntegre:Mark:Trn $journal $mark_to]
if { $n1 != {} && $n2 != {} } {
- set jnltmp [wokUtils:FILES:tmpname wgetslice[id process]]
- wokIntegre:Journal:Assemble $jnltmp $fshop [wokIntegre:Journal:GetBigSlice $n1 $n2 $fshop]
+ set jnltmp [wokUtils:FILES:tmpname wgetslice[pid]]
+ wokIntegre:Journal:Assemble $jnltmp [wokIntegre:Journal:GetBigSlice $n1 $n2]
if { [file size $jnltmp] != 0 } {
wokIntegre:Journal:Slice $jnltmp $n1 $n2 $command $userdata
}
return 1
}
-
-
#
# ((((((((((((((((JOURNAL))))))))))))))))
#
"Comments : $C"
]
}
-#;>
-# Retourne le full path du fichier journal associe a shop
-#;<
-proc wokIntegre:Journal:GetName { fshop {create 0} } {
- set diradm [wokparam -e %VC_ROOT $fshop]/adm/[wokinfo -n [wokinfo -s $fshop]]/wintegre.jnl
- if [file exists $diradm] {
- return $diradm
- } else {
- if { $create } {
- msgprint -c WOKVC -i "Creating file $diradm"
- catch { mkdir -path [file dirname $diradm] }
- wokUtils:FILES:ListToFile {} $diradm
- chmod 0777 $diradm
- return $diradm
- } else {
- return {}
- }
- }
-}
-
# Retourne une marque unique pour ecrire dans le journal comme header de report.
# et pour mettre un commentaire des BASES
#;<
#;>
# Cree un journal tout neuf et renomme le vieux en num1-num2.jnl
#;<
-proc wokIntegre:Journal:Purge { fshop } {
- set jnl [wokIntegre:Journal:GetName $fshop]
+proc wokIntegre:Journal:Purge { } {
+ set jnl [wokIntegre:Journal:GetName ]
if [file exists $jnl] {
set lrep [wokIntegre:Journal:ListReport $jnl]
set num1 [lindex [lindex $lrep 0] 0]
#;>
# Retourne la liste des a-b.jnl dans l'ordre correct pour etre concatene.
#;<
-proc wokIntegre:Journal:List { fshop } {
- set dir [file dirname [wokIntegre:Journal:GetName $fshop]]
+proc wokIntegre:Journal:List { } {
+ set dir [file dirname [wokIntegre:Journal:GetName ]]
set l {}
set deb 1
while { 1 } {
return $l
}
#;>
-# Reconstruit le journal complet de fshop dans path.
+# Reconstruit le journal complet dans path.
#;<
-proc wokIntegre:Journal:Assemble { path fshop {liste {}} } {
+proc wokIntegre:Journal:Assemble { path {liste {}} } {
if [file exists $path] {
if [catch { unlink $path } err] {
msgprint -c WOKVC -e "Assemble error: $err"
if { $liste == {} } {
wokUtils:FILES:concat $path \
[concat \
- [wokIntegre:Journal:List $fshop] \
- [wokIntegre:Journal:GetName $fshop] ]
+ [wokIntegre:Journal:List ] \
+ [wokIntegre:Journal:GetName ] ]
} else {
wokUtils:FILES:concat $path $liste
}
#;>
# Retourne le path du bout de journal contenant le report <num>
#;<
-proc wokIntegre:Journal:GetSlice { num fshop } {
- set ljnl [wokIntegre:Journal:List $fshop]
+proc wokIntegre:Journal:GetSlice { num } {
+ set ljnl [wokIntegre:Journal:List ]
foreach fxt $ljnl {
set lll [split [file root [file tail $fxt]] -]
if { $num >= [lindex $lll 0] && $num <= [lindex $lll 1] } {
return $fxt
}
}
- return [wokIntegre:Journal:GetName $fshop]
+ return [wokIntegre:Journal:GetName ]
}
#;>
# Retourne la liste des pathes des bouts de journal contenant les reports <num1> a <num2>
#;<
-proc wokIntegre:Journal:GetBigSlice { num1 num2 fshop } {
- set ljnl [wokIntegre:Journal:List $fshop]
+proc wokIntegre:Journal:GetBigSlice { num1 num2 } {
+ set ljnl [wokIntegre:Journal:List ]
foreach fxt $ljnl {
set lll [split [file root [file tail $fxt]] -]
if { $num1 >= [lindex $lll 0] && $num1 <= [lindex $lll 1] } {
if { [info exists i1] && [info exists i2] } {
return [lrange $ljnl $i1 $i2]
} elseif { [info exists i1] } {
- return [concat [lrange $ljnl $i1 end] [wokIntegre:Journal:GetName $fshop]]
+ return [concat [lrange $ljnl $i1 end] [wokIntegre:Journal:GetName ]]
} elseif { [info exists i2] } {
return {}
} else {
# Place texte dans le fichier scoop ( derniere integration faite)
# si texte = {} retourne le nom du scoop.
#;<
-proc wokIntegre:Scoop:Create { fshop {texte {}} } {
- set diradm [wokparam -e %VC_ROOT $fshop]/adm/[wokinfo -n [wokinfo -s $fshop]]/scoop.jnl
+proc wokIntegre:Scoop:Create { {texte {}} } {
+ set diradm [file join [file dirname [wokIntegre:Journal:GetName]] scoop.jnl]
if { $texte != {} } {
wokUtils:FILES:copy $texte $diradm
chmod 0777 $diradm
# Place texte dans le fichier scoop ( derniere integration faite)
# si texte = {} retourne le nom du scoop.
#;<
-proc wokIntegre:Scoop:Read { fshop {option header} } {
+proc wokIntegre:Scoop:Read { {option header} } {
switch -- $option {
header {
- set scoop [wokIntegre:Scoop:Create $fshop]
+ set scoop [wokIntegre:Scoop:Create]
if [file exists $scoop] {
return [lindex [wokUtils:FILES:FileToList $scoop] 0]
} else {
proc wokDisplayCook { item w } {
global IWOK_WINDOWS
global IWOK_GLOBALS
-
+
set litm [split $item ^]
if { [llength $litm] == 2 } {
set data [$IWOK_WINDOWS($w,hlist) info data $item]
}
[$IWOK_WINDOWS($w,button) subwidget search] configure -state active
-
+
switch -- $flag {
+ {
wokReadFile $IWOK_WINDOWS($w,text) $d1/$name
global IWOK_GLOBALS
global IWOK_WINDOWS
-
-
if { $loc == {} } {
set verrue [wokCWD readnocell]
} else {
wokDialBox .wokcd {Unknown location} "Location $verrue is unknown" {} -1 OK
return
}
+
set shop [wokinfo -s $verrue]
set wb [wokinfo -n [wokinfo -w $verrue]]
-
-
+
set w [wokTPL wprepare${verrue}]
if [winfo exists $w ] {
wm deiconify $w
toplevel $w
wm title $w "Comparing workbenches in $shop"
wokButton setw [list prepare $w]
-
+
wm geometry $w 960x720+461+113
foreach type $IWOK_GLOBALS(ucreate-P) {
set IWOK_WINDOWS($w,WBPere) $wb
}
+ if { [wokStore:Report:SetQName ${shop}:$IWOK_WINDOWS($w,WBPere)] != {} } {
+ set IWOK_WINDOWS($w,queue_enabled) 1
+ } else {
+ set IWOK_WINDOWS($w,queue_enabled) 0
+ }
+
set func1 wokHliAdd
set func2 wokHliDel
set function wokDisplayCook
-
+
menubutton $w.file -menu $w.file.m -text File -underline 0 -takefocus 0
menu $w.file.m
$w.file.m add command -label "Close " -underline 1 -command [list wokPrepareExit $w]
menubutton $w.admin -menu $w.admin.m -text Admin -underline 0 -takefocus 0
menu $w.admin.m
-
+
$w.admin.m add command -label "Check for init" -underline 1 -command [list wokPrepareCheck $w]
$w.admin.m entryconfigure 1 -state disabled
$w.admin.m configure -postcommand [list wokPostCheck $w]
-
+
menubutton $w.help -menu $w.help.m -text Help -underline 0 -takefocus 0
menu $w.help.m
$w.help.m add command -label "Help" -underline 1 -command [list wokPrepareHelp $w]
-
+
frame $w.top -relief sunken -bd 1
label $w.lab -relief sunken
tixScrolledHList $w.h1 -width 8c ; set hlist1 [$w.h1 subwidget hlist]
set locfunc1 ${func1}_$w ; set body {$item} ; eval "proc $locfunc1 { item } { $func1 $body $w}"
$hlist1 config -separator ^ -drawbranch 0 -browsecmd $locfunc1 -selectmode single
-
+
tixScrolledHList $w.h2 -width 8c ; set hlist2 [$w.h2 subwidget hlist]
set locfunc2 ${func2}_$w ; set body {$item} ; eval "proc $locfunc2 { item } { $func2 $body $w}"
$hlist2 config -separator ^ -drawbranch 0 -browsecmd $locfunc2 -selectmode single
-
+
tixPanedWindow $w.top.pane -orient horizontal -paneborderwidth 0 -separatorbg gray50
pack $w.top.pane -side top -expand yes -fill both -padx 1 -pady 1
pack $p2.text -expand yes -fill both -padx 1 -pady 1 -padx 3
frame $w.wbs -relief sunken -bd 1
- tixLabelEntry $w.wbs.mas -label "Workbench 1" -labelside left -options {
+ tixLabelEntry $w.wbs.mas -label "Master workbench" -labelside left -options {
label.anchor n
}
- tixLabelEntry $w.wbs.rev -label "Workbench 2" -labelside left -options {
+ tixLabelEntry $w.wbs.rev -label "Revision workbench" -labelside left -options {
label.anchor n
}
tixForm $w.wbs.mas -top 0 -left 0 -right -0
tixForm $w.wbs.rev -top $w.wbs.mas -left 0 -right -0
- $w.wbs.mas subwidget entry configure -textvariable IWOK_WINDOWS($w,WBPere)
- $w.wbs.rev subwidget entry configure -textvariable IWOK_WINDOWS($w,WBFils)
+ $w.wbs.mas subwidget entry configure -textvariable IWOK_WINDOWS($w,WBPere) -state disabled
+ $w.wbs.rev subwidget entry configure -textvariable IWOK_WINDOWS($w,WBFils) -state disabled
tixButtonBox $w.but -orientation horizontal -relief raised -padx 0 -pady 0
{exclude "Exclude" disabled wokExcludeItem} \
{hide "Hide=" disabled wokHideEq} \
{rmeq "rm =" disabled wokrmEq} \
- {editcopy "To Editor" disabled wokeditcopy} \
+ {editcopy "Edit" disabled wokeditcopy} \
{search "Search" disabled wokeditsearch} \
{xdiff "More Diff" disabled wokxdiff} \
{comment "Comments" disabled wokEnterComment} \
- {saveas "Save " disabled wokSaveas} \
+ {saveas "Save " active wokSaveas} \
]
foreach b $buttons {
[$w.warbut subwidget [lindex $b 0]] configure \
-state [lindex $b 2] -command [list [lindex $b 3] $w] -width 11
}
-
- if [wokStore:Queue:Enabled $shop $IWOK_WINDOWS($w,WBPere)] {
- set trigger [wokStore:Trigger:Exists $shop]
+
+ if { $IWOK_WINDOWS($w,queue_enabled) } {
button $w.stor -text "Store"
- $w.stor configure -state disabled -command [list wokStoreThat $w]
+ $w.stor configure -state disabled -command [list wokStoreThat $w store]
tixForm $w.file ; tixForm $w.admin -left $w.file
- if { $trigger != {} } {
- menubutton $w.shrt -menu $w.shrt.m -text Trigger -underline 0 -takefocus 0
- menu $w.shrt.m
- $w.shrt.m add command -label "Show content" -underline 0 -command [list wokShowTrig $w $trigger]
- tixForm $w.shrt -left $w.admin
- }
-
tixForm $w.help -right -2
tixForm $w.h1 -top $w.file -left 2 -right %28
tixForm $w.wbs -top $w.file -left $w.h1 -right $w.h2
tixForm $w.h2 -top $w.file -right -2 -left %78
tixForm $w.but -top $w.h1 -left 2
-
- set IWOK_WINDOWS($w,trig) 0
-
- if { $trigger != {} } {
- checkbutton $w.trig -text "Trigger" -variable IWOK_WINDOWS($w,trig)
- $w.trig configure -state disabled
- tixForm $w.trig -top $w.h1 -left $w.but
- tixForm $w.stor -top $w.h1 -left $w.trig -right -1
- } else {
- tixForm $w.stor -top $w.h1 -left $w.but -right -1
- }
+ tixForm $w.stor -top $w.h1 -left $w.but -right -1
} else {
button $w.stor -text "Update $IWOK_WINDOWS($w,WBPere)"
- $w.stor configure -state disabled -command [list wokUpdateThat $w]
+ $w.stor configure -state disabled -command [list wokStoreThat $w copy]
tixForm $w.file
tixForm $w.admin -left $w.file
tixForm $w.help -right -2
tixForm $w.but -top $w.h1 -left 2
tixForm $w.stor -top $w.h1 -left $w.but -right -1
}
-
+
tixForm $w.top -top $w.but -left 2 -right -2 -bottom $w.warbut
tixForm $w.warbut -bottom -0 -left %66 -right %100
tixForm $w.lab -left 0 -bottom -0 -right $w.warbut
-
+
set IWOK_WINDOWS($w,menu) $w.file.m
set IWOK_WINDOWS($w,admin) $w.admin.m
set IWOK_WINDOWS($w,label) $w.lab
set IWOK_WINDOWS($w,hlist2) $hlist2
set IWOK_WINDOWS($w,button) $w.but
set IWOK_WINDOWS($w,warbut) $w.warbut
- set IWOK_WINDOWS($w,actrig) $w.trig
set IWOK_WINDOWS($w,store) $w.stor
set IWOK_WINDOWS($w,shop) $shop
- set IWOK_WINDOWS($w,qroot) [wokStore:Report:GetRootName $shop 0]
+ if { "[info procs wokStore:Report:GetRootName]" == "wokStore:Report:GetRootName" } {
+ set IWOK_WINDOWS($w,qroot) [wokStore:Report:GetRootName]
+ } else {
+ set IWOK_WINDOWS($w,qroot) /nowhere
+ }
set allUnits [wokPreparInitFils $w $wb]
wokPreparInitPere $w $wb
}
}
- bind [$w.wbs.mas subwidget entry] <Return> {
- wokPreparInitPere [winfo toplevel %W] [%W get]
- update
- }
-
- bind [$w.wbs.rev subwidget entry] <Return> {
- wokPreparInitFils [winfo toplevel %W] [%W get]
- update
- }
-
- ;#bind $w <Destroy> { if [winfo exists %W] { wokPrepareExit %W }}
-
return
}
proc wokGetDoublon { hli } {
proc wokPreparInitPere { w wb } {
global IWOK_WINDOWS
- global IWOK_GLOBALS
set fwb $IWOK_WINDOWS($w,shop):$wb
- if [wokinfo -x $fwb] {
- wokActiveStore $w disabled
- wokClearHlist $w [list hlist hlist2]
- } else {
- wokClearHlist $w [list hlist hlist1 hlist2]
- wokDialBox .notawb {Not a workbench} "The workbench $fwb does not exist" {} -1 OK
- }
+ wokActiveStore $w disabled
+ wokClearHlist $w [list hlist hlist2]
return
}
;#
set allUnits {}
set fwb $IWOK_WINDOWS($w,shop):$wb
set IWOK_WINDOWS($w,LWB) [w_info -A $fwb]
- if [wokinfo -x $fwb] {
- $IWOK_WINDOWS($w,hlist1) delete all
- foreach i [ lsort [w_info -a $fwb]] {
- $IWOK_WINDOWS($w,hlist1) add $i -itemtype imagetext \
- -text [lindex $i 1] -image $IWOK_GLOBALS(image,[lindex $i 0])
- lappend allUnits [list [lindex $i 0] [lindex $i 1] $IWOK_GLOBALS(image,[lindex $i 0])]
- }
- wokClearHlist $w [list hlist hlist2]
- } else {
- wokDialBox .notawb {Not a workbench} "The workbench $fwb does not exist" {} -1 OK
+ $IWOK_WINDOWS($w,hlist1) delete all
+ foreach i [ lsort [w_info -a $fwb]] {
+ $IWOK_WINDOWS($w,hlist1) add $i -itemtype imagetext \
+ -text [lindex $i 1] -image $IWOK_GLOBALS(image,[lindex $i 0])
+ lappend allUnits [list [lindex $i 0] [lindex $i 1] $IWOK_GLOBALS(image,[lindex $i 0])]
}
+ wokClearHlist $w [list hlist hlist2]
return $allUnits
}
return
}
;#
-;#;+ xxx.tcl /adv_23/WOK/k1dev/subiwok/prod/WOKTclLib/src
-;# met a jour le workbench pere avec le contenu du report. Pas de store
-;#;# Mkf.tcl /adv_23/WOK/k1dev/subiwok/prod/WOKTclLib/src
-;#
-proc wokUpdateThat { w } {
- global IWOK_WINDOWS
- global IWOK_GLOBALS
-
- $IWOK_WINDOWS($w,text) delete 0.0 end
- msgsetcmd wokMessageInText $IWOK_WINDOWS($w,text)
- set hli $IWOK_WINDOWS($w,hlist)
- set lpere [w_info -l $IWOK_WINDOWS($w,shop):$IWOK_WINDOWS($w,WBPere)]
- foreach U [$hli info children] {
- if { [lsearch $lpere $U] == -1 } {
- set T $IWOK_GLOBALS(L_S,[uinfo -t $U])
- catch { ucreate -${T} $IWOK_WINDOWS($w,WBPere):$U }
- }
- set dest [wokinfo -p source:. $IWOK_WINDOWS($w,shop):$IWOK_WINDOWS($w,WBPere):$U]
- if { [file exist $dest] && [file writable $dest] } {
- foreach f [$hli info children $U] {
- set e [lindex [split $f ^] 1]
- if { "[lindex $e 0]" == "#" || "[lindex $e 0]" == "+" } {
- set from [lindex $e 2]/[lindex $e 1]
- set to $dest/[lindex $e 1]
- if { [file exists $to] } {
- if { [file writable $to] } {
- msgprint -c WOKVC -i "Saving file $to in ${to}-sav"
- wokUtils:FILES:copy $to ${to}-sav
- msgprint -c WOKVC -i "Copying $from to $to"
- wokUtils:FILES:copy $from $to
- } else {
- msgprint -c WOKVC -e "File $to cannot be overwritten"
- }
- } else {
- msgprint -c WOKVC -i "Copying $from to $to"
- wokUtils:FILES:copy $from $to
- }
- }
- }
- }
- }
- msgunsetcmd
- $IWOK_WINDOWS($w,label) configure -text "Workbench $IWOK_WINDOWS($w,WBPere) has been updated."
- return
-}
-;#
;# fait wstore avec comme report le contenu du texte
;#
-proc wokStoreThat { args } {
+proc wokStoreThat { w option } {
global IWOK_WINDOWS
global IWOK_GLOBALS
global wokfileid
+ global tk_version
global env
- set w [lindex $args 0]
- set asfile [expr { ([lindex $args 1] != {}) ? 1 : 0 } ]
+ set defrep $env(HOME)/[wokinfo -n $IWOK_WINDOWS($w,shop)].$IWOK_WINDOWS($w,WBFils).[id user].report
+ if { "$tk_version" == "4.2" } {
+ set rep [tk_getSaveFile]
+ if { $rep == {} } {
+ set rep $defrep
+ }
+ } else {
+ set rep $defrep
+ }
- set rep $env(HOME)/$IWOK_WINDOWS($w,WBFils).[id user].report
set wokfileid [open $rep w]
- wokPrepare:Report:Output banner $IWOK_WINDOWS($w,shop) $IWOK_WINDOWS($w,WBFils)
+ wokPrepare:Report:Output banner \
+ $IWOK_WINDOWS($w,shop) $IWOK_WINDOWS($w,WBPere) $IWOK_WINDOWS($w,WBFils)
set suspect 0
tixBusy $w on
update
set hli $IWOK_WINDOWS($w,hlist)
set pfx $IWOK_WINDOWS($w,shop):$IWOK_WINDOWS($w,WBFils)
+ set lu_pere [w_info -l $IWOK_WINDOWS($w,WBPere)]
+ set lu_new {}
foreach U [$hli info children] {
set T [uinfo -t ${pfx}:$U]
+ if { [lsearch $lu_pere $U] == -1 } {
+ lappend lu_new [list $T $U]
+ }
wokPrepare:Report:Output uheader $U.$T
foreach f [$hli info children $U] {
if { [lindex [$hli info data $f] 0] } {
close $wokfileid
catch {unset wokfileid}
- if { $asfile } {
+ if { "$option" == "asfile" } {
$IWOK_WINDOWS($w,label) configure -text "File $rep has been created."
+ return
+ }
+
+ tixBusy $w on
+ $IWOK_WINDOWS($w,text) delete 0.0 end
+ msgsetcmd wokMessageInText $IWOK_WINDOWS($w,text)
+
+ if { "$option" == "copy" } {
+ wstore $rep -copy
+ set mess "Workbench $IWOK_WINDOWS($w,WBPere) has been updated."
} else {
if { $suspect } {
set retval [wokDialBox .wokcd {Duplicate entries} \
return
}
}
- tixBusy $w on
- $IWOK_WINDOWS($w,text) delete 0.0 end
- msgsetcmd wokMessageInText $IWOK_WINDOWS($w,text)
- if { $IWOK_WINDOWS($w,trig) != 0 } {
- wstore -ws $IWOK_WINDOWS($w,shop) -trig $rep
- } else {
- catch { wstore -ws $IWOK_WINDOWS($w,shop) $rep }
+
+ if { $lu_new != {} } {
+ if { "[wokIntegre:RefCopy:Welcome]" == "no" } {
+ set text "You will create new units. \nThis should be done BY your reference administrator before storing this report.\n"
+ set welcome {}
+ foreach x $lu_new {
+ set tw \
+ "ucreate -$IWOK_GLOBALS(L_S,[lindex $x 0]) $IWOK_WINDOWS($w,WBPere):[lindex $x 1]"
+ lappend welcome $tw
+ append text $tw "\n"
+ }
+ set retval [wokDialBox .wokcd {New units} $text warning 1 {OK}]
+ wokUtils:FILES:ListToFile $welcome $env(HOME)/welcome.tcl
+ $IWOK_WINDOWS($w,label) configure -text \
+ "File $env(HOME)/welcome.tcl has been created. Sorry for that.."
+ msgunsetcmd
+ tixBusy $w off
+ return
+ }
}
- msgunsetcmd
- $IWOK_WINDOWS($w,label) configure -text "Report $rep has been stored."
- tixBusy $w off
- }
+ wstore $rep
+ set mess "Report $rep has been stored."
+ }
+ msgunsetcmd
+ $IWOK_WINDOWS($w,label) configure -text $mess
+ tixBusy $w off
return
}
;#
;#
proc wokActiveStore { w state } {
global IWOK_WINDOWS
- set IWOK_WINDOWS($w,trig) 0
- if [wokStore:Queue:Enabled $IWOK_WINDOWS($w,shop) $IWOK_WINDOWS($w,WBPere)] {
+
+ if { $IWOK_WINDOWS($w,queue_enabled) } {
$IWOK_WINDOWS($w,store) configure -state $state -text "Store" \
- -command [list wokStoreThat $w]
- if { [info commands $IWOK_WINDOWS($w,actrig)] != {} } {
- $IWOK_WINDOWS($w,actrig) configure -state $state
- }
+ -command [list wokStoreThat $w store]
} else {
$IWOK_WINDOWS($w,store) configure \
-state $state -text "Update $IWOK_WINDOWS($w,WBPere)" \
- -command [list wokUpdateThat $w]
+ -command [list wokStoreThat $w copy]
}
return
}
$mw.f configure -label "Adding a unit in $loc."
tixOptionMenu $w.qt -command wokCreate:SetType -label "Type : "
set mbu [$w.qt subwidget menubutton]
- foreach I [linsert $IWOK_GLOBALS(ucreate-P) end {z Zfile...}] {
+ foreach I $IWOK_GLOBALS(ucreate-P) {
$w.qt add command "$I $mbu" -label [lindex $I 1]
}
$w.qt subwidget menubutton configure -height 25 -width 136
set tree [tixTree $w.tree -options {hlist.separator "^" hlist.selectMode single }]
$tree config -browsecmd [list wokWbtree:UpdLab $tree]
set hli [$tree subwidget hlist]
- set father [wokWbtree:LoadSons $loc [wokinfo -p WorkbenchListFile $loc]]
+ set lfath [wokWbtree:LoadSons $loc [wokinfo -p WorkbenchListFile $loc]]
+ if { [llength $lfath] == 1 } {
+ set father [lindex $lfath 0]
+ } elseif { [llength $lfath] > 1 } {
+ puts " more than one root in workbench tree"
+ set father [lindex $lfath 0]
+ }
$hli delete all
$hli add ^
update
set IWOK_GLOBALS(scratch,father) [$hli info data $ent]
return
}
-
+#
+# affiche un arbre dans tree
+#
proc wokWbtree:Tree { tree hli ent name ima } {
if {![$hli info exists ${ent}^${name}] } {
$hli add ${ent}^${name} -itemtype imagetext -text $name -image $ima -data $name
foreach son $lson {
if { "$son" != "$name" } {
if {![$hli info exists ${ent}^${name}^${son}] } {
- $hli add ${ent}^${name}^${son} -itemtype imagetext -text $son -image $ima -data $son
+ if { [info procs ${son}.wokhasq] == "${son}.wokhasq" } {
+ $hli add ${ent}^${name}^${son} -itemtype imagetext -text $son -image [${son}.wokhasq] -data $son
+ } else {
+ $hli add ${ent}^${name}^${son} -itemtype imagetext -text $son -image $ima -data $son
+ }
wokWbtree:Tree $tree $hli ${ent}^${name} $son $ima
}
}
proc wokWbtree:LoadSons { ent WBLIST } {
catch {unset TLOC}
+ foreach p [info procs *.woksons] {
+ rename $p {}
+ }
+
+ foreach p [info procs *.wokhasq] {
+ rename $p {}
+ }
+ set imagq [tix getimage workbenchq]
if [ file exists $WBLIST ] {
set f [ open $WBLIST r ]
while {[gets $f line] >= 0} {
}
} else {
set TLOC($son) {}
- set root $son
+ lappend lroot [set root $son]
+ }
+ if [wokStore:Queue:Exists ${ent}:${son}] {
+ eval "proc $son.wokhasq {} { return $imagq }"
}
}
close $f
foreach x [array names TLOC] {
eval "proc $x.woksons {} { return [list $TLOC($x)] }"
}
- return $root
+ return $lroot
}
proc wokCreate:action { w dir loc cmd } {
proc wokCreate:SetType { string } {
global IWOK_GLOBALS
regexp {(.*) (.*) (.*)} $string ignore IWOK_GLOBALS(scratch,wokType) longname w
- if { [string compare $IWOK_GLOBALS(scratch,wokType) z] != 0 } {
- set img [image create compound -window $w]
- $img add text -text $longname -underline 0
- $img add image -image [tix getimage $longname]
- $w config -image $img
- } else {
- wokCreate:Zfile $w
- }
- return
-}
-
-proc wokCreate:Zfile { ww } {
- global IWOK_GLOBALS
- global IWOK_WINDOWS
- set w [winfo toplevel $ww]
- foreach f [winfo children $w] {
- destroy $f
- }
- set fact [Sinfo -f]
- wm geometry $w 972x551
- menubutton $w.file -menu $w.file.m -text File -underline 0 -takefocus 0
- menu $w.file.m
- $w.file.m add command -label "Close " -underline 0 -command [list wokCreate:ZKill $w]
-
- frame $w.top -relief sunken -bd 1
- label $w.lab -relief raised
-
- tixPanedWindow $w.top.pane -orient horizontal -paneborderwidth 0 -separatorbg gray50
- pack $w.top.pane -side top -expand yes -fill both -padx 10 -pady 10
-
- set p1 [$w.top.pane add tree -min 70 -size 250]
- set p2 [$w.top.pane add text -min 70]
-
- set tree [tixTree $p1.tree -options {separator "^" hlist.selectMode single}]
- $tree config -browsecmd "wokCreate:ZBrowse $w $tree" \
- -opencmd "wokCreate:ZOpen $w $tree" \
- -closecmd "wokCreate:ZClose $w $tree"
-
- tixScrolledText $p2.text ;
- set texte [$p2.text subwidget text]
- $texte config -font $IWOK_GLOBALS(font)
-
- pack $p1.tree -expand yes -fill both -padx 1 -pady 1
- pack $p2.text -expand yes -fill both -padx 1 -pady 1
-
- tixButtonBox $w.but -orientation horizontal -relief flat -padx 0 -pady 0
- set but [list \
- {download "DownLoad" disabled wokCreate:DownLoad} \
- {list "List contents" disabled wokCreate:List} ]
-
- foreach b $but {
- $w.but add [lindex $b 0] -text [lindex $b 1]
- [$w.but subwidget [lindex $b 0]] configure -state [lindex $b 2] -command [list [lindex $b 3] $w]
- }
-
- tixForm $w.file
- ;#tixForm $w.help -right -2
- tixForm $w.top -top $w.file -left 2 -right %99 -bottom $w.but
- tixForm $w.but -left 2 -bottom %99
- tixForm $w.lab -left $w.but -right %99 -bottom %99
-
- set IWOK_WINDOWS($w,hlist) [$tree subwidget hlist]
- set IWOK_WINDOWS($w,text) $texte
- set IWOK_WINDOWS($w,bag) [wokinfo -f]:[finfo -W $fact]
- set IWOK_WINDOWS($w,curwb) [wokinfo -w]
- set IWOK_WINDOWS($w,label) $w.lab
- set IWOK_WINDOWS($w,button) $w.but
-
- set hlist [$tree subwidget hlist]
- $hlist delete all
- set image [tix getimage parcel]
-
- set bag $IWOK_WINDOWS($w,bag)
- set LB [Winfo -p $bag]
- foreach parcel $LB {
- if ![$IWOK_WINDOWS($w,hlist) info exists ${parcel}] {
- $IWOK_WINDOWS($w,hlist) add ${parcel} -itemtype imagetext -text $parcel -image $image \
- -data [list P $bag $parcel]
- $tree setmode ${parcel} open
- }
- }
- return
-}
-
-proc wokCreate:ZClose { w tree ent } {
- set hlist [$tree subwidget hlist]
- foreach kid [$hlist info children $ent] {
- $hlist hide entry $kid
- }
- $hlist entryconfigure $ent -image [tix getimage parcel]
- return
-}
-
-proc wokCreate:ZOpen { w tree ent } {
- global IWOK_WINDOWS
- global IWOK_GLOBALS
- set hlist [$tree subwidget hlist]
-
- tixBusy $w on
-
- update
- if {[$hlist info children $ent] == {}} {
- set data [$hlist info data $ent]
- switch -- [lindex $data 0] {
-
- P {
- set bag [lindex $data 1]
- set pcl [lindex $data 2]
- foreach unit [pinfo -a ${bag}:${pcl}] {
- set type [lindex $unit 0]
- set name [lindex $unit 1]
- $hlist add ${ent}^${name} -itemtype imagetext -text $name \
- -image $IWOK_GLOBALS(image,$type) \
- -data $bag:${pcl}:$name
- }
- }
- }
- }
- foreach kid [$hlist info children $ent] {
- $hlist show entry $kid
- }
- $hlist entryconfigure $ent -image [tix getimage delivery]
- tixBusy $w off
- return
-}
-
-proc wokCreate:ZBrowse { w tree args } {
- global IWOK_WINDOWS
- set hlist [$tree subwidget hlist]
- set sc [split $args ^]
- set lsc [llength $sc]
-
- if { $lsc == 1 } {
- return
- }
-
- set ent [$hlist info anchor]
- if {$ent == ""} {
- return
- }
-
- set kid [$hlist info children $ent]
- if {$kid == {} } {
- $IWOK_WINDOWS($w,text) delete 1.0 end
- set Zf [wokCreate:Zsearch [uinfo -Fp -Tsource [$hlist info data $ent]]]
- if { [set IWOK_WINDOWS($w,Zpath) $Zf] != {} } {
- set IWOK_WINDOWS($w,Zpath) $Zf
- if [info exists IWOK_WINDOWS($w,Zwork)] {
- catch {unlink $IWOK_WINDOWS($w,Zwork)}
- }
- set IWOK_WINDOWS($w,Zwork) [wokUtils:FILES:SansZ $IWOK_WINDOWS($w,Zpath)]
- $IWOK_WINDOWS($w,button) subwidget download configure -state active
- $IWOK_WINDOWS($w,button) subwidget list configure -state active
- } else {
- $IWOK_WINDOWS($w,label) configure -text "This unit has no Z file"
- $IWOK_WINDOWS($w,button) subwidget download configure -state disabled
- $IWOK_WINDOWS($w,button) subwidget list configure -state disabled
- }
- }
+ set img [image create compound -window $w]
+ $img add text -text $longname -underline 0
+ $img add image -image [tix getimage $longname]
+ $w config -image $img
return
}
-
-proc wokCreate:DownLoad { w } {
- global IWOK_GLOBALS
- global IWOK_WINDOWS
- $IWOK_WINDOWS($w,text) delete 1.0 end
- tixBusy $w on
- update
- msgsetcmd wokMessageInText $IWOK_WINDOWS($w,text)
- if ![info exists IWOK_WINDOWS($w,Zwork)] {
- set IWOK_WINDOWS($w,Zwork) [wokUtils:FILES:SansZ $IWOK_WINDOWS($w,Zpath)]
- }
- set Z $IWOK_WINDOWS($w,Zwork)
- set lnam [split [file tail $Z] .]
- set udname [lindex $lnam 0]
- set tyname [lindex $lnam 1]
- set l_units [w_info -l $IWOK_WINDOWS($w,curwb)]
- if { [lsearch $l_units $udname] != -1 } {
- set retval [wokDialBox .wokcd {Already exists } \
- "The $tyname $udname already exists in $IWOK_WINDOWS($w,curwb)" \
- warning 1 {Overwrite} {Abort}]
- if { $retval } {
- $IWOK_WINDOWS($w,label) configure -text "Abort..."
- msgunsetcmd
- tixBusy $w off
- return
- }
- }
-
- if ![info exists retval] {
- msgprint -i "Creating $tyname $udname in $IWOK_WINDOWS($w,curwb)"
- if [catch { ucreate -$IWOK_GLOBALS(L_S,$tyname) $IWOK_WINDOWS($w,curwb):$udname }] {
- msgprint -e "Unable to create $tyname $udname in $IWOK_WINDOWS($w,curwb)"
- msgunsetcmd
- tixBusy $w off
- return
- }
- }
-
- set savloc [wokcd]
- wokcd $IWOK_WINDOWS($w,curwb):$udname
- catch { upack -v -r $Z }
- msgunsetcmd
- wokcd $savloc
-
- if [info exists IWOK_WINDOWS($w,Zwork)] {
- catch {unlink $IWOK_WINDOWS($w,Zwork)}
- unset IWOK_WINDOWS($w,Zwork)
- }
-
- tixBusy $w off
- return
-}
-
-proc wokCreate:List { w } {
- global IWOK_WINDOWS
- $IWOK_WINDOWS($w,text) delete 1.0 end
- if [info exists IWOK_WINDOWS($w,Zwork)] {
- tixBusy $w on
- update
- puts "1"
- msgsetcmd wokMessageInText $IWOK_WINDOWS($w,text)
- puts "2 $IWOK_WINDOWS($w,Zwork)"
- upack -l $IWOK_WINDOWS($w,Zwork)
- puts "3"
- msgunsetcmd
- $IWOK_WINDOWS($w,label) configure -text "Contents of file $IWOK_WINDOWS($w,Zpath)"
- tixBusy $w off
- }
- return
-}
-
-proc wokCreate:ZKill { w } {
- global IWOK_WINDOWS
- if [info exists IWOK_WINDOWS($w,Zwork)] {
- catch {unlink $IWOK_WINDOWS($w,Zwork)}
- }
- foreach v [array names IWOK_WINDOWS $w,*] {
- unset IWOK_WINDOWS($v)
- }
- destroy $w
- return
-}
-
-proc wokCreate:Zsearch { l } {
- foreach f $l {
- if { "[file extension [lindex $f 1]]" == ".Z" } {
- return [lindex $f 2]
- }
- }
- return {}
-}
wokNAV:Initworkbench
set disp $IWOK_GLOBALS(workbench,disp)
set fdate $IWOK_GLOBALS(workbench,fdate)
- set image $IWOK_GLOBALS(workbench,image)
- if { [wokIntegre:BASE:GetType $loc] != {} } {
- if ![$IWOK_WINDOWS($w,NAV,hlist) info exists ${dir}^_Queue] {
- $IWOK_WINDOWS($w,NAV,hlist) add ${dir}^_Queue \
- -itemtype imagetext -text Queue \
- -image [tix getimage queue] \
- -data [list ${loc}:Queue trig_Queue Queue [tix getimage queue] $fdate $disp]
- }
- if ![$IWOK_WINDOWS($w,NAV,hlist) info exists ${dir}^_Reposit] {
- $IWOK_WINDOWS($w,NAV,hlist) add ${dir}^_Reposit \
- -itemtype imagetext -text Repository \
- -image [tix getimage reposit] \
- -data [list ${loc}:Repository trig_Repository Repository [tix getimage reposit] $fdate $disp]
+ foreach name [sinfo -w $loc] {
+
+ if [wokStore:Queue:Exists ${loc}:${name}] {
+ set image $IWOK_GLOBALS(workbenchq,image)
+ } else {
+ set image $IWOK_GLOBALS(workbench,image)
}
- }
- foreach name [sinfo -w $loc] {
$IWOK_WINDOWS($w,NAV,hlist) add ${dir}^${name} -text $name -itemtype imagetext \
-image $image \
-data [list ${loc}:${name} workbench $name $image $fdate $disp]
return
}
;#
-;#
+;# loc est une adresse de workbench.
;#
proc wokNAV:Tree:Updatedevunit { w loc dir } {
global IWOK_WINDOWS
global IWOK_GLOBALS
+
+ set disp $IWOK_GLOBALS(workbench,disp)
+ set fdate $IWOK_GLOBALS(workbench,fdate)
+ set image $IWOK_GLOBALS(workbench,image)
+
+ if { [wokStore:Queue:Exists $loc] } {
+ if { [wokStore:Report:SetQName $loc] != {} } {
+ if ![$IWOK_WINDOWS($w,NAV,hlist) info exists ${dir}^_Queue] {
+ $IWOK_WINDOWS($w,NAV,hlist) add ${dir}^_Queue \
+ -itemtype imagetext -text Queue \
+ -image [tix getimage queue] \
+ -data [list ${loc}:Queue trig_Queue Queue [tix getimage queue] $fdate $disp]
+ }
+ if ![$IWOK_WINDOWS($w,NAV,hlist) info exists ${dir}^_Reposit] {
+ $IWOK_WINDOWS($w,NAV,hlist) add ${dir}^_Reposit \
+ -itemtype imagetext -text Repository \
+ -image [tix getimage reposit] \
+ -data [list ${loc}:Repository trig_Repository Repository [tix getimage reposit] $fdate $disp]
+ }
+ }
+ }
+
wokNAV:Initdevunit $loc
foreach d [lsort -command wokSortUnit [w_info -a $loc]] {
set name [lindex $d 1]
proc wokNAV:Initworkbench { args } {
global IWOK_GLOBALS
+ global env
if ![info exists IWOK_GLOBALS(workbench,initdone)] {
set IWOK_GLOBALS(workbench,initdone) 1
set IWOK_GLOBALS(workbench,disp) [list 18 18 600 30 12 1.4]
set IWOK_GLOBALS(workbench,fdate) wokGetworkbenchdate
set IWOK_GLOBALS(workbench,image) [tix getimage workbench]
+ set IWOK_GLOBALS(workbenchq,image) [tix getimage workbenchq]
}
return
}
regsub {trig_} $itype "" type
}
- ;#bind $w <Destroy> { if [winfo exists %W] {wokPROP:Kill %W} }
-
switch $type {
session {
-label "Environment" -raisecmd [list wokPROP:UPD $w]
$notes add pag4 -createcmd "wokPROP:NOT wokPROP:pth $w $notes pag4" \
-label "Pathes" -raisecmd [list wokPROP:UPD $w]
- ;#$notes add pag5 -createcmd "wokPROP:NOT wokPROP:EDF $w $notes pag5 $location" \
- ;# -label "Editor" -raisecmd [list wokPROP:UPD $w]
$notes add pag6 -createcmd "wokPROP:NOT wokPROP:EDL $w $notes pag6 $location" \
-label "Edl" -raisecmd [list wokPROP:UPD $w]
}
workshop {
$notes add pag1 -createcmd "wokPROP:NOT wokPROP:workshop $w $notes pag1 $location" \
-label "General" -raisecmd [list wokPROP:UPD $w]
- $notes add pag2 -createcmd "wokPROP:NOT wokPROP:workshopconfig $w $notes pag2 $location" \
- -label "Parcel Configuration" -raisecmd [list wokPROP:UPD $w]
+ $notes add pag2 -createcmd "wokPROP:NOT wokPROP:workshopistuff $w $notes pag2 $location" \
+ -label "Integration stuff" -raisecmd [list wokPROP:UPD $w]
$notes add pag3 -createcmd "wokPROP:NOT wokPROP:workbenchtree $w $notes pag3 $location" \
-label "Workbench Tree" -raisecmd [list wokPROP:UPD $w]
$notes add pag4 -createcmd "wokPROP:NOT wokPROP:EDL $w $notes pag4 $location" \
workbench {
$notes add pag1 -createcmd "wokPROP:NOT wokPROP:workbench $w $notes pag1 $location" \
-label "General" -raisecmd [list wokPROP:UPD $w]
- $notes add pag2 -createcmd "wokPROP:NOT wokPROP:workbenchtk $w $notes pag2 $location" \
- -label "Toolkits" -raisecmd [list wokPROP:UPD $w]
+ $notes add pag2 -createcmd "wokPROP:NOT wokPROP:workbenchqq $w $notes pag2 $location" \
+ -label "Integration stuff" -raisecmd [list wokPROP:UPD $w]
$notes add pag3 -createcmd "wokPROP:NOT wokPROP:EDL $w $notes pag3 $location" \
-label "Edl" -raisecmd [list wokPROP:UPD $w]
}
set w [$nb subwidget $page]
frame $w.top -relief flat -bd 1
pack $w.top -side top -expand yes -fill both -padx 1 -pady 1
- set qdir [wokStore:Report:GetRootName $location]
- if { $qdir != {} } {
- set text [text $w.top.jnl -relief flat -font $IWOK_GLOBALS(font)]
- $text insert end "Queue in directory: $qdir\n\n"
- set journal [wokIntegre:Journal:GetName $location]
- if { $journal != {} } {
- set dir [file dirname $journal]
- $text insert end "Journal in directory: $dir\n\n"
- foreach j [wokIntegre:Journal:List $location] {
- $text insert end "[format "%15s %-9d" [file tail $j] [file size $j]]\n"
- }
- set t [fmtclock [file mtime $journal]]
- set str [format "%15s %-8d(Last modified %s)" [file tail $journal] [file size $journal] $t]
- $text insert end "$str\n\n"
- set scoop [wokIntegre:Scoop:Read $location]
- if { $scoop != {} } {
- $text insert end "Last integration: \n\n $scoop "
+ if { [wokStore:Report:SetQName $location] != {} } {
+ if { [set qdir [wokStore:Report:GetRootName]] != {} } {
+ set text [text $w.top.jnl -relief flat -font $IWOK_GLOBALS(font)]
+ $text insert end "Integration queue in directory: $qdir\n\n"
+ set journal [wokIntegre:Journal:GetName]
+ if { $journal != {} } {
+ set dir [file dirname $journal]
+ $text insert end "Journal in directory: $dir\n\n"
+ foreach j [wokIntegre:Journal:List] {
+ $text insert end "[format "%15s %-9d" [file tail $j] [file size $j]]\n"
+ }
+ set t [fmtclock [file mtime $journal]]
+ set str [format "%15s %-8d(Last modified %s)" [file tail $journal] [file size $journal] $t]
+ $text insert end "$str\n\n"
+ set scoop [wokIntegre:Scoop:Read]
+ if { $scoop != {} } {
+ $text insert end "Last integration: \n\n $scoop "
+ }
+ $text configure -state disabled
+ tixForm $text -top 2 -left 2 -bottom %99 -right %99
}
- $text configure -state disabled
- tixForm $text -top 2 -left 2 -bottom %99 -right %99
}
}
return
PTHDIR {
set pdir [lindex $data 1]
- if ![catch { set lfdir [readdir [glob -nocomplain $pdir]] }] {
+ if ![catch { set lfdir [wokUtils:EASY:readdir [glob -nocomplain $pdir]] }] {
foreach f [lsort $lfdir] {
if ![file isdirectory $pdir/$f] {
if {[string match *^* ${f}] == 0 } {
tixForm $w.top.msg -top [list $w.top.ima 20] -left 2
return
}
-proc wokPROP:workshopconfig { adr nb page location} {
+proc wokPROP:workshopistuff { adr nb page location} {
global IWOK_GLOBALS
set w [$nb subwidget $page]
frame $w.top -relief flat -bd 1
pack $w.top -side top -expand yes -fill both -padx 1 -pady 1
- set fact [wokinfo -N $location]
-
- tixScrolledText $w.top.used ; set tused [$w.top.used subwidget text]
- tixScrolledText $w.top.avai ; set tavai [$w.top.avai subwidget text]
-
- label $w.top.image
- set img [image create compound -window $w.top.image]
- $img add image -image [tix getimage parcel] ; $img add text -text " Parcels"
- $w.top.image config -image $img
-
- label $w.top.iused -text "Used:" ; label $w.top.iavai -text "Available:"
-
- tixForm $w.top.image -top 8 -left 6
- tixForm $w.top.iused -top [list $w.top.image 20] -left 6
- tixForm $w.top.iavai -top [list $w.top.image 20] -left [list $w.top.iused 240]
- tixForm $w.top.used -left 2 -top $w.top.iused -bottom %99 -right %50
- tixForm $w.top.avai -left $w.top.used -top $w.top.iused -bottom %99 -right %99
-
- wokReadList $tused [sinfo -p $location]
- wokReadList $tavai [lsort [Winfo -p $fact:[finfo -W $fact]]]
-
- $tused config -state disabled
- $tavai config -state disabled
-
update
return
}
pack $w.top -side top -expand yes -fill both -padx 1 -pady 1
set tree [tixTree $w.top.tree -options {hlist.separator "^" hlist.selectMode single }]
set hli [$tree subwidget hlist]
- set father [wokWbtree:LoadSons $location [wokinfo -p WorkbenchListFile $location]]
+ set lfath [wokWbtree:LoadSons $location [wokinfo -p WorkbenchListFile $location]]
+ if { [llength $lfath] == 1 } {
+ set father [lindex $lfath 0]
+ } elseif { [llength $lfath] > 1 } {
+ puts " more than one root in workbench tree"
+ set father [lindex $lfath 0]
+ }
+
$hli add ^
update
- button $w.top.but -text "Click here to run" \
+ button $w.top.but -text "Show tree" \
-command [list wokWbtree:Tree $tree $hli "" $father $image]
tixForm $w.top.but -top 2
tixForm $tree -top $w.top.but -left 2 -right %99 -bottom %99
return
}
-proc wokPROP:workbenchtk { adr nb page location} {
+proc wokPROP:workbenchqq { adr nb page location} {
global IWOK_GLOBALS
set w [$nb subwidget $page]
frame $w.top -relief flat -bd 1
pack $w.top -side top -expand yes -fill both -padx 1 -pady 1
-
- tixPanedWindow $w.top.pane -orient horizontal -paneborderwidth 0 -separatorbg gray50
- pack $w.top.pane -side top -expand yes -fill both -padx 1 -pady 1
- set p1 [$w.top.pane add tree -min 100 -size 160]
- set p2 [$w.top.pane add text]
-
- set tree [tixTree $p1.tree]
- set text [text $p2.text]
-
- pack $p1.tree -expand yes -fill both -padx 1 -pady 1
- pack $p2.text -expand yes -fill both -padx 1 -pady 1 -padx 3
-
- set labatt $text
- $labatt configure -relief flat -font $IWOK_GLOBALS(font)
-
- set hlist [$tree subwidget hlist]
- $hlist config -indicator 1 -selectmode single -separator "^" -drawbranch 1
- set boldstyle [tixDisplayStyle imagetext -fg #000080 -font $IWOK_GLOBALS(boldfont)]
- $tree config -opencmd [list wokPROP:workbenchtk:Open $labatt $tree $hlist] \
- -browsecmd [list wokPROP:workbenchtk:Browse $labatt $tree $hlist]
-
- foreach P [w_info -k $location] {
- set packages [woklocate -p ${P}:PACKAGES]
- $hlist add ${P} -itemtype imagetext -style $boldstyle -text ${P} \
- -image $IWOK_GLOBALS(image,toolkit) -data [list TOOLKIT $P $packages]
- $tree setmode ${P} open
- }
-
- return
-}
-
-proc wokPROP:workbenchtk:Open { att tree hlist dir } {
- if {[set children [$hlist info children $dir]] != {}} {
- foreach kid $children {
- $hlist show entry $kid
- }
- } else {
- set packages [wokUtils:FILES:FileToList [lindex [$hlist info data $dir] end]]
- foreach p $packages {
- $hlist add ${dir}^${p} -itemtype imagetext -text $p -data [list PACKAGES $p]
- }
- }
- return
-}
-proc wokPROP:workbenchtk:Browse { att tree hlist dir } {
- global IWOK_GLOBALS
- set type [lindex [set data [$hlist info data $dir]] 0]
- switch -- $type {
- TOOLKIT {
- set P [lindex $data 1]
- set U [woklocate -u $P]
- if { "$U" != "" } {
- set t [uinfo -t $U]
- set location [wokinfo -p library:lib${P}.so $U]
- if [file exists $location] {
- catch { unset tt }
- file lstat $location tt
- set lm [list \
- [list $t $U] \
- [list separator 1]\
- [list File [file tail $location]] \
- [list Location [file dirname $location]] \
- [list separator 1] \
- [list Size "$tt(size) (bytes)"]\
- [list separator 1]\
- [list Created [string range [fmtclock $tt(ctime)] 4 18]]\
- [list Modified [string range [fmtclock $tt(mtime)] 4 18]]\
- [list separator 1]\
- ]
- wokPROP:Nice $att $lm
+ if { [wokStore:Report:SetQName $location] != {} } {
+ if { [set qdir [wokStore:Report:GetRootName]] != {} } {
+ set text [text $w.top.jnl -relief flat -font $IWOK_GLOBALS(font)]
+ $text insert end "Integration queue in directory: $qdir\n\n"
+ set journal [wokIntegre:Journal:GetName]
+ if { $journal != {} } {
+ set dir [file dirname $journal]
+ $text insert end "Journal in directory: $dir\n\n"
+ foreach j [wokIntegre:Journal:List] {
+ $text insert end "[format "%15s %-9d" [file tail $j] [file size $j]]\n"
}
- }
- }
-
- PACKAGES {
- set p [lindex $data 1]
- set u [woklocate -u $p]
- if { "$u" != "" } {
- set t [uinfo -t $u]
- set location [wokinfo -p library:lib${p}.so $u]
- if [file exists $location] {
- catch { unset tt }
- file lstat $location tt
- set lm [list \
- [list $t $u] \
- [list separator 1]\
- [list File [file tail $location]] \
- [list Location [file dirname $location]] \
- [list separator 1] \
- [list Size "$tt(size) (bytes)"]\
- [list separator 1]\
- [list Created [string range [fmtclock $tt(ctime)] 4 18]]\
- [list Modified [string range [fmtclock $tt(mtime)] 4 18]]\
- [list separator 1]\
- ]
- wokPROP:Nice $att $lm
+ set t [fmtclock [file mtime $journal]]
+ set str [format "%15s %-8d(Last modified %s)" [file tail $journal] [file size $journal] $t]
+ $text insert end "$str\n\n"
+ set scoop [wokIntegre:Scoop:Read]
+ if { $scoop != {} } {
+ $text insert end "Last integration: \n\n $scoop "
}
+ $text configure -state disabled
+ tixForm $text -top 2 -left 2 -bottom %99 -right %99
}
}
}
+
return
}
+
;#
;# ((((((( D E V U N I T )))))))
;#
wokDialBox .wokcd {Unknown location} "Location $verrue is unknown" {} -1 OK
return
}
- set shop [wokinfo -s $verrue]
-
+ set curwb [wokinfo -w $verrue]
set w [wokTPL queue${verrue}]
if [winfo exists $w ] {
wm deiconify $w
}
toplevel $w
- wm title $w "Integration Queue of $shop"
+ wm title $w "Integration Queue of $curwb"
wm geometry $w 742x970+515+2
wokButton setw [list reports $w]
pack $gw.but -fill both
set buttons1 [list \
- {journal "Display" active wokReadStuffJournalOfshop} \
+ {journal "Display" active wokReadStuffJournalOfcurwb} \
{today "Today's" active wokToday} \
{upday "Prev" active wokUpday} \
{downday "Next" active wokDownday} \
set IWOK_WINDOWS($w,reports) $fw.but
set IWOK_WINDOWS($w,journal) $gw.but
set IWOK_WINDOWS($w,journal,day) [clock scan yesterday]
- set IWOK_WINDOWS($w,shop) $shop
- set IWOK_WINDOWS($w,frigo) [wokStore:Report:GetRootName $IWOK_WINDOWS($w,shop)]
- set IWOK_WINDOWS($w,basewrite) [wokIntegre:BASE:Writable $IWOK_WINDOWS($w,shop)]
+ set IWOK_WINDOWS($w,curwb) $curwb
+ set IWOK_WINDOWS($w,frigo) [wokStore:Report:GetRootName]
+ set IWOK_WINDOWS($w,basewrite) [wokIntegre:BASE:Writable]
wokUpdateQueue $w
- set jnl [wokIntegre:Journal:GetName $IWOK_WINDOWS($w,shop)]
+ set jnl [wokIntegre:Journal:GetName]
if [file exist $jnl] {
$w.lab configure -text "Last integration: [fmtclock [file mtime $jnl]]"
}
-
- ;#bind $w <Destroy> { if [winfo exists %W] { wokWaffQueueExit %W }}
-
return
}
return
}
-proc wokReadStuffJournalOfshop { w } {
+proc wokReadStuffJournalOfcurwb { w } {
global IWOK_WINDOWS
tixBusy $w on
update
- set jnltmp [wokUtils:FILES:tmpname jnltmp[id process].[wokinfo -n $IWOK_WINDOWS($w,shop)]]
+ set jnltmp [wokUtils:FILES:tmpname jnltmp[pid].[wokinfo -n $IWOK_WINDOWS($w,curwb)]]
if [file exists $jnltmp] {
unlink $jnltmp
}
- wokIntegre:Journal:Assemble $jnltmp $IWOK_WINDOWS($w,shop)
+ wokIntegre:Journal:Assemble $jnltmp
if [file exists $jnltmp] {
wokReadFile $IWOK_WINDOWS($w,text) $jnltmp end
}
global IWOK_WINDOWS
tixBusy $w on
update
- set jnltmp [wokUtils:FILES:tmpname jnltmp[id process].[wokinfo -n $IWOK_WINDOWS($w,shop)]]
+ set jnltmp [wokUtils:FILES:tmpname jnltmp[pid].[wokinfo -n $IWOK_WINDOWS($w,curwb)]]
if [file exists $jnltmp] {
unlink $jnltmp
}
- wokIntegre:Journal:Assemble $jnltmp $IWOK_WINDOWS($w,shop)
+ wokIntegre:Journal:Assemble $jnltmp
if [file exists $jnltmp] {
wokEDF:EditFile $jnltmp
}
global IWOK_WINDOWS
tixBusy $w on
update
- set jnltmp [wokUtils:FILES:tmpname jnltmp[id process].[wokinfo -n $IWOK_WINDOWS($w,shop)]]
+ set jnltmp [wokUtils:FILES:tmpname jnltmp[pid].[wokinfo -n $IWOK_WINDOWS($w,curwb)]]
$IWOK_WINDOWS($w,text) delete 1.0 end
if ![file exists $jnltmp] {
- wokIntegre:Journal:Assemble $jnltmp $IWOK_WINDOWS($w,shop)
+ wokIntegre:Journal:Assemble $jnltmp
}
set upto [expr $IWOK_WINDOWS($w,journal,day) + 24*3600]
set str [wokIntegre:Journal:Since $jnltmp $IWOK_WINDOWS($w,journal,day) $upto]
$IWOK_WINDOWS($w,text) delete 1.0 end
msgsetcmd wokIntegre:Msg $w
tixBusy $w on
- wintegre -ws $IWOK_WINDOWS($w,shop) $entry
+ wintegre -wb $IWOK_WINDOWS($w,curwb) $entry
msgunsetcmd
$IWOK_WINDOWS($w,text) see end
wokUpdateQueue $w
msgsetcmd wokIntegre:Msg $w
tixBusy $w on
update
- wstore -f -ws $IWOK_WINDOWS($w,shop) -rm $entry
+ wstore -wb $IWOK_WINDOWS($w,curwb) -rm $entry
msgunsetcmd
$IWOK_WINDOWS($w,text) see end
wokUpdateQueue $w
proc wokWaffQueueExit { w } {
global IWOK_WINDOWS
destroy $w
- foreach f [glob -nocomplain /tmp/jnltmp[id process].*] {
+ foreach f [glob -nocomplain /tmp/jnltmp[pid].*] {
catch { unlink $f }
}
if [info exists IWOK_WINDOWS($w,help)] {
return
}
-proc wokShowTrig { w trigcmd } {
- global IWOK_WINDOWS
- wokReadFile $IWOK_WINDOWS($w,text) $trigcmd
- return
-}
-
proc wokPurgeJnl { w } {
global IWOK_WINDOWS
msgsetcmd wokIntegre:Msg $w
tixBusy $w on
- wokIntegre:Journal:Purge $IWOK_WINDOWS($w,shop)
+ wokIntegre:Journal:Purge
tixBusy $w off
msgunsetcmd
return
}
set fact [wokinfo -f $verrue]
set shop [wokinfo -s $verrue]
- set type [wokIntegre:BASE:InitFunc $shop]
+ set type [wokIntegre:BASE:InitFunc]
set w [wokTPL rpr${verrue}]
if [winfo exists $w ] {
set IWOK_WINDOWS($w,canvas) $canva
set IWOK_WINDOWS($w,fact) $fact
set IWOK_WINDOWS($w,shop) $shop
- set IWOK_WINDOWS($w,journal) [wokIntegre:Journal:GetName $IWOK_WINDOWS($w,shop)]
- set IWOK_WINDOWS($w,qroot) [wokIntegre:BASE:GetRootName $IWOK_WINDOWS($w,shop)]
+ set IWOK_WINDOWS($w,journal) [wokIntegre:Journal:GetName]
+ set IWOK_WINDOWS($w,qroot) [wokIntegre:BASE:GetRootName]
set IWOK_WINDOWS($w,data) {}
set IWOK_GLOBALS(repository,popup,menu) [$IWOK_GLOBALS(repository,popup) subwidget menu]
$IWOK_GLOBALS(repository,popup,menu) configure -font $IWOK_GLOBALS(font)
- set LB [wokIntegre:BASE:LS $IWOK_WINDOWS($w,shop)]
- set V [wokIntegre:Version:Get $IWOK_WINDOWS($w,shop)]
+ set LB [wokIntegre:BASE:LS]
+ set V [wokIntegre:Version:Get]
set R $IWOK_WINDOWS($w,qroot)
foreach d $LB {
set T [lindex $data 2]
set V [lindex $data 3]
set dir $R/${B}${T}
- set LSF [wokIntegre:BASE:List $IWOK_WINDOWS($w,shop) $B $V]
+ set LSF [wokIntegre:BASE:List $B $V]
set txtima [tix getimage textfile]
foreach s $LSF {
set sfile $dir/[wokIntegre:BASE:ftos $s $V]
proc wokRPRShowVersions { w } {
global IWOK_WINDOWS
- $IWOK_WINDOWS($w,text) delete 1.0 end
-
- set msg "Versions and workshops:" ; $IWOK_WINDOWS($w,text) insert end $msg\n
- set msg "_______________________" ; $IWOK_WINDOWS($w,text) insert end $msg\n
- $IWOK_WINDOWS($w,text) insert end \n
- foreach e [wokIntegre:Version:Dump $IWOK_WINDOWS($w,shop)] {
- set msg " [lindex $e 1] : [lindex $e 0]"
- $IWOK_WINDOWS($w,text) insert end $msg\n
- }
- $IWOK_WINDOWS($w,text) insert end \n
- set msg "Repository location:"; $IWOK_WINDOWS($w,text) insert end $msg\n
- set msg "____________________" ; $IWOK_WINDOWS($w,text) insert end $msg\n
- $IWOK_WINDOWS($w,text) insert end \n
- set msg " [wokIntegre:BASE:GetRootName $IWOK_WINDOWS($w,shop)]" ;
- $IWOK_WINDOWS($w,text) insert end $msg\n
- $IWOK_WINDOWS($w,text) insert end \n
- set msg "Administration directory:"; $IWOK_WINDOWS($w,text) insert end $msg\n
- set msg "_________________________" ; $IWOK_WINDOWS($w,text) insert end $msg\n
- $IWOK_WINDOWS($w,text) insert end \n
- set msg " [file dirname [wokIntegre:Version:GetTableName $IWOK_WINDOWS($w,shop)]]" ;
- $IWOK_WINDOWS($w,text) insert end $msg\n
- $IWOK_WINDOWS($w,text) insert end \n
- set msg "EDL file used for parameters:"; $IWOK_WINDOWS($w,text) insert end $msg\n
- set msg "_____________________________" ; $IWOK_WINDOWS($w,text) insert end $msg\n
- $IWOK_WINDOWS($w,text) insert end \n
- set msg " [lindex [wokparam -F VC $IWOK_WINDOWS($w,shop)] 0]" ;
- $IWOK_WINDOWS($w,text) insert end $msg\n
+ puts " not yet implemented"
return
}
tixBusy $w on
update
set _x [wokIntegre:Journal:UnMark [lindex $info 1]]
- set _j [wokIntegre:Journal:GetSlice [set _n [lindex $_x 1]] $IWOK_WINDOWS($w,shop) ]
+ set _j [wokIntegre:Journal:GetSlice [set _n [lindex $_x 1]]]
wokReadList $IWOK_WINDOWS($w,text) \
[wokIntegre:Journal:PickMultReport $_j ${_n} ${_n}]
}
return
}
-;#
-;# Widget
-;#
-
;#
;# recupere le sfile en cours
;#
} elseif { $len == 1 } {
set unit [lindex $lstent 0]
tixBusy $w on
- wokIntegre:BASE:Delete $IWOK_WINDOWS($w,shop) $unit
+ wokIntegre:BASE:Delete $unit
tixBusy $w off
} elseif { $len > 1 } {
set unit [lindex $lstent 0]
$IWOK_WINDOWS($w,text) delete 0.0 end
set dir $IWOK_WINDOWS($w,qroot)/$unit
set lst {}
- catch { set lst [readdir $dir] }
+ catch { set lst [wokUtils:EASY:readdir $dir] }
foreach sfile [lsort $lst] {
if [wokIntegre:BASE:IsElm $sfile] {
set stat [wokIntegre:BASE:check $dir/$sfile]
proc wokRPRExit { w } {
global IWOK_WINDOWS
destroy $w
- foreach f [glob -nocomplain /tmp/jnltmp[id process].*] {
+ foreach f [glob -nocomplain /tmp/jnltmp[pid].*] {
catch { unlink $f }
}
if [info exists IWOK_WINDOWS($w,help)] {
puts stderr { Usage: wprepare [-ref] [-ud <ud_1,ud_2, ..,ud_N>] -o [filename]}
puts stderr { Note: If your specify more than one unit, separate names with a comma.}
puts stderr { }
- puts stderr { The following options allows you to select files based on time. }
- puts stderr { }
- puts stderr { wprepare -since markname [-ud <ud_1,ud_2, ..,ud_N>] -o [filename] }
- puts stderr { Select in the current workbench all files modified since the date }
- puts stderr { pointed to the mark markname ( See command wnews. ) }
- puts stderr { }
- puts stderr { wprepare -newer file [-ud <ud_1,ud_2, ..,ud_N>] -o [filename] }
- puts stderr { Select in the current workbench all files newer than file. }
- puts stderr { (The term newer refers to the modification time.) }
+ puts stderr { The following options allows you to select files based on date/time. }
puts stderr { }
+ puts stderr { wprepare -since date [-ud <ud_1,ud_2, ..,ud_N>] -o [filename] }
+ puts stderr { Format for date is : }
return
}
#
set tblreq(-son) value_required:string
set tblreq(-dad) value_required:string
- set tblreq(-ws) value_required:string
-
set tblreq(-since) value_required:string
-
- set tblreq(-newer) value_required:string
set param {}
if { [wokUtils:EASY:GETOPT param tabarg tblreq wokPrepareUsage $args] == -1 } return
}
+ set SHPere [wokinfo -s $WBPere]
+ set SHFils [wokinfo -s $WBFils]
+
if [info exists tabarg(-o)] {
set wokfileid [open $tabarg(-o) w]
eval "proc wprepare_return { } { close $wokfileid ; return }"
}
- if [info exists tabarg(-ws)] {
- set fshop $tabarg(-ws)
- } else {
- set fshop [wokinfo -s [wokcd]]
- }
-
if [info exists tabarg(-since)] {
- if { [set journal [wokIntegre:Journal:GetName $fshop]] == {} } {
- msgprint -c WOKVC -e "Journal file not found in workshop $fshop."
- return
- }
- set num [wokIntegre:Mark:Get $journal $tabarg(-since)]
- set date [wokIntegre:Journal:ReportDate $journal $num]
+ set date $tabarg(-since)
if { $date != {} } {
wokclose -a
wokPrepare:Report:InitTypes
- wokPrepare:Report:Output banner [wokinfo -n [wokinfo -s $WBFils]] $WBFils
+ wokPrepare:Report:Output banner [wokinfo -n $SHFils] [wokinfo -n $WBPere] [wokinfo -n $WBFils]
wokPrepare:Unit:Since wokPrepare:Report:Output ${WBFils} $LUnits $date
puts $wokfileid "is"
puts $wokfileid " Author : [id user]"
wprepare_return
return
} else {
- msgprint -c WOKVC -e "Unknown mark. Try the command : wnews -admin."
- return
- }
- }
-
- if [info exists tabarg(-newer)] {
- set datf [file mtime $tabarg(-newer)]
- if { [info exists datf] } {
- wokclose -a
- wokPrepare:Report:InitTypes
- wokPrepare:Report:Output banner [wokinfo -n [wokinfo -s $WBFils]] $WBFils
- wokPrepare:Unit:Since wokPrepare:Report:Output ${WBFils} $LUnits $datf
- wokPrepare:Report:Output notes
- catch {unset wokfileid}
- wprepare_return
- return
- } else {
- msgprint -c WOKVC -e "Unknown mark. Try the command : wnews -admin."
+ msgprint -c WOKVC -e "Bad format for date."
return
}
}
wokclose -a
wokPrepare:Report:InitTypes
-
- set SHPere [wokinfo -s $WBPere]
- set SHFils [wokinfo -s $WBFils]
-
- wokPrepare:Report:Output banner [wokinfo -n $SHFils] $WBFils
+ wokPrepare:Report:Output banner [wokinfo -n $SHFils] [wokinfo -n $WBPere] [wokinfo -n $WBFils]
if { [info exists tabarg(-ref)] || [wokUtils:WB:IsRoot $WBFils] } {
wokPrepare:Unit:Ref wokPrepare:Report:Output ${WBFils} $LUnits
#;>
# ecrit station workshop workbench sur fileid
#;<
-proc wokPrepare:Report:WriteInfo { station workshop workbench {fileid stdout}} {
- puts $fileid [format "Station : %s" $station];
+proc wokPrepare:Report:WriteInfo { workshop wbpere wbfils {fileid stdout}} {
puts $fileid [format "Workshop : %s" $workshop];
- puts $fileid [format "Workbench : %s\n" $workbench];
+ puts $fileid [format "Master workbench : %s" $wbpere];
+ puts $fileid [format "Revision workbench : %s\n" $wbfils];
return
}
#;>
# retourne station workshop workbench
#;<
-proc wokPrepare:Report:ListInfo { station workshop workbench {fileid stdout}} {
+proc wokPrepare:Report:ListInfo { workshop wbpere wbfils {fileid stdout}} {
return [list \
- [format "Station : %s" $station]\
[format "Workshop : %s" $workshop]\
- [format "Workbench : %s" $workbench]\
+ [format "Master workbench : %s" $wbpere]\
+ [format "Revision workbench : %s" $wbfils]\
]
}
#;>
# decode info (liste de 3 elements ) dans les variables qui suivent
#;<
-proc wokPrepare:Report:ReadInfo { info station workshop workbench } {
- upvar $station staloc $workshop wsloc $workbench wbloc
- regexp {Station : (.*)} [lindex $info 0] ignore staloc
- regexp {Workshop : (.*)} [lindex $info 1] ignore wsloc
- regexp {Workbench : (.*)} [lindex $info 2] ignore wbloc
+proc wokPrepare:Report:ReadInfo { info workshop wbpere wbfils } {
+ upvar $workshop wsloc $wbpere wbpereloc $wbfils wbfilsloc
+ regexp {Workshop : (.*)} [lindex $info 0] ignore wsloc
+ regexp {Master workbench : (.*)} [lindex $info 1] ignore wbpereloc
+ regexp {Revision workbench : (.*)} [lindex $info 2] ignore wbfilsloc
return
}
-
#;>
# Init d'une global pour utiliser simplement les types de Wok.
# (Voir wokPrepare:Report:UnitHeader)
set ucreateP \
[list {p package} {s schema} {i interface} {C client} {e engine} {x executable}\
{n nocdlpack} {t toolkit} {r resource} {O documentation} {c ccl} {f frontal}\
- {d delivery} {I idl} {S server} {j jini}]
+ {d delivery} {I idl} {S server} {j jini} {m module}]
foreach itm $ucreateP {
set shrt [lindex $itm 0]
set long [lindex $itm 1]
}
}
#;>
-# Ecrit un report avec le contenu de strlist
-#;<
-proc wokPrepare:Report:Skel { strlist } {
-}
-#;>
#
# Appele pour sortir un report sur fileid
#
+proc wokPrepare:Report:replicate { s tim} {
+ for {set i 0} {$i < $tim} {incr i 1} {
+ append ret $s
+ }
+ return $ret
+}
#;<
proc wokPrepare:Report:Output { opt args } {
banner {
set shop [lindex $args 0]
- set wb [lindex $args 1]
- set buf [replicate _ 30]
- set buf_path [replicate _ 61]
- wokPrepare:Report:WriteInfo [id host] $shop $wb $fileid
+ set wbpere [lindex $args 1]
+ set wbfils [lindex $args 2]
+ set buf [wokPrepare:Report:replicate _ 30]
+ set buf_path [wokPrepare:Report:replicate _ 61]
+ wokPrepare:Report:WriteInfo $shop $wbpere $wbfils $fileid
puts $fileid [format " S Date Time Name"];
puts $fileid [format " _ ________ _____ %s %s" $buf $buf_path];
}
-
#############################################################################
#
# W S T O R E
# Usage
#
proc wokStoreUsage { } {
- global env
puts stderr \
{
- Usage : wstore [-f] [-rm|-ls|-cat] [-queue name] [filename]
-
- wstore filename : Add a report in the report's list from <filename>.
- wstore [-ls] : Lists pending reports with their owner and IDs.
- wstore -cat <report_ID> : Shows the content of <report_ID>.
- wstore [-f] -rm <report_ID>: Remove a report from the queue
- : (-f used to force if you dont own the report).
-
- Backup/Admin options:
- -ctar <filename> : Create a tar file named <filename> with all reports in queue.
- -xtar <filename> : Add all reports from tar file <filename>.
- Add -v option to display informational messages
-
- -dump <report_ID> : Dump contents of Report .
- -param : Lists queue parameters associed with the concerned workshop.
-
- To store a "wpack archive files":
+ Usage : wstore is used to enqueue a report file, to get
+ information about a queue, or to perform an update of a workbench.
+ (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).
+ Queue name is deduced from the name of the father
+ workbench found in <file>.
+ 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]
+
+ >wstore -cat ID : Shows the content of <report_ID>.
+ >wstore -rm ID : Remove a report from the queue
- wstore -ar Archname.Z (See command wpack)
+ Initialization/Admin options:
- -queue option allows you to specify a queue name.
- To create a queue named XXX , define parameter VC_XXX (VC.edl) to a directory name.
- The queue XXX will be created under this directory.
+ >wstore -param : Lists queue parameters associed with wb.
+ To create a queue associated with the workbench Sam and say that the queue
+ will be created under the directory /any/directory.
+
+ >wstore -create -wb F:Shop:wSam -queue /any/directory -type SCCS
+
+ -queue to specify the name of the directory under which the queue is created.
+ (Default behavior: Creates a directory "queue" in the adm directory of the workbench)
+ -type to specify the type of the base.
+ (defaulted to SCCS )
+ -base to specify the location where to put the archive files (only for SCCS )
+ (Default behavior: Creates a directory SCCS in the adm directory of the workbench)
+ -counter to specify the name of the directory where the integration counter is located
+ (Default behavior: Create a subdirectory adm in directory created using -base option)
+ -journal to specify the name of the directory where the integration journal is located
+ (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.
+
+ To list all queues and their associated parameters:
+
+ > wstore -lsqueue
+
+ To directly update a workbench use the following command :
+
+ > wstore -copy file
+
+ where <file> is a report generated by wprepare. In that case the workbench listed in
+ the report as the "master" workbench will be automatically updated.
+
}
return
}
#
proc wstore { args } {
- set tblreq(-h) {}
- set tblreq(-f) {}
- set tblreq(-rm) {}
- set tblreq(-ls) {}
- set tblreq(-cat) {}
- set tblreq(-trig) {}
-
- set tblreq(-ctar) value_required:string
- set tblreq(-xtar) value_required:string
- set tblreq(-v) {}
-
- set tblreq(-ar) value_required:string
+ global WOKVC_STYPE WOKVC_LTYPE
+
+ set tblreq(-h) {}
+ set tblreq(-rm) {}
+ set tblreq(-ls) {}
+ set tblreq(-cat) {}
+
+ set tblreq(-param) {}
- set tblreq(-dump) {}
- set tblreq(-param) {}
+ set tblreq(-wb) value_required:string
- set tblreq(-ws) value_required:string
+ set tblreq(-create) {}
+ set tblreq(-queue) value_required:string
+ set tblreq(-base) value_required:string
+ set tblreq(-type) value_required:string
+ set tblreq(-journal) value_required:string
+ set tblreq(-counter) value_required:string
+ set tblreq(-welcome) {}
+ set tblreq(-copy) {}
- set tblreq(-queue) value_required:string
+ set tblreq(-lsqueue) {}
+ set tblreq(-v) {}
+
set param {}
if { [wokUtils:EASY:GETOPT param tabarg tblreq wokStoreUsage $args] == -1 } return
- set option_specified [array exists tabarg]
+ set verbose [info exists tabarg(-v)]
if { [info exists tabarg(-h)] } {
wokStoreUsage
return
}
- if { [info exists tabarg(-f)] } {
- set forced -1
- } else {
- set forced 0
- }
-
- if [info exists tabarg(-ws)] {
- set fshop $tabarg(-ws)
- } else {
- set fshop [wokinfo -s [wokcd]]
- }
- set lshop [finfo -s $fshop]
- if { [lsearch $lshop [wokinfo -n [wokinfo -s $fshop]] ] == -1 } {
- msgprint -c WOKVC -e "Invalid Shop name or no current shop. Should be one of $lshop."
+ if { [info exists tabarg(-lsqueue)] } {
+ if { [wokinfo -s [wokcd]] != {} } {
+ wokStore:queue:ls [sinfo -w [wokinfo -s [wokcd]]]
+ } else {
+ puts stderr " Current location must be at least a workshop."
+ }
return
}
+ ;#
+ ;# Admin options wstore -create -wb F:Shop:wSam -queue /any/directory -type SCCS
+ ;#
+ if [info exists tabarg(-create)] {
+ if [info exists tabarg(-wb)] {
+ set curwb $tabarg(-wb)
+ set queue [file join [wokinfo -p AdmDir:. $curwb] queue]
+ if [info exists tabarg(-queue)] {
+ set queue $tabarg(-queue)
+ }
+ set type SCCS
+ if [info exists tabarg(-type)] {
+ set type $tabarg(-type)
+ }
- if { [info exists tabarg(-param)] } {
- wokStore:Report:GetType $fshop 1
- return
- }
-
- if [info exists tabarg(-queue)] {
- set inqueue $tabarg(-queue)
- set FrigoName [wokStore:Report:GetQName $fshop $tabarg(-queue) 1]
- } else {
- set inqueue "default queue of $fshop"
- set FrigoName [wokStore:Report:GetRootName $fshop 1]
- }
+ if [info exists tabarg(-welcome)] {
+ set welcome yes
+ } else {
+ set welcome no
+ }
- if { $FrigoName == {} } {
- msgprint -c WOKVC -e "Bad queue name. Check file [wokinfo -p AdmDir]/VC.edl"
- return
- }
+ set commonbase [file join [wokinfo -p AdmDir:. $curwb] archives]
+ if [info exists tabarg(-base)] {
+ set base $tabarg(-base)
+ } else {
+ set base [file join $commonbase BASES]
+ }
+ if [info exists tabarg(-counter)] {
+ set counter $tabarg(-counter)
+ } else {
+ set counter [file join $commonbase adm report.num]
+ }
- if { [info exists tabarg(-ar)] } {
- set Zadr $tabarg(-ar)
- set adr [wokUtils:FILES:SansZ $Zadr]
- if { $adr != -1} {
- if ![catch {set idar [open $adr r]} status] {
- set TID [file tail $adr]
- set entry [wokStore:Report:GetUniqueName $TID]
- if { $entry != {} } {
- wokStore:Report:UnPack $idar $FrigoName/${entry}
- close $idar
- } else {
- msgprint -c WOKVC -e "Report name should not contains a comma."
- }
+ if [info exists tabarg(-journal)] {
+ set journal $tabarg(-journal)
} else {
- puts stderr "Error: $status"
+ set journal [file join $commonbase adm wintegre.jnl]
}
- if [file exists $adr] {
- catch {unlink $adr}
+ wokStore:Report:Configure set \
+ [wokStore:Report:FileAdm $curwb] $curwb $queue $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 "Counter in directory $counter "
+ msgprint -c WOKVC -i "Journal in directory $journal "
}
+ } else {
+ msgprint -c WOKVC -i "You must specify -wb with this option. "
}
return
}
-
- set ListReport [wokStore:Report:GetReportList $FrigoName]
- ;#
- ;# Options ne s'appliquant pas a un ID
- ;#
- set ID [lindex $param 0]
-
- if { $ID == {} } {
- if { ( [info exists tabarg(-ls)] == 1 ) || ( $option_specified == 0 ) } {
- set i 0
- wokStore:Report:InitState $FrigoName tabdup
- foreach e $ListReport {
- set user [wokUtils:FILES:Userid $FrigoName/$e]
- set str [wokStore:Report:GetPrettyName $e]
- if { $str != {} } {
- set rep [string range [lindex $str 0] 0 19]
- set dte [lindex $str 1]
- puts [format "%3d - %-10s %-20s (stored at %s)" [incr i] $user $rep $dte ]
- if [info exists tabdup($e)] {
- catch {unset dupfmt }
- wokStore:Report:Fmtdup $FrigoName/$e $tabdup($e) dupfmt
- foreach u [lsort [array names dupfmt]] {
- puts " [lindex [split $u .] 0]:"
- foreach f $dupfmt($u) {
- puts " $f ($FrigoName/$e/${u}/${f})"
- }
+ if { [info exists tabarg(-ls)] } {
+ if [info exists tabarg(-wb)] {
+ set curwb $tabarg(-wb)
+ } else {
+ if { [set curwb [wokinfo -w [wokcd]]] == {} } {
+ msgprint -c WOKVC -e "Current location [wokcd] is not a workbench."
+ return
+ }
+ }
+ if { [wokStore:Report:SetQName $curwb] == {} } {
+ return
+ }
+
+ set FrigoName [wokStore:Report:GetRootName]
+ set ListReport [wokStore:Report:GetReportList $FrigoName]
+
+ set i 0
+ wokStore:Report:InitState $FrigoName tabdup
+ foreach e $ListReport {
+ set user [wokUtils:FILES:Userid $FrigoName/$e]
+ set str [wokStore:Report:GetPrettyName $e]
+ if { $str != {} } {
+ set rep [string range [lindex $str 0] 0 19]
+ set dte [lindex $str 1]
+ puts [format "%3d - %-10s %-20s (stored at %s)" [incr i] $user $rep $dte ]
+ if [info exists tabdup($e)] {
+ catch {unset dupfmt }
+ wokStore:Report:Fmtdup $FrigoName/$e $tabdup($e) dupfmt
+ foreach u [lsort [array names dupfmt]] {
+ puts " [lindex [split $u .] 0]:"
+ foreach f $dupfmt($u) {
+ puts " $f ($FrigoName/$e/${u}/${f})"
}
}
- } else {
- msgprint -c WOKVC -e "Bad entry ($e) found in report.list"
}
+ } else {
+ msgprint -c WOKVC -e "Bad entry ($e) found in report.list"
}
+ }
+ return
+ }
+
+ if [info exists tabarg(-param)] {
+ if [info exists tabarg(-wb)] {
+ set curwb $tabarg(-wb)
} else {
- if [info exists tabarg(-ctar)] {
- if { $ListReport != {} } {
- set tarfile $tabarg(-ctar)
- if { [file dirname $tarfile] == "." } {
- set tarfile [pwd]/$tarfile
- }
- if [file writable [file dirname $tarfile]] {
- return [wokStore:Queue:Tar $FrigoName $tarfile]
- } else {
- msgprint -c WOKVC -e "You cannot write in [file dirname $tarfile]"
- return {}
- }
- } else {
- msgprint -c WOKVC -e "Report Queue is empty."
- return {}
- }
+ if { [set curwb [wokinfo -w [wokcd]]] == {} } {
+ msgprint -c WOKVC -e "Current location [wokcd] is not a workbench."
+ return
}
- if [info exists tabarg(-xtar)] {
- set tarfile $tabarg(-xtar)
- if { [file exists $tarfile] } {
- wokStore:Queue:Untar $tarfile $FrigoName [info exists tabarg(-v)]
- } else {
- msgprint -c WOKVC -e "File $tarfile not found."
- return {}
- }
+ }
+ if { [wokStore:Report:SetQName $curwb] == {} } {
+ return
+ }
+
+ set FrigoName [wokStore:Report:GetRootName]
+ set ListReport [wokStore:Report:GetReportList $FrigoName]
+
+ msgprint -c WOKVC -i "Workbench $curwb :"
+ msgprint -c WOKVC -i "Welcome new units ?: [wokIntegre:RefCopy:Welcome]"
+ msgprint -c WOKVC -i "Reports queue created [wokStore:Report:GetRootName]"
+ 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]"
+ return
+ }
+
+ ;# Following options requres an ID
+ ;#
+ set ID [lindex $param 0]
+
+ if [info exists tabarg(-rm)] {
+ if [info exists tabarg(-wb)] {
+ set curwb $tabarg(-wb)
+ } else {
+ if { [set curwb [wokinfo -w [wokcd]]] == {} } {
+ msgprint -c WOKVC -e "Current location [wokcd] is not a workbench."
+ return
}
}
+ if { [wokStore:Report:SetQName $curwb] == {} } {
+ return
+ }
+
+ set FrigoName [wokStore:Report:GetRootName]
+ set ListReport [wokStore:Report:GetReportList $FrigoName]
+ set entry [wokStore:Report:GetTrueName $ID $ListReport]
+ if { $entry != {} } {
+ wokStore:Report:Del $FrigoName/$entry
+ }
return
}
+
+ if [info exists tabarg(-cat)] {
+
+ if [info exists tabarg(-wb)] {
+ set curwb $tabarg(-wb)
+ } else {
+ if { [set curwb [wokinfo -w [wokcd]]] == {} } {
+ msgprint -c WOKVC -e "Current location [wokcd] is not a workbench."
+ return
+ }
+ }
+ if { [wokStore:Report:SetQName $curwb] == {} } {
+ return
+ }
+
+ set FrigoName [wokStore:Report:GetRootName]
+ set ListReport [wokStore:Report:GetReportList $FrigoName]
+
+ set entry [wokStore:Report:GetTrueName $ID $ListReport]
+ if { $entry != {} } {
+ set rep $FrigoName/$entry/report-orig
+ if { [file exists $rep] } {
+ return [exec cat $rep]
+ } else {
+ msgprint -c WOKVC -e "File $rep not found."
+ }
+ }
+ return
+ }
+
;#
- ;# Options s'appliquant a un ID
+ ;# All previous option failed or -copy option => ID is a filename : wstore [-copy] filename.
+ ;# Parameters are read from the report. wokStore:Setup is not called.
;#
+ if { [file exists $ID] } {
+ wokPrepare:Report:InitTypes
+ wokPrepare:Report:Read $ID table banner notes
+ wokPrepare:Report:ReadInfo $banner shop wbpere wbfils
+ set unews [wokStore:Report:CheckUnits [w_info -l ${shop}:$wbpere] table]
+ if { $unews != {} } {
+ if {"[wokIntegre:RefCopy:Welcome]" == "yes" } {
+ msgprint -c WOKVC -i "The following new units will be created in workbench ${shop}:$wbpere"
+ foreach [list type name] $unews {
+ msgprint -c WOKVC -i "$WOKVC_STYPE($type) $name"
+ }
+ } else {
+ msgprint -c WOKVC -e "Ask your integration manager to create the following new units in ${shop}:$wbpere."
+ foreach [list type name] $unews {
+ msgprint -c WOKVC -e "$WOKVC_STYPE($type) $name"
+ }
+ return
+ }
+ }
+ set msg1 "Workbench $wbpere has no associated queue. "
+ set msg2 "Use wstore -create \n to create one or wstore -wb to specify a workbench."
+ set msg3 "\n Use wstore -copy to directly update workbench $wbpere"
+
+ set defq [wokStore:Report:SetQName ${shop}:$wbpere]
+ if { $defq != {} } {
+ if { [info exists tabarg(-copy)] } {
+ msgprint -c WOKVC -w "Option -copy ignored. $wbpere has an associated queue."
+ }
+ set entry [wokStore:Report:GetUniqueName [set TID [file tail $ID]]]
+ if { $entry != {} } {
+ 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
+ return
+ } else {
+ msgprint -c WOKVC -e "Report name $TID should not contains a comma."
+ }
+ } elseif { [info exists tabarg(-copy)] } {
+ msgprint -c WOKVC -i "Updating workbench ${shop}:$wbpere"
+ wokPrepare:Report:Copy table ${shop}:$wbpere $wbfils
+ } else {
+ set errorInfo
+ msgprint -c WOKVC -e "$msg1$msg2$msg3"
+ }
+ } else {
+ msgprint -c WOKVC -e "File $ID does not exists."
+ }
+
+}
- if ![wokUtils:FILES:ValidName $ID] {
- msgprint -c WOKVC -e "Malformed command or invalid file name $ID"
+;#
+;# Fait la definition de la queue associee a wb
+;#
+proc wokStore:Report:SetQName { wb {alert 0} } {
+ ;#puts "appel setqname avec $wb"
+ if { [wokinfo -x $wb] } {
+ if { "[wokinfo -t $wb]" == "workbench" } {
+ if { [file exists [set vc [wokStore:Report:FileAdm $wb]]] } {
+ uplevel #0 source $vc
+ return 1
+ } else {
+ if { $alert == 1 } {
+ msgprint -c WOKVC -e "File VCDEF.tcl not found in [file dirname $vc] of workbench $wb."
+ }
+ wokStore:Report:Configure unset {} {} {} {} {} {} {} {}
+ return {}
+ }
+ } else {
+ msgprint -c WOKVC -e "Entity $wb is not a workbench."
+ wokStore:Report:Configure unset {} {} {} {} {} {} {} {}
+ return {}
+ }
+ } else {
+ msgprint -c WOKVC -e "Entity $wb does not exists."
+ wokStore:Report:Configure unset {} {} {} {} {} {} {} {}
return {}
}
+}
+;#
+;# retourne le nom du fichier VCDEF.tcl a sourcer pour le workbench wb
+;#
+proc wokStore:Report:FileAdm { wb } {
+ return [file join [wokinfo -p AdmDir:. $wb] VCDEF.tcl]
+}
+;#
+;#
+;#
+proc wokStore:Queue:Exists { wb } {
+ return [file exists [wokStore:Report:FileAdm $wb]]
+}
+;#
+;# 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 } {
+ set proc_defined_in_VC [list \
+ wokStore:Report:GetRootName \
+ wokIntegre:BASE:GetRootName \
+ wokIntegre:BASE:GetType \
+ wokIntegre:RefCopy:GetWB \
+ wokIntegre:Number:GetName \
+ wokIntegre:Version:Get \
+ wokIntegre:RefCopy:Welcome \
+ wokIntegre:Journal:GetName]
+
- wokPrepare:Report:InitTypes
-
- if [info exists tabarg(-rm)] {
- set entry [wokStore:Report:GetTrueName $ID $ListReport]
- if { $entry != {} } {
- wokStore:Report:Del $FrigoName/$entry $forced
- }
- return
- }
-
- if [info exists tabarg(-cat)] {
- set entry [wokStore:Report:GetTrueName $ID $ListReport]
- if { $entry != {} } {
- set rep $FrigoName/$entry/report-orig
- if { [file exists $rep] } {
- return [exec cat $rep]
- } else {
- msgprint -c WOKVC -e "File $rep not found."
- }
- }
- return
- }
-
- if [info exists tabarg(-dump)] {
- set entry [wokStore:Report:GetTrueName $ID [wokStore:Report:GetReportList $FrigoName]]
- return [wokStore:Report:Dump $FrigoName/$entry]
- }
-
- set trig [info exists tabarg(-trig)]
- set trigexist [wokStore:Trigger:Exists $fshop]
- if { $trigexist != {} } {
- set ask [wokStore:Trigger:Invoke $fshop allways_activate {}]
- if { $ask == 0 } {
- if { $trig == 0 } {
- set trigger {}
- } else {
- set trigger $trigexist
- }
- } else {
- set trigger $trigexist
- }
- } else {
- if { $trig != 0 } {
- msgprint -c WOKVC -w "Option -trig ignored. No trigger was declared for $fshop"
- }
- set trigger {}
- }
-
- set ID [lindex $ID 0]
- if [file exists $ID] {
- set TID [file tail $ID]
- set entry [wokStore:Report:GetUniqueName $TID]
- if { $entry != {} } {
- if { [wokStore:Report:Add $ID $FrigoName/${entry}_TMP _TMP] != -1 } {
- if { [catch { frename $FrigoName/${entry}_TMP $FrigoName/${entry} }] == 0 } {
- msgprint -c WOKVC -i "Report $TID has been stored in queue $inqueue."
- if { $trigger != {} } {
- wokStore:Trigger:Invoke $fshop put $FrigoName/${entry}
- }
- } else {
- msgprint -c WOKVC -e "(rename) during storage of $TID"
- }
- } else {
- msgprint -c WOKVC -e "(write) during storage of $TID"
- catch { exec rm -rf $FrigoName/${entry}_TMP }
- }
- } else {
- msgprint -c WOKVC -e "Report name $ID should not contains a comma."
- }
- } else {
- msgprint -c WOKVC -e "File $ID not found."
- }
- return
+ switch -- $option {
+ set {
+ wokStore:mkdir $queue ;# the hook for the queue
+ eval "proc wokStore:Report:GetRootName { } { return $queue }"
+ wokStore:mkdir $base ;# the hook for the base
+ eval "proc wokIntegre:BASE:GetRootName { } { return $base }"
+ ;# the type of the base
+ eval "proc wokIntegre:BASE:GetType { } { return $type }"
+ eval "proc wokIntegre:RefCopy:Welcome { } { return $welcome }"
+ ;# the workbench that will be updated during integration.
+ eval "proc wokIntegre:RefCopy:GetWB { } { return $wb }"
+ ;# the integration counter.
+ eval "proc wokIntegre:Number:GetName { } { return $counter }"
+ ;#
+ ;# create integration counter ONLY if it does not exists.
+ if { ![file exists [wokIntegre:Number:GetName]] } {
+ msgprint -c WOKVC -i "Creating file [wokIntegre:Number:GetName]"
+ wokStore:mkdir [file dirname [wokIntegre:Number:GetName]]
+ wokUtils:FILES:touch [wokIntegre:Number:GetName] 1
+ }
+
+ eval "proc wokIntegre:Journal:GetName { } { return $journal }"
+ ;#
+ ;# create journal file ONLY if it does not exists.
+ if { ![file exists [wokIntegre:Journal:GetName]] } {
+ msgprint -c WOKVC -i "Creating file [wokIntegre:Journal:GetName]"
+ wokStore:mkdir [file dirname [wokIntegre:Journal:GetName]]
+ }
+ ;#
+ eval "proc wokIntegre:Version:Get { } { return 1 }"
+ ;#
+ set id [open $fileadm w]
+ foreach p ${proc_defined_in_VC} {
+ puts $id "proc $p { } {"
+ puts $id "[info body $p]"
+ puts $id "}"
+ }
+ close $id
+ }
+
+ unset {
+ foreach p ${proc_defined_in_VC} {
+ if { "[info procs $p]" == "$p" } {
+ rename $p {}
+ }
+ }
+ }
+ }
}
#;>
# Retourne la table des elements dupliques dans la queue d'integration
}
return
}
-#;>
-# Appel un trigger pour wstore
#;<
-proc wokStore:Trigger:Invoke { fshop action report_path } {
- set trignam [wokStore:Trigger:Exists $fshop]
- if { $trignam != {} } {
- uplevel #0 source $trignam
- ;#msgprint -c WOKVC -i "Invoking file $trignam."
- if { [catch { wstore_trigger $action $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
-}
-#;>
-# Retourne si il y en a un le trigger associe a shop
-#
-#;<
-proc wokStore:Trigger:Exists { fshop } {
- set trignam [wokinfo -p AdmDir ${fshop}]/wstore_trigger.tcl
- if { [file exists $trignam] } {
- return $trignam
- } else {
- return {}
- }
-}
-#;>
# Repond un si path pourra ( a priori ) etre mis dans une base
# de n'importe quel type (SCCS, RCS)
# Pour l'instant exclut les directories.
# 3. Ecriture des report-work et de ReleaseNotes
# 4. Gel des sources dans leur repertoire associe.
#;<
-proc wokStore:Report:Add { ID frigo sfx} {
- catch { unset table banner notes }
- wokPrepare:Report:Read $ID table banner notes
+;# WARNING: voir chmod et clock au lieu de getclock
+
+proc wokStore:Report:Add { ID intable banner notes frigo } {
+
+ upvar $intable table
set writact $banner
- mkdir -path $frigo
+ wokStore:mkdir $frigo
chmod 0777 $frigo
- regsub ${sfx}$ $frigo "" pthfrig
set LST [lsort [array names table]]
foreach e $LST {
- msgprint -c WOKVC -i [format "Processing unit : %s" $e]
- mkdir -path $frigo/$e
+ ;#msgprint -c WOKVC -i [format "Processing unit : %s" $e]
+ wokStore:mkdir $frigo/$e
chmod 0777 $frigo/$e
lappend writact "* $e"
foreach l $table($e) {
+ {
if { [wokUtils:FILES:copy $orig/$file $frigo/$e/$file] != -1 } {
chmod 0777 $frigo/$e/$file
- lappend writact "+ $pthfrig/$e/$file"
+ lappend writact "+ $frigo/$e/$file"
} else {
return -1
}
# {
if { [wokUtils:FILES:copy $orig/$file $frigo/$e/$file] != -1 } {
chmod 0777 $frigo/$e/$file
- lappend writact "# $pthfrig/$e/$file"
+ lappend writact "# $frigo/$e/$file"
} else {
return -1
}
return 1
}
#;>
-# Retourne une map tif(unit.t) { {source toto.c /a/b/toto.c} ... }
-# cree a partir d'un report filename. Utilise par wpack -rep
-#;<
-proc wokStore:Report:Pack { fileid filename verbose } {
- catch { unset table banner notes }
- wokPrepare:Report:InitTypes
- wokPrepare:Report:Read $filename table banner notes
- set writact $banner
- set LST [lsort [array names table]]
- foreach e $LST {
- set ll {}
- lappend writact "* $e"
- foreach l $table($e) {
- set str [wokUtils:LIST:Trim $l]
- set flag [lindex $str 0]
- set file [lindex $str 3]
- switch -- $flag {
- - {
- lappend ll [list source $file [lindex $str 5]/$file]
- lappend writact "# [lindex $str 5]/$file"
- }
- + {
- lappend ll [list source $file [lindex $str 4]/$file]
- lappend writact "# [lindex $str 4]/$file"
- }
- = {
- lappend ll [list source $file [lindex $str 4]/$file]
- lappend writact "# [lindex $str 4]/$file"
- }
- # {
- lappend ll [list source $file [lindex $str 4]/$file]
- lappend writact "# [lindex $str 4]/$file"
- }
-
- default {
- msgprint -c WOKVC -w "Ignored line: $l"
- }
- }
- }
- set str [wokPrepare:Report:UnitHeader tolong $e]
- set typ [lindex $str 0]
- set nam [lindex $str 1]
- if { $verbose } { msgprint -c WOKVC -i "Packing $typ $nam..." }
- puts $fileid [format "=!=!=!=!=!=!=!=!=!=! %s %s" $typ $nam]
- upack:Fold $ll $fileid [upack:Upackable] 0
- }
- puts $fileid [format "=!=!=!=!=!=!=!=!=!=! report-orig report-orig"]
- puts $fileid "=+=+=+=+=+=+=+=+=+=+ source report-orig"
- foreach x [wokUtils:FILES:FileToList $filename] { puts $fileid $x }
- puts $fileid "=!=!=!=!=!=!=!=!=!=! report-notes report-notes"
- puts $fileid "=+=+=+=+=+=+=+=+=+=+ source report-notes"
- foreach x $notes { puts $fileid $x }
- puts $fileid "=!=!=!=!=!=!=!=!=!=! report-work report-work"
- puts $fileid "=+=+=+=+=+=+=+=+=+=+ source report-work"
- foreach x $writact { puts $fileid $x }
- return
-}
-#;>
-# Inverse du precedent.
-#;<
-proc wokStore:Report:UnPack { fileid frigo } {
- wokPrepare:Report:InitTypes
- set origact [set writact [wokPrepare:Report:ListInfo unknown unknown unknown]]
- while {[gets $fileid line] >= 0 } {
- if { [regexp {^=\+=\+=\+=\+=\+=\+=\+=\+=\+=\+ ([^ ]*) ([^ ]*)} $line ignore type name] } {
- if [info exist fileout] {catch {close $fileout; unset fileout } }
- if ![catch { set fileout [open $curdir/$name w] } errout] {
- lappend writact "# $curdir/$name"
- lappend origact " $name"
- } else {
- msgprint -e "$errout"
- return -1
- }
- } elseif {[regexp {^=!=!=!=!=!=!=!=!=!=! ([^ ]*) ([^ ]*)} $line ignore utyp unam]} {
- if [string match report-* $utyp] {
- set curdir $frigo
- } else {
- set curdir $frigo/${unam}.[set s [wokPrepare:Report:UnitHeader ltos $utyp]]
- msgprint -c WOKVC -i [format "Processing unit : %s" ${unam}.${s}]
- catch { mkdir -path $curdir }
- lappend writact "* ${unam}.${s}"
- lappend origact "\n * ${unam} ($utyp):\n"
- }
- } else {
- if [info exist fileout] {
- puts $fileout $line
- }
- }
-
- }
- if [info exist fileout] {catch {close $fileout; unset fileout} }
-
- if ![file exists $frigo/report-work] {
- wokUtils:FILES:ListToFile $writact $frigo/report-work
- }
-
- if ![file exists $frigo/report-notes] {
- set cmt [wokIntegre:Journal:EditReleaseNotes [id user] {It was a workbench backup(wpack)}]
- wokUtils:FILES:ListToFile $cmt $frigo/report-notes
- }
-
- if ![file exists $frigo/report-orig] {
- set cmt [wokIntegre:Journal:EditReleaseNotes [id user] {This is a workbench backup(wpack)}]
- wokUtils:FILES:ListToFile [concat $origact $cmt] $frigo/report-orig
- }
-
- chmod 0777 [list $frigo/report-orig $frigo/report-work $frigo/report-notes]
- return
-}
-#;>
# Retire un report du frigo, le report est donne par son full path
#;<
-proc wokStore:Report:Del { LISTREPORT {forced -1} } {
+proc wokStore:Report:Del { LISTREPORT } {
foreach entry $LISTREPORT {
- if { [file owned $entry] || $forced != -1 } {
- if { [wokStore:Report:RmEntry $entry] == -1 } {
- return -1
- }
- } else {
- msgprint -c WOKVC -e "You are not the owner of this report."
+ if { [wokStore:Report:RmEntry $entry] == -1 } {
return -1
}
}
foreach ud [array names tabud] {
foreach dir $tabud($ud) {
if [file exists $dir] {
- foreach f [readdir $dir] {
+ foreach f [wokUtils:EASY:readdir $dir] {
set key ${f}:${ud}
if [info exists TLOC($key)] {
set ll $TLOC($key)
}
return
}
-#;>
-#
-# Retourne le full path de la racine de la file de nom name. Ce path se trouve dans la variable EDL
-# VC_<name>.
-#;<
-proc wokStore:Report:GetQName { fshop name {create 0} } {
- if { [lsearch {TYPE ROOT WBROOT DEFAULT EDL} $name] == -1 } {
- set pth {}
- catch { set pth [wokparam -e %VC_${name} $fshop] }
- if { $pth != {} } {
- set diradm [file join $pth FRIGO]
- if [file exists $diradm] {
- return $diradm
- } else {
- if { $create } {
- msgprint -c WOKVC -i "Creating file $diradm"
- mkdir -path $diradm
- chmod 0777 $diradm
- return $diradm
- } else {
- return {}
- }
- }
- } else {
- return {}
- }
- } else {
- msgprint -c WOKVC -e "The string $name should not be used as a queue name."
- return {}
- }
-}
-
-#;>
-#
-# Retourne le full path de la racine ou on accroche les reports pour le "gel" des sources d'un ilot.
-# 1. Si create = 1 le cree dans le cas ou il n'existe pas.
-#;<
-proc wokStore:Report:GetRootName { fshop {create 0} } {
- set root [wokStore:Report:GetAdmName $fshop $create]/FRIGO
- if [file exists $root] {
- return $root
- } else {
- if { $create } {
- mkdir -path $root
- chmod 0777 $root
- return $root
- } else {
- return {}
- }
- }
-}
-#;>
-# Retourne le full path du repertoire d'administration de wstore pour un ilot donne.
-# 1. Si create = 1 le cree dans le cas ou il n'existe pas.
-#;<
-proc wokStore:Report:GetAdmName { fshop {create 0} } {
- set diradm [wokparam -e %VC_ROOT $fshop]/adm/[wokinfo -n [wokinfo -s $fshop]]
- if [file exists $diradm] {
- return $diradm
- } else {
- if { $create } {
- msgprint -c WOKVC -i "Creating file $diradm"
- mkdir -path $diradm
- chmod 0777 $diradm
- return $diradm
- } else {
- return {}
- }
- }
-}
+
#;>
# Pour debugger. Imprime tout ce qui se trouve accroche sous ID
#;<
#;<
proc wokStore:Report:GetUniqueName { name } {
if { [string first , $name] == -1 } {
- return [getclock],${name}
+ return [clock seconds],${name}
} else {
return {}
}
#;<
proc wokStore:Report:GetReportList { FrigoName } {
if [file exists $FrigoName] {
- return [lsort -command wokStore:Report:SortEntry [readdir $FrigoName] ]
+ return [lsort -command wokStore:Report:SortEntry [wokUtils:EASY:readdir $FrigoName] ]
} else {
return {}
}
}
}
#;
-# Retourne la longueur de la liste des reports en attente dans shop
+# Retourne la longueur de la liste des reports en attente
#;<
-proc wokStore:Report:QueueLength { fshop } {
- return [llength [wokStore:Report:GetReportList [wokStore:Report:GetRootName $fshop]]]
+proc wokStore:Report:QueueLength { } {
+ return [llength [wokStore:Report:GetReportList [wokStore:Report:GetRootName ]]]
}
#;>
;#
;# Retourne un ou plusieurs pathes de report, mangeables par wokStore:Report:Process
;#
-proc wokStore:Report:Get { id fshop } {
+proc wokStore:Report:Get { id } {
set l {}
- if { [wokStore:Report:QueueLength $fshop] != 0 } {
- set FrigoName [wokStore:Report:GetRootName $fshop]
+ if { [wokStore:Report:QueueLength ] != 0 } {
+ set FrigoName [wokStore:Report:GetRootName ]
if { $FrigoName != {} } {
set ListReport [wokStore:Report:GetReportList $FrigoName]
if { $ListReport != {} } {
msgprint -c WOKVC -e "Unable to get report list."
}
} else {
- msgprint -c WOKVC -e "Administration directory for $fshop not found. No report was stored."
+ msgprint -c WOKVC -e "Administration directory not found. No report was stored."
}
} else {
- msgprint -c WOKVC -i "Report queue is empty or workshop not found."
+ msgprint -c WOKVC -i "Report queue is empty ."
}
return $l
}
;#
-;# Renvoie 1 si on peut faire store dans une queue associee au workbench.
-;# Pour l'instant renvoie 1 si wb est le workbench racine
;#
-proc wokStore:Queue:Enabled { fshop wb } {
- set vc [file join [wokinfo -pAdmDir:. $fshop] VC.tcl]
- if [file exists $vc] {
- source $vc
- if { "[info procs wokIntegre:RefCopy:GetWB]" != {} } {
- if { "[wokIntegre:RefCopy:GetWB]" == "$wb" || "[wokIntegre:RefCopy:OpenWB]" == "$wb" } {
- return 1
- } else {
- return 0
- }
+proc wokStore:mkdir { d } {
+ global tcl_version
+ if ![file exists $d] {
+ if { "$tcl_version" == "7.5" } {
+ mkdir -path $d
} else {
- msgprint -c WOKVC -e "proc wokIntegre:RefCopy:GetWB is undefined (File $vc )."
- return 0
+ file mkdir $d
+ }
+ if [file exists $d] {
+ return $d
+ } else {
+ return {}
}
} else {
- msgprint -c WOKVC -i "File $vc not found. Assume wokIntegre:RefCopy:GetWB is root workbench."
- return 0
+ return $d
}
}
;#
-;# Fait ls d'une file qname. Si qname = {} ls de la file de l'ilot.
;#
-proc wokStore:Report:LS { FrigoName } {
- set i 0
- wokStore:Report:InitState $FrigoName tabdup
- foreach e [wokStore:Report:GetReportList $FrigoName] {
- set user [wokUtils:FILES:Userid $FrigoName/$e]
- set str [wokStore:Report:GetPrettyName $e]
- if { $str != {} } {
- set rep [string range [lindex $str 0] 0 19]
- set dte [lindex $str 1]
- puts [format "%3d - %-10s %-20s (stored at %s)" [incr i] $user $rep $dte ]
- if [info exists tabdup($e)] {
- catch {unset dupfmt }
- wokStore:Report:Fmtdup $FrigoName/$e $tabdup($e) dupfmt
- foreach u [lsort [array names dupfmt]] {
- puts " [lindex [split $u .] 0]:"
- foreach f $dupfmt($u) {
- puts " $f ($FrigoName/$e/${u}/${f})"
+proc wokPrepare:Report:Copy { intable wbpere wbfils {verbose 0} } {
+
+ upvar $intable table
+
+ set LST [lsort [array names table]]
+
+ set lpere [w_info -l $wbpere]
+
+ set writact {}
+
+ foreach e $LST {
+ regexp {(.*)\.(.*)} $e all udname type
+ if { [lsearch $lpere $udname] == -1 } {
+ ucreate -$type ${wbpere}:${udname}
+ }
+ set frigo [wokinfo -p source:. ${wbpere}:${udname}]
+ set localfiles [uinfo -lp -Tsource ${wbfils}:${udname}]
+ if [file exists $frigo] {
+ if [file writable $frigo] {
+ } else {
+ msgprint -c WOKVC -e "You cannot write in directory $frigo."
+ set error 1
+ }
+ } else {
+ msgprint -c WOKVC -e "Directory $frigo does not exists."
+ set error 1
+ }
+ foreach l $table($e) {
+ set str [wokUtils:LIST:Trim $l]
+ set flag [lindex $str 0]
+ set file [lindex $str 3]
+ set orig [lindex $str 4]
+ set path [file join $orig $file]
+
+ if { [wokStore:Report:FOK $orig/$file] } {
+ switch -- $flag {
+ - {
+ }
+ + {
+ if { [lsearch $localfiles $path] != -1 } {
+ msgprint -c WOKVC -i " Adding $file in unit ${wbpere}:${udname}"
+ lappend writact "wokUtils:FILES:copy $path $frigo/$file"
+ }
+ }
+ = {
+ }
+ # {
+ if { [lsearch $localfiles $path] != -1 } {
+ msgprint -c WOKVC -i " Updating $file in unit ${wbpere}:${udname}"
+ lappend writact "chmod 0644 $frigo/$file"
+ lappend writact "wokUtils:FILES:copy $path $frigo/$file"
+ }
+ }
+ >>> {
+ }
+ default {
+ msgprint -c WOKVC -w "Ignored line: $l"
}
}
+ } else {
+ msgprint -c WOKVC -w "Directory $file not processed."
+ set error 1
}
- } else {
- msgprint -c WOKVC -e "Bad entry ($e) found in report.list"
}
}
-}
-;#
-;# Queue -> Tar retourne 1 si OK tarfile n'est pas compresse
-;#
-proc wokStore:Queue:Tar { FrigoName tarfile } {
- set savpwd [pwd]
- cd $FrigoName
- set stat [wokUtils:EASY:tar tarfromroot $tarfile .]
- cd $savpwd
- return $stat
+ if ![ info exists error] {
+ foreach x $writact {
+ eval $x
+ }
+ } else {
+ msgprint -c WOKVC -e "Nothing was done."
+ }
+ return 1
}
;#
-;# Tar -> Queue retourne 1 si OK, tarfile est decompresse
+;# retourne la liste des UDs de table qui ne sont pas dans WB
+;# si cette liste est != {} il faut les creer.
;#
-proc wokStore:Queue:Untar { tarfile FrigoName {verbose 0} } {
- set tmpfrig [wokUtils:FILES:tmpname TMPFRIG]
- catch { exec rm -rf $tmpfrig } statrm
- catch { mkdir -path $tmpfrig } statmk
-
- if [file exists $tmpfrig] {
- set savpwd [pwd]
- cd $tmpfrig
- set stat [wokUtils:EASY:tar untar $tarfile]
- set ListReport [wokStore:Report:GetReportList $tmpfrig]
- set inx 0
- foreach e $ListReport {
- set label [getclock],[lindex [split $e ,] 1]
- if [catch { exec cp -rp $tmpfrig/$e $FrigoName/$label } status] {
- msgprint -c WOKVC -e "$status"
- } else {
- if { $verbose == 1 } {
- msgprint -c WOKVC -i "Report [incr inx] has been restored."
- }
- }
- }
- cd $savpwd
- catch { exec rm -rf $tmpfrig }
-
- if { $verbose == 1 } {
- msgprint -c WOKVC -i "A total of $inx reports has been restored."
+proc wokStore:Report:CheckUnits { lwb table } {
+ upvar $table TLOC
+ set lret {}
+ foreach u [array names TLOC] {
+ regexp {(.*)\.(.*)} $u all udname type
+ if { [lsearch $lwb $udname] != -1 } {
+ lappend lret $type $udname
}
- return $inx
- } else {
- return 0
}
+ return $lret
}
;#
-;# Parametres
;#
-#;>
-# Retourne le type de la base courante. {} sinon => utiliser ca pour savoir si il y en une !!
-#;<
-proc wokStore:Report:GetType { fshop {dump 0} } {
- set lvc [wokparam -l VC $fshop]
- if { $lvc != {} } {
- if { [lsearch -regexp $lvc %VC_TYPE=*] != -1 } {
- if { $dump } {
- foreach dir [wokparam -L $fshop] {
- if [file exists $dir/VC.edl] {
- msgprint -c WOKVC -i "Following definitions in file : $dir/VC.edl"
- break
- }
- }
- msgprint -c WOKVC -i "Repository root : [wokparam -e %VC_ROOT $fshop]"
- msgprint -c WOKVC -i "Repository type : [wokparam -e %VC_TYPE $fshop]"
- msgprint -c WOKVC -i "Default queue : [wokStore:Report:GetRootName $fshop]"
- msgprint -c WOKVC -i "Attached to : [wokIntegre:RefCopy:GetWB $fshop]\n"
-
- foreach nam $lvc {
- if [regsub {^%VC_} $nam {} msg] {
- set t [split $msg =]
- if { [lsearch {TYPE ROOT WBROOT DEFAULT EDL} [lindex $t 0] ] == -1 } {
- msgprint -c WOKVC -i "[lindex $t 0] : [lindex $t 1]"
- }
- }
- }
-
- }
- return [wokparam -e %VC_TYPE $fshop]
- } else {
- return {}
+;#
+proc wokStore:queue:ls { lwb } {
+ foreach wb $lwb {
+ if { [file exists [file join [wokinfo -p AdmDir:. [Sinfo -f]:[Sinfo -s]:$wb] VCDEF.tcl]] } {
+ wokStore:Report:SetQName [Sinfo -f]:[Sinfo -s]:$wb
+ msgprint -c WOKVC -i "Workbench $wb :"
+ msgprint -c WOKVC -i "Welcome new units ?: [wokIntegre:RefCopy:Welcome]"
+ msgprint -c WOKVC -i "Reports queue under [wokStore:Report:GetRootName]"
+ 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]"
+ puts ""
}
- } else {
- return {}
}
}
+;# memo :
+;# Pour faire pointer une file d'attente sur celle UpdateC31
+;# Parametres d'integration des anciennes bases.
+;#
+;# Workbench KAS:C30:UpdateC31
+;# wstore -create -wb :KAS:TEST:UpdateC31 -base /adv_11/KAS/C30/SCCS/BASES -type SCCS -queue /adv_11/KAS/C30/SCCS/adm/C30/FRIGO -counter /adv_11/KAS/C30/SCCS/adm/C30/report.num -journal /adv_11/KAS/C30/SCCS/adm/C30/wintegre.jnl
+;#
+;# 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
}
set result [concat $result $ll]
}
- foreach file [readdir $dir] {
+ foreach file [wokUtils:EASY:readdir $dir] {
set file $dir/$file
if [file isdirectory $file] {
set fileTail [file tail $file]
proc wokUtils:FILES:Intersect { ldir table } {
upvar $table TLOC
foreach r $ldir {
- foreach f [readdir $r] {
+ foreach f [wokUtils:EASY:readdir $r] {
if [info exists TLOC($f)] {
set l $TLOC($f)
} else {
foreach ptn $gblist {
set result [concat $result [glob -nocomplain -- $dir/$ptn]]
}
- foreach file [readdir $dir] {
+ foreach file [wokUtils:EASY:readdir $dir] {
set file $dir/$file
if [file isdirectory $file] {
set fileTail [file tail $file]
proc wokUtils:FILES:ls { dir {select all} } {
set l {}
if { [file exists $dir] } {
- foreach f [readdir $dir] {
+ foreach f [wokUtils:EASY:readdir $dir] {
set e [file extension $f]
switch -- $select {
all {
global tcl_platform
if { "$tcl_platform(platform)" == "unix" } {
if { [file exists $d] } {
- foreach f [readdir $d] {
+ foreach f [wokUtils:EASY:readdir $d] {
unlink -nocomplain $d/$f
}
rmdir -nocomplain $d
}
} elseif { "$tcl_platform(platform)" == "windows" } {
if { [file exists $d] } {
- foreach f [readdir $d] {
+ foreach f [wokUtils:EASY:readdir $d] {
file delete $d/$f
}
file delete $d
;#
proc wokUtils:EASY:seadir { dir } {
set l $dir
- foreach f [readdir $dir] {
+ foreach f [wokUtils:EASY:readdir $dir] {
if [file isdirectory $dir/$f] {
set l [concat $l [wokUtils:EASY:seadir $dir/$f]]
}
}
return
}
+;#
+;#
+;#
+proc wokUtils:EASY:readdir { dir } {
+ set l {}
+ foreach f [glob -nocomplain [file join $dir *]] {
+ lappend l [file tail $f]
+ }
+ return $l
+}
+