︙ | | | ︙ | |
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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
|
#
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 [12]... }
if {![info exists fossilVersionPattern]} then {
set fossilVersionPattern {^This is fossil version [12]\.\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
# the current check-in identifier for the Fossil checkout.
#
variable fossilInfoCheckoutPattern; # DEFAULT: {^checkout:\s+... UTC$}
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
|
>
|
>
|
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
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
129
130
131
132
|
#
variable scriptDirectory; # DEFAULT: <scriptDir>
if {![info exists scriptDirectory]} then {
set scriptDirectory $pkgr_path
}
#
# NOTE: This is the name of the executable file used to invoke Fossil,
# possibly without a file extension.
#
variable fossilFileNameOnly; # DEFAULT: <unset>
if {![info exists fossilFileNameOnly]} then {
if {[isWindows]} then {
set fossilFileNameOnly fossil.exe
} else {
set fossilFileNameOnly fossil
}
}
#
# 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 {{${fossilFileNameOnly}} version}
}
#
# NOTE: The regular expression pattern used when attempting to verify
# that Fossil is installed.
#
variable fossilVersionPattern; # DEFAULT: {^This is fossil version [12]... }
if {![info exists fossilVersionPattern]} then {
set fossilVersionPattern {^This is fossil version [12]\.\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 \
{{${fossilFileNameOnly}} 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 \
{{${fossilFileNameOnly}} info --chdir {${directory}}}
}
#
# NOTE: The regular expression pattern used when attempting to extract
# the current check-in identifier for the Fossil checkout.
#
variable fossilInfoCheckoutPattern; # DEFAULT: {^checkout:\s+... UTC$}
|
︙ | | | ︙ | |
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
|
# 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}
}
#
# NOTE: The regular expression pattern used when attempting to verify
# that Fossil committed a set of files.
#
|
|
|
|
>
|
|
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
|
# 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 \
{{${fossilFileNameOnly}} 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 \
{{${fossilFileNameOnly}} 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 \
{{${fossilFileNameOnly}} commit -m {${comment}}\
--branch {${branch}} --user anonymous --chdir\
{${directory}} --no-prompt}
}
#
# NOTE: The regular expression pattern used when attempting to verify
# that Fossil committed a set of files.
#
|
︙ | | | ︙ | |
597
598
599
600
601
602
603
604
605
606
607
608
609
610
|
#
# NOTE: This procedure attempts to query the identifier of the Fossil
# checkout. There are no arguments. An empty string is returned if
# the information cannot be determined.
#
proc getCheckoutId {} {
variable fossilInfoCommand
variable fossilInfoCheckoutPattern
variable scriptDirectory
fossilMustBeInstalled
if {[isEagle]} then {
|
>
|
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
|
#
# NOTE: This procedure attempts to query the identifier of the Fossil
# checkout. There are no arguments. An empty string is returned if
# the information cannot be determined.
#
proc getCheckoutId {} {
variable fossilFileNameOnly
variable fossilInfoCommand
variable fossilInfoCheckoutPattern
variable scriptDirectory
fossilMustBeInstalled
if {[isEagle]} then {
|
︙ | | | ︙ | |
639
640
641
642
643
644
645
646
647
648
649
650
651
652
|
#
# NOTE: This procedure attempts to query the root directory of the Fossil
# checkout. There are no arguments. An empty string is returned if
# the information cannot be determined.
#
proc getCheckoutDirectory {} {
variable fossilInfoCommand
variable fossilInfoLocalRootPattern
variable scriptDirectory
fossilMustBeInstalled
if {[isEagle]} then {
|
>
|
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
|
#
# NOTE: This procedure attempts to query the root directory of the Fossil
# checkout. There are no arguments. An empty string is returned if
# the information cannot be determined.
#
proc getCheckoutDirectory {} {
variable fossilFileNameOnly
variable fossilInfoCommand
variable fossilInfoLocalRootPattern
variable scriptDirectory
fossilMustBeInstalled
if {[isEagle]} then {
|
︙ | | | ︙ | |
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
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
|
#
# 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
set message {
Cannot use Fossil: it does not appear to be installed.
Fossil may be downloaded from "https://www.fossil-scm.org/"
and then installed by copying the (single) Fossil binary to
a directory that lies somewhere along the executable search
path.
Alternatively, it may be possible to install Fossil via the
package management subsystem included with your operating
system.
}
if {[isEagle]} then {
if {[catch {
eval exec -nocarriagereturns -stdout output -stderr error \
$fossilVersionCommand
} result] == 0} then {
set result [appendArgs $output $error]
} else {
error $message
}
} else {
if {[catch {
eval exec $fossilVersionCommand
} result]} then {
error $message
}
}
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]
|
>
|
|
>
|
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
824
825
826
827
828
829
830
831
832
833
834
835
|
#
# 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 fossilFileNameOnly
variable fossilVersionCommand
variable fossilVersionPattern
set message {
Cannot use Fossil: it does not appear to be installed.
Fossil may be downloaded from "https://www.fossil-scm.org/"
and then installed by copying the (single) Fossil binary to
a directory that lies somewhere along the executable search
path.
Alternatively, it may be possible to install Fossil via the
package management subsystem included with your operating
system.
}
if {[isEagle]} then {
if {[catch {
eval exec -nocarriagereturns -stdout output -stderr error \
[subst $fossilVersionCommand]
} result] == 0} then {
set result [appendArgs $output $error]
} else {
error $message
}
} else {
if {[catch {
eval exec [subst $fossilVersionCommand]
} result]} then {
error $message
}
}
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
variable fossilFileNameOnly
fossilMustBeInstalled
verifyCheckoutDirectory
if {[isEagle]} then {
set directory [::PackageRepository::formatExecArgument \
$checkoutDirectory]
|
︙ | | | ︙ | |
841
842
843
844
845
846
847
848
849
850
851
852
853
854
|
#
# NOTE: This procedure attempts to verify that the checkout directory does
# belong to the correct project. There are no arguments. Non-zero
# is returned if the verification is successful.
#
proc verifyThisIsTheCorrectProject {} {
variable fossilInfoCommand
variable fossilInfoProjectCodePattern
variable projectCode
variable scriptDirectory
fossilMustBeInstalled
|
>
|
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
|
#
# NOTE: This procedure attempts to verify that the checkout directory does
# belong to the correct project. There are no arguments. Non-zero
# is returned if the verification is successful.
#
proc verifyThisIsTheCorrectProject {} {
variable fossilFileNameOnly
variable fossilInfoCommand
variable fossilInfoProjectCodePattern
variable projectCode
variable scriptDirectory
fossilMustBeInstalled
|
︙ | | | ︙ | |
884
885
886
887
888
889
890
891
892
893
894
895
896
897
|
#
# NOTE: This procedure attempts to verify that the checkout directory does
# belong to the correct branch. There are no arguments. Non-zero
# is returned if the verification is successful.
#
proc verifyThisIsTheCorrectBranch {} {
variable fossilInfoCommand
variable fossilInfoTagsPattern
variable scriptDirectory
fossilMustBeInstalled
if {[isEagle]} then {
|
>
|
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
|
#
# NOTE: This procedure attempts to verify that the checkout directory does
# belong to the correct branch. There are no arguments. Non-zero
# is returned if the verification is successful.
#
proc verifyThisIsTheCorrectBranch {} {
variable fossilFileNameOnly
variable fossilInfoCommand
variable fossilInfoTagsPattern
variable scriptDirectory
fossilMustBeInstalled
if {[isEagle]} then {
|
︙ | | | ︙ | |
927
928
929
930
931
932
933
934
935
936
937
938
939
940
|
#
# NOTE: This procedure attempts to change the branch for the checkout
# 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 \
|
>
|
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
|
#
# NOTE: This procedure attempts to change the branch for the checkout
# directory. There are no arguments. This procedure may raise
# script errors.
#
proc changeToTheCorrectBranch {} {
variable checkoutDirectory
variable fossilFileNameOnly
variable fossilUpdateCommand
fossilMustBeInstalled
verifyCheckoutDirectory
if {[isEagle]} then {
set directory [::PackageRepository::formatExecArgument \
|
︙ | | | ︙ | |
963
964
965
966
967
968
969
970
971
972
973
974
975
976
|
# 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]
|
>
|
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
|
# 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
variable fossilFileNameOnly
fossilMustBeInstalled
if {[isEagle]} then {
set directory [::PackageRepository::formatExecArgument \
$targetDirectory]
|
︙ | | | ︙ | |
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
|
# NOTE: This procedure attempts to stage the specified package files using
# Fossil. The fileNames argument is a list of (fully?) qualified
# local file names to stage.
#
proc stagePackageFiles { language version platform fileNames } {
variable checkoutDirectory
variable fossilAddCommand
::PackageDownloader::verifyLanguageAndVersion $language $version isClient
if {$isClient} then {
error "cannot stage files: client files must be committed directly"
}
|
>
|
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
|
# NOTE: This procedure attempts to stage the specified package files using
# Fossil. The fileNames argument is a list of (fully?) qualified
# local file names to stage.
#
proc stagePackageFiles { language version platform fileNames } {
variable checkoutDirectory
variable fossilAddCommand
variable fossilFileNameOnly
::PackageDownloader::verifyLanguageAndVersion $language $version isClient
if {$isClient} then {
error "cannot stage files: client files must be committed directly"
}
|
︙ | | | ︙ | |
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
|
# is the name of a scalar variable in the context of the immediate
# caller that will receive the resulting Fossil check-in identifier.
#
proc commitPackageFiles { package patchLevel language version varName } {
variable checkoutDirectory
variable fossilCommitCommand
variable fossilCommitPattern
fossilMustBeInstalled
verifyCheckoutDirectory
set branch [appendArgs pkg_ $package _ $patchLevel]
set comment [appendArgs \
|
>
|
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
|
# is the name of a scalar variable in the context of the immediate
# caller that will receive the resulting Fossil check-in identifier.
#
proc commitPackageFiles { package patchLevel language version varName } {
variable checkoutDirectory
variable fossilCommitCommand
variable fossilCommitPattern
variable fossilFileNameOnly
fossilMustBeInstalled
verifyCheckoutDirectory
set branch [appendArgs pkg_ $package _ $patchLevel]
set comment [appendArgs \
|
︙ | | | ︙ | |