Browse Source

Update own dogfood

Alois Mahdal 7 years ago
parent
commit
44a898bb1e
4 changed files with 74 additions and 40 deletions
  1. 1
    0
      utils/mkit/include/deploy.sh
  2. 5
    1
      utils/mkit/include/release.sh
  3. 1
    1
      utils/mkit/include/vars.sh
  4. 67
    38
      utils/mkit/stub

+ 1
- 0
utils/mkit/include/deploy.sh View File

40
                 __deploy_item "$item" "$dst${item#$src}" "$mode"
40
                 __deploy_item "$item" "$dst${item#$src}" "$mode"
41
             done
41
             done
42
     else
42
     else
43
+        test "$mode" == "SRC" && mode=$(stat -c "%a" "$src")
43
         __maybe install -DTvm "$mode" "$src" "$dst"
44
         __maybe install -DTvm "$mode" "$src" "$dst"
44
     fi
45
     fi
45
 }
46
 }

+ 5
- 1
utils/mkit/include/release.sh View File

142
     #
142
     #
143
     local rlevel=$1     # bump level (x, y or z)
143
     local rlevel=$1     # bump level (x, y or z)
144
     local nextver       # version after the bump
144
     local nextver       # version after the bump
145
+    local cache         # cache for the message
145
     __relck git_present
146
     __relck git_present
146
     __relck at_relsrc
147
     __relck at_relsrc
147
     __relck not_dirty
148
     __relck not_dirty
152
       || die "failed to update version in mkit.ini"
153
       || die "failed to update version in mkit.ini"
153
     git add mkit.ini \
154
     git add mkit.ini \
154
       || die "failed to add mkit.ini to the index"
155
       || die "failed to add mkit.ini to the index"
155
-    git commit -e -m "$(_vbump_gitmsg)"
156
+    cache=$(mktemp -t "mkit._vbump_gitmsg.XXXXXXXX")
157
+    _vbump_gitmsg > "$cache"
158
+    git commit -e -F "$cache"   # note: reading from stdin will break vim
159
+    rm "$cache"
156
 }
160
 }
157
 
161
 
158
 _vbump_gitmsg() {
162
 _vbump_gitmsg() {

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

58
 #
58
 #
59
 # This MKit version
59
 # This MKit version
60
 #
60
 #
61
-MKIT_VERSION=0.0.25+master.gf8bcff1
61
+MKIT_VERSION=0.0.26+master.gd8016d5

+ 67
- 38
utils/mkit/stub View File

68
 
68
 
69
         */mkit.ini|mkit.ini)
69
         */mkit.ini|mkit.ini)
70
             echo "[project]"
70
             echo "[project]"
71
-            echo "    version     = $Version"
72
-            test -n "$Codename"     && echo "    codename    = $Codename"
73
-            test -n "$NiceName"     && echo "    name        = $NiceName"
74
-            test -n "$Tagline"      && echo "    tagline     = $Tagline"
75
-            test -n "$PackageName"  && echo "    pkgname     = $PackageName"
76
-            test -n "$Maintainer"   && echo "    maintainer  = $Maintainer"
77
-            test -n "$VcsBrowser"   && echo "    vcs_browser = $VcsBrowser"
78
-            test -n "$RelSrc"       && echo "    relsrc      = $RelSrc"
79
-            test -n "$RelDst"       && echo "    reldst      = $RelDst"
71
+            {
72
+                echo "version = $Version"
73
+                test -n "$Codename"     && echo "codename    = $Codename"
74
+                test -n "$NiceName"     && echo "name        = $NiceName"
75
+                test -n "$Tagline"      && echo "tagline     = $Tagline"
76
+                test -n "$PackageName"  && echo "pkgname     = $PackageName"
77
+                test -n "$Maintainer"   && echo "maintainer  = $Maintainer"
78
+                test -n "$VcsBrowser"   && echo "vcs_browser = $VcsBrowser"
79
+                test -n "$RelSrc"       && echo "relsrc      = $RelSrc"
80
+                test -n "$RelDst"       && echo "reldst      = $RelDst"
81
+            } | reformat_section
80
             if updating; then
82
             if updating; then
81
                 remake_section dist
83
                 remake_section dist
82
                 remake_section ENV
84
                 remake_section ENV
87
             else
89
             else
88
                 echo ""
90
                 echo ""
89
                 echo "[dist]"
91
                 echo "[dist]"
90
-                $MkLicense  && echo "    tarball = LICENSE.md"
91
-                $MkMakefile && echo "    tarball = Makefile"
92
-                $MkReadme   && echo "    tarball = README.md"
93
-                echo "    tarball = mkit.ini"
94
-                $MkPackaging && echo "    tarball = packaging"
95
-                echo "    tarball = src"
96
-                echo "    tarball = tests"
97
-                echo "    tarball = utils"
98
-                $MkPackaging && echo "    rpmstuff = packaging/template.spec"
99
-                $MkPackaging && echo "    debstuff = packaging/debian"
92
+                {
93
+                    $MkLicense  && echo "tarball = LICENSE.md"
94
+                    $MkMakefile && echo "tarball = Makefile"
95
+                    $MkReadme   && echo "tarball = README.md"
96
+                    echo "tarball = mkit.ini"
97
+                    $MkPackaging && echo "tarball = packaging"
98
+                    echo "tarball = src"
99
+                    echo "tarball = tests"
100
+                    echo "tarball = utils"
101
+                    $MkPackaging && echo "rpmstuff = packaging/template.spec"
102
+                    $MkPackaging && echo "debstuff = packaging/debian"
103
+                } | reformat_section
100
                 echo ""
104
                 echo ""
101
                 echo "[ENV]"
105
                 echo "[ENV]"
102
-                echo "    PREFIX = /usr/local"
106
+                {
107
+                    echo "    PREFIX = /usr/local"
108
+                } | reformat_section
103
                 echo ""
109
                 echo ""
104
                 echo "[roots]"
110
                 echo "[roots]"
105
-                echo "    bin     = [ENV:PREFIX]/bin"
106
-                echo "    doc     = [ENV:PREFIX]/share/doc/$PackageName"
111
+                {
112
+                    echo "bin = [ENV:PREFIX]/bin"
113
+                    echo "doc = [ENV:PREFIX]/share/doc/$PackageName"
114
+                } | reformat_section
107
                 echo ""
115
                 echo ""
108
                 echo "[tokens]"
116
                 echo "[tokens]"
109
-                echo "    __${PackageName^^}_FOO__ = Barr.."
117
+                {
118
+                    echo "__${PackageName^^}_FOO__ = Barr.."
119
+                } | reformat_section
110
                 echo ""
120
                 echo ""
111
                 echo "[modes]"
121
                 echo "[modes]"
112
-                echo "    bin     = 755"
113
-                echo "    doc     = 644"
122
+                {
123
+                    echo "bin = 755"
124
+                    echo "doc = 644"
125
+                } | reformat_section
114
                 echo ""
126
                 echo ""
115
                 echo "[files]"
127
                 echo "[files]"
116
-                echo "    bin      = src/$PackageName"
117
-                $MkLicense && echo "    doc      = LICENSE.md"
118
-                $MkReadme  && echo "    doc      = README.md"
128
+                {
129
+                    echo "bin = src/$PackageName"
130
+                    $MkLicense && echo "doc = LICENSE.md"
131
+                    $MkReadme  && echo "doc = README.md"
132
+                } | reformat_section
119
             fi
133
             fi
120
             echo ""
134
             echo ""
121
             echo "#mkit version=$MKIT_VERSION"
135
             echo "#mkit version=$MKIT_VERSION"
122
             ;;
136
             ;;
123
 
137
 
124
         packaging/template.spec)
138
         packaging/template.spec)
125
-            echo 'Name:		__MKIT_PROJ_PKGNAME__'
126
-            echo 'Version:	__MKIT_PROJ_VERSION__'
127
-            echo 'Release:	1%{?dist}'
128
-            echo 'Summary:	__MKIT_PROJ_NAME__ - __MKIT_PROJ_TAGLINE__'
139
+            echo 'Name:     __MKIT_PROJ_PKGNAME__'
140
+            echo 'Version:  __MKIT_PROJ_VERSION__'
141
+            echo 'Release:  1%{?dist}'
142
+            echo 'Summary:  __MKIT_PROJ_NAME__ - __MKIT_PROJ_TAGLINE__'
143
+            $MkLicense && echo "License:  $License"
129
             echo ''
144
             echo ''
130
-            $MkLicense && echo "License:	$License"
131
-            echo 'Source0:	%{name}-%{version}.tar.gz'
132
-            echo ''
133
-            echo 'BuildArch:	noarch'
134
-            echo 'BuildRequires:	coreutils git'
135
-            echo 'Requires:	MKIT_STUB_REQUIRES'
145
+            echo 'Source0:       %{name}-%{version}.tar.gz'
146
+            echo 'BuildArch:     noarch'
136
             echo ''
147
             echo ''
148
+            echo 'Requires: MKIT_STUB_REQUIRES'
137
             echo '%description'
149
             echo '%description'
138
             echo 'MKIT_STUB_DESCRIPTION'
150
             echo 'MKIT_STUB_DESCRIPTION'
139
             echo ''
151
             echo ''
615
                     echo "$key = $value"
627
                     echo "$key = $value"
616
                 done
628
                 done
617
         done \
629
         done \
630
+      | reformat_section
631
+}
632
+
633
+reformat_section() {
634
+    #
635
+    # Re-format "k = v" on stdin as "nice" ini section
636
+    #
637
+    local key
638
+    local eq
639
+    local value
640
+    while read -r key eq value; do
641
+        test "$eq" == "=" || {
642
+            warn "ignoring malformed ini line: $key $eq $value"
643
+            continue
644
+        }
645
+        echo "$key = $value"
646
+    done \
618
       | column -to' ' \
647
       | column -to' ' \
619
       | sed 's/^/    /'
648
       | sed 's/^/    /'
620
 }
649
 }