Diff
Not logged in

Differences From Artifact [e66cb55376]:

To Artifact [46ce6d2906]:


105
106
107
108
109
110
111













112
113
114
115
116
117
118

      proc $procName $procArgs [appendArgs $procPreBody $procBody]

      return [uplevel 1 [list $procName] $args]
    }
  }














  #
  # NOTE: This procedure returns a formatted, possibly version-specific,
  #       package name, for use in logging.  The package argument is the
  #       name of the package.  The version argument is the version of the
  #       package.
  #
  proc formatPackageName { package version } {







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







105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131

      proc $procName $procArgs [appendArgs $procPreBody $procBody]

      return [uplevel 1 [list $procName] $args]
    }
  }

  #
  # NOTE: This procedure returns a string argument value, which may contain
  #       spaces, for use with the [exec] command.  The value argument is
  #       the string value to format as an [exec] argument.
  #
  proc formatExecArgument { value } {
    if {[isEagle]} then {
      return [appendArgs \" $value \"]
    } else {
      return $value
    }
  }

  #
  # NOTE: This procedure returns a formatted, possibly version-specific,
  #       package name, for use in logging.  The package argument is the
  #       name of the package.  The version argument is the version of the
  #       package.
  #
  proc formatPackageName { package version } {
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384




















































385
386
387
388
389
390
391
  #       file to verify.
  #
  # <public>
  proc verifyOpenPgpSignature { fileName } {
    variable openPgpVerifyCommand

    if {[isEagle]} then {
      set fileName [appendArgs \" $fileName \"]

      if {[catch {
        eval exec -success Success [subst $openPgpVerifyCommand]
      }] == 0} then {
        return true
      }
    } else {
      if {[catch {
        eval exec [subst $openPgpVerifyCommand] 2>@1
      }] == 0} then {
        return true
      }
    }





















































    return false
  }

  #
  # NOTE: This procedure attempts to import the OpenPGP keys contained in
  #       the specified (named) file.  Non-zero is only returned if the







|













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







377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
  #       file to verify.
  #
  # <public>
  proc verifyOpenPgpSignature { fileName } {
    variable openPgpVerifyCommand

    if {[isEagle]} then {
      set fileName [formatExecArgument $fileName]

      if {[catch {
        eval exec -success Success [subst $openPgpVerifyCommand]
      }] == 0} then {
        return true
      }
    } else {
      if {[catch {
        eval exec [subst $openPgpVerifyCommand] 2>@1
      }] == 0} then {
        return true
      }
    }

    return false
  }

  #
  # NOTE: This procedure returns the name of the file containing the OpenPGP
  #       passphrase.  This procedure is only used when creating an OpenPGP
  #       signature.  There are no arguments.
  #
  proc getOpenPgpPassphraseFile {} {
    global env

    if {[info exists env(GPG_PASSPHRASE_FILE)]} then {
      set fileName [file normalize $env(GPG_PASSPHRASE_FILE)]

      if {[file exists $fileName]} then {
        return $fileName
      } else {
        error "cannot sign with OpenPGP: passphrase file does not exist"
      }
    } else {
      error "cannot sign with OpenPGP: passphrase file is not configured"
    }
  }

  #
  # NOTE: This procedure attempts to create an OpenPGP signature for the
  #       specified (named) file.  Non-zero is only returned if the OpenPGP
  #       signature is created successfully.  A script error should not be
  #       raised by this procedure.  The fileName argument must be the fully
  #       qualified path and file name of the file to be signed.
  #
  # <public>
  proc createOpenPgpSignature { fileName } {
    global env
    variable openPgpSignCommand

    if {[isEagle]} then {
      set fileName [formatExecArgument $fileName]

      if {[catch {
        eval exec -success Success [subst $openPgpSignCommand]
      }] == 0} then {
        return true
      }
    } else {
      if {[catch {
        eval exec [subst $openPgpSignCommand] 2>@1
      }] == 0} then {
        return true
      }
    }

    return false
  }

  #
  # NOTE: This procedure attempts to import the OpenPGP keys contained in
  #       the specified (named) file.  Non-zero is only returned if the
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
    variable openPgpImportPattern

    if {[string length $varName] > 0} then {
      upvar 1 $varName result
    }

    if {[isEagle]} then {
      set fileName [appendArgs \" $fileName \"]

      if {[catch {
        eval exec -nocarriagereturns -stdout output -stderr error \
            [subst $openPgpImportCommand]
      } result] == 0} then {
        set result [appendArgs $output $error]
      } else {







|







467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
    variable openPgpImportPattern

    if {[string length $varName] > 0} then {
      upvar 1 $varName result
    }

    if {[isEagle]} then {
      set fileName [formatExecArgument $fileName]

      if {[catch {
        eval exec -nocarriagereturns -stdout output -stderr error \
            [subst $openPgpImportCommand]
      } result] == 0} then {
        set result [appendArgs $output $error]
      } else {
1948
1949
1950
1951
1952
1953
1954


















1955
1956
1957
1958
1959
1960
1961
    #       to the implementation of OpenPGP in use.
    #
    variable openPgpVerifyCommand; # DEFAULT: gpg2 --verify {${fileName}}

    if {![info exists openPgpVerifyCommand]} then {
      set openPgpVerifyCommand {gpg2 --verify {${fileName}}}
    }



















    #
    # NOTE: Verify that the package script matches the current language
    #       when called from the [package unknown] handler?
    #
    variable strictUnknownLanguage; # DEFAULT: true








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







2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
    #       to the implementation of OpenPGP in use.
    #
    variable openPgpVerifyCommand; # DEFAULT: gpg2 --verify {${fileName}}

    if {![info exists openPgpVerifyCommand]} then {
      set openPgpVerifyCommand {gpg2 --verify {${fileName}}}
    }

    #
    # NOTE: The command to use when creating OpenPGP signatures for the
    #       downloaded package scripts.  This must be configured according
    #       to the implementation of OpenPGP in use.
    #
    variable openPgpSignCommand; # DEFAULT: gpg2 --detach-sign ...

    if {![info exists openPgpSignCommand]} then {
      set openPgpSignCommand ""

      append openPgpSignCommand {gpg2 --detach-sign --armor}

      append openPgpSignCommand \
          { --passphrase-file [formatExecArgument [getOpenPgpPassphraseFile]]}

      append openPgpSignCommand { --batch --yes {${fileName}}}
    }

    #
    # NOTE: Verify that the package script matches the current language
    #       when called from the [package unknown] handler?
    #
    variable strictUnknownLanguage; # DEFAULT: true