Browse Source

Add android-tools

master
mid-kid 8 years ago
parent
commit
ffabe66884
  1. 28
      satellites/android-tools.sat
  2. 142
      satellites/extrafiles/android-tools/Makefile
  3. 122
      satellites/extrafiles/android-tools/fix_core.patch
  4. 58
      satellites/functions/vcs/git.sh

28
satellites/android-tools.sat

@ -0,0 +1,28 @@
import 'vcs/git'
name=android-tools
version=7.1.1_r13
arch_rev='71c06907eb19e7b21dd8ecf4f6b90fd03d62bcc8'
update_url='https://android.googlesource.com/platform/system/core/+refs'
update_names="<a href=\"/platform/system/core/+/android-$version\">"
vcs_git -Vr "android-$version" 'https://android.googlesource.com/platform/system/core'
vcs_git -Vr "android-$version" 'https://android.googlesource.com/platform/system/extras'
vcs_git -Vr "android-$version" 'https://android.googlesource.com/platform/external/libselinux'
vcs_git -Vr "android-$version" 'https://android.googlesource.com/platform/external/f2fs-tools'
extrafile 'Makefile'
extrafile 'fix_core.patch'
header_end
( cd core
patch -p1 -i ../fix_core.patch
)
make \
VERSION="$version"
MYCFLAGS="$CFLAGS" \
MYCXXFLAGS="$CXXFLAGS"
install -Dm755 -t "$dir_install/$dir_prefix/$dir_bindir" adb fastboot
# vim:set tabstop=4 shiftwidth=4 syntax=sh expandtab:

142
satellites/extrafiles/android-tools/Makefile

@ -0,0 +1,142 @@
# Created for android-7.0.0_r13
CFLAGS := -O3 -fdata-sections -ffunction-sections -flto \
-DFASTBOOT_REVISION='"$(VERSION)"' \
-DADB_REVISION='"$(VERSION)"' \
-DADB_HOST=1 \
-DFAKE_LOG_DEVICE=1 \
-I core/adb \
-I core/base/include \
-I core/include \
-I core/libsparse/include \
-I core/mkbootimg \
-I extras/ext4_utils \
-I extras/f2fs_utils \
-I f2fs-tools/include \
-I f2fs-tools/mkfs \
-I libselinux/include \
CXXFLAGS := -std=gnu++14 -fpermissive \
$(CFLAGS)
CFLAGS += $(MYCFLAGS)
CXXFLAGS += $(MYCXXFLAGS)
FASTBOOT_OBJECTS := \
core/fastboot/bootimg_utils.o \
core/fastboot/engine.o \
core/fastboot/fastboot.o \
core/fastboot/fs.o \
core/fastboot/protocol.o \
core/fastboot/socket.o \
core/fastboot/tcp.o \
core/fastboot/udp.o \
core/fastboot/usb_linux.o \
core/fastboot/util.o \
core/fastboot/util_linux.o \
core/adb/diagnose_usb.o \
core/base/errors_unix.o \
core/base/file.o \
core/base/parsenetaddress.o \
core/base/stringprintf.o \
core/base/strings.o \
core/libcutils/socket_inaddr_any_server_unix.o \
core/libcutils/socket_local_client_unix.o \
core/libcutils/socket_network_client_unix.o \
core/libcutils/sockets.o \
core/libcutils/sockets_unix.o \
core/liblog/config_write.o \
core/liblog/fake_log_device.o \
core/liblog/fake_writer.o \
core/liblog/log_event_list.o \
core/liblog/logger_lock.o \
core/liblog/logger_name.o \
core/liblog/logger_write.o \
core/libsparse/backed_block.o \
core/libsparse/output_file.o \
core/libsparse/sparse.o \
core/libsparse/sparse_crc32.o \
core/libsparse/sparse_err.o \
core/libsparse/sparse_read.o \
core/libutils/FileMap.o \
core/libziparchive/zip_archive.o \
extras/ext4_utils/allocate.o \
extras/ext4_utils/contents.o \
extras/ext4_utils/crc16.o \
extras/ext4_utils/ext4_sb.o \
extras/ext4_utils/ext4_utils.o \
extras/ext4_utils/extent.o \
extras/ext4_utils/indirect.o \
extras/ext4_utils/make_ext4fs.o \
extras/ext4_utils/sha1.o \
extras/ext4_utils/wipe.o \
extras/f2fs_utils/f2fs_dlutils.o \
extras/f2fs_utils/f2fs_ioutils.o \
libselinux/src/callbacks.o \
libselinux/src/check_context.o \
libselinux/src/freecon.o \
libselinux/src/init.o \
libselinux/src/label.o \
libselinux/src/label_android_property.o \
libselinux/src/label_file.o \
libselinux/src/label_support.o
ADB_OBJECTS := \
core/adb/adb.o \
core/adb/adb_auth.o \
core/adb/adb_auth_host.o \
core/adb/adb_client.o \
core/adb/adb_io.o \
core/adb/adb_listeners.o \
core/adb/adb_trace.o \
core/adb/adb_utils.o \
core/adb/bugreport.o \
core/adb/client/main.o \
core/adb/commandline.o \
core/adb/console.o \
core/adb/diagnose_usb.o \
core/adb/fdevent.o \
core/adb/file_sync_client.o \
core/adb/get_my_path_linux.o \
core/adb/line_printer.o \
core/adb/services.o \
core/adb/shell_service_protocol.o \
core/adb/sockets.o \
core/adb/sysdeps_unix.o \
core/adb/transport.o \
core/adb/transport_local.o \
core/adb/transport_usb.o \
core/adb/usb_linux.o \
core/base/file.o \
core/base/logging.o \
core/base/parsenetaddress.o \
core/base/stringprintf.o \
core/base/strings.o \
core/libcutils/load_file.o \
core/libcutils/socket_inaddr_any_server_unix.o \
core/libcutils/socket_local_client_unix.o \
core/libcutils/socket_local_server_unix.o \
core/libcutils/socket_loopback_client_unix.o \
core/libcutils/socket_loopback_server_unix.o \
core/libcutils/socket_network_client_unix.o \
core/libcutils/threads.o \
core/liblog/config_write.o \
core/liblog/fake_log_device.o \
core/liblog/fake_writer.o \
core/liblog/log_event_list.o \
core/liblog/logger_lock.o \
core/liblog/logger_name.o \
core/liblog/logger_write.o
.PHONY: all
all: fastboot adb
.PHONY: clean
clean:
rm -f fastboot $(FASTBOOT_OBJECTS) adb $(ADB_OBJECTS)
fastboot: $(FASTBOOT_OBJECTS)
$(LINK.o) $(OUTPUT_OPTION) -Wl,--gc-sections -flto -lstdc++ -lpthread -lz $^
adb: $(ADB_OBJECTS)
$(LINK.o) $(OUTPUT_OPTION) -Wl,--gc-sections -flto -lstdc++ -lm -lpthread -lcrypto $^

122
satellites/extrafiles/android-tools/fix_core.patch

@ -0,0 +1,122 @@
diff --git a/adb/adb_client.h b/adb/adb_client.h
index 9f9eb1f..5355ade 100644
--- a/adb/adb_client.h
+++ b/adb/adb_client.h
@@ -25,8 +25,8 @@
// Connect to adb, connect to the named service, and return a valid fd for
// interacting with that service upon success or a negative number on failure.
-int adb_connect(const std::string& service, std::string* _Nonnull error);
-int _adb_connect(const std::string& service, std::string* _Nonnull error);
+int adb_connect(const std::string& service, std::string* error);
+int _adb_connect(const std::string& service, std::string* error);
// Connect to adb, connect to the named service, returns true if the connection
// succeeded AND the service returned OKAY. Outputs any returned error otherwise.
@@ -34,36 +34,36 @@ bool adb_command(const std::string& service);
// Connects to the named adb service and fills 'result' with the response.
// Returns true on success; returns false and fills 'error' on failure.
-bool adb_query(const std::string& service, std::string* _Nonnull result,
- std::string* _Nonnull error);
+bool adb_query(const std::string& service, std::string* result,
+ std::string* error);
// Set the preferred transport to connect to.
-void adb_set_transport(TransportType type, const char* _Nullable serial);
+void adb_set_transport(TransportType type, const char* serial);
// Get the preferred transport to connect to.
-void adb_get_transport(TransportType* _Nullable type, const char* _Nullable* _Nullable serial);
+void adb_get_transport(TransportType* type, const char** serial);
// Set TCP specifics of the transport to use.
void adb_set_tcp_specifics(int server_port);
// Set TCP Hostname of the transport to use.
-void adb_set_tcp_name(const char* _Nullable hostname);
+void adb_set_tcp_name(const char* hostname);
// Send commands to the current emulator instance. Will fail if there is not
// exactly one emulator connected (or if you use -s <serial> with a <serial>
// that does not designate an emulator).
-int adb_send_emulator_command(int argc, const char* _Nonnull* _Nonnull argv,
- const char* _Nullable serial);
+int adb_send_emulator_command(int argc, const char** argv,
+ const char* serial);
// Reads a standard adb status response (OKAY|FAIL) and returns true in the
// event of OKAY, false in the event of FAIL or protocol error.
-bool adb_status(int fd, std::string* _Nonnull error);
+bool adb_status(int fd, std::string* error);
// Create a host command corresponding to selected transport type/serial.
-std::string format_host_command(const char* _Nonnull command, TransportType type,
- const char* _Nullable serial);
+std::string format_host_command(const char* command, TransportType type,
+ const char* serial);
// Get the feature set of the current preferred transport.
-bool adb_get_feature_set(FeatureSet* _Nonnull feature_set, std::string* _Nonnull error);
+bool adb_get_feature_set(FeatureSet* feature_set, std::string* error);
#endif
diff --git a/base/errors_unix.cpp b/base/errors_unix.cpp
index 296995e..3b983d3 100644
--- a/base/errors_unix.cpp
+++ b/base/errors_unix.cpp
@@ -17,6 +17,7 @@
#include "android-base/errors.h"
#include <errno.h>
+#include <cstring>
namespace android {
namespace base {
diff --git a/base/file.cpp b/base/file.cpp
index da1adba..aed93d6 100644
--- a/base/file.cpp
+++ b/base/file.cpp
@@ -21,7 +21,7 @@
#include <sys/stat.h>
#include <sys/types.h>
-#include <string>
+#include <cstring>
#include "android-base/macros.h" // For TEMP_FAILURE_RETRY on Darwin.
#include "android-base/utf8.h"
diff --git a/base/logging.cpp b/base/logging.cpp
index 1741871..a80cae9 100644
--- a/base/logging.cpp
+++ b/base/logging.cpp
@@ -32,7 +32,7 @@
#include <iostream>
#include <limits>
#include <sstream>
-#include <string>
+#include <cstring>
#include <utility>
#include <vector>
diff --git a/fastboot/socket.h b/fastboot/socket.h
index de543db..b53d2b0 100644
--- a/fastboot/socket.h
+++ b/fastboot/socket.h
@@ -41,7 +41,6 @@
#include <android-base/macros.h>
#include <cutils/sockets.h>
-#include <gtest/gtest_prod.h>
// Socket interface to be implemented for each platform.
class Socket {
@@ -120,8 +119,6 @@ class Socket {
socket_send_buffers_function_ = &socket_send_buffers;
private:
- FRIEND_TEST(SocketTest, TestTcpSendBuffers);
- FRIEND_TEST(SocketTest, TestUdpSendBuffers);
DISALLOW_COPY_AND_ASSIGN(Socket);
};

58
satellites/functions/vcs/git.sh

@ -1,10 +1,12 @@
vcs_git() {
local branch=''
local rev='master'
local setver=true
local OPTIND=1
local opt
while getopts 'b:' opt; do case "$opt" in
b) local branch="$OPTARG" ;;
while getopts 'r:V' opt; do case "$opt" in
r) local rev="$OPTARG" ;;
V) local setver=false ;;
esac; done
shift $((OPTIND-1))
[ "$1" = '--' ] && shift
@ -13,27 +15,41 @@ vcs_git() {
local dir="$dir_source/$name/$reponame"
mkdir -p "$dir"
if [ ! -d "$dir/.git" ]; then
# Clone new repo
git clone --recursive --depth=1 $([ "$branch" ] && echo "-b $branch") "$1" "$dir"
cd "$dir"
echo "$(git rev-parse @)" > "${dir}_rev_$_satname"
cd "$dir"
if [ ! -f HEAD ]; then
# Create new repo
git init --bare
git remote add --mirror=fetch origin "$1"
elif [ "$1" != "$(git config --get remote.origin.url)" ]; then
# Update the URL
git remote remove origin
git remote add --mirror=fetch origin "$1"
fi
# Make sure we have the latest of whatever revision we want
git fetch --prune --depth=1 --recurse-submodules origin "$rev" || true
# Check if it's actually been updated
local rev="$(git rev-parse "$rev")"
if [ "$rev" != "$(cat "${dir}_rev_$_satname" 2> /dev/null || true)" ]; then
echo "$rev" > "${dir}_rev_$_satname"
vcs_compile=true
else
cd "$dir"
if git fetch $([ "$branch" ] && echo "origin $branch") > /dev/null; then
git reset --hard FETCH_HEAD > /dev/null
fi
local rev="$(git rev-parse @)"
if [ "$rev" != "$(cat "${dir}_rev_$_satname" 2> /dev/null || true)" ]; then
echo "$rev" > "${dir}_rev_$_satname"
vcs_compile=true
fi
fi
version="$(git rev-list HEAD --count)_$(git rev-parse --short HEAD)"
cd "$OLDPWD"
getfile "$reponame"
# Clone the repository
if [ "$download_only" = false ]; then
git clone "$dir" "$reponame" 2> /dev/null
cd "$reponame"
git checkout "$rev" 2> /dev/null
# Update the $version variable accordingly
[ "$setver" = true ] && version="$(git rev-list HEAD --count)_$(git rev-parse --short HEAD)" || true
cd "$OLDPWD"
fi
}

Loading…
Cancel
Save