Browse Source

Update own dogfood

Alois Mahdal 7 years ago
parent
commit
1057dc12c0

+ 7
- 9
utils/mkit/include/build.sh View File

17
     test -n "$ftype"    || ftype=$(_guess_ftype "$dstpath")
17
     test -n "$ftype"    || ftype=$(_guess_ftype "$dstpath")
18
     debug_var srcpath dstpath ftype
18
     debug_var srcpath dstpath ftype
19
     <"$srcpath" _build1_ftype "$ftype" >"$dstpath"
19
     <"$srcpath" _build1_ftype "$ftype" >"$dstpath"
20
-    mkdir -p "$MKIT_LOCAL"
21
-    echo "$dstpath" >> "$MKIT_LOCAL/built.lst"
20
+    rec_built "$dstpath"
22
 }
21
 }
23
 
22
 
24
 _build1_ftype() {
23
 _build1_ftype() {
120
     # Add meat to all skeletons
119
     # Add meat to all skeletons
121
     #
120
     #
122
     local srcpath   # each source path
121
     local srcpath   # each source path
123
-    find -type f -name '*.skel' \
122
+    semver >/dev/null
123
+    find . -type f -name '*.skel' \
124
      | while read -r srcpath; do
124
      | while read -r srcpath; do
125
            _build1 "$srcpath"
125
            _build1 "$srcpath"
126
        done
126
        done
137
           | while read -r manfile; do
137
           | while read -r manfile; do
138
                 mdfile="$manfile.md"
138
                 mdfile="$manfile.md"
139
                 ronn -r "$mdfile"
139
                 ronn -r "$mdfile"
140
-                mkdir -p "$MKIT_LOCAL"
141
-                echo "$manfile" >> "$MKIT_LOCAL/built.lst"
140
+                rec_built "$manfile"
142
             done
141
             done
143
     else
142
     else
144
         echo "ronn is not installed"
143
         echo "ronn is not installed"
174
     mv "${MKIT_PROJ_PKGNAME}-$version.tar.gz" \
173
     mv "${MKIT_PROJ_PKGNAME}-$version.tar.gz" \
175
        "${MKIT_PROJ_PKGNAME}_$version.orig.tar.gz" \
174
        "${MKIT_PROJ_PKGNAME}_$version.orig.tar.gz" \
176
      || die "could not rename tarball"
175
      || die "could not rename tarball"
177
-    echo "${MKIT_PROJ_PKGNAME}_$version.orig.tar.gz" >> "$MKIT_LOCAL/built.lst"
176
+    rec_built "${MKIT_PROJ_PKGNAME}_$version.orig.tar.gz"
178
 
177
 
179
     # read content of each mandatory file from debian_skel
178
     # read content of each mandatory file from debian_skel
180
     #
179
     #
188
             mkdir -p "$(dirname "$dftgt")"
187
             mkdir -p "$(dirname "$dftgt")"
189
             _build1 "$dfsrc" "$dftgt" debstuff
188
             _build1 "$dfsrc" "$dftgt" debstuff
190
         done
189
         done
191
-    echo debian >> "$MKIT_LOCAL/built.lst"
190
+    rec_built debian
192
 }
191
 }
193
 
192
 
194
 dist() {
193
 dist() {
211
     echo -n "$git_lasthash" > "$dirname/.mkit/git_lasthash"
210
     echo -n "$git_lasthash" > "$dirname/.mkit/git_lasthash"
212
     tar -cf "$dirname.tar" "$dirname"
211
     tar -cf "$dirname.tar" "$dirname"
213
     gzip -f "$dirname.tar"      # see above FIXME
212
     gzip -f "$dirname.tar"      # see above FIXME
214
-    mkdir -p "$MKIT_LOCAL"
215
-    echo "$dirname.tar.gz" >> "$MKIT_LOCAL/built.lst"
213
+    rec_built "$dirname.tar.gz"
216
     rm -rf "$dirname"
214
     rm -rf "$dirname"
217
 }
215
 }
218
 
216
 

+ 2
- 0
utils/mkit/include/facts.sh View File

154
     local commit        # commit indicator (CURRENT_BRANCH.gHASH)
154
     local commit        # commit indicator (CURRENT_BRANCH.gHASH)
155
     local dirty         # 0 if dirty, 1 if clean
155
     local dirty         # 0 if dirty, 1 if clean
156
     local suffix        # version suffix
156
     local suffix        # version suffix
157
+    local_get semver && return 0
157
     version=$(ini 1value project:version)
158
     version=$(ini 1value project:version)
158
     prerl=$(ini 1value project:prerl)
159
     prerl=$(ini 1value project:prerl)
159
     grep ":" <<<"$prerl" \
160
     grep ":" <<<"$prerl" \
178
         test -n "$prerl" && suffix="-$prerl$suffix"
179
         test -n "$prerl" && suffix="-$prerl$suffix"
179
         version="$version$suffix"
180
         version="$version$suffix"
180
     fi
181
     fi
182
+    local_putb semver <<<"$version"
181
     echo "$version"
183
     echo "$version"
182
 }
184
 }

+ 35
- 2
utils/mkit/include/mkit.sh View File

125
      || die "bad mkit.ini version: $their_ver does not match $MKIT_VERSION"
125
      || die "bad mkit.ini version: $their_ver does not match $MKIT_VERSION"
126
 }
126
 }
127
 
127
 
128
+local_putb() {
129
+    #
130
+    # Make file $1 in $MKIT_LOCAL from stdin and mark as built
131
+    #
132
+    local fpath=$1
133
+    local_put "$fpath" && rec_built "$MKIT_LOCAL/$fpath"
134
+}
135
+
136
+local_put() {
137
+    #
138
+    # Make file $1 in $MKIT_LOCAL from stdin
139
+    #
140
+    local fpath="$MKIT_LOCAL/$1"
141
+    { mkdir -p "${fpath%/*}" && cat >"$fpath"; } \
142
+     || die "cannot write to local cache: $fpath"
143
+}
144
+
145
+local_get() {
146
+    #
147
+    # Read file $1 in $MKIT_LOCAL
148
+    #
149
+    local fpath="$MKIT_LOCAL/$1"
150
+    cat "$fpath" 2>/dev/null
151
+}
152
+
128
 mkit_init() {
153
 mkit_init() {
129
     #
154
     #
130
     # Do basic initialization
155
     # Do basic initialization
132
     # Check for ini file and some variables
157
     # Check for ini file and some variables
133
     #
158
     #
134
     $MKIT_DRY && MKIT_DEBUG=true
159
     $MKIT_DRY && MKIT_DEBUG=true
160
+    #shellcheck disable=SC2034
135
     MKIT_PROJ_PKGNAME=$(ini 1value "project:pkgname")
161
     MKIT_PROJ_PKGNAME=$(ini 1value "project:pkgname")
136
     test -f "$MKIT_INI" || die "cannot find mkit.ini: $MKIT_INI"
162
     test -f "$MKIT_INI" || die "cannot find mkit.ini: $MKIT_INI"
137
     _chkiniversion
163
     _chkiniversion
138
-    test -n "$(tr -d '[:space:]' <<<"$MKIT_LOCAL")" \
139
-     || die "MKIT_LOCAL must be non-blank: '$MKIT_LOCAL'"
164
+}
165
+
166
+rec_built() {
167
+    #
168
+    # Record file $1 for deletion on `clean`
169
+    #
170
+    local file=$1
171
+    mkdir -p "$MKIT_LOCAL"
172
+    echo "$file" >> "$MKIT_LOCAL/built.lst"
140
 }
173
 }
141
 
174
 
142
 route() {
175
 route() {

+ 2
- 1
utils/mkit/include/vars.sh View File

1
 #!/bin/bash
1
 #!/bin/bash
2
+#shellcheck disable=SC2034
2
 # MKit - simple install helper
3
 # MKit - simple install helper
3
 # See LICENSE file for copyright and license details.
4
 # See LICENSE file for copyright and license details.
4
 
5
 
57
 #
58
 #
58
 # This MKit version
59
 # This MKit version
59
 #
60
 #
60
-MKIT_VERSION=0.0.23+master.g1a2dd96
61
+MKIT_VERSION=0.0.24+master.g1446c26

+ 2
- 4
utils/mkit/stub View File

141
             echo '%setup -q'
141
             echo '%setup -q'
142
             echo ''
142
             echo ''
143
             echo '%build'
143
             echo '%build'
144
-            echo 'make %{?_smp_mflags}'
144
+            echo 'make %{?_smp_mflags} PREFIX=/usr'
145
             echo ''
145
             echo ''
146
             echo '%install'
146
             echo '%install'
147
             echo '%make_install PREFIX=/usr'
147
             echo '%make_install PREFIX=/usr'
320
             echo ""
320
             echo ""
321
             echo "        Note that in case of debian/package.install files,"
321
             echo "        Note that in case of debian/package.install files,"
322
             echo "        PREFIX based paths (eg. /usr/bin) in this file should"
322
             echo "        PREFIX based paths (eg. /usr/bin) in this file should"
323
-            echo "        should be as if PREFIX was /usr/local, despite PREFIX"
324
-            echo "        being set to /usr in debian/rules.  (Debian's script"
325
-            echo "        dh_usrlocal will take care of that.)"
323
+            echo "        should be as if PREFIX was /usr."
326
             echo ""
324
             echo ""
327
             echo "        In case of Fedora-based distro, you should make use"
325
             echo "        In case of Fedora-based distro, you should make use"
328
             echo "        of RPM macros:"
326
             echo "        of RPM macros:"