is the stdout (and stderr) from vagrant
"""
p = FDroidPopen(['vagrant'] + params, cwd=cwd)
- return (p.returncode, p.stdout)
+ return (p.returncode, p.output)
def get_vagrant_sshinfo():
p = FDroidPopen(['VBoxManage', 'snapshot',
get_builder_vm_id(), 'list',
'--details'], cwd='builder')
- if 'fdroidclean' in p.stdout:
+ if 'fdroidclean' in p.output:
logging.info("...snapshot exists - resetting build server to "
"clean state")
retcode, output = vagrant(['status'], cwd='builder')
logging.info("...failed to reset to snapshot")
else:
logging.info("...snapshot doesn't exist - "
- "VBoxManage snapshot list:\n" + p.stdout)
+ "VBoxManage snapshot list:\n" + p.output)
# If we can't use the existing machine for any reason, make a
# new one from scratch.
p = FDroidPopen(['VBoxManage', 'snapshot', get_builder_vm_id(),
'list', '--details'],
cwd='builder')
- if 'fdroidclean' not in p.stdout:
+ if 'fdroidclean' not in p.output:
raise BuildException("Failed to take snapshot.")
return sshinfo
if p is not None and p.returncode != 0:
raise BuildException("Error cleaning %s:%s" %
- (app['id'], thisbuild['version']), p.stdout)
+ (app['id'], thisbuild['version']), p.output)
logging.info("Getting rid of Gradle wrapper binaries...")
for root, dirs, files in os.walk(build_dir):
if p.returncode != 0:
raise BuildException("Error running build command for %s:%s" %
- (app['id'], thisbuild['version']), p.stdout)
+ (app['id'], thisbuild['version']), p.output)
# Build native stuff if required...
if thisbuild['buildjni'] and thisbuild['buildjni'] != ['no']:
del manifest_text
p = FDroidPopen(cmd, cwd=os.path.join(root_dir, d))
if p.returncode != 0:
- raise BuildException("NDK build failed for %s:%s" % (app['id'], thisbuild['version']), p.stdout)
+ raise BuildException("NDK build failed for %s:%s" % (app['id'], thisbuild['version']), p.output)
p = None
# Build the release...
bindir = os.path.join(root_dir, 'bin')
if p is not None and p.returncode != 0:
- raise BuildException("Build failed for %s:%s" % (app['id'], thisbuild['version']), p.stdout)
+ raise BuildException("Build failed for %s:%s" % (app['id'], thisbuild['version']), p.output)
logging.info("Successfully built version " + thisbuild['version'] + ' of ' + app['id'])
if thisbuild['type'] == 'maven':
stdout_apk = '\n'.join([
- line for line in p.stdout.splitlines() if any(a in line for a in ('.apk', '.ap_'))])
+ line for line in p.output.splitlines() if any(a in line for a in ('.apk', '.ap_'))])
m = re.match(r".*^\[INFO\] .*apkbuilder.*/([^/]*)\.apk",
stdout_apk, re.S | re.M)
if not m:
src = os.path.join(dd, 'build', 'apk', name + '.apk')
elif thisbuild['type'] == 'ant':
stdout_apk = '\n'.join([
- line for line in p.stdout.splitlines() if '.apk' in line])
+ line for line in p.output.splitlines() if '.apk' in line])
src = re.match(r".*^.*Creating (.+) for release.*$.*", stdout_apk,
re.S | re.M).group(1)
src = os.path.join(bindir, src)
version = None
foundid = None
nativecode = None
- for line in p.stdout.splitlines():
+ for line in p.output.splitlines():
if line.startswith("package:"):
pat = re.compile(".*name='([a-zA-Z0-9._]*)'.*")
m = pat.match(line)
# a safety check.
def checkrepo(self):
p = SilentPopen(['git', 'rev-parse', '--show-toplevel'], cwd=self.local)
- result = p.stdout.rstrip()
+ result = p.output.rstrip()
if not result.endswith(self.local):
raise VCSException('Repository mismatch')
def gettags(self):
self.checkrepo()
p = SilentPopen(['git', 'tag'], cwd=self.local)
- return p.stdout.splitlines()
+ return p.output.splitlines()
def latesttags(self, alltags, number):
self.checkrepo()
+ 'xargs -I@ git log --format=format:"%at @%n" -1 @ | '
+ 'sort -n | awk \'{print $2}\''],
cwd=self.local, shell=True)
- return p.stdout.splitlines()[-number:]
+ return p.output.splitlines()[-number:]
class vcs_gitsvn(vcs):
# a safety check.
def checkrepo(self):
p = SilentPopen(['git', 'rev-parse', '--show-toplevel'], cwd=self.local)
- result = p.stdout.rstrip()
+ result = p.output.rstrip()
if not result.endswith(self.local):
raise VCSException('Repository mismatch')
svn_rev = rev
p = SilentPopen(['git', 'svn', 'find-rev', 'r' + svn_rev, treeish], cwd=self.local)
- git_rev = p.stdout.rstrip()
+ git_rev = p.output.rstrip()
if p.returncode != 0 or not git_rev:
# Try a plain git checkout as a last resort
p = SilentPopen(['git', 'svn', 'find-rev', 'HEAD'], cwd=self.local)
if p.returncode != 0:
return None
- return p.stdout.strip()
+ return p.output.strip()
class vcs_svn(vcs):
def getref(self):
p = SilentPopen(['svn', 'info'], cwd=self.local)
- for line in p.stdout.splitlines():
+ for line in p.output.splitlines():
if line and line.startswith('Last Changed Rev: '):
return line[18:]
return None
raise VCSException("Hg checkout of '%s' failed" % rev)
p = SilentPopen(['hg', 'purge', '--all'], cwd=self.local)
# Also delete untracked files, we have to enable purge extension for that:
- if "'purge' is provided by the following extension" in p.stdout:
+ if "'purge' is provided by the following extension" in p.output:
with open(self.local + "/.hg/hgrc", "a") as myfile:
myfile.write("\n[extensions]\nhgext.purge=\n")
p = SilentPopen(['hg', 'purge', '--all'], cwd=self.local)
def gettags(self):
p = SilentPopen(['hg', 'tags', '-q'], cwd=self.local)
- return p.stdout.splitlines()[1:]
+ return p.output.splitlines()[1:]
class vcs_bzr(vcs):
def gettags(self):
p = SilentPopen(['bzr', 'tags'], cwd=self.local)
return [tag.split(' ')[0].strip() for tag in
- p.stdout.splitlines()]
+ p.output.splitlines()]
def retrieve_string(app_dir, string, xmlfiles=None):
p = FDroidPopen(['bash', '-x', '-c', cmd], cwd=libdir)
if p.returncode != 0:
raise BuildException("Error running prepare command for srclib %s"
- % name, p.stdout)
+ % name, p.output)
if basepath:
libdir = sdir
p = FDroidPopen(['bash', '-x', '-c', cmd], cwd=root_dir)
if p.returncode != 0:
raise BuildException("Error running init command for %s:%s" %
- (app['id'], build['version']), p.stdout)
+ (app['id'], build['version']), p.output)
# Apply patches if any
if build['patch']:
p = FDroidPopen(['bash', '-x', '-c', cmd], cwd=root_dir)
if p.returncode != 0:
raise BuildException("Error running prebuild command for %s:%s" %
- (app['id'], build['version']), p.stdout)
+ (app['id'], build['version']), p.output)
# Generate (or update) the ant build file, build.xml...
if build['update'] and build['update'] != ['no'] and build['type'] == 'ant':
# Check to see whether an error was returned without a proper exit
# code (this is the case for the 'no target set or target invalid'
# error)
- if p.returncode != 0 or p.stdout.startswith("Error: "):
- raise BuildException("Failed to update project at %s" % d, p.stdout)
+ if p.returncode != 0 or p.output.startswith("Error: "):
+ raise BuildException("Failed to update project at %s" % d, p.output)
# Clean update dirs via ant
if d != '.':
logging.info("Cleaning subproject %s" % d)
if p.returncode != 0:
logging.critical("Failed to get apk manifest information")
sys.exit(1)
- for line in p.stdout.splitlines():
+ for line in p.output.splitlines():
if 'android:debuggable' in line and not line.endswith('0x0'):
return True
return False
class PopenResult:
returncode = None
- stdout = ''
+ output = ''
def SilentPopen(commands, cwd=None, shell=False):
# Output directly to console
sys.stdout.write(line)
sys.stdout.flush()
- result.stdout += line
+ result.output += line
time.sleep(0.1)
'-dname', keydname])
# TODO keypass should be sent via stdin
if p.returncode != 0:
- raise BuildException("Failed to generate key", p.stdout)
+ raise BuildException("Failed to generate key", p.output)
# now show the lovely key that was just generated
p = FDroidPopen(['keytool', '-list', '-v',
'-keystore', keystore, '-alias', repo_keyalias,
'-storepass:file', config['keystorepassfile']])
- logging.info(p.stdout.strip() + '\n\n')
+ logging.info(p.output.strip() + '\n\n')
def main():
def devices():
p = FDroidPopen(["adb", "devices"])
if p.returncode != 0:
- raise Exception("An error occured when finding devices: %s" % p.stdout)
- lines = p.stdout.splitlines()
+ raise Exception("An error occured when finding devices: %s" % p.output)
+ lines = p.output.splitlines()
if lines[0].startswith('* daemon not running'):
lines = lines[2:]
if len(lines) < 3:
logging.info("Installing %s on %s..." % (apk, dev))
p = FDroidPopen(["adb", "-s", dev, "install", apk])
fail = ""
- for line in p.stdout.splitlines():
+ for line in p.output.splitlines():
if line.startswith("Failure"):
fail = line[9:-1]
if not fail:
else:
logging.error("Failed to get apk information, skipping " + apkfile)
continue
- for line in p.stdout.splitlines():
+ for line in p.output.splitlines():
if line.startswith("package:"):
try:
thisinfo['id'] = re.match(name_pat, line).group(1)
sys.exit(1)
p = FDroidPopen(['java', '-cp', os.path.join(os.path.dirname(__file__), 'getsig'),
'getsig', os.path.join(os.getcwd(), apkfile)])
- if p.returncode != 0 or not p.stdout.startswith('Result:'):
+ if p.returncode != 0 or not p.output.startswith('Result:'):
logging.critical("Failed to get apk signature")
sys.exit(1)
- thisinfo['sig'] = p.stdout[7:].strip()
+ thisinfo['sig'] = p.output[7:].strip()
apk = zipfile.ZipFile(apkfile, 'r')
logging.critical(msg)
sys.exit(1)
global repo_pubkey_fingerprint
- repo_pubkey_fingerprint = cert_fingerprint(p.stdout)
- return "".join("%02x" % ord(b) for b in p.stdout)
+ repo_pubkey_fingerprint = cert_fingerprint(p.output)
+ return "".join("%02x" % ord(b) for b in p.output)
repoel.setAttribute("pubkey", extract_pubkey())
raise Exception("Failed to unpack remote build of " + apkfilename)
p = FDroidPopen(['diff', '-r', 'this_apk', 'that_apk'], cwd=tmp_dir)
- lines = p.stdout.splitlines()
+ lines = p.output.splitlines()
if len(lines) != 1 or 'META-INF' not in lines[0]:
- raise Exception("Unexpected diff output - " + p.stdout)
+ raise Exception("Unexpected diff output - " + p.output)
logging.info("...successfully verified")
verified += 1