Pārlūkot izejas kodu

Use proper terminology for macros ("macros", not "tokens")

Alois Mahdal 6 gadus atpakaļ
vecāks
revīzija
ea2642d531
4 mainītis faili ar 28 papildinājumiem un 28 dzēšanām
  1. 3
    3
      README.md
  2. 16
    16
      src/include/build.sh
  3. 1
    1
      src/include/vars.sh.skel
  4. 8
    8
      src/stub

+ 3
- 3
README.md Parādīt failu

@@ -42,7 +42,7 @@ Non-goals
42 42
     If you want to really build "serious" "big" stuff from hundreds of
43 43
     source files, MKit is probably not for you.  Nobody has ever tried
44 44
     to use it that way.  What MKit understands as "building" is just
45
-    replacing tokens in files.  (Some extensibility will  be added in
45
+    replacing macros in files.  (Some extensibility will  be added in
46 46
     future but scaling to huge things is not a priority for now.)
47 47
 
48 48
  *  Become a complete solution for building all your RPMs and DEBs.
@@ -186,7 +186,7 @@ features.  What you might want to do next:
186 186
     `make debstuff` under your belt).  You can use `utils/mkit/stub` script
187 187
     for that.
188 188
 
189
- *  Add tokens inside some of your scripts to include stuff known
189
+ *  Add macros inside some of your scripts to include stuff known
190 190
     only at install time (versions, paths...) so that your application
191 191
     can report --version as accurately as possible.
192 192
 
@@ -194,6 +194,6 @@ features.  What you might want to do next:
194 194
     and see how MKit handles versioning.
195 195
 
196 196
 MKit uses SemVer so version reflected in tarbal naming, packaging
197
-files and tokens contains enough data to track it back to actual commit.
197
+files and macros contains enough data to track it back to actual commit.
198 198
 This way you can safely distribute packages immediately to your testers
199 199
 and/or CI systems.

+ 16
- 16
src/include/build.sh Parādīt failu

@@ -26,21 +26,21 @@ __build1_ftype() {
26 26
     #
27 27
     local ftype=$1      # file/builder type
28 28
     case $ftype in
29
-        MKIT_COMMON)    __expand_tokens "tokens" ;;
30
-        rpmstuff)       __expand_tokens "tokens" "rpmstuff:tokens" ;;
31
-        debstuff)       __expand_tokens "tokens" "debstuff:tokens" ;;
29
+        MKIT_COMMON)    __expand_macros "macros" ;;
30
+        rpmstuff)       __expand_macros "macros" "rpmstuff:macros" ;;
31
+        debstuff)       __expand_macros "macros" "debstuff:macros" ;;
32 32
         *)              die "unknown file type: $ftype" ;;
33 33
     esac
34 34
 }
35 35
 
36
-__expand_tokens() {
36
+__expand_macros() {
37 37
     #
38
-    # Read stdin, expanding tokens from sections $@
38
+    # Read stdin, expanding macros from sections $@
39 39
     #
40 40
     local script        # sed script cache
41
-    local section       # each section to expand tokens from
42
-    local varname       # each token name
43
-    local varvalue      # each token value
41
+    local section       # each section to expand macros from
42
+    local varname       # each macro name
43
+    local varvalue      # each macro value
44 44
     script=$(mktemp --tmpdir mkit-tmp.XXXXXXXXXX)
45 45
     {
46 46
         for section in "$@"; do
@@ -63,7 +63,7 @@ __expand_tokens() {
63 63
         echo "s|__MKIT_PROJ_VERSION__|$(__cached semver | __qfs)|g;"
64 64
         echo "s|__MKIT_SELF_VERSION__|$MKIT_VERSION|g;"
65 65
     } >> "$script"
66
-    sed -f "$script" || die "__expand_tokens failed"
66
+    sed -f "$script" || die "__expand_macros failed"
67 67
     rm "$script"
68 68
 }
69 69
 
@@ -141,14 +141,14 @@ __rec_built() {
141 141
 
142 142
 _mkit_data() {
143 143
     #
144
-    # Build sampler showing all token values
144
+    # Build sampler showing all macro values
145 145
     #
146
-    local token
146
+    local macro
147 147
     local section
148 148
     local sections
149 149
     sections=()
150
-    ini lskeys tokens | grep -q . && sections=(tokens)
151
-    sections+=( $(ini lssect | grep ':tokens$') )
150
+    ini lskeys macros | grep -q . && sections=(macros)
151
+    sections+=( $(ini lssect | grep ':macros$') )
152 152
     {
153 153
         echo "(builtin):"
154 154
         echo "  x_MKIT_PROJ_NAME__ => '__MKIT_PROJ_NAME__'"
@@ -163,12 +163,12 @@ _mkit_data() {
163 163
         echo "  x_MKIT_SELF_VERSION__ => '__MKIT_SELF_VERSION__'"
164 164
         for section in "${sections[@]}"; do
165 165
             echo "$section:"
166
-            for token in $(ini lskeys "$section"); do
167
-                echo "  x${token:1} => '$token'"
166
+            for macro in $(ini lskeys "$section"); do
167
+                echo "  x${macro:1} => '$macro'"
168 168
             done
169 169
         done
170 170
     } \
171
-      | __expand_tokens "MKIT_BUILTIN" "${sections[@]}" \
171
+      | __expand_macros "MKIT_BUILTIN" "${sections[@]}" \
172 172
       | sed '/^  x/ s|x|_|'
173 173
 }
174 174
 

+ 1
- 1
src/include/vars.sh.skel Parādīt failu

@@ -51,7 +51,7 @@ MKIT_LOCAL=${MKIT_LOCAL:-.mkit}
51 51
 #
52 52
 # Package name
53 53
 #
54
-# Used as base for tarball and in some default tokens.
54
+# Used as base for tarball and in some default macros.
55 55
 #
56 56
 MKIT_PROJ_PKGNAME=""
57 57
 

+ 8
- 8
src/stub Parādīt failu

@@ -82,7 +82,7 @@ deploy() {
82 82
                 remake_section dist
83 83
                 remake_section ENV
84 84
                 remake_section roots
85
-                remake_section tokens
85
+                remake_section macros
86 86
                 remake_section modes
87 87
                 remake_section files
88 88
             else
@@ -112,7 +112,7 @@ deploy() {
112 112
                     echo "doc = [ENV:PREFIX]/share/doc/$PackageName"
113 113
                 } | reformat_section
114 114
                 echo ""
115
-                echo "[tokens]"
115
+                echo "[macros]"
116 116
                 {
117 117
                     echo "__${PackageName^^}_FOO__ = Barr.."
118 118
                 } | reformat_section
@@ -258,7 +258,7 @@ deploy() {
258 258
             echo "    machine should be uder 'src'."
259 259
             echo ""
260 260
             echo "    Note that during build time, files named ending with"
261
-            echo "    '.skel' are subject to token expansion, see mkit.ini"
261
+            echo "    '.skel' are subject to macro expansion, see mkit.ini"
262 262
             echo "    section below for details."
263 263
             echo ""
264 264
             echo " *  *notes* directory - here you shall store notes"
@@ -279,7 +279,7 @@ deploy() {
279 279
             echo " *  *packaging* directory contains templates that enable"
280 280
             echo "    MKit create raw stuffs used to create DEB or RPM"
281 281
             echo "    packages.  Similar to '.skel' files in 'src', all files"
282
-            echo "    here are automatically considered for token expansion,"
282
+            echo "    here are automatically considered for macro expansion,"
283 283
             echo "    no matter how they are named (see mkit.ini section"
284 284
             echo "    below)."
285 285
             echo ""
@@ -382,13 +382,13 @@ deploy() {
382 382
             echo "    \`[modes]\` section is your friend.  Permissions here"
383 383
             echo "    should be in UNIX octal format."
384 384
             echo ""
385
-            echo " 5. Next, \`[tokens]\` section allows you to define own"
385
+            echo " 5. Next, \`[macros]\` section allows you to define own"
386 386
             echo "    placeholders that will be replaced when your scripts are"
387 387
             echo "    built.  Each file in 'src' directory that is named with"
388 388
             echo "    '.skel' suffix, and each file from 'packaging' directory"
389
-            echo "    (no matter its name), can contain one or more of tokens"
390
-            echo "    defined here, plus range of tokens automatically defined"
391
-            echo "    by MKit.  During build, these tokens are replaced with"
389
+            echo "    (no matter its name), can contain one or more of macros"
390
+            echo "    defined here, plus range of macros automatically defined"
391
+            echo "    by MKit.  During build, these macros are replaced with"
392 392
             echo "    their actual values."
393 393
             echo ""
394 394
             echo " 6. Less interesting, but important section is \`[dist]\`,"