Skip to content
Snippets Groups Projects
Commit 4c18b96a authored by zimoch's avatar zimoch
Browse files

*** empty log message ***

parent ffc63ea4
No related branches found
No related tags found
No related merge requests found
This diff is collapsed.
#!/usr/bin/tclsh
package require Tclx
set epicsversion 3.13
set global_context [scancontext create]
proc opendbd {name} {
global seachpatch
foreach dir $seachpatch {
if ![catch {
set file [open [file join $dir $name]]
}] {
return $file
}
}
return -code error "file $name not found"
}
scanmatch $global_context {^[ \t]*(#|%|$)} {
continue
}
scanmatch $global_context {include[ \t]+"(.*)"} {
global FileName
if [catch {
includeFile $global_context $matchInfo(submatch0)
} msg] {
puts stderr "ERROR: $msg in $FileName($matchInfo(handle)) line $matchInfo(linenum)"
exit 1
}
continue
}
scanmatch $global_context {include[ \t]+(.*)} {
if [catch {
includeFile $global_context $matchInfo(submatch0)
} msg] {
puts stderr "ERROR: $msg in $FileName($matchInfo(handle)) line $matchInfo(linenum)"
exit 1
}
continue
}
scanmatch $global_context {(registrar|variable|function)[ \t]*\(} {
global epicsversion
if {$epicsversion == 3.14} {puts $matchInfo(line)}
}
scanmatch $global_context {
puts $matchInfo(line)
}
proc includeFile {context name} {
global global_context FileName
set file [opendbd $name]
set FileName($file) $name
scanfile $context $file
close $file
}
if {[lindex $argv 0] == "-3.14"} {
set epicsversion 3.14
set argv [lreplace $argv 0 0]
}
set seachpatch {}
while {[lindex $argv 0] == "-I"} {
lappend seachpatch [lindex $argv 1]
set argv [lreplace $argv 0 1]
}
foreach filename $argv {
set file [open $filename]
set FileName($file) $filename
scanfile $global_context $file
close $file
}
#!/usr/bin/tclsh
if {[lindex $argv 0] == "-dep"} {
set depstyle 1
set argv [lrange $argv 1 end]
} else {
set depstyle 0
}
set installdir [lindex $argv 0]
set prerequisites {}
foreach filename [glob -nocomplain *.d] {
set file [open $filename]
set contents [read $file]
close $file
foreach word $contents {
set header [string trim $word]
if [string match $installdir/* $header] {
set file [open $header]
while {[regexp {^#define __(.*)Lib__ ([0-9]+\.[0-9]+)$} \
[gets $file] match lib version]} {
if $depstyle {
lappend prerequisites "$lib $version"
} else {
lappend prerequisites ${lib}Lib_$version
}
}
close $file
}
}
}
set prerequisites [lsort -unique $prerequisites]
puts [join $prerequisites "\n"]
#!/usr/bin/tclsh
package require Tclx
set global_context [scancontext create]
set file_context [scancontext create]
set skip_context [scancontext create]
scanmatch $global_context {^File: .*Up-to-date} {
set file [lindex $matchInfo(line) 1]
puts -nonewline stderr "checking $file: "
scanfile $file_context $matchInfo(handle)
if {![info exists major($file)]} {
puts stderr "revision $rev($file) not tagged => version test"
set version test
continue
}
puts stderr "revision $rev($file) tag $tag($file) => version $major($file).$minor($file).$patch($file)"
if {![info exists version]} {
set version $major($file).$minor($file).$patch($file)
} else {
if ![cequal $major($file).$minor($file).$patch($file) $version] {
set version test
continue
}
}
continue
}
scanmatch $global_context {^File: .*} {
set file [lindex $matchInfo(line) 1]
puts stderr "checking $file: [lrange $matchInfo(line) 3 end] => version test"
set version test
continue
}
scanmatch $global_context {^\? .*} {
set file [lindex $matchInfo(line) 1]
puts stderr "checking $file: not in cvs => version test"
set version test
continue
}
scanmatch $file_context {Working revision:} {
set rev($file) [lindex $matchInfo(line) 2]
}
scanmatch $file_context {Sticky Tag:.*_([0-9]+)_([0-9]+)_([0-9]+)[ \t]+\(revision: } {
set major($file) $matchInfo(submatch0)
set minor($file) $matchInfo(submatch1)
set patch($file) $matchInfo(submatch2)
set tag($file) "[lindex $matchInfo(line) 2] (sticky)"
scanfile $skip_context $matchInfo(handle)
return
}
scanmatch $file_context {Sticky Tag:.*_([0-9]+)_([0-9]+)[ \t]+\(revision: } {
set major($file) $matchInfo(submatch0)
set minor($file) $matchInfo(submatch1)
set patch($file) 0
set tag($file) "[lindex $matchInfo(line) 2] (sticky)"
scanfile $skip_context $matchInfo(handle)
return
}
scanmatch $file_context {_([0-9]+)_([0-9]+)(_([0-9]+))?[ \t]+\(revision: ([\.0-9]+)\)} {
if [cequal $rev($file) $matchInfo(submatch4)] {
set Major $matchInfo(submatch0)
set Minor $matchInfo(submatch1)
set Patch [expr $matchInfo(submatch3) + 0]
if {![info exists major($file)] ||
$Major>$major($file) ||
($Major==$major($file) && ($Minor>$minor($file)
|| ($Minor==$minor($file) && $Patch>$patch($file))))} {
set major($file) $Major
set minor($file) $Minor
set patch($file) $Patch
set tag($file) [lindex $matchInfo(line) 0]
}
}
}
scanmatch $skip_context {=================} {
return
}
scanmatch $file_context {=================} {
return
}
#cvs bug: calling cvs status for files in other directories spoils status information for local files.
#fix: make localfiles non-local: x -> ../dir/x
set dir ../[file tail [pwd]]
set files $dir
foreach file $argv {
if {[file tail $file] == $file} {
lappend files $dir/$file
} else {
lappend files $file
}
}
set cvsstatus [open "|cvs status -l -v $files 2>/dev/null"]
scanfile $global_context $cvsstatus
close $cvsstatus
if {![info exists version]} {set version test}
puts $version
#!/usr/bin/tclsh
package require Tclx
set dir [lindex $argv 0]
set ext [lindex $argv 1]
set names [lrange $argv 2 end]
if {![file isdirectory $dir]} exit
if {[lindex [file split $dir] 1] == "prod"} {
proc mklink {target link} {
global dir
puts "Linking $link -> $target"
puts "repository -H pc770 slink $target $dir/$link"
}
proc rmlink {link} {
}
} else {
proc mklink {target link} {
puts "Linking $link -> $target"
link -sym $target $link
}
proc rmlink {link} {
#puts "removing link $link"
file delete $link
}
}
cd $dir
foreach name $names {
set links [glob -nocomplain -type l $name-*$ext]
lappend links $name$ext
foreach file $links {
rmlink $file
}
set files [glob -nocomplain -types f $name-*$ext]
set files [lsort -decreasing -dictionary $files]
set oldmajor ""
set oldminor ""
set first 1
foreach file $files {
if {[regexp {(.*)-([0-9]+)\.([0-9]+)\.([0-9]+)(.*)} $file \
match head major minor patch tail] && \
$head == $name && $tail == $ext} {
if {$first} {
mklink $file $name$ext
set first 0
}
if {$major != $oldmajor} {
mklink $file $name-$major$ext
set oldmajor $major
set oldminor ""
}
if {$minor != $oldminor} {
mklink $file $name-$major.$minor$ext
set oldminor $minor
}
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment