Skip to content

Commit ad0e879

Browse files
committed
Fix several small bugs
1 parent 46bd28d commit ad0e879

File tree

3 files changed

+14
-5
lines changed

3 files changed

+14
-5
lines changed

fbs/_gpg.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,22 @@ def _get_keygrip(pubkey_id):
3232
if 'invalid option "--with-keygrip"' in e.stderr:
3333
raise GpgDoesNotSupportKeygrip() from None
3434
raise
35-
lines = output.split('\n')
35+
pure_signing_subkey = _find_keygrip(output, 'S')
36+
if pure_signing_subkey:
37+
return pure_signing_subkey
38+
any_signing_key = _find_keygrip(output, '[^]]*S[^]]*')
39+
if any_signing_key:
40+
return any_signing_key
41+
raise RuntimeError('Keygrip not found. Output was:\n' + output)
42+
43+
def _find_keygrip(gpg2_output, type_re):
44+
lines = gpg2_output.split('\n')
3645
for i, line in enumerate(lines):
37-
if re.match(r'.*\[[^]]*S[^]]*\]$', line):
46+
if re.match(r'.*\[%s\]$' % type_re, line):
3847
for keygrip_line in lines[i + 1:]:
3948
m = re.match(r' +Keygrip = ([A-Z0-9]{40})', keygrip_line)
4049
if m:
4150
return m.group(1)
42-
raise RuntimeError('Keygrip not found. Output was:\n' + output)
4351

4452
class GpgDoesNotSupportKeygrip(RuntimeError):
4553
pass

fbs/sign_installer/arch.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ def sign_installer_arch():
1414
# Prevent GPG from prompting us for the passphrase when signing:
1515
preset_gpg_passphrase()
1616
check_call(
17-
['gpg', '--batch', '--yes', '-u', '0x%s!' % SETTINGS['gpg_key'],
17+
['gpg', '--batch', '--yes', '-u', SETTINGS['gpg_key'],
1818
'--output', installer + '.sig', '--detach-sig', installer],
1919
stdout=DEVNULL
2020
)

setup.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ def _get_package_data(pkg_dir, data_subdir):
3232
url='https://build-system.fman.io',
3333
packages=find_packages(exclude=('tests', 'tests.*')),
3434
package_data={
35-
'fbs._defaults': _get_package_data('fbs/_defaults', 'src'),
35+
'fbs._defaults': _get_package_data('fbs/_defaults', 'requirements') +
36+
_get_package_data('fbs/_defaults', 'src'),
3637
'fbs.builtin_commands':
3738
_get_package_data('fbs/builtin_commands', 'project_template'),
3839
'fbs.builtin_commands._gpg':

0 commit comments

Comments
 (0)