From a1591449e766e1a8494be0fd4d90d6632f7f76b2 Mon Sep 17 00:00:00 2001 From: Nathan Hakkakzadeh Date: Thu, 26 May 2016 09:50:02 -0700 Subject: [PATCH] Bug 1275437 - Added methods for interacting with pacman. r=gps These new convenience methods let the bootstrapper update the local package list, upgrade all installed packages, and install new packages. MozReview-Commit-ID: KZPyBl0OU6Z --HG-- extra : rebase_source : 6a345b5e0cce7c0095dc1213d6609c1ca6a58920 --- python/mozboot/mozboot/windows.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/python/mozboot/mozboot/windows.py b/python/mozboot/mozboot/windows.py index a0f7b5642506..7df34750876f 100644 --- a/python/mozboot/mozboot/windows.py +++ b/python/mozboot/mozboot/windows.py @@ -3,6 +3,8 @@ # file, You can obtain one at http://mozilla.org/MPL/2.0/. import os +import sys +import subprocess from mozboot.base import BaseBootstrapper @@ -16,3 +18,22 @@ class WindowsBootstrapper(BaseBootstrapper): BaseBootstrapper.__init__(self, **kwargs) raise NotImplementedError('Bootstrap support is not yet available for Windows. ' 'For now, use MozillaBuild to set up a build environment on Windows.') + + def run(self, command): + subprocess.check_call(command, stdin=sys.stdin) + + def pacman_update(self): + command = ['pacman', '--sync', '--refresh'] + self.run(command) + + def pacman_upgrade(self): + command = ['pacman', '--sync', '--refresh', '--sysupgrade'] + self.run(command) + + def pacman_install(self, *packages): + command = ['pacman', '--sync', '--needed'] + if self.no_interactive: + command.append('--noconfirm') + + command.extend(packages) + self.run(command)