Skip to content
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

[Tizen] Forward stderr from Tizen Studio CLI tool #36976

Merged
merged 3 commits into from
Jan 10, 2025
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 20 additions & 9 deletions third_party/tizen/tizen_dev_certificate.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,33 @@
logging.basicConfig(level=logging.DEBUG)


def run(cmd):
logging.debug("Run: %s", " ".join(cmd))
arkq marked this conversation as resolved.
Show resolved Hide resolved
proc = subprocess.Popen(cmd, errors='replace',
stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
proc.wait()
for line in proc.stderr.readlines():
logging.error("%s", line.rstrip())
return proc


def create_author_certificate(alias: str, password: str,
name: str = "", email: str = ""):
cmd = [tizen_cli, "certificate", "--alias", alias, "--password", password]
if name:
cmd.extend(["--name", name])
if email:
cmd.extend(["--email", email])
logging.debug("Execute: %s", " ".join(cmd))
with subprocess.Popen(cmd, stdout=subprocess.PIPE) as proc:
wd = None
with run(cmd) as proc:
for line in proc.stdout.readlines():
line = line.decode().rstrip()
line = line.rstrip()
if line.startswith("Working path:"):
wd = line[len("Working path:"):].strip()
print(line)
if not wd:
return None
return os.path.join(wd, "author.p12")


Expand Down Expand Up @@ -69,21 +82,19 @@ def check_security_profile(profile):
f.write('<profiles/>')

cmd = [tizen_cli, "security-profiles", "list", "--name", profile]
logging.debug("Execute: %s", " ".join(cmd))
with subprocess.Popen(cmd, stdout=subprocess.PIPE) as proc:
with run(cmd) as proc:
for line in proc.stdout.readlines():
line = line.decode().rstrip()
line = line.rstrip()
print(line)
return proc.wait() == 0


def add_security_profile(profile: str, certificate: str, password: str):
cmd = [tizen_cli, "security-profiles", "add", "--active",
"--name", profile, "--author", certificate, "--password", password]
logging.debug("Execute: %s", " ".join(cmd))
with subprocess.Popen(cmd, stdout=subprocess.PIPE) as proc:
with run(cmd) as proc:
for line in proc.stdout.readlines():
line = line.decode().rstrip()
line = line.rstrip()
print(line)
return proc.wait() == 0

Expand Down
Loading