mirror of
https://gitlab.com/fdroid/fdroidserver.git
synced 2024-11-14 02:50:12 +01:00
Fix init with common, don't require cwd in FDroidPopen
This commit is contained in:
parent
ee67e96aad
commit
2b0badd4c4
@ -1910,7 +1910,7 @@ class PopenResult:
|
|||||||
stderr = ''
|
stderr = ''
|
||||||
stdout_apk = ''
|
stdout_apk = ''
|
||||||
|
|
||||||
def FDroidPopen(commands, cwd):
|
def FDroidPopen(commands, cwd=None):
|
||||||
"""
|
"""
|
||||||
Runs a command the FDroid way and returns return code and output
|
Runs a command the FDroid way and returns return code and output
|
||||||
|
|
||||||
@ -1918,7 +1918,8 @@ def FDroidPopen(commands, cwd):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
if options.verbose:
|
if options.verbose:
|
||||||
print "Directory: %s" % cwd
|
if cwd is not None:
|
||||||
|
print "Directory: %s" % cwd
|
||||||
print " > %s" % ' '.join(commands)
|
print " > %s" % ' '.join(commands)
|
||||||
|
|
||||||
result = PopenResult()
|
result = PopenResult()
|
||||||
|
@ -29,6 +29,7 @@ import sys
|
|||||||
from optparse import OptionParser
|
from optparse import OptionParser
|
||||||
|
|
||||||
import common
|
import common
|
||||||
|
from common import FDroidPopen, BuildException
|
||||||
|
|
||||||
|
|
||||||
config = {}
|
config = {}
|
||||||
@ -56,24 +57,21 @@ def genpassword():
|
|||||||
def genkey(keystore, repo_keyalias, password, keydname):
|
def genkey(keystore, repo_keyalias, password, keydname):
|
||||||
'''generate a new keystore with a new key in it for signing repos'''
|
'''generate a new keystore with a new key in it for signing repos'''
|
||||||
print('Generating a new key in "' + keystore + '"...')
|
print('Generating a new key in "' + keystore + '"...')
|
||||||
p = subprocess.Popen(['keytool', '-genkey',
|
p = FDroidPopen(['keytool', '-genkey',
|
||||||
'-keystore', keystore, '-alias', repo_keyalias,
|
'-keystore', keystore, '-alias', repo_keyalias,
|
||||||
'-keyalg', 'RSA', '-keysize', '4096',
|
'-keyalg', 'RSA', '-keysize', '4096',
|
||||||
'-sigalg', 'SHA256withRSA',
|
'-sigalg', 'SHA256withRSA',
|
||||||
'-validity', '10000',
|
'-validity', '10000',
|
||||||
'-storepass', password, '-keypass', password,
|
'-storepass', password, '-keypass', password,
|
||||||
'-dname', keydname],
|
'-dname', keydname])
|
||||||
stdout=subprocess.PIPE)
|
|
||||||
output = p.communicate()[0]
|
|
||||||
print(output)
|
|
||||||
if p.returncode != 0:
|
if p.returncode != 0:
|
||||||
raise BuildException("Failed to generate key")
|
raise BuildException("Failed to generate key", p.stdout, p.stderr)
|
||||||
# now show the lovely key that was just generated
|
# now show the lovely key that was just generated
|
||||||
p = subprocess.Popen(['keytool', '-list', '-v',
|
p = subprocess.Popen(['keytool', '-list', '-v',
|
||||||
'-keystore', keystore, '-alias', repo_keyalias],
|
'-keystore', keystore, '-alias', repo_keyalias],
|
||||||
stdin=subprocess.PIPE,
|
stdin=subprocess.PIPE,
|
||||||
stdout=subprocess.PIPE,
|
stdout=subprocess.PIPE,
|
||||||
stderr=subprocess.PIPE)
|
stderr=subprocess.PIPE)
|
||||||
output = p.communicate(password)[0]
|
output = p.communicate(password)[0]
|
||||||
print(output.lstrip().strip() + '\n\n')
|
print(output.lstrip().strip() + '\n\n')
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user