Switch to linux-friendly upstream
Use Android SDK versions for versioning(Epoch 1 introduced) Resolves: rhbz 1937578 1873878 1923681 1776001
This commit is contained in:
parent
1f93c0d6f3
commit
823ac9f141
7 changed files with 29 additions and 213 deletions
|
|
@ -1,48 +0,0 @@
|
|||
diff --git a/adb/sysdeps/posix/network.cpp b/adb/sysdeps/posix/network.cpp
|
||||
index ecd1fd24e..07fd8c98e 100644
|
||||
--- a/adb/sysdeps/posix/network.cpp
|
||||
+++ b/adb/sysdeps/posix/network.cpp
|
||||
@@ -19,6 +19,7 @@
|
||||
#include <errno.h>
|
||||
#include <netinet/in.h>
|
||||
#include <sys/socket.h>
|
||||
+#include <string.h>
|
||||
|
||||
#include <string>
|
||||
|
||||
diff --git a/adb/types.h b/adb/types.h
|
||||
index a3e5d4842..bac7181b4 100644
|
||||
--- a/adb/types.h
|
||||
+++ b/adb/types.h
|
||||
@@ -22,6 +22,7 @@
|
||||
#include <type_traits>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
+#include <string.h>
|
||||
|
||||
#include <android-base/logging.h>
|
||||
|
||||
diff --git a/base/errors_unix.cpp b/base/errors_unix.cpp
|
||||
index 296995efe..48269b675 100644
|
||||
--- a/base/errors_unix.cpp
|
||||
+++ b/base/errors_unix.cpp
|
||||
@@ -17,6 +17,7 @@
|
||||
#include "android-base/errors.h"
|
||||
|
||||
#include <errno.h>
|
||||
+#include <string.h>
|
||||
|
||||
namespace android {
|
||||
namespace base {
|
||||
diff --git a/base/file.cpp b/base/file.cpp
|
||||
index d6fe753d1..3b10544dd 100644
|
||||
--- a/base/file.cpp
|
||||
+++ b/base/file.cpp
|
||||
@@ -22,6 +22,7 @@
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
+#include <string.h>
|
||||
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
diff --git a/adb/client/usb_libusb.cpp b/adb/client/usb_libusb.cpp
|
||||
index 7adb262..b994c8c 100644
|
||||
--- a/adb/client/usb_libusb.cpp
|
||||
+++ b/adb/client/usb_libusb.cpp
|
||||
@@ -27,8 +27,9 @@
|
||||
#include <string>
|
||||
#include <thread>
|
||||
#include <unordered_map>
|
||||
+#include <condition_variable>
|
||||
|
||||
-#include <libusb/libusb.h>
|
||||
+#include <libusb-1.0/libusb.h>
|
||||
|
||||
#include <android-base/file.h>
|
||||
#include <android-base/logging.h>
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
diff --git a/adb/adb.cpp b/adb/adb.cpp
|
||||
index 38c6f62c9..9df41a236 100644
|
||||
--- a/adb/adb.cpp
|
||||
+++ b/adb/adb.cpp
|
||||
@@ -44,7 +44,6 @@
|
||||
#include <android-base/parsenetaddress.h>
|
||||
#include <android-base/stringprintf.h>
|
||||
#include <android-base/strings.h>
|
||||
-#include <build/version.h>
|
||||
|
||||
#include "adb_auth.h"
|
||||
#include "adb_io.h"
|
||||
|
|
@ -1,51 +0,0 @@
|
|||
diff --git a/libcrypto_utils/android_pubkey.c b/libcrypto_utils/android_pubkey.c
|
||||
index 3052e52..7061db9 100644
|
||||
--- a/libcrypto_utils/android_pubkey.c
|
||||
+++ b/libcrypto_utils/android_pubkey.c
|
||||
@@ -126,37 +126,41 @@ bool android_pubkey_encode(const RSA* key, uint8_t* key_buffer, size_t size) {
|
||||
BIGNUM* r32 = BN_new();
|
||||
BIGNUM* n0inv = BN_new();
|
||||
BIGNUM* rr = BN_new();
|
||||
+ const BIGNUM *n;
|
||||
+ const BIGNUM *e;
|
||||
|
||||
if (sizeof(RSAPublicKey) > size ||
|
||||
RSA_size(key) != ANDROID_PUBKEY_MODULUS_SIZE) {
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
+ RSA_get0_key(key, &n, &e, NULL);
|
||||
+
|
||||
// Store the modulus size.
|
||||
key_struct->modulus_size_words = ANDROID_PUBKEY_MODULUS_SIZE_WORDS;
|
||||
|
||||
// Compute and store n0inv = -1 / N[0] mod 2^32.
|
||||
- if (!ctx || !r32 || !n0inv || !BN_set_bit(r32, 32) ||
|
||||
- !BN_mod(n0inv, key->n, r32, ctx) ||
|
||||
+ if (!ctx || !r32 || !n0inv || !n || !e || !BN_set_bit(r32, 32) ||
|
||||
+ !BN_mod(n0inv, n, r32, ctx) ||
|
||||
!BN_mod_inverse(n0inv, n0inv, r32, ctx) || !BN_sub(n0inv, r32, n0inv)) {
|
||||
goto cleanup;
|
||||
}
|
||||
key_struct->n0inv = (uint32_t)BN_get_word(n0inv);
|
||||
|
||||
// Store the modulus.
|
||||
- if (!android_pubkey_encode_bignum(key->n, key_struct->modulus)) {
|
||||
+ if (!android_pubkey_encode_bignum(n, key_struct->modulus)) {
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
// Compute and store rr = (2^(rsa_size)) ^ 2 mod N.
|
||||
if (!ctx || !rr || !BN_set_bit(rr, ANDROID_PUBKEY_MODULUS_SIZE * 8) ||
|
||||
- !BN_mod_sqr(rr, rr, key->n, ctx) ||
|
||||
+ !BN_mod_sqr(rr, rr, n, ctx) ||
|
||||
!android_pubkey_encode_bignum(rr, key_struct->rr)) {
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
// Store the exponent.
|
||||
- key_struct->exponent = (uint32_t)BN_get_word(key->e);
|
||||
+ key_struct->exponent = (uint32_t)BN_get_word(e);
|
||||
|
||||
ret = true;
|
||||
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
diff --git a/adb/client/usb_linux.cpp b/adb/client/usb_linux.cpp
|
||||
index 869e858d4..f1bf559a9 100644
|
||||
--- a/adb/client/usb_linux.cpp
|
||||
+++ b/adb/client/usb_linux.cpp
|
||||
@@ -30,6 +30,7 @@
|
||||
#include <string.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/time.h>
|
||||
+#include <sys/sysmacros.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
|
||||
|
|
@ -1,67 +1,36 @@
|
|||
%global date 20180828
|
||||
%global git_commit c7815d675
|
||||
|
||||
%global packdname core-%{git_commit}
|
||||
%global boring_git_commit fb44824b9
|
||||
%global boring_packdname boringssl-%{boring_git_commit}
|
||||
%global mdns_git_commit 33e620a7
|
||||
%global mdns_packdname mdnsresponder-%{mdns_git_commit}
|
||||
%global packdname -%{version}
|
||||
|
||||
%global _hardened_build 1
|
||||
|
||||
Name: android-tools
|
||||
Version: %{date}git%{git_commit}
|
||||
Release: 11%{?dist}
|
||||
Version: 30.0.5p1
|
||||
Release: 1%{?dist}
|
||||
Summary: Android platform tools(adb, fastboot)
|
||||
|
||||
# The entire source code is ASL 2.0 except boringssl which is BSD
|
||||
License: ASL 2.0 and (ASL 2.0 and BSD)
|
||||
URL: http://developer.android.com/guide/developing/tools/
|
||||
|
||||
# using git archive since upstream hasn't created tarballs.
|
||||
# git archive --format=tar --prefix=core/ %%{git_commit} adb base diagnose_usb fastboot libcrypto_utils libcutils liblog libsparse libsystem libutils libziparchive mkbootimg include | xz > %%{packdname}.tar.xz
|
||||
# https://android.googlesource.com/platform/system/core.git
|
||||
# git archive --format=tar --prefix=boringssl/ %%{boring_git_commit} src/crypto include src/include | xz > %%{boring_packdname}.tar.xz
|
||||
# https://android.googlesource.com/platform/external/boringssl
|
||||
# git archive --format=tar --prefix=mdnsresponder/ %%{mdns_git_commit} mDNSShared | xz > %%{mdns_packdname}.tar.xz
|
||||
# https://android.googlesource.com/platform/external/mdnsresponder
|
||||
|
||||
Source0: %{packdname}.tar.xz
|
||||
Source2: generate_build.rb
|
||||
Source3: %{boring_packdname}.tar.xz
|
||||
Source4: %{mdns_packdname}.tar.xz
|
||||
Source5: 51-android.rules
|
||||
Source6: adb.service
|
||||
Patch1: 0001-Add-string-h.patch
|
||||
Patch2: 0002-libusb-modifications.patch
|
||||
Patch3: 0003-buildlib-remove.patch
|
||||
Patch4: 0004-bz1441234.patch
|
||||
# https://android-review.googlesource.com/c/platform/system/core/+/740625
|
||||
Patch5: 0005-Add-sysmacros-h.patch
|
||||
# Sources with all needed patches and cmakelists live there now:
|
||||
#
|
||||
Source0: https://github.com/nmeum/%{name}/releases/download/%{version}/%{name}-%{version}.tar.xz
|
||||
Source1: 51-android.rules
|
||||
Source2: adb.service
|
||||
|
||||
|
||||
Requires(post): systemd
|
||||
Requires(preun): systemd
|
||||
Requires(postun): systemd
|
||||
BuildRequires: clang
|
||||
BuildRequires: cmake
|
||||
BuildRequires: gtest-devel
|
||||
BuildRequires: libselinux-devel
|
||||
BuildRequires: libusbx-devel
|
||||
BuildRequires: ninja-build
|
||||
BuildRequires: openssl-devel
|
||||
BuildRequires: ruby rubygems
|
||||
BuildRequires: systemd
|
||||
BuildRequires: zlib-devel
|
||||
|
||||
Provides: adb
|
||||
Provides: fastboot
|
||||
|
||||
# Bundled boringssl doesn't support the big endian architectures rhbz 1431379
|
||||
ExcludeArch: ppc ppc64 s390x
|
||||
Provides: adb = %{epoch}:%{version}-%{release}
|
||||
Provides: fastboot = %{epoch}:%{version}-%{release}
|
||||
Provides: mke2fs.android = %{epoch}:%{version}-%{release}
|
||||
|
||||
# Bundled bits
|
||||
Provides: bundled(mdnsresponder)
|
||||
# This is a fork of openssl.
|
||||
Provides: bundled(boringssl)
|
||||
|
||||
%description
|
||||
|
|
@ -85,39 +54,19 @@ to read and write the flash partitions. It needs the same USB device
|
|||
setup between the host and the target phone as adb.
|
||||
|
||||
%prep
|
||||
%setup -q -b 3 -n boringssl
|
||||
%setup -q -b 4 -n mdnsresponder
|
||||
%setup -q -b 0 -n core
|
||||
%patch1 -p1
|
||||
%patch2 -p1
|
||||
%patch3 -p1
|
||||
%patch4 -p1
|
||||
%patch5 -p1
|
||||
|
||||
cp -p %{SOURCE5} 51-android.rules
|
||||
export CC="clang"
|
||||
export CXX="clang++"
|
||||
sed -i 's/android::build::GetBuildNumber().c_str()/"%{git_commit}"/g' adb/adb.cpp
|
||||
|
||||
# This package appears to be failing because links to the LLVM plugins
|
||||
# are not installed which results in the tools not being able to
|
||||
# interpret the .o/.a files. Disable LTO for now
|
||||
%define _lto_cflags %{nil}
|
||||
%global optflags %(echo %{optflags} | sed -e 's/-mcet//g' -e 's/-fcf-protection//g' -e 's/-fstack-clash-protection//g')
|
||||
%autosetup
|
||||
cp -p %{SOURCE1} 51-android.rules
|
||||
|
||||
|
||||
%build
|
||||
|
||||
cd ..
|
||||
PKGVER=%{git_commit} CXXFLAGS="%{optflags} -Qunused-arguments" CFLAGS="%{optflags} -Qunused-arguments" ruby %{SOURCE2} > build.ninja
|
||||
%ninja_build
|
||||
%cmake -DBUILD_SHARED_LIBS:BOOL=OFF
|
||||
%cmake_build
|
||||
|
||||
%install
|
||||
cd ../
|
||||
install -d -m 0755 ${RPM_BUILD_ROOT}%{_bindir}
|
||||
install -d -m 0775 ${RPM_BUILD_ROOT}%{_sharedstatedir}/adb
|
||||
install -m 0755 -t ${RPM_BUILD_ROOT}%{_bindir} adb fastboot simg2img img2simg
|
||||
install -p -D -m 0644 %{SOURCE6} \
|
||||
%cmake_install
|
||||
install -p -D -m 0644 %{SOURCE2} \
|
||||
%{buildroot}%{_unitdir}/adb.service
|
||||
install -d -m 0775 ${RPM_BUILD_ROOT}%{_sharedstatedir}/adb
|
||||
|
||||
%post
|
||||
%systemd_post adb.service
|
||||
|
|
@ -129,7 +78,7 @@ install -p -D -m 0644 %{SOURCE6} \
|
|||
%systemd_postun_with_restart adb.service
|
||||
|
||||
%files
|
||||
%doc adb/OVERVIEW.TXT adb/SERVICES.TXT adb/NOTICE adb/protocol.txt 51-android.rules
|
||||
%doc vendor/core/adb/OVERVIEW.TXT vendor/core/adb/SERVICES.TXT vendor/core/adb/NOTICE vendor/core/adb/protocol.txt 51-android.rules
|
||||
%{_unitdir}/adb.service
|
||||
%attr(0755,root,root) %dir %{_sharedstatedir}/adb
|
||||
#ASL2.0 and BSD
|
||||
|
|
@ -138,9 +87,16 @@ install -p -D -m 0644 %{SOURCE6} \
|
|||
%{_bindir}/simg2img
|
||||
%{_bindir}/img2simg
|
||||
%{_bindir}/fastboot
|
||||
%{_bindir}/append2simg
|
||||
%{_bindir}/mke2fs.android
|
||||
|
||||
|
||||
%changelog
|
||||
* Sun Mar 14 2021 Ivan Afonichev <ivan.afonichev@gmail.com> - 1:30.0.5p1-1
|
||||
- Switch to linux-friendly upstream
|
||||
- Use Android SDK versions for versioning(Epoch 1 introduced)
|
||||
- Resolves: rhbz 1937578 1873878 1923681 1776001
|
||||
|
||||
* Tue Mar 02 2021 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 20180828gitc7815d675-11
|
||||
- Rebuilt for updated systemd-rpm-macros
|
||||
See https://pagure.io/fesco/issue/2583.
|
||||
|
|
|
|||
4
sources
4
sources
|
|
@ -1,3 +1 @@
|
|||
SHA512 (core-c7815d675.tar.xz) = eb294bc0f70eb65527610c534140ddc9dd9b4555924ceda6867557dabfc183c3cafe58b8b7a9b60c0adf44fb459250d92df17441dd071367bce0365e6a739b45
|
||||
SHA512 (mdnsresponder-33e620a7.tar.xz) = 9f8a3a05a0dc7440439b8ae8f0032bf8033587fd47bb2cbaad6243dbbf5bb42fa19f251714fc799247ce40fb968b2a51a257e5f9732b1ca9eb9fe3a9c84af904
|
||||
SHA512 (boringssl-fb44824b9.tar.xz) = bf889a8b87cebdb8a70424c855d64fe4a7930fb1e5ace0659ce9486b47ddbb93e91f7f0db8106639969e422fc6be152f9b18f5aec37f05c5c1fb29811dd7179b
|
||||
SHA512 (android-tools-30.0.5p1.tar.xz) = 8807d7e93ca04994c641278f6b260361f5c06186c9d9edacb0caa72484d5367c35f84c3fb3ad66bf969055e87af48c0b69241b70271e4f3891d1bb2e8336a7f6
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue