Parcourir la source

Update own dogfood

Alois Mahdal il y a 7 ans
Parent
révision
44a898bb1e
4 fichiers modifiés avec 74 ajouts et 40 suppressions
  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 Voir le fichier

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

+ 5
- 1
utils/mkit/include/release.sh Voir le fichier

@@ -142,6 +142,7 @@ __vbump() {
142 142
     #
143 143
     local rlevel=$1     # bump level (x, y or z)
144 144
     local nextver       # version after the bump
145
+    local cache         # cache for the message
145 146
     __relck git_present
146 147
     __relck at_relsrc
147 148
     __relck not_dirty
@@ -152,7 +153,10 @@ __vbump() {
152 153
       || die "failed to update version in mkit.ini"
153 154
     git add mkit.ini \
154 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 162
 _vbump_gitmsg() {

+ 1
- 1
utils/mkit/include/vars.sh Voir le fichier

@@ -58,4 +58,4 @@ MKIT_PROJ_PKGNAME=""
58 58
 #
59 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 Voir le fichier

@@ -68,15 +68,17 @@ deploy() {
68 68
 
69 69
         */mkit.ini|mkit.ini)
70 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 82
             if updating; then
81 83
                 remake_section dist
82 84
                 remake_section ENV
@@ -87,53 +89,63 @@ deploy() {
87 89
             else
88 90
                 echo ""
89 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 104
                 echo ""
101 105
                 echo "[ENV]"
102
-                echo "    PREFIX = /usr/local"
106
+                {
107
+                    echo "    PREFIX = /usr/local"
108
+                } | reformat_section
103 109
                 echo ""
104 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 115
                 echo ""
108 116
                 echo "[tokens]"
109
-                echo "    __${PackageName^^}_FOO__ = Barr.."
117
+                {
118
+                    echo "__${PackageName^^}_FOO__ = Barr.."
119
+                } | reformat_section
110 120
                 echo ""
111 121
                 echo "[modes]"
112
-                echo "    bin     = 755"
113
-                echo "    doc     = 644"
122
+                {
123
+                    echo "bin = 755"
124
+                    echo "doc = 644"
125
+                } | reformat_section
114 126
                 echo ""
115 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 133
             fi
120 134
             echo ""
121 135
             echo "#mkit version=$MKIT_VERSION"
122 136
             ;;
123 137
 
124 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 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 147
             echo ''
148
+            echo 'Requires: MKIT_STUB_REQUIRES'
137 149
             echo '%description'
138 150
             echo 'MKIT_STUB_DESCRIPTION'
139 151
             echo ''
@@ -615,6 +627,23 @@ remake_section() {
615 627
                     echo "$key = $value"
616 628
                 done
617 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 647
       | column -to' ' \
619 648
       | sed 's/^/    /'
620 649
 }