~ubuntu-branches/ubuntu/lucid/jhbuild/lucid

« back to all changes in this revision

Viewing changes to jhbuild/versioncontrol/arch.py

  • Committer: Bazaar Package Importer
  • Author(s): Emilio Pozuelo Monfort, Loic Minier, Emilio Pozuelo Monfort
  • Date: 2009-11-09 20:28:48 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20091109202848-m9ec7dmzptqtchtj
Tags: 2.28.0-1
[ Loic Minier ]
* Cleanups.
* Ship scripts.
* Don't set GNOME_MODULE as it equals the name of the source package.

[ Emilio Pozuelo Monfort ]
* New upstream release. Closes: #524504.
  - Use 'git rev-parse' rather than 'git-rev-parse'. Closes: #544642.
* Ship install-check. Closes: #441008.
* Uploaders list regenerated. Closes: #523542, #554071.
* debian/control.in,
  debian/rules:
  - Stop shipping a copy of subprocess.py. Require python >= 2.4.
  - Switch to python-support.
* debian/control.in:
  - Bump Standards-Version to 3.8.3, no changes needed.
  - Build depend on intltool >= 0.35.0.
  - Build depend on pkg-config, gnome-doc-utils and rarian-compat to build
    the documentation.
  - Make jhbuild arch any since install-check is a binary. Depend on
    ${shlibs:Depends}.
  - Recommend, and not suggest, git-core. Also recommend mercurial.
* debian/watch:
  - Added.
* debian/patches/01_import_from_pkgdatadir.patch:
  - Added, import jhbuild from pkgdatadir if everything else fails.
    This way we can ship the jhbuild private modules in /usr/sharejhbuild.
* debian/jhbuild.docs:
  - Removed, the necessary docs are now installed by the upstream Makefile.
* debian/rules:
  - Include autotools.mk and gnome.mk.
  - Remove all the manual build process, autotools.mk does everything now.
  - Install the jhbuild modules in /usr/share/jhbuild.
* debian/install:
  - Install the modulesets and patches from here since the upstream build
    system doesn't install them.

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
 
23
23
import os, sys
24
24
 
25
 
from jhbuild.errors import FatalError, BuildStateError
 
25
from jhbuild.errors import FatalError, BuildStateError, CommandError
26
26
from jhbuild.utils.cmds import get_output
27
27
from jhbuild.versioncontrol import Repository, Branch, register_repo_type
 
28
from jhbuild.commands.sanitycheck import inpath
28
29
 
29
30
def is_registered(archive):
30
31
    location = os.path.join(os.environ['HOME'], '.arch-params',
36
37
        assert uri is not None, 'can not register archive without uri'
37
38
        res = os.system('baz register-archive %s' % uri)
38
39
        if res != 0:
39
 
            raise jhbuild.errors.FatalError('could not register archive %s'
 
40
            raise jhbuild.errors.FatalError(_('could not register archive %s')
40
41
                                            % archive)
41
42
 
42
43
def get_version(directory):
76
77
            return
77
78
 
78
79
        if self.href is None:
79
 
            raise BuildStateError('archive %s not registered' % self.href)
 
80
            raise BuildStateError(_('archive %s not registered') % self.href)
80
81
        res = os.system('baz register-archive %s' % self.href)
81
82
        if res != 0:
82
 
            raise BuildStateError('could not register archive %s'
 
83
            raise BuildStateError(_('could not register archive %s')
83
84
                                  % self.archive)
84
85
 
85
86
    branch_xml_attrs = ['module', 'checkoutdir']
86
87
 
87
88
    def branch(self, name, module=None, checkoutdir=None):
88
89
        if name in self.config.branches:
89
 
            module = self.config.branches[module]
 
90
            module = self.config.branches[name]
 
91
            if not module:
 
92
                raise FatalError(_('branch for %s has wrong override, check your .jhbuildrc') % name)
90
93
        else:
91
94
            if module is None:
92
95
                module = name
97
100
class ArchBranch(Branch):
98
101
    """A class representing an Arch branch"""
99
102
 
100
 
    def __init__(self, repository, module, checkoutdir):
101
 
        self.repository = repository
102
 
        self.config = repository.config
103
 
        self.module = module
104
 
        self.checkoutdir = checkoutdir
105
 
 
106
103
    def srcdir(self):
107
104
        if self.checkoutdir:
108
 
            return os.path.join(self.config.checkoutroot, self.checkoutdir)
 
105
            return os.path.join(self.checkoutroot, self.checkoutdir)
109
106
        else:
110
 
            return os.path.join(self.config.checkoutroot,
 
107
            return os.path.join(self.checkoutroot,
111
108
                                os.path.basename(self.module))
112
109
    srcdir = property(srcdir)
113
110
 
128
125
            cmd.append(checkoutdir)
129
126
 
130
127
        if date:
131
 
            raise BuildStageError('date based checkout not yet supported\n')
 
128
            raise BuildStageError(_('date based checkout not yet supported\n'))
132
129
 
133
 
        buildscript.execute(cmd, 'arch', cwd=self.config.checkoutroot)
 
130
        buildscript.execute(cmd, 'arch', cwd=self.checkoutroot)
134
131
 
135
132
    def _update(self, buildscript):
136
133
        '''Perform a "baz update" (or possibly a checkout)'''
141
138
            self.repository._ensure_registered()
142
139
 
143
140
        if date:
144
 
            raise BuildStageError('date based checkout not yet supported\n')
 
141
            raise BuildStageError(_('date based checkout not yet supported\n'))
145
142
 
146
143
        archive, version = split_name(self.module)
147
144
        # how do you move a working copy to another branch?
154
151
        buildscript.execute(cmd, 'arch', cwd=self.srcdir)
155
152
 
156
153
    def checkout(self, buildscript):
157
 
        if os.path.exists(self.srcdir):
158
 
            self._update(buildscript)
159
 
        else:
160
 
            self._checkout(buildscript)
161
 
 
162
 
    def force_checkout(self, buildscript):
163
 
        self._checkout(buildscript)
 
154
        if not inpath('arch', os.environ['PATH'].split(os.pathsep)):
 
155
            raise CommandError(_('%s not found') % 'arch')
 
156
        Branch.checkout(self, buildscript)
164
157
 
165
158
    def tree_id(self):
166
 
        data = get_output(['baz', 'tree-id', '-d', self.srcdir])
 
159
        if not os.path.exists(self.srcdir):
 
160
            return None
 
161
        data = get_output(['baz', 'tree-id', '-d', self.srcdir], cwd = self.srcdir)
167
162
        return data.strip()
168
163
 
169
164