-
Notifications
You must be signed in to change notification settings - Fork 190
two commits for koji uploading and python2 #720
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,11 +9,6 @@ | |
| import subprocess | ||
| import sys | ||
| import tempfile | ||
| import gi | ||
| import semver | ||
|
|
||
| gi.require_version("RpmOstree", "1.0") | ||
| from gi.repository import RpmOstree | ||
|
|
||
| from datetime import datetime | ||
|
|
||
|
|
@@ -101,7 +96,7 @@ def fatal(msg): | |
| :type msg: str | ||
| :raises: SystemExit | ||
| """ | ||
| print('fatal: {}'.format(msg), file=sys.stderr) | ||
| sys.stderr.write('fatal: {}\n'.format(msg)) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
| raise SystemExit(1) | ||
|
|
||
|
|
||
|
|
@@ -112,7 +107,7 @@ def info(msg): | |
| :param msg: The message to show to output | ||
| :type msg: str | ||
| """ | ||
| print('info: {}'.format(msg), file=sys.stderr) | ||
| print('info: {}'.format(msg)) | ||
|
|
||
|
|
||
| def rfc3339_time(t=None): | ||
|
|
@@ -166,14 +161,14 @@ def import_ostree_commit(repo, commit, tarfile): | |
|
|
||
| # in the common case where we're operating on a recent build, the OSTree | ||
| # commit should already be in the tmprepo | ||
| commitpartial = os.path.join(repo, f'state/{commit}.commitpartial') | ||
| if (subprocess.call(['ostree', 'show', '--repo', repo, commit], | ||
| stdout=subprocess.DEVNULL, | ||
| stderr=subprocess.DEVNULL) == 0 | ||
| and not os.path.isfile(commitpartial)): | ||
| commitpartial = os.path.join(repo, 'state/{}.commitpartial'.format(commit)) | ||
| have_commit = subprocess.call(['ostree', 'show', '--repo', repo, commit], | ||
| stdout=subprocess.DEVNULL, | ||
| stderr=subprocess.DEVNULL) == 0 | ||
| if have_commit and not os.path.isfile(commitpartial): | ||
| return | ||
|
|
||
| with tempfile.TemporaryDirectory(dir=f'{repo}/tmp') as d: | ||
| with tempfile.TemporaryDirectory(dir='{}/tmp'.format(repo)) as d: | ||
| subprocess.check_call(['tar', '-C', d, '-xf', tarfile]) | ||
| subprocess.check_call(['ostree', 'pull-local', '--repo', repo, | ||
| d, commit]) | ||
|
|
@@ -183,13 +178,17 @@ def get_basearch(): | |
| try: | ||
| return get_basearch.saved | ||
| except AttributeError: | ||
| import gi | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we disable |
||
| gi.require_version("RpmOstree", "1.0") | ||
| from gi.repository import RpmOstree | ||
| get_basearch.saved = RpmOstree.get_basearch() | ||
| return get_basearch.saved | ||
|
|
||
|
|
||
| # FIXME: Add tests | ||
| class Builds: # pragma: nocover | ||
| def __init__(self, workdir=None): | ||
| import semver | ||
| self._workdir = workdir | ||
| self._fn = self._path("builds/builds.json") | ||
| if not os.path.isdir(self._path("builds")): | ||
|
|
@@ -242,11 +241,11 @@ def get_build_dir(self, build_id, basearch=None): | |
| if build_id == 'latest': | ||
| build_id = self.get_latest() | ||
| if self._legacy: | ||
| return self._path(f"builds/{build_id}") | ||
| return self._path("builds/" + build_id) | ||
| if not basearch: | ||
| # just assume caller wants build dir for current arch | ||
| basearch = get_basearch() | ||
| return self._path(f"builds/{build_id}/{basearch}") | ||
| return self._path("builds/{}/{}".format(build_id, basearch)) | ||
|
|
||
| def insert_build(self, build_id, basearch=None): | ||
| if self._legacy: | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍