Merge lp:~jelmer/bzr-builddeb/move-config-to-debian-dir into lp:bzr-builddeb
- move-config-to-debian-dir
- Merge into trunk
Proposed by
Jelmer Vernooij
Status: | Superseded | ||||
---|---|---|---|---|---|
Proposed branch: | lp:~jelmer/bzr-builddeb/move-config-to-debian-dir | ||||
Merge into: | lp:bzr-builddeb | ||||
Diff against target: |
345 lines (+76/-59) (has conflicts) 11 files modified
__init__.py (+2/-0) config.py (+3/-1) debian/changelog (+6/-0) doc/user_manual/configuration.rst (+3/-2) doc/user_manual/hooks.rst (+1/-1) doc/user_manual/merge.rst (+3/-4) doc/user_manual/native.rst (+3/-4) doc/user_manual/split.rst (+3/-3) import_dsc.py (+34/-36) tests/test_import_dsc.py (+5/-7) util.py (+13/-1) Text conflict in debian/changelog |
||||
To merge this branch: | bzr merge lp:~jelmer/bzr-builddeb/move-config-to-debian-dir | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Bzr-builddeb-hackers | Pending | ||
Review via email: mp+77327@code.launchpad.net |
This proposal has been superseded by a proposal from 2011-10-11.
Commit message
Description of the change
Move versioned configuration to debian/
To post a comment you must log in.
Revision history for this message
James Westby (james-w) wrote : | # |
- 619. By Jelmer Vernooij
-
Don't create empty .bzr-builddeb directory.
- 620. By Jelmer Vernooij
-
Support debian/
bzr-builddeb. conf.local.
Unmerged revisions
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file '__init__.py' |
2 | --- __init__.py 2011-10-07 10:57:44 +0000 |
3 | +++ __init__.py 2011-10-11 09:16:32 +0000 |
4 | @@ -57,6 +57,8 @@ |
5 | from bzrlib.config import config_dir |
6 | return os.path.join(config_dir(), 'builddeb.conf') |
7 | local_conf = os.path.join(builddeb_dir, 'local.conf') |
8 | +new_local_conf = 'debian/local.conf.local' |
9 | +new_conf = 'debian/bzr-builddeb.conf' |
10 | |
11 | default_build_dir = '../build-area' |
12 | default_orig_dir = '..' |
13 | |
14 | === modified file 'config.py' |
15 | --- config.py 2011-10-07 10:57:44 +0000 |
16 | +++ config.py 2011-10-11 09:16:32 +0000 |
17 | @@ -56,7 +56,9 @@ |
18 | class DebBuildConfig(object): |
19 | """Holds the configuration settings for builddeb. These are taken from |
20 | a hierarchy of config files. .bzr-builddeb/local.conf then |
21 | - ~/.bazaar/builddeb.conf, finally .bzr-builddeb/default.conf. The value is |
22 | + debian/bzr-builddeb.conf.local, |
23 | + ~/.bazaar/builddeb.conf, debian/bzr-builddeb.conf, |
24 | + finally .bzr-builddeb/default.conf. The value is |
25 | taken from the first file in which it is specified.""" |
26 | |
27 | section = 'BUILDDEB' |
28 | |
29 | === modified file 'debian/changelog' |
30 | --- debian/changelog 2011-10-08 21:45:17 +0000 |
31 | +++ debian/changelog 2011-10-11 09:16:32 +0000 |
32 | @@ -17,7 +17,10 @@ |
33 | |
34 | [ Jelmer Vernooij ] |
35 | * Support .tar.xz Debian files rather than .tar.lzma. |
36 | + * Move .bzr-builddeb/default.conf to debian/bzr-builddeb.conf. LP: |
37 | + #793137 |
38 | |
39 | +<<<<<<< TREE |
40 | [ Martin Packman ] |
41 | * Support non-ascii characters in changelog entry when determining |
42 | commit message. LP: #853664 |
43 | @@ -26,6 +29,9 @@ |
44 | * Use more complete control file during examples. Closes: #642818 |
45 | |
46 | -- Jelmer Vernooij <jelmer@debian.org> Sat, 01 Oct 2011 21:27:05 +0200 |
47 | +======= |
48 | + -- Jelmer Vernooij <jelmer@debian.org> Wed, 28 Sep 2011 15:15:14 +0200 |
49 | +>>>>>>> MERGE-SOURCE |
50 | |
51 | bzr-builddeb (2.7.8) unstable; urgency=low |
52 | |
53 | |
54 | === modified file 'doc/user_manual/configuration.rst' |
55 | --- doc/user_manual/configuration.rst 2011-10-07 11:14:44 +0000 |
56 | +++ doc/user_manual/configuration.rst 2011-10-11 09:16:32 +0000 |
57 | @@ -6,7 +6,8 @@ |
58 | |
59 | * .bzr-builddeb/local.conf (in the package directory) |
60 | * ~/.bazaar/builddeb.conf |
61 | - * .bzr-builddeb/default.conf (in the package directory) |
62 | + * debian/bzr-builddeb.conf (in the package directory) |
63 | + * .bzr-builddeb/default.conf (in the package directory, deprecated) |
64 | |
65 | The last of these should be used for values that will be used by all users of |
66 | the package, for instance 'merge = True'. The others are for the user to add |
67 | @@ -138,7 +139,7 @@ |
68 | (Defaults to ``fakeroot debian/rules binary``). Will only be read from |
69 | the config file in your home directory. |
70 | |
71 | -The idea is that certain options can be set in ``.bzr-builddeb/default.conf`` |
72 | +The idea is that certain options can be set in ``debian/bzr-builddeb.conf`` |
73 | that apply to the package on all systems, or that there is a default that is |
74 | wanted that differs from the default provided. ``merge = True`` is a perfect |
75 | example of this. |
76 | |
77 | === modified file 'doc/user_manual/hooks.rst' |
78 | --- doc/user_manual/hooks.rst 2011-02-27 16:15:50 +0000 |
79 | +++ doc/user_manual/hooks.rst 2011-10-11 09:16:32 +0000 |
80 | @@ -48,7 +48,7 @@ |
81 | Hooks are set by editing the configuration files. The normal precedence |
82 | rules for these files are followed (see `configuration`_ for details). This |
83 | means that you should set hooks needed to build the package in |
84 | -``.bzr-builddeb/default.conf``, and any hooks that you would like to run |
85 | +``debian/bzr-builddeb.conf``, and any hooks that you would like to run |
86 | that would not be appropriate for everyone in ``.bzr-builddeb/local.conf``. |
87 | Note however that the latter overrides the formula, so your local hooks should |
88 | run all necessary commands from the default hooks that are necessary to build |
89 | |
90 | === modified file 'doc/user_manual/merge.rst' |
91 | --- doc/user_manual/merge.rst 2011-10-03 11:03:46 +0000 |
92 | +++ doc/user_manual/merge.rst 2011-10-11 09:16:32 +0000 |
93 | @@ -48,14 +48,13 @@ |
94 | |
95 | Now you have a branch that you will create the package in you need to tell |
96 | `bzr-builddeb` that it will be built in merge mode. To do this you need to |
97 | -create the configuration file ``.bzr-builddeb/default.conf``. This contains |
98 | +create the configuration file ``debian/bzr-builddeb.conf``. This contains |
99 | the default options for the package. The file starts with a ``[BUILDDEB]`` |
100 | header which states that the file is for use by `bzr-builddeb`. The option |
101 | we are interested in is the ``merge`` option. The commands to do this are:: |
102 | |
103 | - $ mkdir .bzr-builddeb/ |
104 | - $ echo -e '[BUILDDEB]\nmerge = True' > .bzr-builddeb/default.conf |
105 | - $ bzr add .bzr-builddeb/default.conf |
106 | + $ echo -e '[BUILDDEB]\nmerge = True' > debian/bzr-builddeb.conf |
107 | + $ bzr add debian/bzr-builddeb.conf |
108 | |
109 | Now you should add the packaging files to the branch. You have a choice |
110 | here, either you can add a ``debian/`` directory containing the files, |
111 | |
112 | === modified file 'doc/user_manual/native.rst' |
113 | --- doc/user_manual/native.rst 2009-02-18 22:50:44 +0000 |
114 | +++ doc/user_manual/native.rst 2011-10-11 09:16:32 +0000 |
115 | @@ -53,14 +53,13 @@ |
116 | |
117 | Now you have a branch that you will create the package in you need to tell |
118 | `bzr-builddeb` that it will be a native package. To do this you need to |
119 | -create the configuration file ``.bzr-builddeb/default.conf``. This contains |
120 | +create the configuration file ``debian/bzr-builddeb.conf``. This contains |
121 | the default options for the package. The file starts with a ``[BUILDDEB]`` |
122 | header which states that the file is for use by `bzr-builddeb`. The option |
123 | we are interested in is the ``native`` option. The commands to do this are:: |
124 | |
125 | - $ mkdir .bzr-builddeb/ |
126 | - $ echo -e '[BUILDDEB]\nnative = True' > .bzr-builddeb/default.conf |
127 | - $ bzr add .bzr-builddeb/default.conf |
128 | + $ echo -e '[BUILDDEB]\nnative = True' > debian/bzr-builddeb.conf |
129 | + $ bzr add dbian/bzr-builddeb.conf |
130 | |
131 | Now you are ready to create the package. Add all of the files for the |
132 | package, and the packaging in ``debian/``, and then you can add the files |
133 | |
134 | === modified file 'doc/user_manual/split.rst' |
135 | --- doc/user_manual/split.rst 2009-02-18 18:36:18 +0000 |
136 | +++ doc/user_manual/split.rst 2011-10-11 09:16:32 +0000 |
137 | @@ -60,14 +60,14 @@ |
138 | which will create a branch and add all of your current code to it. |
139 | |
140 | The next step is to tell `bzr-builddeb` that it is a split mode package. To |
141 | -do this create the configuration file ``.bzr-builddeb/default.conf`` in the |
142 | +do this create the configuration file ``debian/bzr-builddeb.conf`` in the |
143 | branch. This contains the options that are default for building the package. |
144 | The file starts with a ``[BUILDDEB]`` header to identify the options that |
145 | the plugin should use, and the option that you need to set is ``split``. |
146 | The following commands will set up the configuration files for you:: |
147 | |
148 | - $ echo -e '[BUILDDEB]\nsplit = True' > .bzr-builddeb/default.conf |
149 | - $ bzr add .bzr-builddeb/default.conf |
150 | + $ echo -e '[BUILDDEB]\nsplit = True' > debian/bzr-builddeb.conf |
151 | + $ bzr add debian/bzr-builddeb.conf |
152 | |
153 | When you are happy with the code you can commit, and then build the package. |
154 | `bzr-builddeb` will see that it is a split mode package and create the |
155 | |
156 | === modified file 'import_dsc.py' |
157 | --- import_dsc.py 2011-09-27 00:48:16 +0000 |
158 | +++ import_dsc.py 2011-10-11 09:16:32 +0000 |
159 | @@ -451,23 +451,24 @@ |
160 | |
161 | def _default_config_for_tree(self, tree): |
162 | # FIXME: shouldn't go to configobj directly |
163 | - path = '.bzr-builddeb/default.conf' |
164 | - c_fileid = tree.path2id(path) |
165 | - config = None |
166 | - if c_fileid is not None: |
167 | - tree.lock_read() |
168 | + for path in ('debian/bzr-builddeb.conf', '.bzr-builddeb/default.conf',): |
169 | + c_fileid = tree.path2id(path) |
170 | + if c_fileid is not None: |
171 | + break |
172 | + else: |
173 | + return None, None |
174 | + tree.lock_read() |
175 | + try: |
176 | + config = ConfigObj(tree.get_file(c_fileid, path)) |
177 | try: |
178 | - config = ConfigObj(tree.get_file(c_fileid, path)) |
179 | - try: |
180 | - config['BUILDDEB'] |
181 | - except KeyError: |
182 | - config['BUILDDEB'] = {} |
183 | - finally: |
184 | - tree.unlock() |
185 | - return config |
186 | + config['BUILDDEB'] |
187 | + except KeyError: |
188 | + config['BUILDDEB'] = {} |
189 | + finally: |
190 | + tree.unlock() |
191 | + return c_fileid, config |
192 | |
193 | - def _is_tree_native(self, tree): |
194 | - config = self._default_config_for_tree(tree) |
195 | + def _is_tree_native(self, config): |
196 | if config is not None: |
197 | try: |
198 | current_value = config['BUILDDEB']['native'] |
199 | @@ -486,7 +487,8 @@ |
200 | """ |
201 | revid = self.revid_of_version(version) |
202 | rev_tree = self.branch.repository.revision_tree(revid) |
203 | - if self._is_tree_native(rev_tree): |
204 | + config_fileid, current_config = self._default_config_for_tree(rev_tree) |
205 | + if self._is_tree_native(current_config): |
206 | return True |
207 | rev = self.branch.repository.get_revision(revid) |
208 | try: |
209 | @@ -918,22 +920,20 @@ |
210 | |
211 | def _mark_native_config(self, native): |
212 | poss_native_tree = self.branch.basis_tree() |
213 | - current_native = self._is_tree_native(poss_native_tree) |
214 | - current_config = self._default_config_for_tree(poss_native_tree) |
215 | - dirname = os.path.join(self.tree.basedir, '.bzr-builddeb') |
216 | + config_fileid, current_config = self._default_config_for_tree(poss_native_tree) |
217 | + current_native = self._is_tree_native(current_config) |
218 | if current_config is not None: |
219 | # Add that back to the current tree |
220 | - if not os.path.exists(dirname): |
221 | - os.mkdir(dirname) |
222 | - current_config.filename = os.path.join(dirname, |
223 | - 'default.conf') |
224 | + current_config.filename = os.path.join(self.tree.basedir, |
225 | + poss_native_tree.id2path(config_fileid)) |
226 | + dir_path = osutils.dirname(current_config.filename) |
227 | + if not os.path.exists(dir_path): |
228 | + os.mkdir(dir_path) |
229 | current_config.write() |
230 | - dir_id = poss_native_tree.path2id('.bzr-builddeb') |
231 | - file_id = poss_native_tree.path2id( |
232 | - '.bzr-builddeb/default.conf') |
233 | - self.tree.add(['.bzr-builddeb/', |
234 | - '.bzr-builddeb/default.conf'], |
235 | - ids=[dir_id, file_id]) |
236 | + dirname = osutils.dirname(poss_native_tree.id2path(config_fileid)) |
237 | + dir_id = poss_native_tree.path2id(dirname) |
238 | + self.tree.add([dirname, poss_native_tree.id2path(config_fileid)], |
239 | + ids=[dir_id, config_fileid]) |
240 | if native != current_native: |
241 | if current_config is None: |
242 | needs_add = True |
243 | @@ -949,17 +949,15 @@ |
244 | del current_config['BUILDDEB'] |
245 | if len(current_config) == 0: |
246 | self.tree.remove(['.bzr-builddeb', |
247 | - '.bzr-builddeb/default.conf'], |
248 | + '.bzr-builddeb/default.conf', |
249 | + 'debian/bzr-builddeb.conf'], |
250 | keep_files=False) |
251 | else: |
252 | - if needs_add: |
253 | - os.mkdir(dirname) |
254 | - current_config.filename = os.path.join(dirname, |
255 | - 'default.conf') |
256 | + current_config.filename = os.path.join( |
257 | + self.tree.basedir, 'debian', 'bzr-builddeb.conf') |
258 | current_config.write() |
259 | if needs_add: |
260 | - self.tree.add(['.bzr-builddeb/', |
261 | - '.bzr-builddeb/default.conf']) |
262 | + self.tree.add(['debian', 'debian/bzr-builddeb.conf']) |
263 | |
264 | def import_debian(self, debian_part, version, parents, md5, |
265 | native=False, timestamp=None, file_ids_from=None): |
266 | |
267 | === modified file 'tests/test_import_dsc.py' |
268 | --- tests/test_import_dsc.py 2011-09-26 23:40:46 +0000 |
269 | +++ tests/test_import_dsc.py 2011-10-11 09:16:32 +0000 |
270 | @@ -1196,7 +1196,8 @@ |
271 | self.addCleanup(self.tree1.unlock) |
272 | self.assertTrue(self.db1.is_version_native(version)) |
273 | revtree = self.tree1.branch.repository.revision_tree(rh1[0]) |
274 | - self.assertTrue(self.db1._is_tree_native(revtree)) |
275 | + config_fileid, current_config = self.db1._default_config_for_tree(revtree) |
276 | + self.assertTrue(self.db1._is_tree_native(current_config)) |
277 | |
278 | def test_import_native_two(self): |
279 | version1 = Version("1.0") |
280 | @@ -1288,8 +1289,7 @@ |
281 | self.assertEqual(rev_tree1.get_parent_ids(), [rh1[0]]) |
282 | self.assertEqual(rev_tree2.get_parent_ids(), [rh1[1]]) |
283 | self.check_changes(rev_tree2.changes_from(rev_tree1), |
284 | - added=["NEWS", ".bzr-builddeb/", |
285 | - ".bzr-builddeb/default.conf"], |
286 | + added=["NEWS", "debian/bzr-builddeb.conf"], |
287 | removed=["BUGS"], modified=["debian/changelog", "COPYING"]) |
288 | self.assertEqual(self.db1.revid_of_version(version1), rh1[1]) |
289 | self.assertEqual(self.db1.revid_of_version(version2), rh1[2]) |
290 | @@ -1329,14 +1329,12 @@ |
291 | self.assertEqual(up_rev_tree1.get_parent_ids(), [rh1[0]]) |
292 | self.check_changes(rev_tree2.changes_from(rev_tree1), |
293 | added=["NEWS"], |
294 | - removed=["BUGS", ".bzr-builddeb/", |
295 | - ".bzr-builddeb/default.conf"], |
296 | + removed=["BUGS", "debian/bzr-builddeb.conf"], |
297 | modified=["debian/changelog", "COPYING"]) |
298 | self.check_changes(up_rev_tree1.changes_from(rev_tree1), |
299 | added=["NEWS"], |
300 | removed=["debian/", "debian/changelog", "debian/control", |
301 | - "BUGS", "README", ".bzr-builddeb/", |
302 | - ".bzr-builddeb/default.conf"], |
303 | + "BUGS", "README", "debian/bzr-builddeb.conf"], |
304 | modified=["COPYING"]) |
305 | self.check_changes(rev_tree2.changes_from(up_rev_tree1), |
306 | added=["debian/", "debian/changelog", "debian/control", |
307 | |
308 | === modified file 'util.py' |
309 | --- util.py 2011-09-29 10:11:07 +0000 |
310 | +++ util.py 2011-10-11 09:16:32 +0000 |
311 | @@ -55,6 +55,7 @@ |
312 | default_conf, |
313 | local_conf, |
314 | global_conf, |
315 | + new_conf, |
316 | ) |
317 | from bzrlib.plugins.builddeb.config import ( |
318 | DebBuildConfig, |
319 | @@ -533,14 +534,25 @@ |
320 | """ |
321 | config_files = [] |
322 | user_config = None |
323 | + if (working_tree and tree.has_filename(new_local_conf)): |
324 | + if tree.path2id(new_local_conf) is None: |
325 | + config_files.append((tree.get_file_byname(new_local_conf), True, |
326 | + "local.conf")) |
327 | + else: |
328 | + warning('Not using configuration from %s as it is versioned.', |
329 | + new_local_conf) |
330 | if (working_tree and tree.has_filename(local_conf)): |
331 | if tree.path2id(local_conf) is None: |
332 | config_files.append((tree.get_file_byname(local_conf), True, |
333 | "local.conf")) |
334 | else: |
335 | - warning('Not using configuration from %s as it is versioned.') |
336 | + warning('Not using configuration from %s as it is versioned.', |
337 | + local_conf) |
338 | config_files.append((global_conf(), True)) |
339 | user_config = global_conf() |
340 | + if tree.path2id(new_conf): |
341 | + config_files.append((tree.get_file(tree.path2id(new_conf)), False, |
342 | + "bzr-builddeb.conf")) |
343 | if tree.path2id(default_conf): |
344 | config_files.append((tree.get_file(tree.path2id(default_conf)), False, |
345 | "default.conf")) |
241 if needs_add:
242 os.mkdir(dirname)
It looks like that would still create .bzr-builddeb?
Also, what do you think about moving local.conf as discussed on IRC?
Thanks,
James