Diff
Not logged in

Differences From Artifact [ca0c7be030]:

To Artifact [bbc0f7d2d2]:


18
19
20
21
22
23
24
25
26



27
28

29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47

48
49
50
51
52
53
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
133
134

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
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
209
210
211

212
213
214
215
216
217
218
219
220

221
222
223
224
225
226
227
228



229
230

231
232
233
234
235
236
237
238

239
240
241
242
243
244
245
18
19
20
21
22
23
24


25
26
27
28

29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47

48
49
50
51
52
53
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
133
134

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
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
209
210
211

212
213
214
215
216
217
218
219
220

221
222
223
224
225
226
227
228

229
230
231
232

233
234
235
236
237
238
239
240

241
242
243
244
245
246
247
248







-
-
+
+
+

-
+


















-
+









-
+









-
+













-
+









-
+









-
+











-
+









-
+










-
+










-
+









-
+










-
+









-
+










-
+










-
+












-
+








-
+







-
+
+
+

-
+







-
+







# NOTE: Use our own namespace here because even though we do not directly
#       support namespaces ourselves, we do not want to pollute the global
#       namespace if this script actually ends up being evaluated in Tcl.
#
namespace eval ::PackageUploader {
  #
  # NOTE: This procedure sets up the default values for all configuration
  #       parameters used by the package uploader client.  There are no
  #       arguments.
  #       parameters used by the package uploader client.  If the force
  #       argument is non-zero, any existing values will be overwritten
  #       and set back to their default values.
  #
  proc setupUploadVars {} {
  proc setupUploadVars { force } {
    #
    # NOTE: This variable must exist and must be the fully qualified path
    #       of the directory containing this script.
    #
    variable pkgr_path

    if {![info exists pkgr_path]} then {
      error [appendArgs \
          "required namespace variable \"" [namespace current] \
          "::pkgr_path\" does not exist"]
    }

    #
    # NOTE: The project code for the Fossil repository.  This will be checked
    #       prior to staging or committing any files.
    #
    variable projectCode; # DEFAULT: 9ceada8dbb8678898e5b2c05386e73b3ff2c2dec

    if {![info exists projectCode]} then {
    if {$force || ![info exists projectCode]} then {
      set projectCode 9ceada8dbb8678898e5b2c05386e73b3ff2c2dec
    }

    #
    # NOTE: What is the fully qualified path to the directory containing
    #       package client toolset?
    #
    variable scriptDirectory; # DEFAULT: <scriptDir>

    if {![info exists scriptDirectory]} then {
    if {$force || ![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 {$force || ![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 {
    if {$force || ![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 {
    if {$force || ![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 {
    if {$force || ![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 {
    if {$force || ![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 {
    if {$force || ![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$}

    if {![info exists fossilInfoCheckoutPattern]} then {
    if {$force || ![info exists fossilInfoCheckoutPattern]} then {
      set fossilInfoCheckoutPattern \
          {^checkout:\s+([0-9a-f]{40}) \d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2} UTC$}
    }

    #
    # NOTE: The regular expression pattern used when attempting to extract
    #       the root directory for the Fossil checkout.
    #
    variable fossilInfoLocalRootPattern; # DEFAULT: {^local-root:\s+(.*?)$}

    if {![info exists fossilInfoLocalRootPattern]} then {
    if {$force || ![info exists fossilInfoLocalRootPattern]} then {
      set fossilInfoLocalRootPattern {^local-root:\s+(.*?)$}
    }

    #
    # NOTE: The regular expression pattern used when attempting to verify
    #       that the Fossil checkout belongs to the correct project.
    #
    variable fossilInfoProjectCodePattern; # DEFAULT: {^project-code:\\s+...\$}

    if {![info exists fossilInfoProjectCodePattern]} then {
    if {$force || ![info exists fossilInfoProjectCodePattern]} then {
      set fossilInfoProjectCodePattern [appendArgs \
          {^project-code:\\s+${projectCode}\$}]
    }

    #
    # NOTE: The regular expression pattern used when attempting to verify
    #       that the Fossil checkout is sitting on the correct branch.
    #
    variable fossilInfoTagsPattern; # DEFAULT: {^tags:\s+trunk(?:,|$)}

    if {![info exists fossilInfoTagsPattern]} then {
    if {$force || ![info exists fossilInfoTagsPattern]} then {
      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 {
    if {$force || ![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 {
    if {$force || ![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 {
    if {$force || ![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.
    #
    variable fossilCommitPattern; # DEFAULT: {^New_Version: ([0-9a-f]{40,64})$}

    if {![info exists fossilCommitPattern]} then {
    if {$force || ![info exists fossilCommitPattern]} then {
      set fossilCommitPattern {^New_Version: ([0-9a-f]{40,64})$}
    }

    #
    # NOTE: Emit diagnostic messages when a new package is submitted?
    #
    variable verboseMetadataSubmit; # DEFAULT: false

    if {![info exists verboseMetadataSubmit]} then {
    if {$force || ![info exists verboseMetadataSubmit]} then {
      set verboseMetadataSubmit false
    }
  }

  #
  # NOTE: This procedure sets up the default values for all configuration
  #       parameters used by the package uploader client that require the
  #       location of the checkout directory.  There are no arguments.
  #       location of the checkout directory.  If the force argument is
  #       non-zero, any existing values will be overwritten and set back
  #       to their default values.
  #
  proc setupCheckoutVars {} {
  proc setupCheckoutVars { force } {
    #
    # NOTE: What is the fully qualified path to the root directory of the
    #       Fossil checkout containing the package client toolset?  This
    #       procedure may raise script errors.
    #
    variable checkoutDirectory; # DEFAULT: <checkoutDir>

    if {![info exists checkoutDirectory]} then {
    if {$force || ![info exists checkoutDirectory]} then {
      set checkoutDirectory [getCheckoutDirectory]
    }
  }

  #
  # NOTE: This procedure returns a string value, formatted for use within a
  #       script block being processed by the [string map] command.  The
1935
1936
1937
1938
1939
1940
1941
1942
1943


1944
1945
1946
1947
1948

1949
1950
1938
1939
1940
1941
1942
1943
1944


1945
1946
1947
1948
1949
1950

1951
1952
1953







-
-
+
+




-
+


  #       one or more of the variable setup in the next step.
  #
  ::PackageRepository::maybeReadSettingsFiles [info script]

  #
  # NOTE: Setup the variables, within this namespace, used by this package.
  #
  setupUploadVars
  setupCheckoutVars
  setupUploadVars false
  setupCheckoutVars false

  #
  # NOTE: Provide the package to the interpreter.
  #
  package provide Eagle.Package.Uploader 1.0.8
  package provide Eagle.Package.Uploader 1.0.9
}