Merge lp:~jelmer/bzr-builddeb/move-config-to-debian-dir into lp:bzr-builddeb

Proposed by Jelmer Vernooij
Status: Merged
Approved by: James Westby
Approved revision: 620
Merged at revision: 630
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
Reviewer Review Type Date Requested Status
Bzr-builddeb-hackers Pending
Review via email: mp+78989@code.launchpad.net

This proposal supersedes a proposal from 2011-09-28.

Description of the change

Move versioned configuration to debian/bzr-builddeb.conf and local configuration to debian/bzr-builddeb.conf.local.

To post a comment you must log in.
Revision history for this message
James Westby (james-w) wrote : Posted in a previous version of this proposal

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

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file '__init__.py'
--- __init__.py 2011-10-07 10:57:44 +0000
+++ __init__.py 2011-10-11 14:49:23 +0000
@@ -57,6 +57,8 @@
57 from bzrlib.config import config_dir57 from bzrlib.config import config_dir
58 return os.path.join(config_dir(), 'builddeb.conf')58 return os.path.join(config_dir(), 'builddeb.conf')
59local_conf = os.path.join(builddeb_dir, 'local.conf')59local_conf = os.path.join(builddeb_dir, 'local.conf')
60new_local_conf = 'debian/local.conf.local'
61new_conf = 'debian/bzr-builddeb.conf'
6062
61default_build_dir = '../build-area'63default_build_dir = '../build-area'
62default_orig_dir = '..'64default_orig_dir = '..'
6365
=== modified file 'config.py'
--- config.py 2011-10-07 10:57:44 +0000
+++ config.py 2011-10-11 14:49:23 +0000
@@ -56,7 +56,9 @@
56class DebBuildConfig(object):56class DebBuildConfig(object):
57 """Holds the configuration settings for builddeb. These are taken from57 """Holds the configuration settings for builddeb. These are taken from
58 a hierarchy of config files. .bzr-builddeb/local.conf then 58 a hierarchy of config files. .bzr-builddeb/local.conf then
59 ~/.bazaar/builddeb.conf, finally .bzr-builddeb/default.conf. The value is 59 debian/bzr-builddeb.conf.local,
60 ~/.bazaar/builddeb.conf, debian/bzr-builddeb.conf,
61 finally .bzr-builddeb/default.conf. The value is
60 taken from the first file in which it is specified."""62 taken from the first file in which it is specified."""
6163
62 section = 'BUILDDEB'64 section = 'BUILDDEB'
6365
=== modified file 'debian/changelog'
--- debian/changelog 2011-10-08 21:45:17 +0000
+++ debian/changelog 2011-10-11 14:49:23 +0000
@@ -17,7 +17,10 @@
1717
18 [ Jelmer Vernooij ]18 [ Jelmer Vernooij ]
19 * Support .tar.xz Debian files rather than .tar.lzma.19 * Support .tar.xz Debian files rather than .tar.lzma.
20 * Move .bzr-builddeb/default.conf to debian/bzr-builddeb.conf. LP:
21 #793137
2022
23<<<<<<< TREE
21 [ Martin Packman ]24 [ Martin Packman ]
22 * Support non-ascii characters in changelog entry when determining25 * Support non-ascii characters in changelog entry when determining
23 commit message. LP: #85366426 commit message. LP: #853664
@@ -26,6 +29,9 @@
26 * Use more complete control file during examples. Closes: #64281829 * Use more complete control file during examples. Closes: #642818
2730
28 -- Jelmer Vernooij <jelmer@debian.org> Sat, 01 Oct 2011 21:27:05 +020031 -- Jelmer Vernooij <jelmer@debian.org> Sat, 01 Oct 2011 21:27:05 +0200
32=======
33 -- Jelmer Vernooij <jelmer@debian.org> Wed, 28 Sep 2011 15:15:14 +0200
34>>>>>>> MERGE-SOURCE
2935
30bzr-builddeb (2.7.8) unstable; urgency=low36bzr-builddeb (2.7.8) unstable; urgency=low
3137
3238
=== modified file 'doc/user_manual/configuration.rst'
--- doc/user_manual/configuration.rst 2011-10-07 11:14:44 +0000
+++ doc/user_manual/configuration.rst 2011-10-11 14:49:23 +0000
@@ -6,7 +6,8 @@
66
7 * .bzr-builddeb/local.conf (in the package directory)7 * .bzr-builddeb/local.conf (in the package directory)
8 * ~/.bazaar/builddeb.conf8 * ~/.bazaar/builddeb.conf
9 * .bzr-builddeb/default.conf (in the package directory)9 * debian/bzr-builddeb.conf (in the package directory)
10 * .bzr-builddeb/default.conf (in the package directory, deprecated)
1011
11The last of these should be used for values that will be used by all users of12The last of these should be used for values that will be used by all users of
12the package, for instance 'merge = True'. The others are for the user to add13the package, for instance 'merge = True'. The others are for the user to add
@@ -138,7 +139,7 @@
138 (Defaults to ``fakeroot debian/rules binary``). Will only be read from139 (Defaults to ``fakeroot debian/rules binary``). Will only be read from
139 the config file in your home directory.140 the config file in your home directory.
140141
141The idea is that certain options can be set in ``.bzr-builddeb/default.conf`` 142The idea is that certain options can be set in ``debian/bzr-builddeb.conf``
142that apply to the package on all systems, or that there is a default that is 143that apply to the package on all systems, or that there is a default that is
143wanted that differs from the default provided. ``merge = True`` is a perfect 144wanted that differs from the default provided. ``merge = True`` is a perfect
144example of this.145example of this.
145146
=== modified file 'doc/user_manual/hooks.rst'
--- doc/user_manual/hooks.rst 2011-02-27 16:15:50 +0000
+++ doc/user_manual/hooks.rst 2011-10-11 14:49:23 +0000
@@ -48,7 +48,7 @@
48Hooks are set by editing the configuration files. The normal precedence48Hooks are set by editing the configuration files. The normal precedence
49rules for these files are followed (see `configuration`_ for details). This49rules for these files are followed (see `configuration`_ for details). This
50means that you should set hooks needed to build the package in50means that you should set hooks needed to build the package in
51``.bzr-builddeb/default.conf``, and any hooks that you would like to run51``debian/bzr-builddeb.conf``, and any hooks that you would like to run
52that would not be appropriate for everyone in ``.bzr-builddeb/local.conf``.52that would not be appropriate for everyone in ``.bzr-builddeb/local.conf``.
53Note however that the latter overrides the formula, so your local hooks should53Note however that the latter overrides the formula, so your local hooks should
54run all necessary commands from the default hooks that are necessary to build54run all necessary commands from the default hooks that are necessary to build
5555
=== modified file 'doc/user_manual/merge.rst'
--- doc/user_manual/merge.rst 2011-10-03 11:03:46 +0000
+++ doc/user_manual/merge.rst 2011-10-11 14:49:23 +0000
@@ -48,14 +48,13 @@
4848
49Now you have a branch that you will create the package in you need to tell49Now you have a branch that you will create the package in you need to tell
50`bzr-builddeb` that it will be built in merge mode. To do this you need to50`bzr-builddeb` that it will be built in merge mode. To do this you need to
51create the configuration file ``.bzr-builddeb/default.conf``. This contains51create the configuration file ``debian/bzr-builddeb.conf``. This contains
52the default options for the package. The file starts with a ``[BUILDDEB]``52the default options for the package. The file starts with a ``[BUILDDEB]``
53header which states that the file is for use by `bzr-builddeb`. The option53header which states that the file is for use by `bzr-builddeb`. The option
54we are interested in is the ``merge`` option. The commands to do this are::54we are interested in is the ``merge`` option. The commands to do this are::
5555
56 $ mkdir .bzr-builddeb/56 $ echo -e '[BUILDDEB]\nmerge = True' > debian/bzr-builddeb.conf
57 $ echo -e '[BUILDDEB]\nmerge = True' > .bzr-builddeb/default.conf57 $ bzr add debian/bzr-builddeb.conf
58 $ bzr add .bzr-builddeb/default.conf
5958
60Now you should add the packaging files to the branch. You have a choice59Now you should add the packaging files to the branch. You have a choice
61here, either you can add a ``debian/`` directory containing the files,60here, either you can add a ``debian/`` directory containing the files,
6261
=== modified file 'doc/user_manual/native.rst'
--- doc/user_manual/native.rst 2009-02-18 22:50:44 +0000
+++ doc/user_manual/native.rst 2011-10-11 14:49:23 +0000
@@ -53,14 +53,13 @@
5353
54Now you have a branch that you will create the package in you need to tell54Now you have a branch that you will create the package in you need to tell
55`bzr-builddeb` that it will be a native package. To do this you need to55`bzr-builddeb` that it will be a native package. To do this you need to
56create the configuration file ``.bzr-builddeb/default.conf``. This contains56create the configuration file ``debian/bzr-builddeb.conf``. This contains
57the default options for the package. The file starts with a ``[BUILDDEB]``57the default options for the package. The file starts with a ``[BUILDDEB]``
58header which states that the file is for use by `bzr-builddeb`. The option58header which states that the file is for use by `bzr-builddeb`. The option
59we are interested in is the ``native`` option. The commands to do this are::59we are interested in is the ``native`` option. The commands to do this are::
6060
61 $ mkdir .bzr-builddeb/61 $ echo -e '[BUILDDEB]\nnative = True' > debian/bzr-builddeb.conf
62 $ echo -e '[BUILDDEB]\nnative = True' > .bzr-builddeb/default.conf62 $ bzr add dbian/bzr-builddeb.conf
63 $ bzr add .bzr-builddeb/default.conf
6463
65Now you are ready to create the package. Add all of the files for the64Now you are ready to create the package. Add all of the files for the
66package, and the packaging in ``debian/``, and then you can add the files65package, and the packaging in ``debian/``, and then you can add the files
6766
=== modified file 'doc/user_manual/split.rst'
--- doc/user_manual/split.rst 2009-02-18 18:36:18 +0000
+++ doc/user_manual/split.rst 2011-10-11 14:49:23 +0000
@@ -60,14 +60,14 @@
60which will create a branch and add all of your current code to it.60which will create a branch and add all of your current code to it.
6161
62The next step is to tell `bzr-builddeb` that it is a split mode package. To62The next step is to tell `bzr-builddeb` that it is a split mode package. To
63do this create the configuration file ``.bzr-builddeb/default.conf`` in the63do this create the configuration file ``debian/bzr-builddeb.conf`` in the
64branch. This contains the options that are default for building the package.64branch. This contains the options that are default for building the package.
65The file starts with a ``[BUILDDEB]`` header to identify the options that65The file starts with a ``[BUILDDEB]`` header to identify the options that
66the plugin should use, and the option that you need to set is ``split``.66the plugin should use, and the option that you need to set is ``split``.
67The following commands will set up the configuration files for you::67The following commands will set up the configuration files for you::
6868
69 $ echo -e '[BUILDDEB]\nsplit = True' > .bzr-builddeb/default.conf69 $ echo -e '[BUILDDEB]\nsplit = True' > debian/bzr-builddeb.conf
70 $ bzr add .bzr-builddeb/default.conf70 $ bzr add debian/bzr-builddeb.conf
7171
72When you are happy with the code you can commit, and then build the package.72When you are happy with the code you can commit, and then build the package.
73`bzr-builddeb` will see that it is a split mode package and create the73`bzr-builddeb` will see that it is a split mode package and create the
7474
=== modified file 'import_dsc.py'
--- import_dsc.py 2011-09-27 00:48:16 +0000
+++ import_dsc.py 2011-10-11 14:49:23 +0000
@@ -451,23 +451,24 @@
451451
452 def _default_config_for_tree(self, tree):452 def _default_config_for_tree(self, tree):
453 # FIXME: shouldn't go to configobj directly453 # FIXME: shouldn't go to configobj directly
454 path = '.bzr-builddeb/default.conf'454 for path in ('debian/bzr-builddeb.conf', '.bzr-builddeb/default.conf',):
455 c_fileid = tree.path2id(path)455 c_fileid = tree.path2id(path)
456 config = None456 if c_fileid is not None:
457 if c_fileid is not None:457 break
458 tree.lock_read()458 else:
459 return None, None
460 tree.lock_read()
461 try:
462 config = ConfigObj(tree.get_file(c_fileid, path))
459 try:463 try:
460 config = ConfigObj(tree.get_file(c_fileid, path))464 config['BUILDDEB']
461 try:465 except KeyError:
462 config['BUILDDEB']466 config['BUILDDEB'] = {}
463 except KeyError:467 finally:
464 config['BUILDDEB'] = {}468 tree.unlock()
465 finally:469 return c_fileid, config
466 tree.unlock()
467 return config
468470
469 def _is_tree_native(self, tree):471 def _is_tree_native(self, config):
470 config = self._default_config_for_tree(tree)
471 if config is not None:472 if config is not None:
472 try:473 try:
473 current_value = config['BUILDDEB']['native']474 current_value = config['BUILDDEB']['native']
@@ -486,7 +487,8 @@
486 """487 """
487 revid = self.revid_of_version(version)488 revid = self.revid_of_version(version)
488 rev_tree = self.branch.repository.revision_tree(revid)489 rev_tree = self.branch.repository.revision_tree(revid)
489 if self._is_tree_native(rev_tree):490 config_fileid, current_config = self._default_config_for_tree(rev_tree)
491 if self._is_tree_native(current_config):
490 return True492 return True
491 rev = self.branch.repository.get_revision(revid)493 rev = self.branch.repository.get_revision(revid)
492 try:494 try:
@@ -918,22 +920,20 @@
918920
919 def _mark_native_config(self, native):921 def _mark_native_config(self, native):
920 poss_native_tree = self.branch.basis_tree()922 poss_native_tree = self.branch.basis_tree()
921 current_native = self._is_tree_native(poss_native_tree)923 config_fileid, current_config = self._default_config_for_tree(poss_native_tree)
922 current_config = self._default_config_for_tree(poss_native_tree)924 current_native = self._is_tree_native(current_config)
923 dirname = os.path.join(self.tree.basedir, '.bzr-builddeb')
924 if current_config is not None:925 if current_config is not None:
925 # Add that back to the current tree926 # Add that back to the current tree
926 if not os.path.exists(dirname):927 current_config.filename = os.path.join(self.tree.basedir,
927 os.mkdir(dirname)928 poss_native_tree.id2path(config_fileid))
928 current_config.filename = os.path.join(dirname,929 dir_path = osutils.dirname(current_config.filename)
929 'default.conf')930 if not os.path.exists(dir_path):
931 os.mkdir(dir_path)
930 current_config.write()932 current_config.write()
931 dir_id = poss_native_tree.path2id('.bzr-builddeb')933 dirname = osutils.dirname(poss_native_tree.id2path(config_fileid))
932 file_id = poss_native_tree.path2id(934 dir_id = poss_native_tree.path2id(dirname)
933 '.bzr-builddeb/default.conf')935 self.tree.add([dirname, poss_native_tree.id2path(config_fileid)],
934 self.tree.add(['.bzr-builddeb/',936 ids=[dir_id, config_fileid])
935 '.bzr-builddeb/default.conf'],
936 ids=[dir_id, file_id])
937 if native != current_native:937 if native != current_native:
938 if current_config is None:938 if current_config is None:
939 needs_add = True939 needs_add = True
@@ -949,17 +949,15 @@
949 del current_config['BUILDDEB']949 del current_config['BUILDDEB']
950 if len(current_config) == 0:950 if len(current_config) == 0:
951 self.tree.remove(['.bzr-builddeb',951 self.tree.remove(['.bzr-builddeb',
952 '.bzr-builddeb/default.conf'],952 '.bzr-builddeb/default.conf',
953 'debian/bzr-builddeb.conf'],
953 keep_files=False)954 keep_files=False)
954 else:955 else:
955 if needs_add:956 current_config.filename = os.path.join(
956 os.mkdir(dirname)957 self.tree.basedir, 'debian', 'bzr-builddeb.conf')
957 current_config.filename = os.path.join(dirname,
958 'default.conf')
959 current_config.write()958 current_config.write()
960 if needs_add:959 if needs_add:
961 self.tree.add(['.bzr-builddeb/',960 self.tree.add(['debian', 'debian/bzr-builddeb.conf'])
962 '.bzr-builddeb/default.conf'])
963961
964 def import_debian(self, debian_part, version, parents, md5,962 def import_debian(self, debian_part, version, parents, md5,
965 native=False, timestamp=None, file_ids_from=None):963 native=False, timestamp=None, file_ids_from=None):
966964
=== modified file 'tests/test_import_dsc.py'
--- tests/test_import_dsc.py 2011-09-26 23:40:46 +0000
+++ tests/test_import_dsc.py 2011-10-11 14:49:23 +0000
@@ -1196,7 +1196,8 @@
1196 self.addCleanup(self.tree1.unlock)1196 self.addCleanup(self.tree1.unlock)
1197 self.assertTrue(self.db1.is_version_native(version))1197 self.assertTrue(self.db1.is_version_native(version))
1198 revtree = self.tree1.branch.repository.revision_tree(rh1[0])1198 revtree = self.tree1.branch.repository.revision_tree(rh1[0])
1199 self.assertTrue(self.db1._is_tree_native(revtree))1199 config_fileid, current_config = self.db1._default_config_for_tree(revtree)
1200 self.assertTrue(self.db1._is_tree_native(current_config))
12001201
1201 def test_import_native_two(self):1202 def test_import_native_two(self):
1202 version1 = Version("1.0")1203 version1 = Version("1.0")
@@ -1288,8 +1289,7 @@
1288 self.assertEqual(rev_tree1.get_parent_ids(), [rh1[0]])1289 self.assertEqual(rev_tree1.get_parent_ids(), [rh1[0]])
1289 self.assertEqual(rev_tree2.get_parent_ids(), [rh1[1]])1290 self.assertEqual(rev_tree2.get_parent_ids(), [rh1[1]])
1290 self.check_changes(rev_tree2.changes_from(rev_tree1),1291 self.check_changes(rev_tree2.changes_from(rev_tree1),
1291 added=["NEWS", ".bzr-builddeb/",1292 added=["NEWS", "debian/bzr-builddeb.conf"],
1292 ".bzr-builddeb/default.conf"],
1293 removed=["BUGS"], modified=["debian/changelog", "COPYING"])1293 removed=["BUGS"], modified=["debian/changelog", "COPYING"])
1294 self.assertEqual(self.db1.revid_of_version(version1), rh1[1])1294 self.assertEqual(self.db1.revid_of_version(version1), rh1[1])
1295 self.assertEqual(self.db1.revid_of_version(version2), rh1[2])1295 self.assertEqual(self.db1.revid_of_version(version2), rh1[2])
@@ -1329,14 +1329,12 @@
1329 self.assertEqual(up_rev_tree1.get_parent_ids(), [rh1[0]])1329 self.assertEqual(up_rev_tree1.get_parent_ids(), [rh1[0]])
1330 self.check_changes(rev_tree2.changes_from(rev_tree1),1330 self.check_changes(rev_tree2.changes_from(rev_tree1),
1331 added=["NEWS"],1331 added=["NEWS"],
1332 removed=["BUGS", ".bzr-builddeb/",1332 removed=["BUGS", "debian/bzr-builddeb.conf"],
1333 ".bzr-builddeb/default.conf"],
1334 modified=["debian/changelog", "COPYING"])1333 modified=["debian/changelog", "COPYING"])
1335 self.check_changes(up_rev_tree1.changes_from(rev_tree1),1334 self.check_changes(up_rev_tree1.changes_from(rev_tree1),
1336 added=["NEWS"],1335 added=["NEWS"],
1337 removed=["debian/", "debian/changelog", "debian/control",1336 removed=["debian/", "debian/changelog", "debian/control",
1338 "BUGS", "README", ".bzr-builddeb/",1337 "BUGS", "README", "debian/bzr-builddeb.conf"],
1339 ".bzr-builddeb/default.conf"],
1340 modified=["COPYING"])1338 modified=["COPYING"])
1341 self.check_changes(rev_tree2.changes_from(up_rev_tree1),1339 self.check_changes(rev_tree2.changes_from(up_rev_tree1),
1342 added=["debian/", "debian/changelog", "debian/control",1340 added=["debian/", "debian/changelog", "debian/control",
13431341
=== modified file 'util.py'
--- util.py 2011-09-29 10:11:07 +0000
+++ util.py 2011-10-11 14:49:23 +0000
@@ -55,6 +55,7 @@
55 default_conf,55 default_conf,
56 local_conf,56 local_conf,
57 global_conf,57 global_conf,
58 new_conf,
58 )59 )
59from bzrlib.plugins.builddeb.config import (60from bzrlib.plugins.builddeb.config import (
60 DebBuildConfig,61 DebBuildConfig,
@@ -533,14 +534,25 @@
533 """534 """
534 config_files = []535 config_files = []
535 user_config = None536 user_config = None
537 if (working_tree and tree.has_filename(new_local_conf)):
538 if tree.path2id(new_local_conf) is None:
539 config_files.append((tree.get_file_byname(new_local_conf), True,
540 "local.conf"))
541 else:
542 warning('Not using configuration from %s as it is versioned.',
543 new_local_conf)
536 if (working_tree and tree.has_filename(local_conf)):544 if (working_tree and tree.has_filename(local_conf)):
537 if tree.path2id(local_conf) is None:545 if tree.path2id(local_conf) is None:
538 config_files.append((tree.get_file_byname(local_conf), True,546 config_files.append((tree.get_file_byname(local_conf), True,
539 "local.conf"))547 "local.conf"))
540 else:548 else:
541 warning('Not using configuration from %s as it is versioned.')549 warning('Not using configuration from %s as it is versioned.',
550 local_conf)
542 config_files.append((global_conf(), True))551 config_files.append((global_conf(), True))
543 user_config = global_conf()552 user_config = global_conf()
553 if tree.path2id(new_conf):
554 config_files.append((tree.get_file(tree.path2id(new_conf)), False,
555 "bzr-builddeb.conf"))
544 if tree.path2id(default_conf):556 if tree.path2id(default_conf):
545 config_files.append((tree.get_file(tree.path2id(default_conf)), False,557 config_files.append((tree.get_file(tree.path2id(default_conf)), False,
546 "default.conf"))558 "default.conf"))

Subscribers

People subscribed via source and target branches