Diff
Not logged in

Differences From Artifact [f6f8c2af9a]:

To Artifact [e647b537ea]:


609
610
611
612
613
614
615


























616
617
618
619
620
621
622
623
624
625
626

627
628
629
630
631
632
633




634
635



636
637

638
639
640
641
642

643
644

645




646
647
648
649
650
651
652
653
654
655
656
657













658
659

660
661

662




663
664
665
666
667
668
669
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664


665
666
667
668

669
670
671
672
673

674
675

676
677
678
679
680
681
682
683
684
685
686
687
688
689
690



691
692
693
694
695
696
697
698
699
700
701
702
703
704

705
706

707
708
709
710
711
712
713
714
715
716
717
718
719







+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+











+







+
+
+
+
-
-
+
+
+

-
+




-
+

-
+

+
+
+
+









-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+

-
+

-
+

+
+
+
+







        error "cannot sign with OpenPGP: passphrase file does not exist"
      }
    } else {
      error "cannot sign with OpenPGP: passphrase file is not configured"
    }
  }

  #
  # NOTE: This procedure returns a list of the same size as the list argument
  #       value.  Each element will have one pair of surrounding double quote
  #       characters removed -IF- they are the first and last non-whitespace
  #       character of that element.  A script error should not be raised by
  #       this procedure.
  #
  proc dequoteList { list } {
    set result [list]

    foreach element $list {
      set trimElement [string trim $element]
      set trimLength [string length $trimElement]

      if {$trimLength >= 2 && \
          [string index $trimElement 0] eq "\"" && \
          [string index $trimElement end] eq "\""} then {
        lappend result [string range $trimElement 1 end-1]
      } else {
        lappend result $element; # verbatim
      }
    }

    return $result
  }

  #
  # NOTE: This procedure attempts to create a Harpy (script) certificate for
  #       the specified (named) file.  Non-zero is only returned if the Harpy
  #       (script) certificate 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.  This
  #       procedure assumes that the Harpy package for Eagle is installed and
  #       ready for use (i.e. it can find a valid license certificate).
  #
  # <internal>
  proc createHarpyCertificate { fileName } {
    global env
    variable harpySignCommand
    variable pkgr_harpy_path

    set toolFileName \
        [file nativename [file join $pkgr_harpy_path sign.eagle]]

    set scriptFileName [file nativename $fileName]

    if {[info exists env(PKGR_VENDOR)]} then {
      set vendor $env(PKGR_VENDOR); # NOTE: Configured default.
    } else {
    set vendor "Mistachkin Systems"; # NOTE: System default.

      set vendor "Mistachkin Systems"; # NOTE: System default.
    }

    if {[isEagle]} then {
      set shellFileName [formatExecArgument [info nameofexecutable]]
      set runtimeCommandLine [getRuntimeCommandLine [getShellExecutableName]]
      set toolFileName [formatExecArgument $toolFileName]
      set scriptFileName [formatExecArgument $scriptFileName]
      set vendor [formatExecArgument $vendor]

      if {[catch {
      if {[set code [catch {
        eval exec -success Success [subst $harpySignCommand]
      }] == 0} then {
      } error]] == 0} then {
        return true
      } else {
        pkgLog [appendArgs \
            "Harpy certificate was not created (from Eagle): " \
            [formatResult $code $error]]
      }
    } else {
      #
      # HACK: Make sure that Eagle is loaded into this process so that we
      #       can figure out the shell for it and then [exec] out to that
      #       shell.
      #
      makeEagleReady

      set shellFileName [eagle {
        file join [file dirname [lindex [info assembly] end]] EagleShell.exe
      }]
      set runtimeCommandLine [dequoteList [eagle {
        apply [list [list] {
          set directory [file dirname [lindex [info assembly] end]]

          foreach fileNameOnly [list EagleShell.dll EagleShell.exe] {
            set fileName [file join $directory $fileNameOnly]

            if {[file exists $fileName]} then {
              return [getRuntimeCommandLine $fileName]
            }
          }
        }]
      }]]

      if {[catch {
      if {[set code [catch {
        eval exec [subst $harpySignCommand] 2>@1
      } result] == 0} then {
      } error]] == 0} then {
        return true
      } else {
        pkgLog [appendArgs \
            "Harpy certificate was not created (from Tcl): " \
            [formatResult $code $error]]
      }
    }

    return false
  }

  #
2541
2542
2543
2544
2545
2546
2547
2548

2549
2550
2551
2552
2553
2554
2555
2591
2592
2593
2594
2595
2596
2597

2598
2599
2600
2601
2602
2603
2604
2605







-
+







    #       package scripts.
    #
    variable harpySignCommand; # DEFAULT: {${shellFileName}} -file ...

    if {$force || ![info exists harpySignCommand]} then {
      set harpySignCommand ""

      append harpySignCommand {{${shellFileName}}}
      append harpySignCommand {${runtimeCommandLine}}
      append harpySignCommand { -noArgumentsFileName -file {${toolFileName}}}
      append harpySignCommand { {${scriptFileName}} {${vendor}}}
    }

    #
    # NOTE: Verify that the package script matches the current language
    #       when called from the [package unknown] handler?