[packages/android-tools] up to 33.0.3p1 (based on fedora)

atler atler at pld-linux.org
Fri Dec 30 00:18:14 CET 2022


commit a4e949f362d9cf54c264ba46ce0c224e2a52a81b
Author: Jan Palus <atler at pld-linux.org>
Date:   Fri Dec 30 00:17:53 2022 +0100

    up to 33.0.3p1 (based on fedora)

 0001-Add-string-h.patch |  36 ---------
 51-android.rules        |   2 +-
 android-tools.spec      | 138 ++++++++++++++++++++--------------
 generate_build.rb       | 191 ------------------------------------------------
 4 files changed, 85 insertions(+), 282 deletions(-)
---
diff --git a/android-tools.spec b/android-tools.spec
index 59c8dd7..707cf3b 100644
--- a/android-tools.spec
+++ b/android-tools.spec
@@ -1,52 +1,40 @@
-%define		rel	2
-%define		git_date 20160327
-%define		git_commit 3761365735de
-%define		packdname core-%{git_commit}
-%define		extras_git_commit 7f5999a
-%define		extras_packdname extras-%{extras_git_commit}
-Summary:	Android platform tools(adb, fastboot)
+Summary:	Android platform tools
 Name:		android-tools
-# use platform version from git (git describe --tags)
-# core: android-6.0.1_r21
-# extras: android-6.0.1_r68
-Version:	6.0.1
-Release:	0.%{git_date}git%{git_commit}.%{rel}
+Version:	33.0.3p1
+Release:	1
+# The entire source code is ASL 2.0 except boringssl which is BSD
+License:	ASL 2.0, BSD
 Group:		Applications/System
-# The entire source code is ASL 2.0 except fastboot/ which is BSD
-License:	ASL 2.0 and (ASL 2.0 and BSD)
-#  using git archive since upstream hasn't created tarballs.
-#  git archive --format=tar --prefix=%%{packdname}/ %%{git_commit} adb fastboot libzipfile libcutils libmincrypt libsparse mkbootimg include/cutils include/zipfile include/mincrypt include/utils include/private | xz  > %%{packdname}.tar.xz
-#  https://android.googlesource.com/platform/system/core.git
-#  git archive --format=tar --prefix=extras/ %%{extras_git_commit} ext4_utils f2fs_utils | xz  > %%{extras_packdname}.tar.xz
-#  https://android.googlesource.com/platform/system/extras.git
-Source0:	http://pkgs.fedoraproject.org/repo/pkgs/android-tools/%{packdname}.tar.xz/bdccaa042b73d1f5a29630c69ae5df26/%{packdname}.tar.xz
-# Source0-md5:	bdccaa042b73d1f5a29630c69ae5df26
-Source1:	http://pkgs.fedoraproject.org/repo/pkgs/android-tools/%{extras_packdname}.tar.xz/2cd5ea576fdf35f5e9ee1c208f6d9fa5/%{extras_packdname}.tar.xz
-# Source1-md5:	2cd5ea576fdf35f5e9ee1c208f6d9fa5
-Source2:	generate_build.rb
-Source5:	51-android.rules
-Source6:	adb.service
-Patch1:		0001-Add-string-h.patch
+Source0:	https://github.com/nmeum/android-tools/releases/download/%{version}/%{name}-%{version}.tar.xz
+# Source0-md5:	d0474aac5d7ca6e02906705a5c9307ac
+Source1:	51-android.rules
+Source2:	adb.service
 URL:		http://developer.android.com/guide/developing/tools/
-BuildRequires:	f2fs-tools
+BuildRequires:	cmake >= 3.12.0
+BuildRequires:	golang
 BuildRequires:	gtest-devel
-BuildRequires:	libselinux-devel
-BuildRequires:	openssl-devel
-BuildRequires:	rpmbuild(macros) >= 1.671
-BuildRequires:	ruby
-BuildRequires:	systemd-devel
+BuildRequires:	libbrotli-devel
+BuildRequires:	libstdc++-devel
+BuildRequires:	libusb-devel
+BuildRequires:	lz4-devel
+BuildRequires:	pcre2-8-devel
+BuildRequires:	perl-base
+BuildRequires:	protobuf-devel
+BuildRequires:	rpm-build >= 4.6
+BuildRequires:	rpmbuild(macros) >= 1.605
 BuildRequires:	tar >= 1:1.22
 BuildRequires:	xz
 BuildRequires:	zlib-devel
+BuildRequires:	zstd-devel
 Requires:	systemd-units >= 38
-Provides:	adb
-Provides:	fastboot
 BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
 
 %description
 The Android Debug Bridge (ADB) is used to:
+
 - keep track of all Android devices and emulators instances connected
   to or running on a given host developer machine
+
 - implement various control commands (e.g. "adb shell", "adb pull",
   etc.) for the benefit of clients (command-line users, or helper
   programs like DDMS). These commands are what is called a 'service' in
@@ -61,26 +49,45 @@ conjunction with firmware on the phone to read and write the flash
 partitions. It needs the same USB device setup between the host and
 the target phone as adb.
 
+%package -n bash-completion-android-tools
+Summary:	bash-completion for android-tools
+Group:		Applications/Shells
+Requires:	%{name} = %{version}-%{release}
+Requires:	bash-completion >= 1:2.0
+BuildArch:	noarch
+
+%description -n bash-completion-android-tools
+This package provides bash-completion for android-tools.
+
 %prep
-%setup -qc -a1
-mv %{packdname}/* .
+%setup -q
 
-%patch1 -p1
+%{__sed} -i -e '1 s,#!.*env python3,#!%{__python3},' \
+	vendor/mkbootimg/mkbootimg.py \
+	vendor/mkbootimg/unpack_bootimg.py \
+	vendor/avb/avbtool.py \
+	vendor/mkbootimg/repack_bootimg.py \
+	vendor/libufdt/utils/src/mkdtboimg.py
 
 %build
-%{__ruby} %{SOURCE2} | tee build.sh
-PKGVER=%{git_commit} \
-CC="%{__cc}" \
-CXX="%{__cxx}" \
-sh -xe build.sh
+export GO111MODULE=off
+install -d build
+cd build
+%cmake .. \
+	-DBUILD_SHARED_LIBS:BOOL=OFF
+
+%{__make}
 
 %install
 rm -rf $RPM_BUILD_ROOT
-install -d $RPM_BUILD_ROOT{%{_bindir},%{systemdunitdir},%{_sharedstatedir}/adb,/lib/udev/rules.d}
-install -p adb/adb fastboot/fastboot libsparse/simg2img libsparse/img2simg $RPM_BUILD_ROOT%{_bindir}
 
-cp -p %{SOURCE5} $RPM_BUILD_ROOT/lib/udev/rules.d/51-android.rules
-cp -p %{SOURCE6} $RPM_BUILD_ROOT%{systemdunitdir}/adb.service
+install -d $RPM_BUILD_ROOT{%{systemdunitdir},/var/lib/adb,/lib/udev/rules.d}
+
+%{__make} -C build install \
+	DESTDIR=$RPM_BUILD_ROOT
+
+cp -p %{SOURCE1} $RPM_BUILD_ROOT/lib/udev/rules.d/51-android.rules
+cp -p %{SOURCE2} $RPM_BUILD_ROOT%{systemdunitdir}/adb.service
 
 %clean
 rm -rf $RPM_BUILD_ROOT
@@ -96,14 +103,37 @@ rm -rf $RPM_BUILD_ROOT
 
 %files
 %defattr(644,root,root,755)
-%doc adb/OVERVIEW.TXT adb/SERVICES.TXT adb/NOTICE adb/protocol.txt
-# ASL2.0
+%doc vendor/adb/{OVERVIEW.TXT,SERVICES.TXT,NOTICE,protocol.txt}
 %attr(755,root,root) %{_bindir}/adb
-%attr(755,root,root) %{_bindir}/img2simg
+%attr(755,root,root) %{_bindir}/avbtool
+%attr(755,root,root) %{_bindir}/mke2fs.android
 %attr(755,root,root) %{_bindir}/simg2img
-# ASL2.0 and BSD.
+%attr(755,root,root) %{_bindir}/img2simg
 %attr(755,root,root) %{_bindir}/fastboot
-
-%{systemdunitdir}/adb.service
+%attr(755,root,root) %{_bindir}/append2simg
+%attr(755,root,root) %{_bindir}/e2fsdroid
+%attr(755,root,root) %{_bindir}/ext2simg
+%attr(755,root,root) %{_bindir}/lpadd
+%attr(755,root,root) %{_bindir}/lpdump
+%attr(755,root,root) %{_bindir}/lpflash
+%attr(755,root,root) %{_bindir}/lpmake
+%attr(755,root,root) %{_bindir}/lpunpack
+%attr(755,root,root) %{_bindir}/mkbootimg
+%attr(755,root,root) %{_bindir}/mkdtboimg
+%attr(755,root,root) %{_bindir}/repack_bootimg
+%attr(755,root,root) %{_bindir}/unpack_bootimg
 /lib/udev/rules.d/51-android.rules
-%dir %{_sharedstatedir}/adb
+%{systemdunitdir}/adb.service
+%dir %{_datadir}/android-tools
+%dir %{_datadir}/android-tools/completions
+%{_datadir}/android-tools/completions/adb
+%{_datadir}/android-tools/completions/fastboot
+%dir %{_datadir}/android-tools/mkbootimg
+%{_datadir}/android-tools/mkbootimg/gki/generate_gki_certificate.py
+%{_datadir}/android-tools/mkbootimg/mkbootimg.py
+%dir /var/lib/adb
+
+%files -n bash-completion-android-tools
+%defattr(644,root,root,755)
+%{bash_compdir}/adb
+%{bash_compdir}/fastboot
diff --git a/0001-Add-string-h.patch b/0001-Add-string-h.patch
deleted file mode 100644
index e325c04..0000000
--- a/0001-Add-string-h.patch
+++ /dev/null
@@ -1,36 +0,0 @@
-diff --git a/base/errors_unix.cpp b/base/errors_unix.cpp
-index 296995e..48269b6 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 da1adba..91a3901 100644
---- a/base/file.cpp
-+++ b/base/file.cpp
-@@ -20,6 +20,7 @@
- #include <fcntl.h>
- #include <sys/stat.h>
- #include <sys/types.h>
-+#include <string.h>
- 
- #include <string>
- 
-diff --git a/base/logging.cpp b/base/logging.cpp
-index 1741871..0f9e11a 100644
---- a/base/logging.cpp
-+++ b/base/logging.cpp
-@@ -29,6 +29,7 @@
- #include <errno.h>
- #endif
- 
-+#include <string.h>
- #include <iostream>
- #include <limits>
- #include <sstream>
diff --git a/51-android.rules b/51-android.rules
index c4c0be6..f141a2f 100644
--- a/51-android.rules
+++ b/51-android.rules
@@ -8299,7 +8299,7 @@ SUBSYSTEM=="usb", ATTR{idVendor}=="21a1", TAG+="systemd", ENV{SYSTEMD_WANTS}="ad
 SUBSYSTEM=="usb", ATTR{idVendor}=="21d6", TAG+="systemd", ENV{SYSTEMD_WANTS}="adb.service"
 
 # Fuzhou Rockchip Electronics
-SUBSYSTEM=="usb", ATTR{idVendor}=="2207", MODE="0666", GROUP="plugdev"
+SUBSYSTEM=="usb", ATTR{idVendor}=="2207", TAG+="systemd", ENV{SYSTEMD_WANTS}="adb.service"
 
 #MacAlly 
 SUBSYSTEM=="usb", ATTR{idVendor}=="2222", TAG+="systemd", ENV{SYSTEMD_WANTS}="adb.service"
diff --git a/generate_build.rb b/generate_build.rb
deleted file mode 100644
index ee7660f..0000000
--- a/generate_build.rb
+++ /dev/null
@@ -1,191 +0,0 @@
-#!/usr/bin/ruby
-
-# Android build system is complicated and does not allow to build
-# separate parts easily.
-# This script tries to mimic Android build rules.
-
-def expand(dir, files)
-  files.map{|f| File.join(dir,f)}
-end
-
-# Compiles sources to *.o files.
-# Returns array of output *.o filenames
-def compile(sources, cflags)
-  outputs = []
-  for s in sources
-    ext = File.extname(s)
-    
-    case ext
-    when '.c'
-        cc = '${CC:-gcc}'
-    	lang_flags = '-std=gnu11 $CFLAGS $CPPFLAGS'
-    when '.cpp', '.cc'
-        cc = '${CXX:-g++}'
-    	lang_flags = '-std=gnu++14 $CXXFLAGS $CPPFLAGS'
-    else
-        raise "Unknown extension #{ext}"
-    end
-
-    output = s + '.o'
-    outputs << output
-    puts "#{cc} -o #{output} #{lang_flags} #{cflags} -c #{s}\n"
-  end
-
-  return outputs
-end
-
-# Links object files
-def link(output, objects, ldflags)
-  puts "g++ -o #{output} #{ldflags} $LDFLAGS #{objects.join(' ')}"
-end
-
-minicryptfiles = %w(
-  dsa_sig.c
-  p256_ec.c
-  rsa.c
-  sha.c
-  p256.c
-  p256_ecdsa.c
-  sha256.c
-)
-libminicrypt = compile(expand('libmincrypt', minicryptfiles), '-Iinclude')
-
-adbdfiles = %w(
-  adb.cpp
-  adb_auth.cpp
-  adb_io.cpp
-  adb_listeners.cpp
-  adb_utils.cpp
-  sockets.cpp
-  transport.cpp
-  transport_local.cpp
-  transport_usb.cpp
-  services.cpp
-  adb_trace.cpp
-  get_my_path_linux.cpp
-  usb_linux.cpp
-  diagnose_usb.cpp
-  adb_auth_host.cpp
-  sysdeps_unix.cpp
-)
-libadbd = compile(expand('adb', adbdfiles), '-DADB_REVISION=\"$PKGVER\" -DADB_HOST=1 -fpermissive -Iinclude -Ibase/include')
-
-adbshfiles = %w(
-  fdevent.cpp
-  shell_service.cpp
-  shell_service_protocol.cpp
-)
-libadbsh = compile(expand('adb', adbshfiles), '-DADB_REVISION=\"$PKGVER\" -DADB_HOST=0 -D_Nonnull= -D_Nullable= -fpermissive -Iadb -Iinclude -Ibase/include')
-
-adbfiles = %w(
-  console.cpp
-  commandline.cpp
-  adb_client.cpp
-  file_sync_client.cpp
-  line_printer.cpp
-  client/main.cpp
-)
-libadb = compile(expand('adb', adbfiles), '-DADB_REVISION=\"$PKGVER\" -D_GNU_SOURCE -DADB_HOST=1 -D_Nonnull= -D_Nullable= -fpermissive -Iadb -Iinclude -Ibase/include')
-
-basefiles = %w(
-  file.cpp
-  logging.cpp
-  parsenetaddress.cpp
-  stringprintf.cpp
-  strings.cpp
-  errors_unix.cpp
-)
-libbase = compile(expand('base', basefiles), '-DADB_HOST=1 -D_GNU_SOURCE -Ibase/include -Iinclude')
-
-logfiles = %w(
-  logger_write.c
-  config_write.c
-  logger_lock.c
-  logger_name.c
-  log_event_list.c
-  log_event_write.c
-  fake_log_device.c
-  fake_writer.c
-)
-liblog = compile(expand('liblog', logfiles), '-DLIBLOG_LOG_TAG=1005 -DFAKE_LOG_DEVICE=1 -D_GNU_SOURCE -Ilog/include -Iinclude')
-
-cutilsfiles = %w(
-  load_file.c
-  socket_inaddr_any_server_unix.c
-  socket_local_client_unix.c
-  socket_local_server_unix.c
-  socket_loopback_client_unix.c
-  socket_loopback_server_unix.c
-  socket_network_client_unix.c
-  threads.c
-  sockets.cpp
-  sockets_unix.cpp
-)
-libcutils = compile(expand('libcutils', cutilsfiles), '-D_GNU_SOURCE -Iinclude')
-
-link('adb/adb', libbase + liblog + libcutils + libadbd + libadbsh + libadb, '-lrt -ldl -lpthread -lcrypto -lutil')
-
-
-fastbootfiles = %w(
-  socket.cpp
-  tcp.cpp
-  udp.cpp
-  protocol.cpp
-  engine.cpp
-  bootimg_utils.cpp
-  fastboot.cpp
-  util.cpp
-  fs.cpp
-  usb_linux.cpp
-  util_linux.cpp
-)
-libfastboot = compile(expand('fastboot', fastbootfiles), '-DFASTBOOT_REVISION=\"$PKGVER\" -D_GNU_SOURCE -Iadb -Iinclude -Imkbootimg -Ibase/include -Ilibsparse/include -Iextras/ext4_utils -Iextras/f2fs_utils')
-
-sparsefiles = %w(
-  backed_block.c
-  output_file.c
-  sparse.c
-  sparse_crc32.c
-  sparse_err.c
-  sparse_read.c
-)
-libsparse = compile(expand('libsparse', sparsefiles), '-Ilibsparse/include')
-
-zipfiles = %w(
-  zip_archive.cc
-)
-libzip = compile(expand('libziparchive', zipfiles), '-Ibase/include -Iinclude')
-
-utilfiles = %w(
-  FileMap.cpp
-)
-libutil = compile(expand('libutils', utilfiles), '-Iinclude')
-
-ext4files = %w(
-  make_ext4fs.c
-  ext4fixup.c
-  ext4_utils.c
-  allocate.c
-  contents.c
-  extent.c
-  indirect.c
-  sha1.c
-  wipe.c
-  crc16.c
-  ext4_sb.c
-)
-libext4 = compile(expand('extras/ext4_utils', ext4files), '-Ilibsparse/include -Iinclude')
-
-link('fastboot/fastboot', libsparse + libzip + liblog + libutil + libcutils + libbase + libext4 + libfastboot + libadbsh + libadbd, '-lpthread -lselinux -lz -lcrypto -lutil')
-
-simg2imgfiles = %w(
-  simg2img.c
-)
-libsimg2img = compile(expand('libsparse', simg2imgfiles), '-Iinclude -Ilibsparse/include')
-link('libsparse/simg2img', libsparse + libsimg2img, '-lz')
-
-img2simgfiles = %w(
-  img2simg.c
-)
-libimg2simg = compile(expand('libsparse', img2simgfiles), '-Iinclude -Ilibsparse/include')
-link('libsparse/img2simg', libsparse + libimg2simg, '-lz')
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/android-tools.git/commitdiff/a4e949f362d9cf54c264ba46ce0c224e2a52a81b



More information about the pld-cvs-commit mailing list