Diff
Not logged in

Differences From Artifact [120bac8f62]:

To Artifact [c16bb4baaf]:


634
635
636
637
638
639
640


































641
642
643
644
645
646
647
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







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








      set isClient true
    } else {
      error "unsupported language"
    }
  }

  #
  # NOTE: This procedure verifies the platform specified by the caller.  The
  #       platform argument must be an empty string -OR- one of the literal
  #       strings "win32-arm", "win32-x86", "win64-arm64", "win64-ia64", or
  #       "win64-x64".  An empty string means that the associated entity does
  #       not require a specific platform.  Upon failure, a script error will
  #       be raised.  The return value is undefined.
  #
  proc verifyPlatform { platform varName } {
    switch -exact -- $platform {
      "" {
        #
        # NOTE: This platform name is supported; however, the name needs
        #       to be normalized to "neutral".
        #
        if {[string length $varName] > 0} then {
          upvar 1 $varName newPlatform; set newPlatform neutral
        }
      }
      win32-arm -
      win32-x86 -
      win64-arm64 -
      win64-ia64 -
      win64-x64 {
        #
        # NOTE: This platform name is supported verbatim, do nothing.
        #
      }
      default {
        error "unsupported platform"
      }
    }
  }

  #
  # NOTE: This procedure issues a request to an HTTP(S) server.  It returns
  #       the raw response data verbatim.  It may raise a script error.  It
  #       will always use the currently configured HTTP(S) login cookie, if
  #       any; therefore, it should really only be used for requests to the
  #       package file server.  The uri argument is the fully qualified URI
  #       to request.
833
834
835
836
837
838
839
840
841
842
843
844









845
846
847

848
849
850
851
852

853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868

869


870
871
872


873
874
875
876
877
878
879
867
868
869
870
871
872
873





874
875
876
877
878
879
880
881
882
883
884

885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908

909
910
911
912

913
914
915
916
917
918
919
920
921







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


-
+





+
















+
-
+
+


-
+
+








  #
  # NOTE: This procedure checks if there is a higher version available of the
  #       specified package on the package file server.  The language argument
  #       must be one of the literal strings "eagle", "tcl", or "client".  The
  #       version argument must be one of the literal strings "8.4", "8.5", or
  #       "8.6" when the language is "tcl" -OR- the literal string "1.0" when
  #       the language is either "eagle" or "client".  The packageName argument
  #       is a directory name relative to the language and version-specific
  #       directory on the package file server and may be an empty string.  The
  #       usePgp argument should be non-zero when an OpenPGP signature file
  #       needs to be downloaded and verified for the downloaded file.
  #       the language is either "eagle" or "client".  The platform argument
  #       must be an empty string -OR- one of the literal strings "win32-arm",
  #       "win32-x86", "win64-arm64", "win64-ia64", or "win64-x64".  An empty
  #       string means that the associated package does not require a specific
  #       platform.  The packageName argument is a directory name relative to
  #       the language and version-specific directory on the package file
  #       server and may be an empty string.  The usePgp argument should be
  #       non-zero when an OpenPGP signature file needs to be downloaded and
  #       verified for the downloaded file.
  #
  # <public>
  proc checkForHigherVersion { language version packageName usePgp } {
  proc checkForHigherVersion { language version platform packageName usePgp } {
    variable clientDirectory
    variable persistentRootDirectory
    variable temporaryRootDirectory

    verifyLanguageAndVersion $language $version isClient
    verifyPlatform $platform platform

    set temporaryDirectory [file join \
        $temporaryRootDirectory [appendArgs \
        pkgd_ver_ [::PackageRepository::getUniqueSuffix]]]

    if {$isClient} then {
      set persistentDirectory $clientDirectory
    } else {
      verifyPersistentRootDirectory
      set persistentDirectory $persistentRootDirectory
    }

    set fileName [file join $packageName VERSION]
    set downloadFileName [file join $temporaryDirectory $fileName]

    file mkdir [file dirname $downloadFileName]

    downloadOneFile $language $version $fileName $downloadFileName $usePgp
    downloadOneFile $language $version $platform \
        $fileName $downloadFileName $usePgp

    if {$usePgp} then {
      downloadOneFile $language $version [appendArgs $fileName .asc] \
      downloadOneFile $language $version $platform \
          [appendArgs $fileName .asc] \
          [appendArgs $downloadFileName .asc] $usePgp
    }

    set localFileName [file join $persistentDirectory $fileName]

    set compare [package vcompare \
        [string trim [readFile $downloadFileName]] \
894
895
896
897
898
899
900
901
902
903
904
905
906










907
908


909
910
911
912
913
914
915
916
917

918
919
920
921
922
923
924
936
937
938
939
940
941
942






943
944
945
946
947
948
949
950
951
952
953

954
955
956
957
958
959
960
961
962
963

964
965
966
967
968
969
970
971







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

-
+
+








-
+







  #       verify the OpenPGP signatures.  When an OpenPGP signature file is
  #       downloaded, this procedure assumes the corresponding data file was
  #       already downloaded (i.e. since OpenPGP needs both to perform the
  #       signature checks).  The language argument must be one of the
  #       literal strings "eagle", "tcl", or "client".  The version argument
  #       must be one of the literal strings "8.4", "8.5", or "8.6" when the
  #       language is "tcl" -OR- the literal string "1.0" when the language
  #       is either "eagle" or "client".  The fileName argument is a file
  #       name relative to the language and version-specific directory on the
  #       package file server.  The localFileName argument is the file name
  #       where the downloaded file should be written.  The usePgp argument
  #       should be non-zero when an OpenPGP signature file needs to be
  #       downloaded and verified for the downloaded file.
  #       is either "eagle" or "client".  The platform argument must be an
  #       empty string -OR- one of the literal strings "win32-arm",
  #       "win32-x86", "win64-arm64", "win64-ia64", or "win64-x64".  An empty
  #       string means that the associated package does not require a specific
  #       platform.  The fileName argument is a file name relative to the
  #       language and version-specific directory on the package file server.
  #       The localFileName argument is the file name where the downloaded
  #       file should be written.  The usePgp argument should be non-zero when
  #       an OpenPGP signature file needs to be downloaded and verified for
  #       the downloaded file.
  #
  proc downloadOneFile { language version fileName localFileName usePgp } {
  proc downloadOneFile {
          language version platform fileName localFileName usePgp } {
    variable baseUri
    variable downloadUri
    variable downloadUrn

    #
    # NOTE: First, build the full relative file name to download from
    #       the remote package repository.
    #
    set fileName [file join $language $version $fileName]
    set fileName [file join $language $version $platform $fileName]
    set uri [subst $downloadUri]

    #
    # NOTE: Then, in one step, download the file from the package file
    #       server and write it to the specified local file.
    #
    writeFile $localFileName [getPackageFile $uri]
942
943
944
945
946
947
948




949
950
951
952
953
954
955
956
957
958
959
960












961
962
963

964
965
966
967
968
969

970
971
972
973
974
975
976
989
990
991
992
993
994
995
996
997
998
999












1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013

1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028







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


-
+






+







  #
  # NOTE: This procedure attempts to download a list of files, optionally
  #       persistening them for subsequent uses by the target language.
  #       The language argument must be one of the literal strings "eagle",
  #       "tcl", or "client".  The version argument must be one of the
  #       literal strings "8.4", "8.5", or "8.6" when the language is "tcl"
  #       -OR- the literal string "1.0" when the language is either "eagle"
  #       or "client".  The platform argument must be an empty string -OR-
  #       one of the literal strings "win32-arm", "win32-x86", "win64-arm64",
  #       "win64-ia64", or "win64-x64".  An empty string means that the
  #       associated package does not require a specific platform.  The
  #       or "client".  The fileNames argument must be a well-formed list
  #       of file names to download, each one relative to the language and
  #       version-specific directory on the package file server.  The
  #       options argument must be a dictionary of name/value pairs.  The
  #       -persistent option should be non-zero if the downloaded files
  #       should be saved to permanent storage for subsequent use.  The
  #       -usePgp option should be non-zero when an OpenPGP signature file
  #       needs to be downloaded and verified for each downloaded file.  The
  #       -useAutoPath option should be non-zero to modify the auto-path to
  #       include the temporary or persistent directories containing the
  #       downloaded files.  The -allowUpdate option should be non-zero to
  #       allow existing package files to be overwritten.
  #       fileNames argument must be a well-formed list of file names to
  #       download, each one relative to the language and version-specific
  #       directory on the package file server.  The options argument must
  #       be a dictionary of name/value pairs.  The -persistent option should
  #       be non-zero if the downloaded files should be saved to permanent
  #       storage for subsequent use.  The -usePgp option should be non-zero
  #       when an OpenPGP signature file needs to be downloaded and verified
  #       for each downloaded file.  The -useAutoPath option should be
  #       non-zero to modify the auto-path to include the temporary or
  #       persistent directories containing the downloaded files.  The
  #       -allowUpdate option should be non-zero to allow existing package
  #       files to be overwritten.
  #
  # <public>
  proc downloadFiles { language version fileNames options } {
  proc downloadFiles { language version platform fileNames options } {
    variable clientDirectory
    variable persistentRootDirectory
    variable temporaryRootDirectory
    variable viaInstall

    verifyLanguageAndVersion $language $version isClient
    verifyPlatform $platform platform

    set temporaryDirectory [file join \
        $temporaryRootDirectory [appendArgs \
        pkgd_lib_ [::PackageRepository::getUniqueSuffix]]]

    if {$isClient} then {
      set persistentDirectory $clientDirectory
1021
1022
1023
1024
1025
1026
1027

1028


1029
1030
1031
1032
1033
1034
1035


1036
1037
1038
1039
1040
1041
1042
1073
1074
1075
1076
1077
1078
1079
1080

1081
1082
1083
1084
1085
1086
1087
1088

1089
1090
1091
1092
1093
1094
1095
1096
1097







+
-
+
+






-
+
+







      if {[file exists $downloadFileName]} then {
        error [appendArgs \
            "temporary file name \"" $downloadFileName \
            "\" already exists"]
      }

      file mkdir [file dirname $downloadFileName]

      downloadOneFile $language $version $fileName $downloadFileName $usePgp
      downloadOneFile $language $version $platform \
          $fileName $downloadFileName $usePgp

      lappend downloadedFileNames [list \
          $fileNameOnly $directory(temporary) $directory(persistent)]

      if {$usePgp && \
          ![isOpenPgpSignatureFileName $downloadFileName true]} then {
        downloadOneFile $language $version [appendArgs $fileName .asc] \
        downloadOneFile $language $version $platform \
            [appendArgs $fileName .asc] \
            [appendArgs $downloadFileName .asc] $usePgp

        lappend downloadedFileNames [list \
            [appendArgs $fileNameOnly .asc] $directory(temporary) \
            $directory(persistent)]
      }
    }