dist: get Ubuntu version from dpkg-parsechangelog

This commit is contained in:
Peter F. Patel-Schneider 2022-11-26 23:56:56 -05:00
parent 0692dd1911
commit 9b868c8869
1 changed files with 6 additions and 7 deletions

View File

@ -16,7 +16,6 @@ with open('lib/solaar/version', 'r') as vfile:
try: # get commit from git describe try: # get commit from git describe
commit = subprocess.check_output(['git', 'describe', '--always'], stderr=subprocess.DEVNULL).strip().decode() commit = subprocess.check_output(['git', 'describe', '--always'], stderr=subprocess.DEVNULL).strip().decode()
print('GIT', commit)
with open('lib/solaar/commit', 'w') as vfile: with open('lib/solaar/commit', 'w') as vfile:
vfile.write(f'{commit}\n') vfile.write(f'{commit}\n')
except Exception: # get commit from Ubuntu dpkg-parsechangelog except Exception: # get commit from Ubuntu dpkg-parsechangelog
@ -24,14 +23,14 @@ except Exception: # get commit from Ubuntu dpkg-parsechangelog
dpkg = subprocess.check_output(['dpkg-parsechangelog'], stderr=subprocess.DEVNULL).strip().decode() dpkg = subprocess.check_output(['dpkg-parsechangelog'], stderr=subprocess.DEVNULL).strip().decode()
print(dpkg) print(dpkg)
match = re.search(r'\nVersion: (.*)~', dpkg) match = re.search(r'\nVersion: (.*)~', dpkg)
print(match.group(1)) print('VERSION', match.group(0), match.group(1))
with open('lib/solaar/commit', 'w') as vfile: with open('lib/solaar/commit', 'w') as vfile:
vfile.write(f'{match.group[1]}\n') vfile.write(f'{match.group[1]}\n')
print( commit = subprocess.check_output(['dpkg-parsechangelog', '--show-field', 'Version'],
'DPKG VERSION', stderr=subprocess.DEVNULL).strip().decode()
subprocess.check_output(['dpkg-parsechangelog', '--show-field', 'Version'], print('DPKG VERSION', commit)
stderr=subprocess.DEVNULL).strip().decode() # with open('lib/solaar/commit', 'w') as vfile:
) # vfile.write(f'{commit]}\n')
except Exception: except Exception:
pass pass