Diff
Not logged in

Differences From Artifact [f9abe24483]:

To Artifact [514835c60a]:


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
103
104
105
106
107
108
    #
    variable scriptDirectory; # DEFAULT: <scriptDir>

    if {![info exists scriptDirectory]} then {
      set scriptDirectory $pkgr_path
    }





















    #
    # NOTE: The command to use when attempting to check for changes prior to
    #       staging files using Fossil.
    #
    variable fossilChangesCommand; # DEFAULT fossil changes ...

    if {![info exists fossilChangesCommand]} then {
      set fossilChangesCommand {fossil changes --chdir {${directory}}}
    }

    #
    # NOTE: The regular expression pattern used when attempting to verify
    #       that the Fossil checkout has no changes staged.  Generally, this
    #       pattern should only match an empty string.
    #
    variable fossilChangesPattern; # DEFAULT: {^$}

    if {![info exists fossilChangesPattern]} then {
      set fossilChangesPattern {^$}
    }

    #
    # NOTE: The command to use when attempting to check the checkout status
    #       prior to staging files using Fossil.
    #
    variable fossilInfoCommand; # DEFAULT fossil info ...

    if {![info exists fossilInfoCommand]} then {
      set fossilInfoCommand {fossil info --chdir {${directory}}}
    }

    #
    # NOTE: The regular expression pattern used when attempting to extract







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




|




















|







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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
    #
    variable scriptDirectory; # DEFAULT: <scriptDir>

    if {![info exists scriptDirectory]} then {
      set scriptDirectory $pkgr_path
    }

    #
    # NOTE: The command to use when attempting to verify that Fossil is
    #       available for use.
    #
    variable fossilVersionCommand; # DEFAULT: fossil version

    if {![info exists fossilVersionCommand]} then {
      set fossilVersionCommand {fossil version}
    }

    #
    # NOTE: The regular expression pattern used when attempting to verify
    #       that Fossil is installed.
    #
    variable fossilVersionPattern; # DEFAULT: {^This is fossil version 1\.\d+ }

    if {![info exists fossilVersionPattern]} then {
      set fossilVersionPattern {^This is fossil version 1\.\d+ }
    }

    #
    # NOTE: The command to use when attempting to check for changes prior to
    #       staging files using Fossil.
    #
    variable fossilChangesCommand; # DEFAULT: fossil changes ...

    if {![info exists fossilChangesCommand]} then {
      set fossilChangesCommand {fossil changes --chdir {${directory}}}
    }

    #
    # NOTE: The regular expression pattern used when attempting to verify
    #       that the Fossil checkout has no changes staged.  Generally, this
    #       pattern should only match an empty string.
    #
    variable fossilChangesPattern; # DEFAULT: {^$}

    if {![info exists fossilChangesPattern]} then {
      set fossilChangesPattern {^$}
    }

    #
    # NOTE: The command to use when attempting to check the checkout status
    #       prior to staging files using Fossil.
    #
    variable fossilInfoCommand; # DEFAULT: fossil info ...

    if {![info exists fossilInfoCommand]} then {
      set fossilInfoCommand {fossil info --chdir {${directory}}}
    }

    #
    # NOTE: The regular expression pattern used when attempting to extract
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
165
166
167
168
169
170
171
      set fossilInfoTagsPattern {^tags:\s+trunk(?:,|$)}
    }

    #
    # NOTE: The command to use when attempting to reset the checkout to the
    #       default branch prior to staging files using Fossil.
    #
    variable fossilUpdateCommand; # DEFAULT fossil update trunk ...

    if {![info exists fossilUpdateCommand]} then {
      set fossilUpdateCommand \
          {fossil update trunk --chdir {${directory}}}
    }

    #
    # NOTE: The command to use when attempting to stage package files using
    #       Fossil.
    #
    variable fossilAddCommand; # DEFAULT fossil add ...

    if {![info exists fossilAddCommand]} then {
      set fossilAddCommand \
          {fossil add --chdir {${directory}} {${fileName}}}
    }

    #
    # NOTE: The command to use when attempting to commit package files using
    #       Fossil.
    #
    variable fossilCommitCommand; # DEFAULT fossil commit ...

    if {![info exists fossilCommitCommand]} then {
      set fossilCommitCommand {fossil commit -m {${comment}}\
          --branch {${branch}} --user anonymous --chdir \
          {${directory}} --no-prompt}
    }








|










|










|







155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
      set fossilInfoTagsPattern {^tags:\s+trunk(?:,|$)}
    }

    #
    # NOTE: The command to use when attempting to reset the checkout to the
    #       default branch prior to staging files using Fossil.
    #
    variable fossilUpdateCommand; # DEFAULT: fossil update trunk ...

    if {![info exists fossilUpdateCommand]} then {
      set fossilUpdateCommand \
          {fossil update trunk --chdir {${directory}}}
    }

    #
    # NOTE: The command to use when attempting to stage package files using
    #       Fossil.
    #
    variable fossilAddCommand; # DEFAULT: fossil add ...

    if {![info exists fossilAddCommand]} then {
      set fossilAddCommand \
          {fossil add --chdir {${directory}} {${fileName}}}
    }

    #
    # NOTE: The command to use when attempting to commit package files using
    #       Fossil.
    #
    variable fossilCommitCommand; # DEFAULT: fossil commit ...

    if {![info exists fossilCommitCommand]} then {
      set fossilCommitCommand {fossil commit -m {${comment}}\
          --branch {${branch}} --user anonymous --chdir \
          {${directory}} --no-prompt}
    }

587
588
589
590
591
592
593


594
595
596
597
598
599
600
601
602
603
604
605
606


607
608
609
610
611
612
613
  #       the root directory of the Fossil checkout cannot be determined.
  #
  proc getCheckoutDirectory {} {
    variable fossilInfoCommand
    variable fossilInfoLocalRootPattern
    variable scriptDirectory



    if {[isEagle]} then {
      set directory [::PackageRepository::formatExecArgument \
          $scriptDirectory]

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


      if {[catch {
        eval exec [subst $fossilInfoCommand]
      } result]} then {
        return false
      }
    }








>
>













>
>







607
608
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
  #       the root directory of the Fossil checkout cannot be determined.
  #
  proc getCheckoutDirectory {} {
    variable fossilInfoCommand
    variable fossilInfoLocalRootPattern
    variable scriptDirectory

    fossilMustBeInstalled

    if {[isEagle]} then {
      set directory [::PackageRepository::formatExecArgument \
          $scriptDirectory]

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

      if {[catch {
        eval exec [subst $fossilInfoCommand]
      } result]} then {
        return false
      }
    }

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
    if {![file isdir $checkoutDirectory]} then {
      error [appendArgs \
          "checkout directory \"" $checkoutDirectory \
          "\" is not really a directory"]
    }
  }

































  #
  # NOTE: This procedure attempts to verify that the checkout directory does
  #       not contain any (stray) changes.  There are no arguments.  Non-zero
  #       is returned if the verification is successful.
  #
  proc verifyThereAreNoChanges {} {
    variable checkoutDirectory
    variable fossilChangesCommand
    variable fossilChangesPattern


    verifyCheckoutDirectory

    if {[isEagle]} then {
      set directory [::PackageRepository::formatExecArgument \
          $checkoutDirectory]

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


      if {[catch {
        eval exec [subst $fossilChangesCommand]
      } result]} then {
        return false
      }
    }








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










>















>
>







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
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
    if {![file isdir $checkoutDirectory]} then {
      error [appendArgs \
          "checkout directory \"" $checkoutDirectory \
          "\" is not really a directory"]
    }
  }

  #
  # NOTE: This procedure attempts to verify that an implementation of Fossil
  #       is installed locally.  There are no arguments.  Script errors are
  #       raised if any problems are found.  The return value is undefined.
  #
  proc fossilMustBeInstalled {} {
    variable fossilVersionCommand
    variable fossilVersionPattern

    if {[isEagle]} then {
      if {[catch {
        eval exec -nocarriagereturns -stdout output -stderr error \
            $fossilVersionCommand
      } result] == 0} then {
        set result [appendArgs $output $error]
      } else {
        error "cannot use Fossil: may not be installed and/or configured"
      }
    } else {
      if {[catch {
        eval exec $fossilVersionCommand
      } result]} then {
        error "cannot use Fossil: may not be installed and/or configured"
      }
    }

    if {![info exists result] || \
        ![regexp -- $fossilVersionPattern $result]} then {
      error "cannot use Fossil: unknown or unsupported version"
    }
  }

  #
  # NOTE: This procedure attempts to verify that the checkout directory does
  #       not contain any (stray) changes.  There are no arguments.  Non-zero
  #       is returned if the verification is successful.
  #
  proc verifyThereAreNoChanges {} {
    variable checkoutDirectory
    variable fossilChangesCommand
    variable fossilChangesPattern

    fossilMustBeInstalled
    verifyCheckoutDirectory

    if {[isEagle]} then {
      set directory [::PackageRepository::formatExecArgument \
          $checkoutDirectory]

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

      if {[catch {
        eval exec [subst $fossilChangesCommand]
      } result]} then {
        return false
      }
    }

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
  #
  proc verifyThisIsTheCorrectProject {} {
    variable fossilInfoCommand
    variable fossilInfoProjectCodePattern
    variable projectCode
    variable scriptDirectory



    if {[isEagle]} then {
      set directory [::PackageRepository::formatExecArgument \
          $scriptDirectory]

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


      if {[catch {
        eval exec [subst $fossilInfoCommand]
      } result]} then {
        return false
      }
    }








>
>













>
>







749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
  #
  proc verifyThisIsTheCorrectProject {} {
    variable fossilInfoCommand
    variable fossilInfoProjectCodePattern
    variable projectCode
    variable scriptDirectory

    fossilMustBeInstalled

    if {[isEagle]} then {
      set directory [::PackageRepository::formatExecArgument \
          $scriptDirectory]

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

      if {[catch {
        eval exec [subst $fossilInfoCommand]
      } result]} then {
        return false
      }
    }

728
729
730
731
732
733
734


735
736
737
738
739
740
741
742
743
744
745
746
747


748
749
750
751
752
753
754
  #       is returned if the verification is successful.
  #
  proc verifyThisIsTheCorrectBranch {} {
    variable fossilInfoCommand
    variable fossilInfoTagsPattern
    variable scriptDirectory



    if {[isEagle]} then {
      set directory [::PackageRepository::formatExecArgument \
          $scriptDirectory]

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


      if {[catch {
        eval exec [subst $fossilInfoCommand]
      } result]} then {
        return false
      }
    }








>
>













>
>







791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
  #       is returned if the verification is successful.
  #
  proc verifyThisIsTheCorrectBranch {} {
    variable fossilInfoCommand
    variable fossilInfoTagsPattern
    variable scriptDirectory

    fossilMustBeInstalled

    if {[isEagle]} then {
      set directory [::PackageRepository::formatExecArgument \
          $scriptDirectory]

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

      if {[catch {
        eval exec [subst $fossilInfoCommand]
      } result]} then {
        return false
      }
    }

765
766
767
768
769
770
771

772
773
774
775
776
777
778
779
780
781
782
783
784


785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803


804
805
806
807
808
809
810
811
812
813
814
815
816


817
818
819
820
821
822
823
  #       directory.  There are no arguments.  This procedure may raise
  #       script errors.
  #
  proc changeToTheCorrectBranch {} {
    variable checkoutDirectory
    variable fossilUpdateCommand


    verifyCheckoutDirectory

    if {[isEagle]} then {
      set directory [::PackageRepository::formatExecArgument \
          $checkoutDirectory]

      if {[catch {
        eval exec -success Success [subst $fossilUpdateCommand]
      } error]} then {
        error [appendArgs \
            "could not change branch: " $error]
      }
    } else {


      if {[catch {
        eval exec [subst $fossilUpdateCommand]
      } error]} then {
        error [appendArgs \
            "could not change branch: " $error]
      }
    }
  }

  #
  # NOTE: This procedure attempts to stage the specified package file using
  #       Fossil.  The targetDirectory argument is the fully qualified path
  #       to the package platform directory.  The fileName argument is the
  #       relative name of the file to be staged.  This procedure may raise
  #       script errors.
  #
  proc stageOnePackageFile { targetDirectory fileName } {
    variable fossilAddCommand



    if {[isEagle]} then {
      set directory [::PackageRepository::formatExecArgument \
          $targetDirectory]

      set fileName [::PackageRepository::formatExecArgument $fileName]

      if {[catch {
        eval exec -success Success [subst $fossilAddCommand]
      } error]} then {
        error [appendArgs \
            "could not stage file \"" $fileName "\": " $error]
      }
    } else {


      if {[catch {
        eval exec [subst $fossilAddCommand]
      } error]} then {
        error [appendArgs \
            "could not stage file \"" $fileName "\": " $error]
      }
    }







>













>
>



















>
>













>
>







832
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
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
  #       directory.  There are no arguments.  This procedure may raise
  #       script errors.
  #
  proc changeToTheCorrectBranch {} {
    variable checkoutDirectory
    variable fossilUpdateCommand

    fossilMustBeInstalled
    verifyCheckoutDirectory

    if {[isEagle]} then {
      set directory [::PackageRepository::formatExecArgument \
          $checkoutDirectory]

      if {[catch {
        eval exec -success Success [subst $fossilUpdateCommand]
      } error]} then {
        error [appendArgs \
            "could not change branch: " $error]
      }
    } else {
      set directory $checkoutDirectory

      if {[catch {
        eval exec [subst $fossilUpdateCommand]
      } error]} then {
        error [appendArgs \
            "could not change branch: " $error]
      }
    }
  }

  #
  # NOTE: This procedure attempts to stage the specified package file using
  #       Fossil.  The targetDirectory argument is the fully qualified path
  #       to the package platform directory.  The fileName argument is the
  #       relative name of the file to be staged.  This procedure may raise
  #       script errors.
  #
  proc stageOnePackageFile { targetDirectory fileName } {
    variable fossilAddCommand

    fossilMustBeInstalled

    if {[isEagle]} then {
      set directory [::PackageRepository::formatExecArgument \
          $targetDirectory]

      set fileName [::PackageRepository::formatExecArgument $fileName]

      if {[catch {
        eval exec -success Success [subst $fossilAddCommand]
      } error]} then {
        error [appendArgs \
            "could not stage file \"" $fileName "\": " $error]
      }
    } else {
      set directory $targetDirectory

      if {[catch {
        eval exec [subst $fossilAddCommand]
      } error]} then {
        error [appendArgs \
            "could not stage file \"" $fileName "\": " $error]
      }
    }
884
885
886
887
888
889
890

891
892
893
894
895
896
897
  #
  # <public>
  proc commitPackageFiles { package patchLevel language version varName } {
    variable checkoutDirectory
    variable fossilCommitCommand
    variable fossilCommitPattern


    verifyCheckoutDirectory

    set branch [appendArgs pkg_ $package _ $patchLevel]

    set comment [appendArgs \
        "Add package " $package " v" $patchLevel " for " $language \
        " v" $version .]







>







958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
  #
  # <public>
  proc commitPackageFiles { package patchLevel language version varName } {
    variable checkoutDirectory
    variable fossilCommitCommand
    variable fossilCommitPattern

    fossilMustBeInstalled
    verifyCheckoutDirectory

    set branch [appendArgs pkg_ $package _ $patchLevel]

    set comment [appendArgs \
        "Add package " $package " v" $patchLevel " for " $language \
        " v" $version .]
908
909
910
911
912
913
914


915
916
917
918
919
920
921
            [subst $fossilCommitCommand]
      } result] == 0} then {
        set result [appendArgs $output $error]
      } else {
        return false
      }
    } else {


      if {[catch {
        eval exec [subst $fossilCommitCommand]
      } result]} then {
        return false
      }
    }








>
>







983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
            [subst $fossilCommitCommand]
      } result] == 0} then {
        set result [appendArgs $output $error]
      } else {
        return false
      }
    } else {
      set directory $checkoutDirectory

      if {[catch {
        eval exec [subst $fossilCommitCommand]
      } result]} then {
        return false
      }
    }