Add option to enable new Rust based mDNS backend - #209
Conversation
023d174 to
e4dd9f8
Compare
diff --git a/android-tools.spec b/android-tools.spec
index 7ead2af..89edc79 100644
--- a/android-tools.spec
+++ b/android-tools.spec
@@ -13,7 +13,10 @@ Source0: https://github.com/nmeum/%{name}/releases/download/%{version}/%{n
Patch: https://github.com/nmeum/android-tools/pull/208.patch
BuildRequires: brotli-devel
+BuildRequires: cargo
+BuildRequires: cargo-rpm-macros
BuildRequires: cmake
+BuildRequires: corrosion
BuildRequires: fmt-devel
BuildRequires: gcc
BuildRequires: gcc-c++
@@ -58,13 +61,18 @@ setup between the host and the target phone as adb.
%autosetup -p1
%build
-%cmake -DBUILD_SHARED_LIBS:BOOL=OFF
+%cmake -DANDROID_TOOLS_ADB_ENABLE_MDNS:BOOL=ON -DBUILD_SHARED_LIBS:BOOL=OFF
%cmake_build
+pushd vendor/adb/client/adbmdns
+%cargo_vendor_manifest
+popd
+
%install
%cmake_install
%files
+%license vendor/adb/client/adbmdns/cargo-vendor.txt
%{_bindir}/adb
%{_bindir}/avbtool
%{_bindir}/mke2fs.androidspec diff for those that do rpm packaging. |
|
Is it required to vendor rust crates? Those increase tarball size and total rust vendor directory is 220 MB. |
if you want to support distro packaging - yes. |
|
Would it be difficult for distributions to follow similar steps as other Rust packages? |
for anything but nix the chance that all dependencies are already packaged is slim and getting them packaged (or updated) might take a lot of time. |
https://github.com/nmeum/android-tools/compare/934b9680c5a0e84406f142daf8b54e695bd6cf9c..ed9993bdaf60ba2634fbb1130abfc45c61fa4b9d should at least slightly help with that. but on fedora there are still 2 missing crates (and probably their dependencies, if they aren't standalone): |
https://bugzilla.redhat.com/show_bug.cgi?id=2512796 I guess it's better for me to not depend on vendored deps anyway. |
3241556 to
8ee281f
Compare
|
moved rust vendor tree to a separate tarball to match |
|
I created a local build on openSUSE Tumbleweed using the artifacts from build #326 and it looks good. |
diff --git a/adb_mdns-fix-metadata.diff b/adb_mdns-fix-metadata.diff
new file mode 100644
index 0000000..9e9e268
--- /dev/null
+++ b/adb_mdns-fix-metadata.diff
@@ -0,0 +1,23 @@
+--- a/vendor/adb/client/adbmdns/Cargo.toml
++++ b/vendor/adb/client/adbmdns/Cargo.toml
+@@ -11,18 +11,10 @@ crate-type = ["staticlib"]
+ [dependencies]
+ socket2 = { version = "0.4.0", features = ["all"] }
+ log = { version = "0.4.27" , features = ["std"] }
+-simple-dns = "0.11.0"
++simple-dns = "0.12.0"
+ zerocopy = { version = "0.8.26", features = ["derive"] }
+ libc = "0.2.174"
+ anyhow = "1.0.99"
+ nix = { version = "0.29.0", features = ["net", "socket", "uio"] }
+-if-addrs = "0.14.0"
++if-addrs = "0.15.0"
+ mio = { version = "1.1.0", features = ["net", "os-poll"] }
+-
+-[target.'cfg(windows)'.dependencies.windows-sys]
+-version = "0.61.1"
+-features = [
+- "Win32_Foundation",
+- "Win32_Networking_WinSock",
+- "Win32_NetworkManagement_WiFi",
+-]
diff --git a/android-tools.spec b/android-tools.spec
index 7ead2af..50ebc9d 100644
--- a/android-tools.spec
+++ b/android-tools.spec
@@ -11,9 +11,15 @@ URL: http://developer.android.com/guide/developing/tools/
Source0: https://github.com/nmeum/%{name}/releases/download/%{version}/%{name}-%{version}.tar.xz
# https://github.com/nmeum/android-tools/pull/208
Patch: https://github.com/nmeum/android-tools/pull/208.patch
+# https://github.com/nmeum/android-tools/pull/209
+Patch: 209.patch
+# Update dependencies to match available packages
+Patch: adb_mdns-fix-metadata.diff
BuildRequires: brotli-devel
+BuildRequires: cargo-rpm-macros
BuildRequires: cmake
+BuildRequires: corrosion
BuildRequires: fmt-devel
BuildRequires: gcc
BuildRequires: gcc-c++
@@ -57,14 +63,29 @@ setup between the host and the target phone as adb.
%prep
%autosetup -p1
+pushd vendor/adb/client/adbmdns > /dev/null
+%cargo_prep
+popd > /dev/null
+
+%generate_buildrequires
+pushd vendor/adb/client/adbmdns > /dev/null
+%cargo_generate_buildrequires
+popd > /dev/null
+
%build
-%cmake -DBUILD_SHARED_LIBS:BOOL=OFF
+%cmake -DANDROID_TOOLS_ADB_ENABLE_MDNS:BOOL=ON -DBUILD_SHARED_LIBS:BOOL=OFF
%cmake_build
+pushd vendor/adb/client/adbmdns > /dev/null
+%{cargo_license_summary}
+%{cargo_license} > LICENSE.dependencies
+popd > /dev/null
+
%install
%cmake_install
%files
+%license vendor/adb/client/adbmdns/LICENSE.dependencies
%{_bindir}/adb
%{_bindir}/avbtool
%{_bindir}/mke2fs.androidbuilds across all fedora arches - https://copr.fedorainfracloud.org/coprs/luk1337/test/build/10840424/ |
|
I've now built the vendor archive using Even though As it stands now, openSUSE doesn’t need the corresponding @luk1337, is there a specific reason why you modified the https://build.opensuse.org/package/show/home:munix9:test/android-tools |
I'm packaging newer versions of those, that's why. |
and %cargo_generate_buildrequires puts version constraint on them. |
Fixes: #181