python/mozboot/mozboot/ubuntu.py

Thu, 15 Jan 2015 21:13:52 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 21:13:52 +0100
branch
TOR_BUG_9701
changeset 12
7540298fafa1
permissions
-rw-r--r--

Remove forgotten relic of ABI crash risk averse overloaded method change.

michael@0 1 # This Source Code Form is subject to the terms of the Mozilla Public
michael@0 2 # License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 3 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
michael@0 4
michael@0 5 import os
michael@0 6
michael@0 7 from mozboot.debian import DebianBootstrapper
michael@0 8
michael@0 9
michael@0 10 MERCURIAL_PPA = '''
michael@0 11 Ubuntu does not provide a modern Mercurial in its package repository. So,
michael@0 12 we will install a PPA that does.
michael@0 13 '''.strip()
michael@0 14
michael@0 15 # Ubuntu shares much logic with Debian, so it inherits from it.
michael@0 16 class UbuntuBootstrapper(DebianBootstrapper):
michael@0 17 DISTRO_PACKAGES = [
michael@0 18 # This contains add-apt-repository.
michael@0 19 'software-properties-common',
michael@0 20 ]
michael@0 21
michael@0 22 def upgrade_mercurial(self, current):
michael@0 23 # Ubuntu releases up through at least 13.04 don't ship a modern
michael@0 24 # Mercurial. So we hook up a PPA that provides one.
michael@0 25 self._add_ppa('mercurial-ppa/releases')
michael@0 26 self._update_package_manager()
michael@0 27 self.apt_install('mercurial')
michael@0 28
michael@0 29 def _add_ppa(self, ppa):
michael@0 30 # Detect PPAs that have already been added. Sadly add-apt-repository
michael@0 31 # doesn't do this for us and will import keys, etc every time. This
michael@0 32 # incurs a user prompt and is annoying, so we try to prevent it.
michael@0 33 list_file = ppa.replace('/', '-')
michael@0 34 for source in os.listdir('/etc/apt/sources.list.d'):
michael@0 35 if source.startswith(list_file) and source.endswith('.list'):
michael@0 36 return
michael@0 37
michael@0 38 self.run_as_root(['add-apt-repository', 'ppa:%s' % ppa])

mercurial