Package: bzr-builddeb
Version: 0.95
Severity: minor
Tags: patch

Hi,

the documentation obtained using `bzr help builddeb' contains the
following text:

        $ bzr help builddeb
        [...]
        for use in merge mode, defaults to ../tarballs. --result-dir specifies 
where
        the resulting package files should be placed, defaults to whatever is 
        used for the build directory. --result-dir will have problems if you 
use a
        build command that places the results in a different directory.
        [...]

However,

        $  bzr builddeb --orig-dir ../../../tarballs/ \
        > --result-dir ../../../build-area/
        bzr: ERROR: no such option: --result-dir
        $

while

        $  bzr builddeb --orig-dir ../../../tarballs/ \
        > --result ../../../build-area/
        [builds just fine]
        $

The attached patch (modify_documentation.diff) fixes the problem by syncing
the inline documentation with the actual option name. It's a simple
two-line patch which doesn't touch the code, so no harm can possibly be
done by applying it.

However, since having that option named --result instead of --result-dir is
not coherent with the other options (--orig-dir and --build-dir), I've made
a second patch (modify_behavior.diff), which changes the code to reflect the
documentation.

This is not a simple name change, since I've modified the behavior as well,
to make it orthogonal with the behavior of the other two options. I feel
pretty confident the patch is harmless, but I can offer no guarantee.

By the way, I feel a --dir-prefix or similar option would be nice to have,
so that you will be able to replace

        $ bzr builddeb --orig-dir ../../../tarballs \
          --build-dir ../../../build-area \
          --result-dir ../../../build-area

with just

        $ bzr builddeb --dir-prefix ../../../

to save some typing when you're building from a branch deep into a shared
repository. But I'll file a separate, wishlist bug about that another day.

Cheers.

-- System Information:
Debian Release: squeeze/sid
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'unstable'), (1, 'experimental')
Architecture: i386 (i686)

Kernel: Linux 2.6.30-2-686 (SMP w/1 CPU core)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages bzr-builddeb depends on:
ii  bzr                           2.0.1-1    easy to use distributed version co
ii  bzrtools                      2.0.1-1    Collection of tools for bzr
ii  devscripts                    2.10.55    scripts to make the life of a Debi
ii  dpkg-dev                      1.15.3.1   Debian package development tools
ii  fakeroot                      1.14       Gives a fake root environment
ii  patchutils                    0.3.1-2    Utilities to work with patches
ii  python                        2.5.4-2    An interactive high-level object-o
ii  python-apt                    0.7.13.3   Python interface to libapt-pkg
ii  python-central                0.6.11     register and build utility for Pyt
ii  python-debian                 0.1.14     Python modules to work with Debian

bzr-builddeb recommends no packages.

Versions of packages bzr-builddeb suggests:
pn  bzr-svn                       <none>     (no description available)

-- no debconf information
diff -Naru builddeb.orig/__init__.py builddeb/__init__.py
--- builddeb.orig/__init__.py	2009-10-22 09:07:16.000000000 +0200
+++ builddeb/__init__.py	2009-10-22 10:24:12.000000000 +0200
@@ -110,9 +110,9 @@
   You can also specify directories to use for different things. --build-dir
   is the directory to build the packages beneath, defaults to ../build-area.
   --orig-dir specifies the directory that contains the .orig.tar.gz files 
-  for use in merge mode, defaults to ../tarballs. --result-dir specifies where
+  for use in merge mode, defaults to ../tarballs. --result specifies where
   the resulting package files should be placed, defaults to whatever is 
-  used for the build directory. --result-dir will have problems if you use a
+  used for the build directory. --result will have problems if you use a
   build command that places the results in a different directory.
 
   The --reuse option will be useful if you are in merge mode, and the upstream
diff -Naru builddeb.orig/builder.py builddeb/builder.py
--- builddeb.orig/builder.py	2009-10-22 10:02:59.000000000 +0200
+++ builddeb/builder.py	2009-10-22 10:05:16.000000000 +0200
@@ -314,6 +314,10 @@
 
     The files are found by reading the changes file.
     """
+    if result == self._properties.build_dir():
+      info("Not moving result, build dir and result dir are the same")
+      return
+
     info("Placing result in %s", result)
     package = self._properties.package()
     version = self._properties.full_version()
diff -Naru builddeb.orig/__init__.py builddeb/__init__.py
--- builddeb.orig/__init__.py	2009-10-22 09:07:16.000000000 +0200
+++ builddeb/__init__.py	2009-10-22 09:39:10.000000000 +0200
@@ -58,7 +58,7 @@
 
 dont_purge_opt = Option('dont-purge',
     help="Don't purge the build directory after building")
-result_opt = Option('result',
+result_dir_opt = Option('result-dir',
     help="Directory in which to place the resulting package files", type=str)
 builder_opt = Option('builder',
     help="Command to build the package", type=str)
@@ -87,6 +87,7 @@
 
 default_build_dir = '../build-area'
 default_orig_dir = '../tarballs'
+default_result_dir = '../build-area'
 
 
 class cmd_builddeb(Command):
@@ -158,14 +159,14 @@
   takes_args = ['branch?']
   aliases = ['bd']
   takes_options = [working_tree_opt, export_only_opt,
-      dont_purge_opt, use_existing_opt, result_opt, builder_opt, merge_opt,
+      dont_purge_opt, use_existing_opt, result_dir_opt, builder_opt, merge_opt,
       build_dir_opt, orig_dir_opt, ignore_changes_opt, ignore_unknowns_opt,
       quick_opt, reuse_opt, native_opt, split_opt, export_upstream_opt,
       export_upstream_revision_opt, source_opt, 'revision', no_user_conf]
 
   def run(self, branch=None, verbose=False, working_tree=False,
           export_only=False, dont_purge=False, use_existing=False,
-          result=None, builder=None, merge=False, build_dir=None,
+          result_dir=None, builder=None, merge=False, build_dir=None,
           orig_dir=None, ignore_changes=False, ignore_unknowns=False,
           quick=False, reuse=False, native=False, split=False,
           export_upstream=None, export_upstream_revision=None,
@@ -262,13 +263,11 @@
     if export_upstream_revision is None:
       export_upstream_revision = config.export_upstream_revision
 
-    if result is None:
+    if result_dir is None:
       if is_local:
-        result = config.result_dir
+        result_dir = config.result_dir or default_result_dir
       else:
-        result = config.user_result_dir
-    if result is not None:
-      result = os.path.realpath(result)
+        result_dir = config.user_result_dir or 'build-area'
     
     if build_dir is None:
       if is_local:
@@ -327,8 +326,8 @@
       run_hook(tree, 'post-build', config, wd=properties.source_dir())
       if not dont_purge:
         build.clean()
-      if result is not None:
-        build.move_result(result)
+      if result_dir is not None:
+        build.move_result(result_dir)
 
 
 register_command(cmd_builddeb)
@@ -585,6 +584,8 @@
     orig_dir = config.orig_dir
     if orig_dir is None:
       orig_dir = default_orig_dir
+    if result_dir is None:
+      result_dir = default_result_dir
     properties = BuildProperties(changelog, build_dir, orig_dir, larstiq)
     export_upstream = config.export_upstream
     export_upstream_revision = config.export_upstream_revision

Reply via email to