|
@@ -1,4 +1,190 @@
|
1
|
|
-Mkit
|
|
1
|
+MKit
|
2
|
2
|
====
|
3
|
3
|
|
4
|
|
-Simple Makefile target helper
|
|
4
|
+Simple Makefile target helper.
|
|
5
|
+
|
|
6
|
+MKit can help you with boring but important tasks such as:
|
|
7
|
+
|
|
8
|
+ * starting up your project under git with sane structure,
|
|
9
|
+
|
|
10
|
+ * building and installing your project,
|
|
11
|
+
|
|
12
|
+ * managing release history and tags,
|
|
13
|
+
|
|
14
|
+ * ensuring reliable version information is always included
|
|
15
|
+ with any package (from scratch builds to official releases),
|
|
16
|
+
|
|
17
|
+ * writing changelogs,
|
|
18
|
+
|
|
19
|
+ * packaging for distributions (or just spitting out tarballs).
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+Goals
|
|
23
|
+-----
|
|
24
|
+
|
|
25
|
+ * Be distro-agnostic -- you can use it to prepare RPM spec files,
|
|
26
|
+ debian meta-data or just tarballs.
|
|
27
|
+
|
|
28
|
+ * Be very simple to start up, especially for smaller non-arch-specific
|
|
29
|
+ projects such as helper scripts and distributable config files.
|
|
30
|
+
|
|
31
|
+ * Encourage best development practices such as semantic versioning.
|
|
32
|
+
|
|
33
|
+ * Make file deployment easy: no need to write install script;
|
|
34
|
+ just define roots and relative file paths.
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+Non-goals
|
|
38
|
+---------
|
|
39
|
+
|
|
40
|
+ * Manage huge and complicated tree of build targets.
|
|
41
|
+
|
|
42
|
+ If you want to really build "serious" "big" stuff from hundreds of
|
|
43
|
+ source files, MKit is probably for you. Nobody has ever tried to
|
|
44
|
+ use it that way. What MKit understands as "building" is just
|
|
45
|
+ replacing tokens in files. (Some extensibility will be added in
|
|
46
|
+ future but scaling to huge things is not a priority for now.)
|
|
47
|
+
|
|
48
|
+ * Become a complete solution for building all your RPMs and DEBs.
|
|
49
|
+
|
|
50
|
+ Other tools such as Copr already exist for this purpose and do
|
|
51
|
+ it well. Also, building is best done in isolated environment, while
|
|
52
|
+ MKit is really just about managing your repo.
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+Your first project with MKit
|
|
56
|
+----------------------------
|
|
57
|
+
|
|
58
|
+MKit is intended to be *embedded* inside your git repo. We will
|
|
59
|
+demonstrate simple usage on a demo project `myproj` that delivers one
|
|
60
|
+script and one config file:
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+### 1. start your git repo ###
|
|
64
|
+
|
|
65
|
+ $ mkdir myproj
|
|
66
|
+ $ cd myproj
|
|
67
|
+ $ git init
|
|
68
|
+ $ mkdir src
|
|
69
|
+ $ echo 'echo Hello world' > src/hello
|
|
70
|
+ $ echo 'some config' > src/hello.conf
|
|
71
|
+ $ git add .
|
|
72
|
+ $ git commit -m "Initial commit"
|
|
73
|
+ $ git tag v0.0.0
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+### 2. embed MKit into your repo ###
|
|
77
|
+
|
|
78
|
+ $ git clone <url-to-mkit>
|
|
79
|
+ $ cd mkit
|
|
80
|
+ $ make install <path/to/myproj>
|
|
81
|
+ $ echo 'MKIT_DIR=utils/mkit' >> Makefile
|
|
82
|
+ $ echo 'include $(MKIT_DIR)/mkit.mk' >> Makefile
|
|
83
|
+ $ git add .
|
|
84
|
+ $ git commit -m "Add MKit v0.0.15"
|
|
85
|
+
|
|
86
|
+Using Makefile is not mandatory; you can call MKit commands directly
|
|
87
|
+via *utils/mkit/make* command. It is conventional, however: your users
|
|
88
|
+will be able to use the ubiquitous: `make` and `sudo make install`,
|
|
89
|
+and you get tab copmpletion for free.
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+### 3. add mkit.ini with everything about your project ###
|
|
93
|
+
|
|
94
|
+Create file called 'mkit.ini' in the root of your repo:
|
|
95
|
+
|
|
96
|
+ #mkit version=0.0.15
|
|
97
|
+
|
|
98
|
+ [project]
|
|
99
|
+ version = 0.0.0
|
|
100
|
+ name = myproj
|
|
101
|
+ pkgname = bmo
|
|
102
|
+ relsrc = master
|
|
103
|
+
|
|
104
|
+ [dist]
|
|
105
|
+ tarball = Makefile
|
|
106
|
+ tarball = mkit.ini
|
|
107
|
+ tarball = src
|
|
108
|
+ tarball = utils
|
|
109
|
+
|
|
110
|
+ [ENV]
|
|
111
|
+ PREFIX = /usr/local
|
|
112
|
+
|
|
113
|
+ [roots]
|
|
114
|
+ bin = [ENV:PREFIX]/bin
|
|
115
|
+ share = [ENV:PREFIX]/share/myproj
|
|
116
|
+
|
|
117
|
+ [modes]
|
|
118
|
+ bin = 755
|
|
119
|
+ share = 644
|
|
120
|
+
|
|
121
|
+ [files]
|
|
122
|
+ bin = src/hello
|
|
123
|
+ share = src/hello.conf
|
|
124
|
+
|
|
125
|
+This is pretty minimal but working prioject.
|
|
126
|
+
|
|
127
|
+ $ git add mkit.ini
|
|
128
|
+ $ git commit -m "Add mkit.ini"
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+### 4. Prepare your first release ###
|
|
132
|
+
|
|
133
|
+We have decided to make just minor Z-stream release, i.e. 0.0.1.
|
|
134
|
+First, we need to raise the version:
|
|
135
|
+
|
|
136
|
+ $ make vbump_z
|
|
137
|
+
|
|
138
|
+This will open your editor with commit message already prepared for
|
|
139
|
+a "Bump version" commit. Ths is a special type of commit that accompanies
|
|
140
|
+every release and its purpose is to track the version change itself and
|
|
141
|
+provide human-readable overview of changes since the last release.
|
|
142
|
+
|
|
143
|
+Next step is doing actual release; that is, generate an annotated tag
|
|
144
|
+and update stable branch (we haven't defined that in our demo).
|
|
145
|
+
|
|
146
|
+ $ make release_z
|
|
147
|
+
|
|
148
|
+Note that `release_z`, makes "Bump version" commits mandatory; this is
|
|
149
|
+to help you keep your release history clean and documented. Of course
|
|
150
|
+you can skip both `vbump_z` and `release_z` and do the tags manually.
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+### 5. Release it out into the wild ###
|
|
154
|
+
|
|
155
|
+At this point, what you probably want to do is push the release to your
|
|
156
|
+main repo:
|
|
157
|
+
|
|
158
|
+ $ git push
|
|
159
|
+ $ git push --tags
|
|
160
|
+
|
|
161
|
+So new version is out. What's left is to publish the tarballs, e.g.:
|
|
162
|
+
|
|
163
|
+ $ make dist
|
|
164
|
+ $ scp myproj-0.0.1.tar.gz your:web/server
|
|
165
|
+
|
|
166
|
+Note that tarball is now independent and can be installed on any typical
|
|
167
|
+Linux machine using common workflow:
|
|
168
|
+
|
|
169
|
+ $ tar -xvzf myproj-0.0.1.tar.gz
|
|
170
|
+ $ cd myproj-0.0.1
|
|
171
|
+ $ make
|
|
172
|
+ $ make install # can add DESTDIR=/some/test/path
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+### Further steps ###
|
|
176
|
+
|
|
177
|
+The tutorial above has been cut down to really only show the most common
|
|
178
|
+features. What you might want to do next:
|
|
179
|
+
|
|
180
|
+ * Add SPEC file and debian dir templates,
|
|
181
|
+
|
|
182
|
+ * Add tokens inside some of your scripts to include stuff known
|
|
183
|
+ only on install time (versions, paths...)
|
|
184
|
+
|
|
185
|
+ * Do some actual development (branch off, do scratch builds, experiment).
|
|
186
|
+
|
|
187
|
+MKit uses SemVer so version reflected in tarbal naming, packaging
|
|
188
|
+files and tokens contains enough data to track it back to actual commit.
|
|
189
|
+This way you can safely distribute packages immediately to your testers
|
|
190
|
+and/or CI systems.
|