Skip to content

Commit

Permalink
portindex: generate PortIndex.quick if missing
Browse files Browse the repository at this point in the history
  • Loading branch information
jmroot committed Feb 8, 2024
1 parent 7d9e33a commit ac9fd35
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions src/port/portindex.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ if {[info exists outdir]} {
puts "Creating port index in $outdir"
set outpath [file join $outdir PortIndex]
# open old index for comparison
if {[file isfile $outpath] && [file isfile ${outpath}.quick]} {
if {[file isfile $outpath]} {
set oldmtime [file mtime $outpath]
set attrlist [list -permissions]
if {[getuid] == 0} {
Expand All @@ -407,13 +407,18 @@ if {[file isfile $outpath] && [file isfile ${outpath}.quick]} {
lappend oldattrs $attr [file attributes $outpath $attr]
}
set newest $oldmtime
if {![catch {set oldfd [open $outpath r]}] && ![catch {set quickfd [open ${outpath}.quick r]}]} {
if {![catch {set quicklist [read $quickfd]}]} {
foreach entry [split $quicklist "\n"] {
set qindex([lindex $entry 0]) [lindex $entry 1]
}
if {![catch {open $outpath r} oldfd]} {
set quicklist [list]
if {![file isfile ${outpath}.quick]} {
catch {set quicklist [mports_generate_quickindex ${outpath}]}
} elseif {![catch {open ${outpath}.quick r} quickfd]} {
catch {set quicklist [read $quickfd]}
close $quickfd
}
foreach entry [split $quicklist "\n"] {
set qindex([lindex $entry 0]) [lindex $entry 1]
}
close $quickfd
unset quicklist
}
} else {
set newest 0
Expand Down

0 comments on commit ac9fd35

Please sign in to comment.