Skip to content

Commit 409086f

Browse files
committed
chore: Add waydroid spec file with patch for regex issue
1 parent 19db7fb commit 409086f

9 files changed

+476
-0
lines changed

spec_files/waydroid/README.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# waydroid
2+
3+
The waydroid package
+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[Unit]
2+
Description=Mount binderfs partition
3+
4+
[Mount]
5+
What=binder
6+
Where=/dev/binderfs
7+
Type=binder
+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
diff --git a/tools/helpers/mount.py b/tools/helpers/mount.py
2+
index a0d34be5..f507d668 100644
3+
--- a/tools/helpers/mount.py
4+
+++ b/tools/helpers/mount.py
5+
@@ -133,7 +133,7 @@ def mount(args, source, destination, create_folders=True, umount=False,
6+
destination)
7+
8+
extra_args = []
9+
- opt_args = []
10+
+ opt_args = ["context=\"system_u:object_r:waydroid_rootfs_t:s0\""]
11+
if mount_type:
12+
extra_args.extend(["-t", mount_type])
13+
if readonly:

spec_files/waydroid/regex.patch

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
From 66c8343c4d2ea118601ba5d8ce52fa622cbcd665 Mon Sep 17 00:00:00 2001
2+
From: Aarron Lee <[email protected]>
3+
Date: Sun, 19 Nov 2023 16:11:44 -0500
4+
Subject: [PATCH] update regex for deprecation warning
5+
6+
---
7+
tools/helpers/net.py | 4 ++--
8+
1 file changed, 2 insertions(+), 2 deletions(-)
9+
10+
diff --git a/tools/helpers/net.py b/tools/helpers/net.py
11+
index c20a95bc..b267357a 100644
12+
--- a/tools/helpers/net.py
13+
+++ b/tools/helpers/net.py
14+
@@ -31,6 +31,6 @@ def get_device_ip_address():
15+
16+
try:
17+
with open(lease_file) as f:
18+
- return re.search("(\d{1,3}\.){3}\d{1,3}\s", f.read()).group().strip()
19+
+ return re.search(r"(\d{1,3}\.){3}\d{1,3}\s", f.read()).group().strip()
20+
except:
21+
- pass
22+
\ No newline at end of file
23+
+ pass
+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
--- waydroid-1.2.0/data/scripts/waydroid-net.sh 2021-10-19 15:50:56.000000000 +0800
2+
+++ waydroid-1.2.0-1/data/scripts/waydroid-net.sh 2021-10-21 22:57:50.991706580 +0800
3+
@@ -1,4 +1,4 @@
4+
-#!/bin/sh -
5+
+#!/usr/bin/sh -
6+
7+
varrun="/run/waydroid-lxc"
8+
varlib="/var/lib"
9+
@@ -60,6 +60,8 @@ _ifup() {
10+
ip addr add ${CIDR_ADDR} broadcast + dev ${LXC_BRIDGE}
11+
ip link set dev ${LXC_BRIDGE} address $LXC_BRIDGE_MAC
12+
ip link set dev ${LXC_BRIDGE} up
13+
+ # Fedora specific
14+
+ firewall-cmd --zone=trusted --add-interface=${LXC_BRIDGE} || true
15+
}
16+
17+
start_ipv6() {

spec_files/waydroid/sse3.patch

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
From 6eea5cf63f4a724e66a2857b8f67ee2bbc82f0bd Mon Sep 17 00:00:00 2001
2+
From: sta-c0000 <[email protected]>
3+
Date: Tue, 19 Dec 2023 09:49:12 -0500
4+
Subject: [PATCH] Add SSSE3 CPU check for arch x86/x86_64
5+
6+
---
7+
tools/helpers/arch.py | 11 +++++++----
8+
1 file changed, 7 insertions(+), 4 deletions(-)
9+
10+
diff --git a/tools/helpers/arch.py b/tools/helpers/arch.py
11+
index 735d344e..c74ef906 100644
12+
--- a/tools/helpers/arch.py
13+
+++ b/tools/helpers/arch.py
14+
@@ -19,11 +19,14 @@ def host():
15+
" architecture is not supported")
16+
17+
def maybe_remap(target):
18+
- if target == "x86_64":
19+
+ if target.startswith("x86"):
20+
with open("/proc/cpuinfo") as f:
21+
- if "sse4_2" not in f.read():
22+
- logging.info("x86_64 CPU does not support SSE4.2, falling back to x86...")
23+
- return "x86"
24+
+ cpuinfo = f.read()
25+
+ if "ssse3" not in cpuinfo:
26+
+ raise ValueError("x86/x86_64 CPU must support SSSE3!")
27+
+ if target == "x86_64" and "sse4_2" not in cpuinfo:
28+
+ logging.info("x86_64 CPU does not support SSE4.2, falling back to x86...")
29+
+ return "x86"
30+
elif target == "arm64" and platform.architecture()[0] == "32bit":
31+
return "arm"
32+

spec_files/waydroid/waydroid.fc

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/usr/lib/waydroid/waydroid.py gen_context(system_u:object_r:waydroid_exec_t,s0)
2+
/usr/lib/waydroid/data/scripts/waydroid-net\.sh gen_context(system_u:object_r:waydroid_net_exec_t,s0)
3+
/var/lib/waydroid(.*)? gen_context(system_u:object_r:waydroid_data_t,s0)
4+
/var/run/waydroid-(?!lxc).* gen_context(system_u:object_r:waydroid_var_run_t,s0)
5+
/run/waydroid-(?!lxc).* gen_context(system_u:object_r:waydroid_var_run_t,s0)

spec_files/waydroid/waydroid.spec

+215
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,215 @@
1+
%global forgeurl https://github.com/waydroid/waydroid
2+
%global selinuxtype targeted
3+
4+
Version: 1.4.2
5+
%global tag %{version}
6+
7+
%forgemeta
8+
Name: waydroid
9+
Release: 1%{?dist}.bazzite
10+
Summary: Container-based approach to boot a full Android system on GNU/Linux
11+
License: GPL-3.0-only
12+
URL: %{forgeurl}
13+
Source: %{forgesource}
14+
Source1: waydroid.te
15+
Source4: dev-binderfs.mount
16+
Source6: waydroid.fc
17+
18+
# Assign firewalld zone to the waydroid network interface
19+
Patch0: setup-firewalld.patch
20+
21+
# Mount the android rootfs with a default selinux context
22+
Patch1: mount-secontext.patch
23+
24+
# https://github.com/waydroid/waydroid/commit/66c8343c4d2ea118601ba5d8ce52fa622cbcd665
25+
Patch2: regex.patch
26+
# https://github.com/waydroid/waydroid/commit/6eea5cf63f4a724e66a2857b8f67ee2bbc82f0bd
27+
Patch3: sse3.patch
28+
29+
BuildArch: noarch
30+
31+
BuildRequires: make
32+
BuildRequires: selinux-policy-devel
33+
BuildRequires: container-selinux
34+
BuildRequires: systemd
35+
BuildRequires: python3-devel
36+
BuildRequires: systemd-rpm-macros
37+
BuildRequires: desktop-file-utils
38+
BuildRequires: libappstream-glib
39+
40+
Requires: python3-gbinder >= 1.1.0
41+
Requires: python3-gobject
42+
Requires: lxc
43+
Requires: gtk3
44+
Requires: (%{name}-selinux = %{version}-%{release} if selinux-policy-%{selinuxtype})
45+
Requires: nftables
46+
Requires: iproute
47+
Requires: dnsmasq
48+
Recommends: python3-pyclip
49+
Recommends: wl-clipboard
50+
51+
%description
52+
Waydroid uses Linux namespaces to run a full Android system in a container
53+
and provide Android applications on any GNU/Linux-based platform.
54+
The Android system inside the container has direct access to needed hardware
55+
through LXC and the binder interface.
56+
57+
%package selinux
58+
Summary: SELinux policy module for waydroid
59+
Requires: %{name} = %{version}-%{release}
60+
Requires: container-selinux
61+
%{?selinux_requires}
62+
63+
%description selinux
64+
This package contains the SELinux policy module necessary to run waydroid.
65+
66+
%prep
67+
%forgeautosetup -p1
68+
mkdir SELinux
69+
cp %{S:1} SELinux/
70+
cp %{S:6} SELinux/
71+
72+
%build
73+
# Remove link for ROM files
74+
sed -i -e '/"system_channel":/ s/: ".*"/: ""/' tools/config/__init__.py
75+
sed -i -e '/"vendor_channel":/ s/: ".*"/: ""/' tools/config/__init__.py
76+
# Compile sepolicy
77+
cd SELinux
78+
%{__make} NAME=%{selinuxtype} -f /usr/share/selinux/devel/Makefile
79+
80+
%install
81+
%make_install LIBDIR=%{_libdir} DESTDIR=%{buildroot} USE_SYSTEMD=1 USE_DBUS_ACTIVATION=1 USE_NFTABLES=1
82+
%py_byte_compile %{python3} %{buildroot}%{_prefix}/lib/waydroid
83+
%{__install} -d %{buildroot}%{_unitdir}
84+
%{__install} -d %{buildroot}%{_datadir}/selinux/%{selinuxtype}
85+
%{__install} -p -m 644 %{S:4} %{buildroot}%{_unitdir}/
86+
%{__install} -p -m 644 SELinux/%{name}.pp %{buildroot}%{_datadir}/selinux/%{selinuxtype}/%{name}.pp
87+
sed -i '/^\[Unit\]/a Wants=dev-binderfs.mount' %{buildroot}%{_unitdir}/waydroid-container.service
88+
sed -i '/^\[Service\]/a ExecStartPre=/usr/bin/ln -sf /dev/binderfs/binder /dev/binderfs/vndbinder /dev/binderfs/hwbinder /dev/' %{buildroot}%{_unitdir}/waydroid-container.service
89+
90+
%check
91+
desktop-file-validate %{buildroot}/%{_datadir}/applications/Waydroid.desktop
92+
desktop-file-validate %{buildroot}/%{_datadir}/applications/waydroid.market.desktop
93+
desktop-file-validate %{buildroot}/%{_datadir}/applications/waydroid.app.install.desktop
94+
appstream-util validate --nonet %{buildroot}%{_metainfodir}/id.waydro.waydroid.metainfo.xml
95+
96+
%pre selinux
97+
%selinux_relabel_pre -s %{selinuxtype}
98+
99+
%post selinux
100+
%selinux_modules_install -s %{selinuxtype} %{_datadir}/selinux/%{selinuxtype}/%{name}.pp
101+
%selinux_relabel_post -s %{selinuxtype}
102+
103+
if [ "$1" -le "1" ]; then # First install
104+
# the daemon needs to be restarted for the custom label to be applied
105+
%systemd_postun_with_restart waydroid-container.service
106+
fi
107+
108+
%postun selinux
109+
if [ $1 -eq 0 ]; then
110+
%selinux_modules_uninstall -s %{selinuxtype} %{name}
111+
%selinux_relabel_post -s %{selinuxtype}
112+
fi
113+
114+
%post
115+
waydroid upgrade -o > /dev/null || :
116+
%systemd_post waydroid-container.service
117+
if [ $1 -eq 1 ]; then
118+
if systemctl -q is-enabled waydroid-container.service > /dev/null 2>&1 ; then
119+
systemctl start waydroid-container.service > /dev/null 2>&1 || :
120+
fi
121+
fi
122+
123+
%preun
124+
%systemd_preun waydroid-container.service
125+
126+
%postun
127+
%systemd_postun_with_restart waydroid-container.service
128+
129+
%files
130+
%license LICENSE
131+
%doc README.md
132+
%{_prefix}/lib/waydroid
133+
%{_datadir}/applications/Waydroid.desktop
134+
%{_datadir}/applications/waydroid.market.desktop
135+
%{_datadir}/applications/waydroid.app.install.desktop
136+
%{_datadir}/metainfo/id.waydro.waydroid.metainfo.xml
137+
%{_datadir}/icons/hicolor/512x512/apps/waydroid.png
138+
%{_bindir}/waydroid
139+
%{_unitdir}/waydroid-container.service
140+
%{_unitdir}/dev-binderfs.mount
141+
%{_datadir}/dbus-1/system-services/id.waydro.Container.service
142+
%{_datadir}/dbus-1/system.d/id.waydro.Container.conf
143+
%{_datadir}/polkit-1/actions/id.waydro.Container.policy
144+
%{_datadir}/desktop-directories/waydroid.directory
145+
%{_sysconfdir}/xdg/menus/applications-merged/waydroid.menu
146+
147+
%files selinux
148+
%doc SELinux/%{name}.te
149+
%{_datadir}/selinux/%{selinuxtype}/%{name}.pp
150+
151+
%changelog
152+
* Tue Oct 31 2023 Alessandro Astone <[email protected]> - 1.4.2-1
153+
- Update to 1.4.2
154+
155+
* Tue Sep 26 2023 Alessandro Astone <[email protected]> - 1.4.1-3
156+
- Amend SELinux to coexist with snap
157+
158+
* Sat Jul 22 2023 Fedora Release Engineering <[email protected]> - 1.4.1-2
159+
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
160+
161+
* Tue Apr 25 2023 Alessandro Astone <[email protected]> - 1.4.1-1
162+
- Update to 1.4.1
163+
164+
* Wed Feb 08 2023 Alessandro Astone <[email protected]> - 1.4.0-1
165+
- Update to 1.4.0
166+
167+
* Sat Jan 21 2023 Fedora Release Engineering <[email protected]> - 1.3.4-5
168+
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
169+
170+
* Fri Jan 06 2023 Alessandro Astone <[email protected]> - 1.3.4-4
171+
- Re-enable s390x build
172+
- Sepolicy fixes
173+
174+
* Tue Dec 27 2022 Alessandro Astone <[email protected]> - 1.3.4-3
175+
- Fix description typos etc.
176+
- Validate desktop and metainfo files
177+
- Reorder post install scriptlets
178+
179+
* Sun Dec 25 2022 Alessandro Astone <[email protected]> - 1.3.4-2
180+
- Add selinux label to android rootfs
181+
- Make package noarch
182+
183+
* Wed Dec 14 2022 Alessandro Astone <[email protected]> - 1.3.4-1
184+
- Update to 1.3.4
185+
186+
* Sat Nov 05 2022 Alessandro Astone <[email protected]> - 1.3.3-3
187+
- Override selinux context of the android rootfs
188+
- Fixes https://github.com/casualsnek/waydroid_script
189+
190+
* Sun Oct 30 2022 Alessandro Astone <[email protected]> - 1.3.3-2
191+
- Add sepolicy for updating from the android app
192+
193+
* Sun Sep 25 2022 Alessandro Astone <[email protected]> - 1.3.3-1
194+
- Update to 1.3.3
195+
196+
* Fri Sep 02 2022 Alessandro Astone <[email protected]> - 1.3.1-1
197+
- Update to 1.3.1
198+
199+
* Tue Aug 09 2022 Alessandro Astone <[email protected]> - 1.3.0-1
200+
- Update to 1.3.0
201+
202+
* Sun Apr 17 2022 Alessandro Astone <[email protected]> - 1.2.1-1
203+
- Update to 1.2.1
204+
205+
* Mon Mar 07 2022 Alessandro Astone <[email protected]> - 1.2.0-7.20220307git1.2.0
206+
- Recommend pyclip
207+
208+
* Sat Feb 26 2022 Alessandro Astone <[email protected]> - 1.2.0-5.20220226git1.2.0
209+
- Add sepolicy for crash handler
210+
211+
* Fri Feb 25 2022 Alessandro Astone <[email protected]> - 1.2.0-4.20220225git1.2.0
212+
- Respin package
213+
214+
* Wed Aug 12 2020 Qiyu Yan <[email protected]> - 0-0.1.20200811gitc87ea48
215+
- initial package

0 commit comments

Comments
 (0)