summaryrefslogtreecommitdiffstats
path: root/python/mozboot/mozboot/gentoo.py
blob: 4ddf86696fdd96eeb9bb5beb30b50e80db89fb77 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

from mozboot.base import BaseBootstrapper
from mozboot.linux_common import LinuxBootstrapper


class GentooBootstrapper(LinuxBootstrapper, BaseBootstrapper):
    def __init__(self, version, dist_id, **kwargs):
        BaseBootstrapper.__init__(self, **kwargs)

        self.version = version
        self.dist_id = dist_id

    def install_packages(self, packages):
        DISAMBIGUATE = {
            "gzip": "app-arch/gzip",
            "tar": "app-arch/tar",
        }
        # watchman is available but requires messing with USEs.
        packages = [DISAMBIGUATE.get(p, p) for p in packages if p != "watchman"]
        self.run_as_root(["emerge", "--noreplace"] + packages)

    def _update_package_manager(self):
        self.run_as_root(["emerge", "--sync"])

    def upgrade_mercurial(self, current):
        self.run_as_root(["emerge", "--update", "mercurial"])