~ubuntu-branches/ubuntu/natty/bzr-builddeb/natty-proposed

« back to all changes in this revision

Viewing changes to util.py

  • Committer: Bazaar Package Importer
  • Author(s): Jelmer Vernooij, James Westby, Jelmer Vernooij
  • Date: 2010-02-13 00:44:03 UTC
  • mfrom: (6.1.1 experimental)
  • Revision ID: james.westby@ubuntu.com-20100213004403-9ug5ihttyyomebf6
Tags: 2.3
[ James Westby ]
* Some support for v3 source formats (Closes: #562991)
  - Those that look quite a lot like v1 are supported well.
  - .tar.bz2 tarballs are supported for import, building, merge-upstream,
    etc., but only enabled for the latter with a --v3 switch for now.
  - Multiple orig.tar.gz is not supported.
  - .tar.lzma is not supported awaiting pristine-tar support.
* New "dh-make" command ("dh_make" alias) that allows you to start
  packaging, either in an empty branch, or based on an upstream branch.
* Fix merge-package for native packages (LP: #476348)
* debian/changelog merge hook to reduce the manual conflict resolution
  required there. Thanks to John Arbash Meinel and Andrew Bennetts
  (LP: #501754).
  - Requires newer bzr.
* Fix merge-package outside a shared repo (LP: #493462)
* Fix exporting of symlinks (LP: #364671)
* Add --force option to merge-upstream which may help certain people.
* Use system configobj if the bzr copy isn't available. Thanks Jelmer.
* Make merging multiple-root branches work. Thanks Robert Collins.
* Disentangle from bzrtools. Thanks Max Bowser.

[ Jelmer Vernooij ]
* Bump standards version to 3.8.4.
* Fix formatting in doc-base.

Show diffs side-by-side

added added

removed removed

Lines of Context:
38
38
        errors,
39
39
        urlutils,
40
40
        )
 
41
from bzrlib.trace import warning
41
42
from bzrlib.transport import (
42
43
    do_catching_redirections,
43
44
    get_transport,
44
45
    )
 
46
from bzrlib.plugins.builddeb import (
 
47
    default_conf,
 
48
    local_conf,
 
49
    global_conf,
 
50
    )
 
51
from bzrlib.plugins.builddeb.config import DebBuildConfig
45
52
from bzrlib.plugins.builddeb.errors import (
46
53
                MissingChangelogError,
47
54
                AddChangelogError,
155
162
        return changes
156
163
 
157
164
 
158
 
def tarball_name(package, version):
 
165
def tarball_name(package, version, format=None):
159
166
    """Return the name of the .orig.tar.gz for the given package and version.
160
167
 
161
168
    :param package: the name of the source package.
162
169
    :param version: the upstream version of the package.
 
170
    :param format: the format for the tarball. If None then 'gz' will be
 
171
         used. You probably want on of 'gz', 'bz2', or 'lzma'.
163
172
    :return: a string that is the name of the upstream tarball to use.
164
173
    """
165
 
    return "%s_%s.orig.tar.gz" % (package, str(version))
 
174
    if format is None:
 
175
        format = 'gz'
 
176
    return "%s_%s.orig.tar.%s" % (package, str(version), format)
166
177
 
167
178
 
168
179
def get_snapshot_revision(upstream_version):
463
474
    # non-Python subprocesses expect.
464
475
    # Many, many thanks to Colin Watson
465
476
    signal.signal(signal.SIGPIPE, signal.SIG_DFL)
 
477
 
 
478
 
 
479
def debuild_config(tree, working_tree, no_user_config):
 
480
    """Obtain the Debuild configuration object.
 
481
 
 
482
    :param tree: A Tree object, can be a WorkingTree or RevisionTree.
 
483
    :param working_tree: Whether the tree is a working tree.
 
484
    :param no_user_config: Whether to skip the user configuration
 
485
    """
 
486
    config_files = []
 
487
    user_config = None
 
488
    if (working_tree and tree.has_filename(local_conf)):
 
489
        if tree.path2id(local_conf) is None:
 
490
            config_files.append((tree.get_file_byname(local_conf), True,
 
491
                        "local.conf"))
 
492
        else:
 
493
            warning('Not using configuration from %s as it is versioned.')
 
494
    if not no_user_config:
 
495
        config_files.append((global_conf, True))
 
496
        user_config = global_conf
 
497
    if tree.path2id(default_conf):
 
498
        config_files.append((tree.get_file(tree.path2id(default_conf)), False,
 
499
                    "default.conf"))
 
500
    config = DebBuildConfig(config_files, tree=tree)
 
501
    config.set_user_config(user_config)
 
502
    return config