]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Configure script internal cleanups. Factor out the superfluous proj-lshift_ and use...
authorstephan <stephan@noemail.net>
Tue, 25 Mar 2025 01:32:16 +0000 (01:32 +0000)
committerstephan <stephan@noemail.net>
Tue, 25 Mar 2025 01:32:16 +0000 (01:32 +0000)
FossilOrigin-Name: 1f98fc07fdf06d699ffbf1521b0b5e937a582017e4325bd994b488e06becbecc

autosetup/proj.tcl
manifest
manifest.uuid

index ae61ee3a9157e774d4087264e8f4357e0163ad0e..fdd5d5e346cd5c205624ad2549aa4afd28d088d4 100644 (file)
@@ -64,6 +64,7 @@ proc proj-warn {msg} {
   show-notices
   puts stderr "WARNING: $msg"
 }
+
 ########################################################################
 # @proj-error msg
 #
@@ -111,6 +112,7 @@ proc proj-bold {str} {
 # @proj-indented-notice ?-error? ?-notice? msg
 #
 # Takes a multi-line message and emits it with consistent indentation.
+# It does not perform any line-wrapping of its own.
 #
 # If the -notice flag it used then it emits using [user-notice], which
 # means its rendering will (A) go to stderr and (B) be delayed until
@@ -162,26 +164,6 @@ proc proj-is-cross-compiling {} {
   return [expr {[get-define host] ne [get-define build]}]
 }
 
-########################################################################
-# proj-lshift_ shifts $count elements from the list named $listVar
-# and returns them as a new list. On empty input, returns "".
-#
-# Modified slightly from: https://wiki.tcl-lang.org/page/lshift
-proc proj-lshift_ {listVar {count 1}} {
-  upvar 1 $listVar l
-  if {![info exists l]} {
-    # make the error message show the real variable name
-    error "can't read \"$listVar\": no such variable"
-  }
-  if {![llength $l]} {
-    # error Empty
-    return ""
-  }
-  set r [lrange $l 0 [incr count -1]]
-  set l [lreplace $l [set l 0] $count]
-  return $r
-}
-
 ########################################################################
 # @proj-strip-hash-comments value
 #
@@ -479,16 +461,16 @@ proc proj-opt-define-bool {args} {
   set invert 0
   if {[lindex $args 0] eq "-v"} {
     set invert 1
-    set args [lrange $args 1 end]
+    lassign $args - optName defName descr
+  } else {
+    lassign $args optName defName descr
   }
-  set optName [proj-lshift_ args]
-  set defName [proj-lshift_ args]
-  set descr [proj-lshift_ args]
   if {"" eq $descr} {
     set descr $defName
   }
+  puts "optName=$optName defName=$defName descr=$descr"
   set rc 0
-  msg-checking "$descr ... "
+  msg-checking "[join $descr] ... "
   if {[proj-opt-truthy $optName]} {
     if {0 eq $invert} {
       set rc 1
@@ -617,14 +599,28 @@ proc proj-file-content-list {fname} {
 }
 
 ########################################################################
-# @proj-file-write fname content
+# @proj-file-write ?-ro? fname content
 #
 # Works like autosetup's [writefile] but explicitly uses binary mode
-# to avoid EOL translation on Windows.
-proc proj-file-write {fname content} {
+# to avoid EOL translation on Windows. If $fname already exists, it is
+# overwritten, even if it's flagged as read-only.
+proc proj-file-write {args} {
+  if {"-ro" eq [lindex $args 0]} {
+    lassign $args ro fname content
+  } else {
+    set ro ""
+    lassign $args fname content
+  }
+  file delete -force -- $fname; # in case it's read-only
   set f [open $fname wb]
   puts -nonewline $f $content
   close $f
+  if {"" ne $ro} {
+    catch {
+      exec chmod -w $fname
+      #file attributes -w $fname; #jimtcl has no 'attributes'
+    }
+  }
 }
 
 ########################################################################
@@ -693,12 +689,17 @@ proc proj-make-from-dot-in {args} {
   }
   foreach f $filename {
     set f [string trim $f]
-    catch { exec chmod u+w $f }
+    if {[file exists $f]} {
+      catch { exec chmod u+w $f }
+    }
     make-template $f.in $f
     if {$touch} {
       proj-touch $f
     }
-    catch { exec chmod -w $f }
+    catch {
+      exec chmod -w $f
+      #file attributes -w $f; #jimtcl has no 'attributes'
+    }
   }
 }
 
@@ -1407,6 +1408,8 @@ proc proj-tclConfig-sh-to-autosetup {tclConfigSh} {
     TCL_PREFIX
     TCL_VERSION
   }
+  # Build a small shell script which proxies the $tclVars from
+  # $tclConfigSh into autosetup code...
   lappend shBody "if test x = \"x${tclConfigSh}\"; then"
   foreach v $tclVars {
     lappend shBody "$v= ;"
index dbe512c36e0ee9b535d00dd6fb9dbb0adb688a85..fd16d584a0abc1c971414a381b4c97e6c5811df7 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Clarify\sand\sreduce\sredundancy\sin\san\sassert()\sin\swalChecksumBytes().
-D 2025-03-24T23:08:40.014
+C Configure\sscript\sinternal\scleanups.\sFactor\sout\sthe\ssuperfluous\sproj-lshift_\sand\suse\slassign\sinstead.\sAdd\s-ro\sflag\sto\sproj-file-write.
+D 2025-03-25T01:32:16.183
 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
 F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d
@@ -50,7 +50,7 @@ F autosetup/cc.tcl c0fcc50ca91deff8741e449ddad05bcd08268bc31177e613a6343bbd1fd3e
 F autosetup/find_tclconfig.tcl e64886ffe3b982d4df42cd28ed91fe0b5940c2c5785e126c1821baf61bc86a7e
 F autosetup/jimsh0.c a57c16e65dcffc9c76e496757cb3f7fb47e01ecbd1631a0a5e01751fc856f049
 F autosetup/pkg-config.tcl 4e635bf39022ff65e0d5434339dd41503ea48fc53822c9c5bde88b02d3d952ba
-F autosetup/proj.tcl 4706741184076b3056356324727b7691e3b6877c84224fa05bbf7d804e895e55
+F autosetup/proj.tcl 8bf99398c20a440d197182f85aaa60a41f07248af779fea68c41df30e6da8546
 F autosetup/sqlite-config.tcl 85490e59fb374cf091765308eae96bb96cc85169af46d78e034f3766bdbd0523
 F autosetup/system.tcl 51d4be76cd9a9074704b584e5c9cbba616202c8468cf9ba8a4f8294a7ab1dba9
 F configure 9a00b21dfd13757bbfb8d89b30660a89ec1f8f3a79402b8f9f9b6fc475c3303a x
@@ -2215,8 +2215,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350
 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7
 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139
 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
-P 1dadea3a79c3edd110b0b32b07287744300958fed31f2da11901a42b16f86669
-R c08c05d83169d801717107adbed59c20
-U drh
-Z 6fb51dc820f4b9af99017fdaa2038941
+P 3c53abf5e6df446d569040042363265737aa10fc8aaa20b31c587100c557c5e7
+R 1bbb3c025ec1b46650981e453b29c862
+U stephan
+Z c139b7624e642b2a32a6648b4ac4392b
 # Remove this line to create a well-formed Fossil manifest.
index 36359607da4f3300c27b552fed2dc38e44cd1594..ce13eb13ea28afef70c4d7e783e991f7cbb52cba 100644 (file)
@@ -1 +1 @@
-3c53abf5e6df446d569040042363265737aa10fc8aaa20b31c587100c557c5e7
+1f98fc07fdf06d699ffbf1521b0b5e937a582017e4325bd994b488e06becbecc