System.Data.SQLite
Check-in [e100045f84]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Improvements to the master release archive verification tool.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: e100045f84e37bdb97d8dbf41051bf3e856c7016
User & Date: mistachkin 2014-11-24 21:34:14
Context
2014-11-24
22:03
Check for missing Fossil tool in the master release archive verification tool. check-in: 59d9761e66 user: mistachkin tags: trunk
21:34
Improvements to the master release archive verification tool. check-in: e100045f84 user: mistachkin tags: trunk
2014-11-19
23:09
Update SQLite core library to the 3.8.7.2 release. check-in: 919cb869dc user: mistachkin tags: trunk
Changes
Hide Diffs Unified Diffs Show Whitespace Changes Patch

Changes to Setup/verify.eagle.

10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
































25
26
27
28
29
30


















31
32
33
34
35










36
37
38
39
40
41
42
..
65
66
67
68
69
70
71















72
73
74
75
76
77
78
...
132
133
134
135
136
137
138



139
140
141
142
143
144



145
146
147
148
149
150
151



152
153
154
155
156
157



158
159
160
161
162
163
164
...
189
190
191
192
193
194
195




























































196
197
198
199
200
201
202
...
216
217
218
219
220
221
222
223
224
225
226
227
228
package require Eagle
 
proc usage { error } {
  if {[string length $error] > 0} then {puts stdout $error}

  puts stdout "usage:\
[file tail [info nameofexecutable]]\
[file tail [info script]] <directory>"

  #
  # NOTE: Indicate to the caller, if any, that we have failed.
  #
  exit 1
}
 
































set argc [llength $argv]

if {$argc == 1} then {
  set directory [lindex $argv 0]

  if {[string length $directory] > 0} then {


















    set exitCode 0

    set script [info script]
    set path [file dirname $script]
    set rootName [file rootname [file tail $script]]











    if {![info exists innounp]} then {
      if {[info exists env(InnoUnpackTool)]} then {
        set innounp $env(InnoUnpackTool)
      }

      if {![info exists innounp] || ![file exists $innounp]} then {
................................................................................
    }

    source [file join $path data [appendArgs $rootName .lst]]

    if {![array exists manifests]} then {
      usage "master archive manifest is missing"
    }
















    set archiveFileNames [list]

    foreach extension [list exe rar zip] {
      eval lappend archiveFileNames [findFilesRecursive \
          [file join $directory [appendArgs *. $extension]]]
    }
................................................................................
          lappend manifestFileNames $manifestFileName
        }
      }

      set listCommand [list]
      lappend listCommand exec -success Success -nocarriagereturns --




      if {[file extension $archiveFileName] eq ".zip"} then {
        if {![file exists $zip]} then {
          usage [appendArgs "tool \"" $zip "\" is missing"]
        }

        lappend listCommand $zip -Z -1 $archiveFileName



      } elseif {[file extension $archiveFileName] eq ".exe" && \
          [string match -nocase *Setup*.exe $manifest]} then {
        #
        # HACK: Assume this is an Inno Setup package and process
        #       it using the necessary external tool.
        #
        lappend listCommand $innounp -v $archiveFileName



      } else {
        if {![file exists $rar]} then {
          usage [appendArgs "tool \"" $rar "\" is missing"]
        }

        lappend listCommand $rar vb -- $archiveFileName



      }

      if {[catch {eval $listCommand} result] == 0} then {
        #
        # HACK: The Inno Setup unpacking tool requires some extra
        #       parsing logic to handle the output.
        #
................................................................................
            puts stdout [appendArgs \
                "ERROR: Archive \"" $archiveFileName \
                "\" missing file \"" $manifestFileName \
                "\" from manifest \"" $manifest "\"."]

            set exitCode 1
          }




























































        }

        foreach containedFileName $containedFileNames {
          #
          # TODO: Should we use -nocase here because Windows
          #       is the primary release platform?
          #
................................................................................
            $archiveFileName "\", error: " $result]

        set exitCode 1
      }
    }

    exit $exitCode
  } else {
    usage "invalid directory"
  }
} else {
  usage ""
}







|







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>


|


|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>





>
>
>
>
>
>
>
>
>
>







 







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







 







>
>
>






>
>
>







>
>
>






>
>
>







 







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







 







<
<
<



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
...
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
...
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
...
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
...
363
364
365
366
367
368
369



370
371
372
package require Eagle
 
proc usage { error } {
  if {[string length $error] > 0} then {puts stdout $error}

  puts stdout "usage:\
[file tail [info nameofexecutable]]\
[file tail [info script]] <directory> <withHashes>"

  #
  # NOTE: Indicate to the caller, if any, that we have failed.
  #
  exit 1
}
 
proc getSha1Hashes { varName } {
  variable fossil

  upvar 1 $varName hashes

  set data [exec -success Success -nocarriagereturns -- \
      $fossil artifact current]

  set result 0
  set lines [split $data \n]

  foreach line $lines {
    if {[string range $line 0 1] eq "F "} then {
      set fields [split $line " "]

      if {[llength $fields] >= 3} then {
        set hashes([lindex $fields 1]) [lindex $fields 2]
        incr result
      }
    }
  }

  return $result
}
 
proc getSha1Sum { fileName } {
  variable fossil

  return [string range [exec -success Success -nocarriagereturns \
      -trimall -- $fossil sha1sum $fileName] 0 39]
}
 
set argc [llength $argv]

if {$argc == 2} then {
  set directory [lindex $argv 0]

  if {[string length $directory] == 0} then {
    usage "invalid directory specified"
  }

  if {![file isdirectory $directory]} then {
    usage [appendArgs \
        "directory \"" $directory "\" does not exist"]
  }

  set withHashes [lindex $argv 1]

  if {[string length $withHashes] == 0} then {
    usage "invalid \"withHashes\" flag specified"
  }

  if {![string is boolean -strict $withHashes]} then {
    usage "bad \"withHashes\" flag, not a boolean"
  }

  set exitCode 0

  set script [info script]
  set path [file dirname $script]
  set rootName [file rootname [file tail $script]]

  if {![info exists fossil]} then {
    if {[info exists env(FossilTool)]} then {
      set fossil $env(FossilTool)
    }

    if {![info exists fossil] || ![file exists $fossil]} then {
      set fossil [file join $path fossil.exe]
    }
  }

  if {![info exists innounp]} then {
    if {[info exists env(InnoUnpackTool)]} then {
      set innounp $env(InnoUnpackTool)
    }

    if {![info exists innounp] || ![file exists $innounp]} then {
................................................................................
  }

  source [file join $path data [appendArgs $rootName .lst]]

  if {![array exists manifests]} then {
    usage "master archive manifest is missing"
  }

  package require Eagle.Test; set extractDirectory [getTemporaryPath]

  if {[string length $extractDirectory] == 0} then {
    usage "no extract directory is available"
  }

  if {![file isdirectory $extractDirectory]} then {
    usage [appendArgs \
        "extract directory \"" $extractDirectory "\" does not exist"]
  }

  if {[getSha1Hashes hashes] == 0} then {
    usage "no repository hashes are available"
  }

  set archiveFileNames [list]

  foreach extension [list exe rar zip] {
    eval lappend archiveFileNames [findFilesRecursive \
        [file join $directory [appendArgs *. $extension]]]
  }
................................................................................
        lappend manifestFileNames $manifestFileName
      }
    }

    set listCommand [list]
    lappend listCommand exec -success Success -nocarriagereturns --

    set extractCommand [list]
    lappend extractCommand exec -success Success -nocarriagereturns --

    if {[file extension $archiveFileName] eq ".zip"} then {
      if {![file exists $zip]} then {
        usage [appendArgs "tool \"" $zip "\" is missing"]
      }

      lappend listCommand $zip -Z -1 $archiveFileName

      lappend extractCommand $zip -j -o $archiveFileName \
          \"%fileName%\" -d \"%directory%\"
    } elseif {[file extension $archiveFileName] eq ".exe" && \
        [string match -nocase *Setup*.exe $manifest]} then {
      #
      # HACK: Assume this is an Inno Setup package and process
      #       it using the necessary external tool.
      #
      lappend listCommand $innounp -v $archiveFileName

      lappend extractCommand $innounp -x -e -y \"-d%directory%\" \
          $archiveFileName \"%fileName%\"
    } else {
      if {![file exists $rar]} then {
        usage [appendArgs "tool \"" $rar "\" is missing"]
      }

      lappend listCommand $rar vb -- $archiveFileName

      lappend extractCommand $rar x -ep -y -- $archiveFileName \
          \"%fileName%\" \"%directory%\"
    }

    if {[catch {eval $listCommand} result] == 0} then {
      #
      # HACK: The Inno Setup unpacking tool requires some extra
      #       parsing logic to handle the output.
      #
................................................................................
          puts stdout [appendArgs \
              "ERROR: Archive \"" $archiveFileName \
              "\" missing file \"" $manifestFileName \
              "\" from manifest \"" $manifest "\"."]

          set exitCode 1
        }

        #
        # NOTE: Skip checking SHA1 hashes if it was not requested on the
        #       command line.
        #
        if {!$withHashes} then {
          continue
        }

        #
        # HACK: For now, only verify SHA1 hashes for those files present
        #       in the repository.
        #
        if {![string match -nocase -- *Source* $archiveFileName]} then {
          continue
        }

        set extractCommandMap [list \
            %fileName% [file nativename $manifestFileName] \
            %directory% [file nativename $extractDirectory]]

        set extractFileName [file join \
            $extractDirectory [file tail $manifestFileName]]

        catch {
          file attributes $extractFileName -readonly false
          file delete $extractFileName
        }

        try {
          if {[catch {eval [string map \
              $extractCommandMap $extractCommand]} result] == 0} then {
            if {[info exists hashes($manifestFileName)]} then {
              set hash [getSha1Sum $extractFileName]

              if {$hash ne $hashes($manifestFileName)} then {
                puts stdout [appendArgs \
                    "ERROR: Archive \"" $archiveFileName \
                    "\" file \"" $manifestFileName \
                    "\" repository hash mismatch, have \"" \
                    $hash "\", want \"" $hashes($manifestFileName) \
                    "\"."]

                set exitCode 1
              }
            } else {
              puts stdout [appendArgs \
                  "ERROR: Archive \"" $archiveFileName \
                  "\" file \"" $manifestFileName \
                  "\" has no repository hash."]

              set exitCode 1
            }
          }
        } finally {
          catch {
            file attributes $extractFileName -readonly false
            file delete $extractFileName
          }
        }
      }

      foreach containedFileName $containedFileNames {
        #
        # TODO: Should we use -nocase here because Windows
        #       is the primary release platform?
        #
................................................................................
          $archiveFileName "\", error: " $result]

      set exitCode 1
    }
  }

  exit $exitCode



} else {
  usage ""
}

Changes to www/release.wiki.

318
319
320
321
322
323
324
325
326
327
328
329
330
331
332

  <li>Change the current directory to &quot;&lt;root&gt;\Setup&quot;.</li>

  <li>
    Enter the following command to build all the source release packages:
    <br />
    <br />
    <b>..\Externals\Eagle\bin\EagleShell.exe -file verify.eagle Output</b>
    <br />
    <br />
    <i>If errors are generated, the file
    &quot;&lt;root&gt;\Setup\data\verify.lst&quot; may need to be updated to
    account for the files that have been added and/or removed from the release
    archives since the previous release.</i>
  </li>







|







318
319
320
321
322
323
324
325
326
327
328
329
330
331
332

  <li>Change the current directory to &quot;&lt;root&gt;\Setup&quot;.</li>

  <li>
    Enter the following command to build all the source release packages:
    <br />
    <br />
    <b>..\Externals\Eagle\bin\EagleShell.exe -file verify.eagle Output true</b>
    <br />
    <br />
    <i>If errors are generated, the file
    &quot;&lt;root&gt;\Setup\data\verify.lst&quot; may need to be updated to
    account for the files that have been added and/or removed from the release
    archives since the previous release.</i>
  </li>