[arch-commits] Commit in android-tools/trunk (5 files)

Anatol Pomozov anatolik at archlinux.org
Sat Nov 2 23:21:33 UTC 2019


    Date: Saturday, November 2, 2019 @ 23:21:32
  Author: anatolik
Revision: 522398

upgpkg: android-tools 29.0.5-1

This release adds more dependencies to 'adb' sourcetree:
 - it started using protos, thus adding protobuf as a dependency
 - fastdeploy feature requires deployagent.jar. The jar would add enormous amount of
   deps, so I added the jar file as prebuilt for now.
 - it added a dependency to 'core' Android project that itself is ~2G of sources

Added:
  android-tools/trunk/deployagent.jar
Modified:
  android-tools/trunk/PKGBUILD
  android-tools/trunk/fix_build_core.patch
  android-tools/trunk/generate_build.rb
Deleted:
  android-tools/trunk/fix_sparse_img.patch

----------------------+
 PKGBUILD             |   35 +++++---
 deployagent.jar      |    1 
 fix_build_core.patch |    9 +-
 fix_sparse_img.patch |   38 --------
 generate_build.rb    |  208 ++++++++++++++++++++++++++++++-------------------
 5 files changed, 162 insertions(+), 129 deletions(-)

Modified: PKGBUILD
===================================================================
--- PKGBUILD	2019-11-02 23:01:26 UTC (rev 522397)
+++ PKGBUILD	2019-11-02 23:21:32 UTC (rev 522398)
@@ -3,21 +3,24 @@
 # Contributor: Alucryd <alucryd at gmail dot com>
 
 pkgname=android-tools
-pkgver=29.0.4
-pkgrel=2
+pkgver=29.0.5
+pkgrel=1
 tag=platform-tools-$pkgver
 pkgdesc='Android platform tools'
 arch=(x86_64)
 url='http://tools.android.com/'
 license=(Apache MIT)
-depends=(pcre2 libusb)
+depends=(pcre2 libusb protobuf)
 optdepends=('python: for mkbootimg script'
             'python2: for unpack_bootimg & avbtool scripts')
-makedepends=(git clang gtest ruby cmake ninja go-pie)
+# depend on 'vim' for 'xxd' tool.
+makedepends=(git clang gtest ruby cmake ninja go-pie vim)
 provides=(fastboot adb)
 conflicts=(fastboot adb)
 _boringssl_commit=$(curl https://android.googlesource.com/platform/external/boringssl/+/refs/tags/$tag/BORINGSSL_REVISION?format=TEXT | base64 -d)
-source=(git+https://android.googlesource.com/platform/system/core#tag=$tag
+source=(git+https://android.googlesource.com/platform/frameworks/base#tag=$tag
+	git+https://android.googlesource.com/platform/frameworks/native#tag=$tag
+	git+https://android.googlesource.com/platform/system/core#tag=$tag
         git+https://android.googlesource.com/platform/system/extras#tag=$tag
         git+https://android.googlesource.com/platform/system/tools/mkbootimg#tag=$tag
         git+https://android.googlesource.com/platform/external/selinux#tag=$tag
@@ -26,8 +29,19 @@
         git+https://android.googlesource.com/platform/external/avb#tag=$tag
         git+https://boringssl.googlesource.com/boringssl#commit=$_boringssl_commit
         generate_build.rb
+# deployagent.jar is a library built from Android sources.
+# Building this java library requires a lot of dependencies:
+#  java, protobuf-java, dex compiler, Android base libs.
+# To avoid the complexity we prebuilt the lib from the Android sources directly
+# using following instructiuons:
+#   (See https://wiki.archlinux.org/index.php/Android for context)
+# 
+#   source build/envsetup.sh
+#   lunch full-eng
+#   mmm system/core/adb/
+#   cp ./target/product/generic/system/framework/deployagent.jar .
+	deployagent.jar
         fix_build_core.patch
-        fix_sparse_img.patch
         bash_completion.fastboot)
         # Bash completion file was taken from https://github.com/mbrubeck/android-completion
 sha1sums=('SKIP'
@@ -38,9 +52,11 @@
           'SKIP'
           'SKIP'
           'SKIP'
-          'afca7974ad8658e52fd028ead12ad0a959d63273'
-          '9d35e4e9c4d1064783f3b1edaae0a2fae49493a4'
-          '2b57a4cf8012473c1a4fc6adae16573756272b02'
+          'SKIP'
+          'SKIP'
+          'acb02d8c048411fd21d00d57909a45aa6a6a6a7a'
+          'd9dfac30245faa0a96968b96f3acd9ad536f4910'
+          '31779cd6c0df710be9589bd2ee4f697f59b100fd'
           '7004dbd0c193668827174880de6f8434de8ceaee')
 
 prepare() {
@@ -48,7 +64,6 @@
 
   cd "$srcdir"/core
   patch -p1 < ../fix_build_core.patch
-  patch -p1 < ../fix_sparse_img.patch # FS#63370
 
   cd "$srcdir"/avb
   sed -i 's|/usr/bin/env python$|/usr/bin/env python2|g' avbtool

Added: deployagent.jar
===================================================================
(Binary files differ)

Index: android-tools/trunk/deployagent.jar
===================================================================
--- deployagent.jar	2019-11-02 23:01:26 UTC (rev 522397)
+++ deployagent.jar	2019-11-02 23:21:32 UTC (rev 522398)

Property changes on: android-tools/trunk/deployagent.jar
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/zip
\ No newline at end of property
Modified: fix_build_core.patch
===================================================================
--- fix_build_core.patch	2019-11-02 23:01:26 UTC (rev 522397)
+++ fix_build_core.patch	2019-11-02 23:21:32 UTC (rev 522398)
@@ -1,5 +1,5 @@
 diff --git a/adb/adb.cpp b/adb/adb.cpp
-index 098ed38f30..d0b2e87e7c 100644
+index 1ec145b25c..b6e943f6ee 100644
 --- a/adb/adb.cpp
 +++ b/adb/adb.cpp
 @@ -44,8 +44,6 @@
@@ -53,20 +53,21 @@
  #include <android-base/file.h>
  #include <android-base/logging.h>
 diff --git a/fastboot/fastboot.cpp b/fastboot/fastboot.cpp
-index 8923f409df..5cadb9649b 100644
+index 2fe3b1a9e0..a61b221ce3 100644
 --- a/fastboot/fastboot.cpp
 +++ b/fastboot/fastboot.cpp
-@@ -58,9 +58,7 @@
+@@ -59,10 +59,8 @@
  #include <android-base/stringprintf.h>
  #include <android-base/strings.h>
  #include <android-base/unique_fd.h>
 -#include <build/version.h>
+ #include <libavb/libavb.h>
  #include <liblp/liblp.h>
 -#include <platform_tools_version.h>
  #include <sparse/sparse.h>
  #include <ziparchive/zip_archive.h>
  
-@@ -1749,7 +1747,7 @@ int FastBootTool::Main(int argc, char* argv[]) {
+@@ -1783,7 +1781,7 @@ int FastBootTool::Main(int argc, char* argv[]) {
                  setvbuf(stdout, nullptr, _IONBF, 0);
                  setvbuf(stderr, nullptr, _IONBF, 0);
              } else if (name == "version") {

Deleted: fix_sparse_img.patch
===================================================================
--- fix_sparse_img.patch	2019-11-02 23:01:26 UTC (rev 522397)
+++ fix_sparse_img.patch	2019-11-02 23:21:32 UTC (rev 522398)
@@ -1,38 +0,0 @@
-commit fbb9535aaea5ae4011f3c3edf4c00b27452f57ec
-Author: Tom Cherry <tomcherry at google.com>
-Date:   Tue Sep 17 13:34:04 2019 -0700
-
-    fastboot: don't use sparse_file_import_auto() in load_buf_fd()
-    
-    load_buf_fd() attempts to find the size of the file that it is about
-    to load by first calling sparse_file_import_auto() then using
-    sparse_file_len() upon success or falling back to the file size on the
-    filesystem on failure.
-    
-    This is problematic however as sparse_file_import_auto() creates a
-    sparse_file out of the normal file, but does not resparse it, so an
-    assertion fails during the sparse_file_len() call.
-    
-    This is fixed by using sparse_file_import() instead.  This will fail
-    in the case that the file is not sparse and the call to
-    sparse_file_len() will be properly skipped.
-    
-    Bug: 140538105
-    Test: flash blueline factory image with assertions enabled in
-          libsparse/sparse.cpp
-    
-    Change-Id: I0283be33563a3301ce5b09bde41105a20f91086c
-
-diff --git a/fastboot/fastboot.cpp b/fastboot/fastboot.cpp
-index 4737ae4d66..a7fc628c43 100644
---- a/fastboot/fastboot.cpp
-+++ b/fastboot/fastboot.cpp
-@@ -874,7 +874,7 @@ static bool load_buf_fd(int fd, struct fastboot_buffer* buf) {
-         return false;
-     }
- 
--    if (sparse_file* s = sparse_file_import_auto(fd, false, false)) {
-+    if (sparse_file* s = sparse_file_import(fd, false, false)) {
-         buf->image_size = sparse_file_len(s, false, false);
-         sparse_file_destroy(s);
-     } else {

Modified: generate_build.rb
===================================================================
--- generate_build.rb	2019-11-02 23:01:26 UTC (rev 522397)
+++ generate_build.rb	2019-11-02 23:21:32 UTC (rev 522398)
@@ -10,7 +10,7 @@
 
 # Compiles sources to *.o files.
 # Returns array of output *.o filenames
-def compile(sources, cflags)
+def compile(sources, cflags, params = {})
   outputs = []
   for s in sources
     ext = File.extname(s)
@@ -28,12 +28,30 @@
 
     output = s + ".o"
     outputs << output
-    puts "build #{output}: #{cc} #{s}\n    cflags = #{lang_flags} #{cflags}"
+    order_deps = if params[:order_deps]
+                   " || " + params[:order_deps].join(" ")
+                 else
+                   ""
+                 end
+
+    puts "build #{output}: #{cc} #{s}#{order_deps}\n    cflags = #{lang_flags} #{cflags}"
   end
 
   return outputs
 end
 
+# Generate proto and compile it
+def protoc(source)
+  basename = File.join(File.dirname(source), File.basename(source, ".proto"))
+  cfile = basename + ".pb.cc"
+  hfile = basename + ".pb.h"
+  ofile = cfile + ".o"
+  puts "build #{cfile} #{hfile}: protoc #{source}"
+  puts "build #{ofile}: cc #{cfile}\n    cflags = -std=gnu++2a $CXXFLAGS $CPPFLAGS -I."
+
+  return hfile, cfile, ofile
+end
+
 # dir - directory where ninja file is located
 # lib - static library path relative to dir
 def subninja(dir, lib)
@@ -46,6 +64,10 @@
   puts "build #{output}: link #{objects.join(" ")}\n    ldflags = #{ldflags} $LDFLAGS"
 end
 
+def genheader(input, variable, output)
+  puts "build #{output}: genheader #{input}\n    var = #{variable}"
+end
+
 puts "# This set of commands generated by generate_build.rb script\n\n"
 puts "CC = #{ENV["CC"] || "clang"}"
 puts "CXX = #{ENV["CXX"] || "clang++"}\n\n"
@@ -64,7 +86,13 @@
 rule link
   command = $CXX $ldflags $LDFLAGS $in -o $out
 
+rule protoc
+  command = protoc --cpp_out=. $in
 
+rule genheader
+  command = (echo 'unsigned char $var[] = {' && xxd -i <$in && echo '};') > $out
+
+
 " ""
 
 adbdfiles = %w(
@@ -73,78 +101,97 @@
   adb_listeners.cpp
   adb_trace.cpp
   adb_utils.cpp
+  fdevent/fdevent.cpp
+  fdevent/fdevent_poll.cpp
+  fdevent/fdevent_epoll.cpp
+  shell_service_protocol.cpp
   sockets.cpp
   transport.cpp
   transport_local.cpp
   transport_usb.cpp
-  fdevent/fdevent.cpp
-  fdevent/fdevent_poll.cpp
-  shell_service_protocol.cpp
 )
 libadbd = compile(expand("core/adb", adbdfiles), '-DPLATFORM_TOOLS_VERSION="\"$PLATFORM_TOOLS_VERSION\"" -DADB_HOST=1 -Icore/include -Icore/base/include -Icore/adb -Icore/libcrypto_utils/include -Iboringssl/include -Icore/diagnose_usb/include')
 
+apkent_h, apkent_c, apkent_o = protoc("core/adb/fastdeploy/proto/ApkEntry.proto")
+
+deployagent_inc = "core/adb/client/deployagent.inc"
+genheader("deployagent.jar", "kDeployAgent", deployagent_inc)
+
+deployagentscript_inc = "core/adb/client/deployagentscript.inc"
+genheader("core/adb/fastdeploy/deployagent/deployagent.sh", "kDeployAgentScript", deployagentscript_inc)
+
 adbfiles = %w(
-  socket_spec.cpp
-  services.cpp
-  sysdeps_unix.cpp
-  sysdeps/errno.cpp
-  client/main.cpp
   client/adb_client.cpp
+  client/adb_install.cpp
   client/auth.cpp
+  client/bugreport.cpp
   client/commandline.cpp
+  client/console.cpp
+  client/fastdeploy.cpp
+  client/fastdeploycallbacks.cpp
+  client/file_sync_client.cpp
+  client/line_printer.cpp
+  client/main.cpp
   client/usb_dispatch.cpp
+  client/usb_libusb.cpp
   client/usb_linux.cpp
-  client/usb_libusb.cpp
-  client/bugreport.cpp
-  client/file_sync_client.cpp
-  client/line_printer.cpp
-  client/adb_install.cpp
-  client/console.cpp
+  fastdeploy/deploypatchgenerator/apk_archive.cpp
+  fastdeploy/deploypatchgenerator/deploy_patch_generator.cpp
+  fastdeploy/deploypatchgenerator/patch_utils.cpp
+  services.cpp
+  socket_spec.cpp
+  sysdeps/errno.cpp
   sysdeps/posix/network.cpp
+  sysdeps_unix.cpp
 )
-libadb = compile(expand("core/adb", adbfiles), "-D_GNU_SOURCE -DADB_HOST=1 -Icore/include -Icore/base/include -Icore/adb -Icore/libcrypto_utils/include -Iboringssl/include")
+libadb = compile(expand("core/adb", adbfiles), "-D_GNU_SOURCE -DADB_HOST=1 -Icore/include -Icore/base/include -Icore/adb -Icore/libcrypto_utils/include -Iboringssl/include -Ibase/libs/androidfw/include -Inative/include", :order_deps => [apkent_h, deployagent_inc, deployagentscript_inc])
 
+androidfwfiles = %w(
+  LocaleData.cpp
+  ResourceTypes.cpp
+  TypeWrappers.cpp
+  ZipFileRO.cpp
+)
+libandroidfw = compile(expand("base/libs/androidfw", androidfwfiles), "-Icore/base/include -Ibase/libs/androidfw/include -Icore/libutils/include -Icore/liblog/include -Icore/libsystem/include -Inative/include -Icore/libcutils/include -Icore/libziparchive/include")
+
 basefiles = %w(
+  chrono_utils.cpp
+  errors_unix.cpp
   file.cpp
   logging.cpp
-  threads.cpp
   mapped_file.cpp
   parsenetaddress.cpp
   stringprintf.cpp
   strings.cpp
-  errors_unix.cpp
   test_utils.cpp
-  chrono_utils.cpp
+  threads.cpp
 )
 libbase = compile(expand("core/base", basefiles), "-DADB_HOST=1 -Icore/base/include -Icore/include")
 
 logfiles = %w(
-  log_event_write.cpp
   fake_log_device.cpp
+  fake_writer.cpp
   log_event_list.cpp
-  logger_write.cpp
-  config_write.cpp
-  config_read.cpp
+  log_event_write.cpp
   logger_lock.cpp
-  fake_writer.cpp
   logger_name.cpp
-  stderr_write.cpp
+  logger_write.cpp
   logprint.cpp
 )
 liblog = compile(expand("core/liblog", logfiles), "-DLIBLOG_LOG_TAG=1006 -D_XOPEN_SOURCE=700 -DFAKE_LOG_DEVICE=1 -Icore/log/include -Icore/include")
 
 cutilsfiles = %w(
+  android_get_control_file.cpp
+  canned_fs_config.cpp
+  fs_config.cpp
   load_file.cpp
+  socket_inaddr_any_server_unix.cpp
   socket_local_client_unix.cpp
+  socket_local_server_unix.cpp
   socket_network_client_unix.cpp
-  socket_local_server_unix.cpp
+  sockets.cpp
   sockets_unix.cpp
-  socket_inaddr_any_server_unix.cpp
-  sockets.cpp
-  android_get_control_file.cpp
   threads.cpp
-  fs_config.cpp
-  canned_fs_config.cpp
 )
 libcutils = compile(expand("core/libcutils", cutilsfiles), "-D_GNU_SOURCE -Icore/libcutils/include -Icore/include -Icore/base/include")
 
@@ -162,30 +209,28 @@
 #boringssl = subninja('boringssl/build/', ['crypto/libcrypto.a'])
 boringssl = ["boringssl/build/crypto/libcrypto.a"]
 
-link("adb", libbase + liblog + libcutils + libadbd + libadb + libdiagnoseusb + libcrypto + boringssl, "-lpthread -lusb-1.0")
-
 fastbootfiles = %w(
   bootimg_utils.cpp
   fastboot.cpp
-  util.cpp
+  fastboot_driver.cpp
   fs.cpp
-  usb_linux.cpp
+  main.cpp
   socket.cpp
   tcp.cpp
   udp.cpp
-  main.cpp
-  fastboot_driver.cpp
+  usb_linux.cpp
+  util.cpp
 )
-libfastboot = compile(expand("core/fastboot", fastbootfiles), '-DPLATFORM_TOOLS_VERSION="\"$PLATFORM_TOOLS_VERSION\"" -D_GNU_SOURCE -D_XOPEN_SOURCE=700 -DUSE_F2FS -Icore/base/include -Icore/include -Icore/adb -Icore/libsparse/include -Imkbootimg/include/bootimg -Iextras/ext4_utils/include -Iextras/f2fs_utils -Icore/libziparchive/include -Icore/fs_mgr/liblp/include -Icore/diagnose_usb/include')
+libfastboot = compile(expand("core/fastboot", fastbootfiles), '-DPLATFORM_TOOLS_VERSION="\"$PLATFORM_TOOLS_VERSION\"" -D_GNU_SOURCE -D_XOPEN_SOURCE=700 -DUSE_F2FS -Icore/base/include -Icore/include -Icore/adb -Icore/libsparse/include -Imkbootimg/include/bootimg -Iextras/ext4_utils/include -Iextras/f2fs_utils -Icore/libziparchive/include -Icore/fs_mgr/liblp/include -Icore/diagnose_usb/include -Iavb')
 
 fsmgrfiles = %w(
+  liblp/images.cpp
+  liblp/partition_opener.cpp
   liblp/reader.cpp
+  liblp/utility.cpp
   liblp/writer.cpp
-  liblp/utility.cpp
-  liblp/partition_opener.cpp
-  liblp/images.cpp
 )
-libfsmgr = compile(expand("core/fs_mgr", fsmgrfiles), '-Icore/fs_mgr/liblp/include -Icore/base/include -Iextras/ext4_utils/include -Icore/libsparse/include')
+libfsmgr = compile(expand("core/fs_mgr", fsmgrfiles), "-Icore/fs_mgr/liblp/include -Icore/base/include -Iextras/ext4_utils/include -Icore/libsparse/include")
 
 sparsefiles = %w(
   backed_block.cpp
@@ -208,8 +253,13 @@
 
 utilfiles = %w(
   FileMap.cpp
+  SharedBuffer.cpp
+  String16.cpp
+  String8.cpp
+  VectorImpl.cpp
+  Unicode.cpp
 )
-libutil = compile(expand("core/libutils", utilfiles), "-Icore/include")
+libutil = compile(expand("core/libutils", utilfiles), "-Icore/include -Icore/base/include")
 
 ext4files = %w(
   ext4_utils.cpp
@@ -219,58 +269,58 @@
 libext4 = compile(expand("extras/ext4_utils", ext4files), "-D_GNU_SOURCE -Icore/libsparse/include -Icore/include -Iselinux/libselinux/include -Iextras/ext4_utils/include -Icore/base/include")
 
 selinuxfiles = %w(
+  booleans.c
   callbacks.c
+  canonicalize_context.c
   check_context.c
+  disable.c
+  enabled.c
   freecon.c
+  getenforce.c
   init.c
+  label_backends_android.c
   label.c
   label_file.c
   label_support.c
-  setrans_client.c
+  lgetfilecon.c
+  load_policy.c
+  lsetfilecon.c
+  matchpathcon.c
+  policyvers.c
   regex.c
-  matchpathcon.c
   selinux_config.c
-  label_backends_android.c
-  canonicalize_context.c
-  lsetfilecon.c
-  policyvers.c
-  lgetfilecon.c
-  load_policy.c
+  setenforce.c
+  setrans_client.c
   seusers.c
   sha1.c
-  booleans.c
-  disable.c
-  enabled.c
-  getenforce.c
-  setenforce.c
 )
 libselinux = compile(expand("selinux/libselinux/src", selinuxfiles), "-DAUDITD_LOG_TAG=1003 -D_GNU_SOURCE -DHOST -DUSE_PCRE2 -DNO_PERSISTENTLY_STORED_PATTERNS -DDISABLE_SETRANS -DDISABLE_BOOL -DNO_MEDIA_BACKEND -DNO_X_BACKEND -DNO_DB_BACKEND -DPCRE2_CODE_UNIT_WIDTH=8 -Iselinux/libselinux/include -Iselinux/libsepol/include")
 
 libsepolfiles = %w(
-  policydb_public.c
-  genbools.c
-  debug.c
-  policydb.c
-  conditional.c
-  services.c
-  ebitmap.c
-  util.c
   assertion.c
+  avrule_block.c
   avtab.c
-  hashtab.c
-  sidtab.c
+  conditional.c
+  constraint.c
   context.c
+  context_record.c
+  debug.c
+  ebitmap.c
+  expand.c
+  genbools.c
   genusers.c
-  context_record.c
+  hashtab.c
+  hierarchy.c
+  kernel_to_common.c
   mls.c
-  avrule_block.c
+  policydb.c
+  policydb_convert.c
+  policydb_public.c
+  services.c
+  sidtab.c
   symtab.c
-  policydb_convert.c
+  util.c
   write.c
-  constraint.c
-  expand.c
-  hierarchy.c
-  kernel_to_common.c
 )
 libsepol = compile(expand("selinux/libsepol/src", libsepolfiles), "-Iselinux/libsepol/include -Iselinux/libsepol/src")
 
@@ -289,6 +339,7 @@
   lib/blkid/resolve.c
   lib/blkid/save.c
   lib/blkid/tag.c
+  lib/e2p/encoding.c
   lib/e2p/feature.c
   lib/e2p/hashstr.c
   lib/e2p/mntopts.c
@@ -347,6 +398,7 @@
   lib/ext2fs/mmp.c
   lib/ext2fs/namei.c
   lib/ext2fs/newdir.c
+  lib/ext2fs/nls_utf8.c
   lib/ext2fs/openfs.c
   lib/ext2fs/progress.c
   lib/ext2fs/punch.c
@@ -392,12 +444,12 @@
 link("mke2fs.android", mke2fs + libext2fs + libsparse + libbase + libzip + liblog + libutil, "-lpthread -lz")
 
 e2fsdroidfiles = %w(
-  contrib/android/e2fsdroid.c
   contrib/android/basefs_allocator.c
+  contrib/android/base_fs.c
+  contrib/android/block_list.c
   contrib/android/block_range.c
-  contrib/android/base_fs.c
+  contrib/android/e2fsdroid.c
   contrib/android/fsmap.c
-  contrib/android/block_list.c
   contrib/android/perms.c
 )
 e2fsdroid = compile(expand("e2fsprogs", e2fsdroidfiles), "-Ie2fsprogs/lib -Ie2fsprogs/lib/ext2fs -Iselinux/libselinux/include -Icore/libcutils/include -Ie2fsprogs/misc")
@@ -410,3 +462,5 @@
 ext2simg = compile(expand("e2fsprogs", ext2simgfiles), "-Ie2fsprogs/lib -Icore/libsparse/include")
 
 link("ext2simg", ext2simg + libext2fs + libsparse + libbase + libzip + liblog + libutil, "-lz -lpthread")
+
+link("adb", libbase + liblog + libcutils + libutil + libadbd + libadb + libdiagnoseusb + libcrypto + boringssl + libandroidfw + libzip + [apkent_o], "-lpthread -lusb-1.0 -lprotobuf-lite -lz")



More information about the arch-commits mailing list