Browse Source

punkcheck debugging - error out on duplicate FILEINFO record (same targets)

master
Julian Noble 3 months ago
parent
commit
a549c8eeb6
  1. 3
      src/bootsupport/modules/punk/tdl-0.1.0.tm
  2. 10
      src/bootsupport/modules/punkcheck-0.1.0.tm
  3. 3
      src/modules/punk/tdl-999999.0a1.0.tm
  4. 10
      src/modules/punkcheck-0.1.0.tm

3
src/bootsupport/modules/punk/tdl-0.1.0.tm

@ -50,8 +50,7 @@ namespace eval punk::tdl {
# $i invokehidden namespace delete {*}[$i invokehidden namespace children] # $i invokehidden namespace delete {*}[$i invokehidden namespace children]
$i alias unknown apply {{i tag args} { $i alias unknown apply {{i tag args} {
upvar 1 result result upvar 1 result result
set e [concat [list tag $tag]\ set e [concat [list tag $tag] [lrange $args 0 [expr {([llength $args] & ~1) - 1}]]]
[lrange $args 0 [expr {([llength $args] & ~1) - 1}]]]
if {[llength $args] % 2} { if {[llength $args] % 2} {
set saved $result set saved $result
set result {} set result {}

10
src/bootsupport/modules/punkcheck-0.1.0.tm

@ -2085,6 +2085,10 @@ namespace eval punkcheck {
foreach rec $record_list { foreach rec $record_list {
if {[dict get $rec tag] eq "FILEINFO"} { if {[dict get $rec tag] eq "FILEINFO"} {
set tgtlist [dict get $rec -targets] set tgtlist [dict get $rec -targets]
if {[dict exists $result $tgtlist]} {
#todo - warn - duplicate record for same targetlist - shouldn't happen as we should be using get_file_record to find existing records
error "punkcheck::recordlist::records_as_target_dict - multiple records with same targetlist '$tgtlist'"
}
dict set result $tgtlist $rec dict set result $tgtlist $rec
} }
} }
@ -2092,8 +2096,6 @@ namespace eval punkcheck {
} }
#will only match if same base was used.. and same targetlist #will only match if same base was used.. and same targetlist
proc get_file_record {targetlist record_list} { proc get_file_record {targetlist record_list} {
set posn 0 set posn 0
@ -2349,12 +2351,12 @@ namespace eval punkcheck {
} }
#extract new or existing filerecord for path given #extract new or existing filerecord for path given
#review - locking/concurrency #REVIEW - locking/concurrency
proc extract_or_create_fileset_record {relative_target_paths recordset} { proc extract_or_create_fileset_record {relative_target_paths recordset} {
set fetch_record_result [punkcheck::recordlist::get_file_record $relative_target_paths $recordset] set fetch_record_result [punkcheck::recordlist::get_file_record $relative_target_paths $recordset]
set existing_posn [dict get $fetch_record_result position] set existing_posn [dict get $fetch_record_result position]
if {$existing_posn == -1} { if {$existing_posn == -1} {
#puts stdout "NO existing record for $relative_target_paths" puts stdout "punkcheck NO existing record for $relative_target_paths"
set isnew 1 set isnew 1
set fileset_record [dict create tag FILEINFO -targets $relative_target_paths body {}] set fileset_record [dict create tag FILEINFO -targets $relative_target_paths body {}]
} else { } else {

3
src/modules/punk/tdl-999999.0a1.0.tm

@ -50,8 +50,7 @@ namespace eval punk::tdl {
# $i invokehidden namespace delete {*}[$i invokehidden namespace children] # $i invokehidden namespace delete {*}[$i invokehidden namespace children]
$i alias unknown apply {{i tag args} { $i alias unknown apply {{i tag args} {
upvar 1 result result upvar 1 result result
set e [concat [list tag $tag]\ set e [concat [list tag $tag] [lrange $args 0 [expr {([llength $args] & ~1) - 1}]]]
[lrange $args 0 [expr {([llength $args] & ~1) - 1}]]]
if {[llength $args] % 2} { if {[llength $args] % 2} {
set saved $result set saved $result
set result {} set result {}

10
src/modules/punkcheck-0.1.0.tm

@ -2085,6 +2085,10 @@ namespace eval punkcheck {
foreach rec $record_list { foreach rec $record_list {
if {[dict get $rec tag] eq "FILEINFO"} { if {[dict get $rec tag] eq "FILEINFO"} {
set tgtlist [dict get $rec -targets] set tgtlist [dict get $rec -targets]
if {[dict exists $result $tgtlist]} {
#todo - warn - duplicate record for same targetlist - shouldn't happen as we should be using get_file_record to find existing records
error "punkcheck::recordlist::records_as_target_dict - multiple records with same targetlist '$tgtlist'"
}
dict set result $tgtlist $rec dict set result $tgtlist $rec
} }
} }
@ -2092,8 +2096,6 @@ namespace eval punkcheck {
} }
#will only match if same base was used.. and same targetlist #will only match if same base was used.. and same targetlist
proc get_file_record {targetlist record_list} { proc get_file_record {targetlist record_list} {
set posn 0 set posn 0
@ -2349,12 +2351,12 @@ namespace eval punkcheck {
} }
#extract new or existing filerecord for path given #extract new or existing filerecord for path given
#review - locking/concurrency #REVIEW - locking/concurrency
proc extract_or_create_fileset_record {relative_target_paths recordset} { proc extract_or_create_fileset_record {relative_target_paths recordset} {
set fetch_record_result [punkcheck::recordlist::get_file_record $relative_target_paths $recordset] set fetch_record_result [punkcheck::recordlist::get_file_record $relative_target_paths $recordset]
set existing_posn [dict get $fetch_record_result position] set existing_posn [dict get $fetch_record_result position]
if {$existing_posn == -1} { if {$existing_posn == -1} {
#puts stdout "NO existing record for $relative_target_paths" puts stdout "punkcheck NO existing record for $relative_target_paths"
set isnew 1 set isnew 1
set fileset_record [dict create tag FILEINFO -targets $relative_target_paths body {}] set fileset_record [dict create tag FILEINFO -targets $relative_target_paths body {}]
} else { } else {

Loading…
Cancel
Save