Skip to content

Commit c9700e4

Browse files
committed
Use sudo when updating udev rules
1 parent b3daf4b commit c9700e4

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

Android/android.py

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -276,8 +276,10 @@ def clean_all(context):
276276
def setup_ci():
277277
# https://github.blog/changelog/2024-04-02-github-actions-hardware-accelerated-android-virtualization-now-available/
278278
if "GITHUB_ACTIONS" in os.environ and platform.system() == "Linux":
279-
Path("/etc/udev/rules.d/99-kvm4all.rules").write_text(
280-
'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"\n'
279+
run(
280+
["sudo", "tee", "/etc/udev/rules.d/99-kvm4all.rules"],
281+
input='KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"\n',
282+
text=True,
281283
)
282284
run(["sudo", "udevadm", "control", "--reload-rules"])
283285
run(["sudo", "udevadm", "trigger", "--name-match=kvm"])
@@ -691,13 +693,8 @@ def package(context):
691693

692694
# Strip debug information.
693695
if not context.debug:
694-
run(
695-
[
696-
android_env(context.host)["STRIP"],
697-
*glob(f"{temp_dir}/**/*.so", recursive=True),
698-
],
699-
log=False,
700-
)
696+
so_files = glob(f"{temp_dir}/**/*.so", recursive=True)
697+
run([android_env(context.host)["STRIP"], *so_files], log=False)
701698

702699
dist_dir = subdir(context.host, "dist", create=True)
703700
package_path = shutil.make_archive(
@@ -731,7 +728,7 @@ def ci(context):
731728
and (platform.system(), platform.machine()) != ("Linux", "x86_64")
732729
):
733730
print(
734-
"Skipping test: GitHub Actions does not supports the Android "
731+
"Skipping tests: GitHub Actions does not support the Android "
735732
"emulator on this platform."
736733
)
737734
else:

0 commit comments

Comments
 (0)