diff options
Diffstat (limited to 'dynamic-layers/selinux/android-tools/android-tools/core-debian')
17 files changed, 660 insertions, 0 deletions
diff --git a/dynamic-layers/selinux/android-tools/android-tools/core-debian/Added-missing-headers.patch b/dynamic-layers/selinux/android-tools/android-tools/core-debian/Added-missing-headers.patch new file mode 100644 index 0000000..2820e79 --- /dev/null +++ b/dynamic-layers/selinux/android-tools/android-tools/core-debian/Added-missing-headers.patch | |||
@@ -0,0 +1,94 @@ | |||
1 | Description: Added missing headers causing compile errors | ||
2 | Author: Umang Parmar <umangjparmar@gmail.com> | ||
3 | Forwarded: not-needed | ||
4 | |||
5 | --- a/adb/sysdeps/posix/network.cpp | ||
6 | +++ b/adb/sysdeps/posix/network.cpp | ||
7 | @@ -22,6 +22,7 @@ | ||
8 | #include <sys/socket.h> | ||
9 | |||
10 | #include <string> | ||
11 | +#include <cstring> | ||
12 | |||
13 | #include <android-base/logging.h> | ||
14 | #include <android-base/stringprintf.h> | ||
15 | --- a/base/errors_unix.cpp | ||
16 | +++ b/base/errors_unix.cpp | ||
17 | @@ -17,6 +17,7 @@ | ||
18 | #include "android-base/errors.h" | ||
19 | |||
20 | #include <errno.h> | ||
21 | +#include <cstring> | ||
22 | |||
23 | namespace android { | ||
24 | namespace base { | ||
25 | --- a/base/file.cpp | ||
26 | +++ b/base/file.cpp | ||
27 | @@ -26,6 +26,7 @@ | ||
28 | #include <sys/stat.h> | ||
29 | #include <sys/types.h> | ||
30 | #include <unistd.h> | ||
31 | +#include <cstring> | ||
32 | |||
33 | #include <memory> | ||
34 | #include <mutex> | ||
35 | --- a/base/logging.cpp | ||
36 | +++ b/base/logging.cpp | ||
37 | @@ -24,6 +24,7 @@ | ||
38 | #include <inttypes.h> | ||
39 | #include <libgen.h> | ||
40 | #include <time.h> | ||
41 | +#include <cstring> | ||
42 | |||
43 | // For getprogname(3) or program_invocation_short_name. | ||
44 | #if defined(__ANDROID__) || defined(__APPLE__) | ||
45 | --- a/libcutils/include/cutils/jstring.h | ||
46 | +++ b/libcutils/include/cutils/jstring.h | ||
47 | @@ -19,6 +19,7 @@ | ||
48 | |||
49 | #include <stdint.h> | ||
50 | #include <stddef.h> | ||
51 | +#include <uchar.h> | ||
52 | |||
53 | #ifdef __cplusplus | ||
54 | extern "C" { | ||
55 | --- a/libbacktrace/BacktraceMap.cpp | ||
56 | +++ b/libbacktrace/BacktraceMap.cpp | ||
57 | @@ -21,6 +21,7 @@ | ||
58 | #include <stdint.h> | ||
59 | #include <sys/types.h> | ||
60 | #include <unistd.h> | ||
61 | +#include <algorithm> | ||
62 | |||
63 | #include <log/log.h> | ||
64 | |||
65 | --- a/demangle/Demangler.cpp | ||
66 | +++ b/demangle/Demangler.cpp | ||
67 | @@ -20,6 +20,7 @@ | ||
68 | #include <stack> | ||
69 | #include <string> | ||
70 | #include <vector> | ||
71 | +#include <cstring> | ||
72 | |||
73 | #include "Demangler.h" | ||
74 | |||
75 | --- a/libbacktrace/UnwindStackMap.cpp | ||
76 | +++ b/libbacktrace/UnwindStackMap.cpp | ||
77 | @@ -20,6 +20,7 @@ | ||
78 | |||
79 | #include <string> | ||
80 | #include <vector> | ||
81 | +#include <algorithm> | ||
82 | |||
83 | #include <backtrace/BacktraceMap.h> | ||
84 | #include <unwindstack/Elf.h> | ||
85 | --- a/adb/types.h | ||
86 | +++ b/adb/types.h | ||
87 | @@ -17,6 +17,7 @@ | ||
88 | #pragma once | ||
89 | |||
90 | #include <algorithm> | ||
91 | +#include <cstring> | ||
92 | #include <deque> | ||
93 | #include <memory> | ||
94 | #include <type_traits> | ||
diff --git a/dynamic-layers/selinux/android-tools/android-tools/core-debian/Nonnull.patch b/dynamic-layers/selinux/android-tools/android-tools/core-debian/Nonnull.patch new file mode 100644 index 0000000..a7e0fa8 --- /dev/null +++ b/dynamic-layers/selinux/android-tools/android-tools/core-debian/Nonnull.patch | |||
@@ -0,0 +1,20 @@ | |||
1 | Description: Bring Clang's _Nonnull keyword to GCC | ||
2 | Author: Kai-Chung Yan | ||
3 | Forwarded: not-needed | ||
4 | --- a/adb/sysdeps.h | ||
5 | +++ b/adb/sysdeps.h | ||
6 | @@ -40,11 +40,12 @@ | ||
7 | #include "sysdeps/network.h" | ||
8 | #include "sysdeps/stat.h" | ||
9 | |||
10 | +#define _Nonnull | ||
11 | +#define _Nullable | ||
12 | + | ||
13 | #ifdef _WIN32 | ||
14 | |||
15 | // Clang-only nullability specifiers | ||
16 | -#define _Nonnull | ||
17 | -#define _Nullable | ||
18 | |||
19 | #include <ctype.h> | ||
20 | #include <direct.h> | ||
diff --git a/dynamic-layers/selinux/android-tools/android-tools/core-debian/Vector-cast.patch b/dynamic-layers/selinux/android-tools/android-tools/core-debian/Vector-cast.patch new file mode 100644 index 0000000..dd39d1e --- /dev/null +++ b/dynamic-layers/selinux/android-tools/android-tools/core-debian/Vector-cast.patch | |||
@@ -0,0 +1,14 @@ | |||
1 | Description: Fix the wired error by GCC7 that fails to match the correct parent method. | ||
2 | Author: Kai-Chung Yan | ||
3 | Forwarded: not-needed | ||
4 | --- a/libutils/include/utils/Vector.h | ||
5 | +++ b/libutils/include/utils/Vector.h | ||
6 | @@ -256,7 +256,7 @@ | ||
7 | |||
8 | template<class TYPE> inline | ||
9 | const Vector<TYPE>& Vector<TYPE>::operator = (const Vector<TYPE>& rhs) const { | ||
10 | - VectorImpl::operator = (static_cast<const VectorImpl&>(rhs)); | ||
11 | + VectorImpl::operator = (rhs); | ||
12 | return *this; | ||
13 | } | ||
14 | |||
diff --git a/dynamic-layers/selinux/android-tools/android-tools/core-debian/add-missing-headers.patch b/dynamic-layers/selinux/android-tools/android-tools/core-debian/add-missing-headers.patch new file mode 100644 index 0000000..62a8ba2 --- /dev/null +++ b/dynamic-layers/selinux/android-tools/android-tools/core-debian/add-missing-headers.patch | |||
@@ -0,0 +1,20 @@ | |||
1 | --- a/fs_mgr/liblp/reader.cpp | ||
2 | +++ b/fs_mgr/liblp/reader.cpp | ||
3 | @@ -21,6 +21,7 @@ | ||
4 | #include <unistd.h> | ||
5 | |||
6 | #include <functional> | ||
7 | +#include <cstring> | ||
8 | |||
9 | #include <android-base/file.h> | ||
10 | #include <android-base/unique_fd.h> | ||
11 | --- a/fs_mgr/liblp/writer.cpp | ||
12 | +++ b/fs_mgr/liblp/writer.cpp | ||
13 | @@ -20,6 +20,7 @@ | ||
14 | #include <unistd.h> | ||
15 | |||
16 | #include <string> | ||
17 | +#include <cstring> | ||
18 | |||
19 | #include <android-base/file.h> | ||
20 | #include <android-base/unique_fd.h> | ||
diff --git a/dynamic-layers/selinux/android-tools/android-tools/core-debian/fix-attribute-issue-with-gcc.patch b/dynamic-layers/selinux/android-tools/android-tools/core-debian/fix-attribute-issue-with-gcc.patch new file mode 100644 index 0000000..771f0e7 --- /dev/null +++ b/dynamic-layers/selinux/android-tools/android-tools/core-debian/fix-attribute-issue-with-gcc.patch | |||
@@ -0,0 +1,17 @@ | |||
1 | Description: remove clang-ism | ||
2 | Forwarded: not-needed | ||
3 | |||
4 | --- a/base/include/android-base/logging.h | ||
5 | +++ b/base/include/android-base/logging.h | ||
6 | @@ -484,10 +484,7 @@ | ||
7 | // -Wno-user-defined-warnings to CPPFLAGS. | ||
8 | #pragma clang diagnostic push | ||
9 | #pragma clang diagnostic ignored "-Wgcc-compat" | ||
10 | -#define OSTREAM_STRING_POINTER_USAGE_WARNING \ | ||
11 | - __attribute__((diagnose_if(true, "Unexpected logging of string pointer", "warning"))) | ||
12 | -inline std::ostream& operator<<(std::ostream& stream, const std::string* string_pointer) | ||
13 | - OSTREAM_STRING_POINTER_USAGE_WARNING { | ||
14 | +inline std::ostream& operator<<(std::ostream& stream, const std::string* string_pointer) { | ||
15 | return stream << static_cast<const void*>(string_pointer); | ||
16 | } | ||
17 | #pragma clang diagnostic pop | ||
diff --git a/dynamic-layers/selinux/android-tools/android-tools/core-debian/fix-build-on-non-x86.patch b/dynamic-layers/selinux/android-tools/android-tools/core-debian/fix-build-on-non-x86.patch new file mode 100644 index 0000000..66d1ddd --- /dev/null +++ b/dynamic-layers/selinux/android-tools/android-tools/core-debian/fix-build-on-non-x86.patch | |||
@@ -0,0 +1,24 @@ | |||
1 | Description: non-x86 arches do not have PAGE_SIZE | ||
2 | Forwarded: not-needed | ||
3 | --- a/base/cmsg.cpp | ||
4 | +++ b/base/cmsg.cpp | ||
5 | @@ -33,7 +33,8 @@ | ||
6 | const std::vector<int>& fds) { | ||
7 | size_t cmsg_space = CMSG_SPACE(sizeof(int) * fds.size()); | ||
8 | size_t cmsg_len = CMSG_LEN(sizeof(int) * fds.size()); | ||
9 | - if (cmsg_space >= PAGE_SIZE) { | ||
10 | + size_t pagesize = static_cast<size_t>(sysconf(_SC_PAGE_SIZE)); | ||
11 | + if (cmsg_space >= pagesize) { | ||
12 | errno = ENOMEM; | ||
13 | return -1; | ||
14 | } | ||
15 | @@ -75,7 +76,8 @@ | ||
16 | fds->clear(); | ||
17 | |||
18 | size_t cmsg_space = CMSG_SPACE(sizeof(int) * max_fds); | ||
19 | - if (cmsg_space >= PAGE_SIZE) { | ||
20 | + size_t pagesize = static_cast<size_t>(sysconf(_SC_PAGE_SIZE)); | ||
21 | + if (cmsg_space >= pagesize) { | ||
22 | errno = ENOMEM; | ||
23 | return -1; | ||
24 | } | ||
diff --git a/dynamic-layers/selinux/android-tools/android-tools/core-debian/fix-gcc-11-ftbfs.patch b/dynamic-layers/selinux/android-tools/android-tools/core-debian/fix-gcc-11-ftbfs.patch new file mode 100644 index 0000000..8a21054 --- /dev/null +++ b/dynamic-layers/selinux/android-tools/android-tools/core-debian/fix-gcc-11-ftbfs.patch | |||
@@ -0,0 +1,22 @@ | |||
1 | Index: android-platform-system-core/libunwindstack/include/unwindstack/DwarfMemory.h | ||
2 | =================================================================== | ||
3 | --- android-platform-system-core.orig/libunwindstack/include/unwindstack/DwarfMemory.h | ||
4 | +++ android-platform-system-core/libunwindstack/include/unwindstack/DwarfMemory.h | ||
5 | @@ -29,7 +29,7 @@ class DwarfMemory { | ||
6 | DwarfMemory(Memory* memory) : memory_(memory) {} | ||
7 | virtual ~DwarfMemory() = default; | ||
8 | |||
9 | - bool ReadBytes(void* dst, size_t num_bytes); | ||
10 | + bool ReadBytes(void* dst, std::size_t num_bytes); | ||
11 | |||
12 | template <typename SignedType> | ||
13 | bool ReadSigned(uint64_t* value); | ||
14 | @@ -39,7 +39,7 @@ class DwarfMemory { | ||
15 | bool ReadSLEB128(int64_t* value); | ||
16 | |||
17 | template <typename AddressType> | ||
18 | - size_t GetEncodedSize(uint8_t encoding); | ||
19 | + std::size_t GetEncodedSize(uint8_t encoding); | ||
20 | |||
21 | bool AdjustEncodedValue(uint8_t encoding, uint64_t* value); | ||
22 | |||
diff --git a/dynamic-layers/selinux/android-tools/android-tools/core-debian/fix-gettid-exception-declaration.patch b/dynamic-layers/selinux/android-tools/android-tools/core-debian/fix-gettid-exception-declaration.patch new file mode 100644 index 0000000..3622d7e --- /dev/null +++ b/dynamic-layers/selinux/android-tools/android-tools/core-debian/fix-gettid-exception-declaration.patch | |||
@@ -0,0 +1,22 @@ | |||
1 | --- a/libcutils/include/cutils/threads.h | ||
2 | +++ b/libcutils/include/cutils/threads.h | ||
3 | @@ -33,7 +33,7 @@ | ||
4 | // Deprecated: use android::base::GetThreadId instead, which doesn't truncate on Mac/Windows. | ||
5 | // | ||
6 | |||
7 | -extern pid_t gettid(); | ||
8 | +extern pid_t gettid(void) __THROW; | ||
9 | |||
10 | // | ||
11 | // Deprecated: use `_Thread_local` in C or `thread_local` in C++. | ||
12 | --- a/libcutils/threads.cpp | ||
13 | +++ b/libcutils/threads.cpp | ||
14 | @@ -33,7 +33,7 @@ | ||
15 | |||
16 | // No definition needed for Android because we'll just pick up bionic's copy. | ||
17 | #ifndef __ANDROID__ | ||
18 | -pid_t gettid() { | ||
19 | +pid_t gettid(void) __THROW { | ||
20 | #if defined(__APPLE__) | ||
21 | uint64_t tid; | ||
22 | pthread_threadid_np(NULL, &tid); | ||
diff --git a/dynamic-layers/selinux/android-tools/android-tools/core-debian/fix-gnu-hurd.patch b/dynamic-layers/selinux/android-tools/android-tools/core-debian/fix-gnu-hurd.patch new file mode 100644 index 0000000..6c21022 --- /dev/null +++ b/dynamic-layers/selinux/android-tools/android-tools/core-debian/fix-gnu-hurd.patch | |||
@@ -0,0 +1,150 @@ | |||
1 | From: Roger Shimizu <rosh@debian.org> | ||
2 | Date: Sun, 10 Jan 2021 19:03:17 +0900 | ||
3 | Subject: Fix GNU/Hurd | ||
4 | |||
5 | Reference: | ||
6 | - https://www.gnu.org/software/hurd/hurd/porting/guidelines.html | ||
7 | |||
8 | Closes: #915762 | ||
9 | --- | ||
10 | base/cmsg.cpp | 2 ++ | ||
11 | base/threads.cpp | 2 +- | ||
12 | libcutils/ashmem-host.cpp | 20 +++++++++++++++++--- | ||
13 | libcutils/canned_fs_config.cpp | 2 +- | ||
14 | libcutils/fs.cpp | 20 ++++++++++++++++---- | ||
15 | 5 files changed, 37 insertions(+), 9 deletions(-) | ||
16 | |||
17 | diff --git a/base/cmsg.cpp b/base/cmsg.cpp | ||
18 | index ae5bb16..e5ec321 100644 | ||
19 | --- a/base/cmsg.cpp | ||
20 | +++ b/base/cmsg.cpp | ||
21 | @@ -20,7 +20,9 @@ | ||
22 | #include <fcntl.h> | ||
23 | #include <stdlib.h> | ||
24 | #include <sys/socket.h> | ||
25 | +#ifndef __GNU__ | ||
26 | #include <sys/user.h> | ||
27 | +#endif | ||
28 | |||
29 | #include <memory> | ||
30 | |||
31 | diff --git a/base/threads.cpp b/base/threads.cpp | ||
32 | index 48f6197..19cc293 100644 | ||
33 | --- a/base/threads.cpp | ||
34 | +++ b/base/threads.cpp | ||
35 | @@ -47,7 +47,7 @@ uint64_t GetThreadId() { | ||
36 | } // namespace base | ||
37 | } // namespace android | ||
38 | |||
39 | -#if defined(__GLIBC__) | ||
40 | +#if defined(__GLIBC__) && !defined(__GNU__) | ||
41 | int tgkill(int tgid, int tid, int sig) { | ||
42 | return syscall(__NR_tgkill, tgid, tid, sig); | ||
43 | } | ||
44 | diff --git a/libcutils/ashmem-host.cpp b/libcutils/ashmem-host.cpp | ||
45 | index 32446d4..83dd622 100644 | ||
46 | --- a/libcutils/ashmem-host.cpp | ||
47 | +++ b/libcutils/ashmem-host.cpp | ||
48 | @@ -31,16 +31,30 @@ | ||
49 | #include <sys/types.h> | ||
50 | #include <time.h> | ||
51 | #include <unistd.h> | ||
52 | +#include <stdint.h> | ||
53 | |||
54 | #include <utils/Compat.h> | ||
55 | |||
56 | int ashmem_create_region(const char* /*ignored*/, size_t size) { | ||
57 | - char pattern[PATH_MAX]; | ||
58 | - snprintf(pattern, sizeof(pattern), "/tmp/android-ashmem-%d-XXXXXXXXX", getpid()); | ||
59 | + char *pattern; | ||
60 | + size_t pattern_size = 128; | ||
61 | + while(1) { | ||
62 | + pattern = (char*) malloc(pattern_size); | ||
63 | + if(snprintf(pattern, strlen(pattern), "/tmp/android-ashmem-%d-XXXXXXXXX", getpid()) < pattern_size) | ||
64 | + break; | ||
65 | + free(pattern); | ||
66 | + pattern_size *= 2; | ||
67 | + if(pattern_size >= INT_LEAST16_MAX) | ||
68 | + return -1; | ||
69 | + } | ||
70 | int fd = mkstemp(pattern); | ||
71 | - if (fd == -1) return -1; | ||
72 | + if (fd == -1) { | ||
73 | + free(pattern); | ||
74 | + return -1; | ||
75 | + } | ||
76 | |||
77 | unlink(pattern); | ||
78 | + free(pattern); | ||
79 | |||
80 | if (TEMP_FAILURE_RETRY(ftruncate(fd, size)) == -1) { | ||
81 | close(fd); | ||
82 | diff --git a/libcutils/canned_fs_config.cpp b/libcutils/canned_fs_config.cpp | ||
83 | index 2772ef0..1e41f37 100644 | ||
84 | --- a/libcutils/canned_fs_config.cpp | ||
85 | +++ b/libcutils/canned_fs_config.cpp | ||
86 | @@ -42,7 +42,7 @@ static int path_compare(const void* a, const void* b) { | ||
87 | } | ||
88 | |||
89 | int load_canned_fs_config(const char* fn) { | ||
90 | - char buf[PATH_MAX + 200]; | ||
91 | + char buf[1024]; | ||
92 | FILE* f; | ||
93 | |||
94 | f = fopen(fn, "r"); | ||
95 | diff --git a/libcutils/fs.cpp b/libcutils/fs.cpp | ||
96 | index ef85acc..2884835 100644 | ||
97 | --- a/libcutils/fs.cpp | ||
98 | +++ b/libcutils/fs.cpp | ||
99 | @@ -33,6 +33,7 @@ | ||
100 | #include <sys/stat.h> | ||
101 | #include <sys/types.h> | ||
102 | #include <unistd.h> | ||
103 | +#include <stdint.h> | ||
104 | |||
105 | #include <log/log.h> | ||
106 | |||
107 | @@ -150,15 +151,24 @@ fail: | ||
108 | } | ||
109 | |||
110 | int fs_write_atomic_int(const char* path, int value) { | ||
111 | - char temp[PATH_MAX]; | ||
112 | - if (snprintf(temp, PATH_MAX, "%s.XXXXXX", path) >= PATH_MAX) { | ||
113 | - ALOGE("Path too long"); | ||
114 | - return -1; | ||
115 | + char *temp; | ||
116 | + size_t temp_size = 128; | ||
117 | + while(1) { | ||
118 | + temp = (char*) malloc(temp_size); | ||
119 | + if(snprintf(temp, strlen(temp), "%s.XXXXXX", path) < temp_size) | ||
120 | + break; | ||
121 | + free(temp); | ||
122 | + temp_size *= 2; | ||
123 | + if(temp_size >= INT_LEAST16_MAX) { | ||
124 | + ALOGE("Path too long"); | ||
125 | + return -1; | ||
126 | + } | ||
127 | } | ||
128 | |||
129 | int fd = TEMP_FAILURE_RETRY(mkstemp(temp)); | ||
130 | if (fd == -1) { | ||
131 | ALOGE("Failed to open %s: %s", temp, strerror(errno)); | ||
132 | + free(temp); | ||
133 | return -1; | ||
134 | } | ||
135 | |||
136 | @@ -182,12 +192,14 @@ int fs_write_atomic_int(const char* path, int value) { | ||
137 | goto fail_closed; | ||
138 | } | ||
139 | |||
140 | + free(temp); | ||
141 | return 0; | ||
142 | |||
143 | fail: | ||
144 | close(fd); | ||
145 | fail_closed: | ||
146 | unlink(temp); | ||
147 | + free(temp); | ||
148 | return -1; | ||
149 | } | ||
150 | |||
diff --git a/dynamic-layers/selinux/android-tools/android-tools/core-debian/hard-code-build-number.patch b/dynamic-layers/selinux/android-tools/android-tools/core-debian/hard-code-build-number.patch new file mode 100644 index 0000000..ccc7655 --- /dev/null +++ b/dynamic-layers/selinux/android-tools/android-tools/core-debian/hard-code-build-number.patch | |||
@@ -0,0 +1,43 @@ | |||
1 | Description: just hard code rather than deal with circular deps | ||
2 | Forwarded: not-needed | ||
3 | --- a/adb/adb.cpp | ||
4 | +++ b/adb/adb.cpp | ||
5 | @@ -44,8 +44,6 @@ | ||
6 | #include <android-base/parsenetaddress.h> | ||
7 | #include <android-base/stringprintf.h> | ||
8 | #include <android-base/strings.h> | ||
9 | -#include <build/version.h> | ||
10 | -#include <platform_tools_version.h> | ||
11 | |||
12 | #include "adb_auth.h" | ||
13 | #include "adb_io.h" | ||
14 | @@ -69,7 +67,7 @@ | ||
15 | "Version %s-%s\n" | ||
16 | "Installed as %s\n", | ||
17 | ADB_VERSION_MAJOR, ADB_VERSION_MINOR, ADB_SERVER_VERSION, | ||
18 | - PLATFORM_TOOLS_VERSION, android::build::GetBuildNumber().c_str(), | ||
19 | + PLATFORM_TOOLS_VERSION, "debian", | ||
20 | android::base::GetExecutablePath().c_str()); | ||
21 | } | ||
22 | |||
23 | --- a/fastboot/fastboot.cpp | ||
24 | +++ b/fastboot/fastboot.cpp | ||
25 | @@ -58,9 +58,7 @@ | ||
26 | #include <android-base/stringprintf.h> | ||
27 | #include <android-base/strings.h> | ||
28 | #include <android-base/unique_fd.h> | ||
29 | -#include <build/version.h> | ||
30 | #include <liblp/liblp.h> | ||
31 | -#include <platform_tools_version.h> | ||
32 | #include <sparse/sparse.h> | ||
33 | #include <ziparchive/zip_archive.h> | ||
34 | |||
35 | @@ -1680,7 +1678,7 @@ | ||
36 | setvbuf(stdout, nullptr, _IONBF, 0); | ||
37 | setvbuf(stderr, nullptr, _IONBF, 0); | ||
38 | } else if (name == "version") { | ||
39 | - fprintf(stdout, "fastboot version %s-%s\n", PLATFORM_TOOLS_VERSION, android::build::GetBuildNumber().c_str()); | ||
40 | + fprintf(stdout, "fastboot version %s-%s\n", PLATFORM_TOOLS_VERSION, "debian"); | ||
41 | fprintf(stdout, "Installed as %s\n", android::base::GetExecutablePath().c_str()); | ||
42 | return 0; | ||
43 | #if !defined(_WIN32) | ||
diff --git a/dynamic-layers/selinux/android-tools/android-tools/core-debian/libusb-header-path.patch b/dynamic-layers/selinux/android-tools/android-tools/core-debian/libusb-header-path.patch new file mode 100644 index 0000000..d507eab --- /dev/null +++ b/dynamic-layers/selinux/android-tools/android-tools/core-debian/libusb-header-path.patch | |||
@@ -0,0 +1,16 @@ | |||
1 | Description: libusb.h comes from different location | ||
2 | Author: Umang Parmar <umangjparmar@gmail.com> | ||
3 | Forwarded: not-needed | ||
4 | Last-Update: 2018-05-26 | ||
5 | |||
6 | --- a/adb/client/usb_libusb.cpp | ||
7 | +++ b/adb/client/usb_libusb.cpp | ||
8 | @@ -30,7 +30,7 @@ | ||
9 | #include <thread> | ||
10 | #include <unordered_map> | ||
11 | |||
12 | -#include <libusb/libusb.h> | ||
13 | +#include <libusb-1.0/libusb.h> | ||
14 | |||
15 | #include <android-base/file.h> | ||
16 | #include <android-base/logging.h> | ||
diff --git a/dynamic-layers/selinux/android-tools/android-tools/core-debian/move-log-file-to-proper-dir.patch b/dynamic-layers/selinux/android-tools/android-tools/core-debian/move-log-file-to-proper-dir.patch new file mode 100644 index 0000000..e71af86 --- /dev/null +++ b/dynamic-layers/selinux/android-tools/android-tools/core-debian/move-log-file-to-proper-dir.patch | |||
@@ -0,0 +1,18 @@ | |||
1 | Description: Update log file directory. | ||
2 | Author: Umang Parmar <umangjparmar@gmail.com> | ||
3 | Last Updated: 2018-05-17 | ||
4 | |||
5 | --- a/adb/adb_utils.cpp | ||
6 | +++ b/adb/adb_utils.cpp | ||
7 | @@ -339,6 +339,11 @@ | ||
8 | |||
9 | return temp_path_utf8 + log_name; | ||
10 | #else | ||
11 | + std::string log_dir = android::base::StringPrintf("/run/user/%u/adb.log", getuid()); | ||
12 | + struct stat st = {0}; | ||
13 | + if (stat(log_dir.c_str(), &st) == 0) { | ||
14 | + return log_dir; | ||
15 | + } | ||
16 | const char* tmp_dir = getenv("TMPDIR"); | ||
17 | if (tmp_dir == nullptr) tmp_dir = "/tmp"; | ||
18 | return android::base::StringPrintf("%s/adb.%u.log", tmp_dir, getuid()); | ||
diff --git a/dynamic-layers/selinux/android-tools/android-tools/core-debian/simg_dump-python3.patch b/dynamic-layers/selinux/android-tools/android-tools/core-debian/simg_dump-python3.patch new file mode 100644 index 0000000..947b526 --- /dev/null +++ b/dynamic-layers/selinux/android-tools/android-tools/core-debian/simg_dump-python3.patch | |||
@@ -0,0 +1,62 @@ | |||
1 | Description: Port simg_dump to Python 3. | ||
2 | Author: Antonio Russo <antonio.e.russo@gmail.com> | ||
3 | Forwarded: no | ||
4 | Last-Update: 2019-01-05 | ||
5 | Origin: https://bugs.debian.org/945646 | ||
6 | |||
7 | --- | ||
8 | Index: android-platform-system-core/libsparse/simg_dump.py | ||
9 | =================================================================== | ||
10 | --- android-platform-system-core.orig/libsparse/simg_dump.py | ||
11 | +++ android-platform-system-core/libsparse/simg_dump.py | ||
12 | @@ -1,4 +1,4 @@ | ||
13 | -#! /usr/bin/env python | ||
14 | +#! /usr/bin/env python3 | ||
15 | |||
16 | # Copyright (C) 2012 The Android Open Source Project | ||
17 | # | ||
18 | @@ -14,7 +14,7 @@ | ||
19 | # See the License for the specific language governing permissions and | ||
20 | # limitations under the License. | ||
21 | |||
22 | -from __future__ import print_function | ||
23 | + | ||
24 | import csv | ||
25 | import getopt | ||
26 | import hashlib | ||
27 | @@ -47,7 +47,7 @@ def main(): | ||
28 | opts, args = getopt.getopt(sys.argv[1:], | ||
29 | "vsc:", | ||
30 | ["verbose", "showhash", "csvfile"]) | ||
31 | - except getopt.GetoptError, e: | ||
32 | + except getopt.GetoptError as e: | ||
33 | print(e) | ||
34 | usage(me) | ||
35 | for o, a in opts: | ||
36 | @@ -66,7 +66,7 @@ def main(): | ||
37 | usage(me) | ||
38 | |||
39 | if csvfilename: | ||
40 | - csvfile = open(csvfilename, "wb") | ||
41 | + csvfile = open(csvfilename, "w", newline='') | ||
42 | csvwriter = csv.writer(csvfile) | ||
43 | |||
44 | output = verbose or csvfilename or showhash | ||
45 | @@ -121,7 +121,7 @@ def main(): | ||
46 | "output offset", "output blocks", "type", "hash"]) | ||
47 | |||
48 | offset = 0 | ||
49 | - for i in xrange(1, total_chunks + 1): | ||
50 | + for i in range(1, total_chunks + 1): | ||
51 | header_bin = FH.read(12) | ||
52 | header = struct.unpack("<2H2I", header_bin) | ||
53 | chunk_type = header[0] | ||
54 | @@ -160,7 +160,7 @@ def main(): | ||
55 | if showhash: | ||
56 | h = hashlib.sha1() | ||
57 | data = fill_bin * (blk_sz / 4); | ||
58 | - for block in xrange(chunk_sz): | ||
59 | + for block in range(chunk_sz): | ||
60 | h.update(data) | ||
61 | curhash = h.hexdigest() | ||
62 | elif chunk_type == 0xCAC3: | ||
diff --git a/dynamic-layers/selinux/android-tools/android-tools/core-debian/stdatomic.patch b/dynamic-layers/selinux/android-tools/android-tools/core-debian/stdatomic.patch new file mode 100644 index 0000000..8de0035 --- /dev/null +++ b/dynamic-layers/selinux/android-tools/android-tools/core-debian/stdatomic.patch | |||
@@ -0,0 +1,74 @@ | |||
1 | Description: Fix incompatibility between <stdatomic.h> and <atomic> | ||
2 | This 2 headers combined will cause errors for both GCC and Clang. This patch | ||
3 | makes sure only one of them is present at any time. | ||
4 | Bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60932 | ||
5 | Bug: https://reviews.llvm.org/D45470 | ||
6 | --- a/libcutils/include/cutils/trace.h | ||
7 | +++ b/libcutils/include/cutils/trace.h | ||
8 | @@ -18,7 +18,14 @@ | ||
9 | #define _LIBS_CUTILS_TRACE_H | ||
10 | |||
11 | #include <inttypes.h> | ||
12 | +#ifdef __cplusplus | ||
13 | +#include <atomic> | ||
14 | +using std::atomic_bool; | ||
15 | +using std::atomic_load_explicit; | ||
16 | +using std::memory_order_acquire; | ||
17 | +#else | ||
18 | #include <stdatomic.h> | ||
19 | +#endif | ||
20 | #include <stdbool.h> | ||
21 | #include <stdint.h> | ||
22 | #include <stdio.h> | ||
23 | --- a/libcutils/include/cutils/atomic.h | ||
24 | +++ b/libcutils/include/cutils/atomic.h | ||
25 | @@ -19,7 +19,23 @@ | ||
26 | |||
27 | #include <stdint.h> | ||
28 | #include <sys/types.h> | ||
29 | +#ifdef __cplusplus | ||
30 | +#include <atomic> | ||
31 | +using std::atomic_compare_exchange_strong_explicit; | ||
32 | +using std::atomic_fetch_add_explicit; | ||
33 | +using std::atomic_fetch_or_explicit; | ||
34 | +using std::atomic_fetch_sub_explicit; | ||
35 | +using std::atomic_int_least32_t; | ||
36 | +using std::atomic_load_explicit; | ||
37 | +using std::atomic_store_explicit; | ||
38 | +using std::atomic_thread_fence; | ||
39 | +using std::memory_order::memory_order_acquire; | ||
40 | +using std::memory_order::memory_order_relaxed; | ||
41 | +using std::memory_order::memory_order_release; | ||
42 | +using std::memory_order::memory_order_seq_cst; | ||
43 | +#else | ||
44 | #include <stdatomic.h> | ||
45 | +#endif | ||
46 | |||
47 | #ifndef ANDROID_ATOMIC_INLINE | ||
48 | #define ANDROID_ATOMIC_INLINE static inline | ||
49 | --- a/liblog/logger.h | ||
50 | +++ b/liblog/logger.h | ||
51 | @@ -16,7 +16,13 @@ | ||
52 | |||
53 | #pragma once | ||
54 | |||
55 | +#ifdef __cplusplus | ||
56 | +#include <atomic> | ||
57 | +using std::atomic_int; | ||
58 | +using std::atomic_uintptr_t; | ||
59 | +#else | ||
60 | #include <stdatomic.h> | ||
61 | +#endif | ||
62 | #include <stdbool.h> | ||
63 | |||
64 | #include <cutils/list.h> | ||
65 | --- a/liblog/logger_write.cpp | ||
66 | +++ b/liblog/logger_write.cpp | ||
67 | @@ -15,7 +15,6 @@ | ||
68 | */ | ||
69 | |||
70 | #include <errno.h> | ||
71 | -#include <stdatomic.h> | ||
72 | #include <stdlib.h> | ||
73 | #include <string.h> | ||
74 | #include <sys/time.h> | ||
diff --git a/dynamic-layers/selinux/android-tools/android-tools/core-debian/throw-exception-on-unknown-os.patch b/dynamic-layers/selinux/android-tools/android-tools/core-debian/throw-exception-on-unknown-os.patch new file mode 100644 index 0000000..5e239b7 --- /dev/null +++ b/dynamic-layers/selinux/android-tools/android-tools/core-debian/throw-exception-on-unknown-os.patch | |||
@@ -0,0 +1,15 @@ | |||
1 | Description: Turn #error into exceptions | ||
2 | So the library can be built on non-Linux platforms too, although can't | ||
3 | guarauntee its functionality regarding that piece of code. | ||
4 | --- a/base/file.cpp | ||
5 | +++ b/base/file.cpp | ||
6 | @@ -422,7 +422,8 @@ | ||
7 | path[PATH_MAX - 1] = 0; | ||
8 | return path; | ||
9 | #else | ||
10 | -#error unknown OS | ||
11 | +#include <stdexcept> | ||
12 | + throw std::runtime_error(std::string("Unknown OS!")); | ||
13 | #endif | ||
14 | } | ||
15 | |||
diff --git a/dynamic-layers/selinux/android-tools/android-tools/core-debian/use-Python-3-for-mkbootimg.patch b/dynamic-layers/selinux/android-tools/android-tools/core-debian/use-Python-3-for-mkbootimg.patch new file mode 100644 index 0000000..a14261a --- /dev/null +++ b/dynamic-layers/selinux/android-tools/android-tools/core-debian/use-Python-3-for-mkbootimg.patch | |||
@@ -0,0 +1,18 @@ | |||
1 | Description: Use Python 3 for `mkbootimg` | ||
2 | Bug: https://android.googlesource.com/platform/system/core/+/c434cf82d526f07cd3dcebf53582eeddf12b0a74 | ||
3 | --- a/mkbootimg/mkbootimg.py | ||
4 | +++ b/mkbootimg/mkbootimg.py | ||
5 | @@ -1,4 +1,4 @@ | ||
6 | -#!/usr/bin/env python | ||
7 | +#!/usr/bin/python3 | ||
8 | # Copyright 2015, The Android Open Source Project | ||
9 | # | ||
10 | # Licensed under the Apache License, Version 2.0 (the "License"); | ||
11 | --- a/mkbootimg/unpack_bootimg.py | ||
12 | +++ b/mkbootimg/unpack_bootimg.py | ||
13 | @@ -1,4 +1,4 @@ | ||
14 | -#!/usr/bin/env python | ||
15 | +#!/usr/bin/python3 | ||
16 | # Copyright 2018, The Android Open Source Project | ||
17 | # | ||
18 | # Licensed under the Apache License, Version 2.0 (the "License"); | ||
diff --git a/dynamic-layers/selinux/android-tools/android-tools/core-debian/workaround-error-expected-primary-expression-before-.-token.patch b/dynamic-layers/selinux/android-tools/android-tools/core-debian/workaround-error-expected-primary-expression-before-.-token.patch new file mode 100644 index 0000000..5e153b0 --- /dev/null +++ b/dynamic-layers/selinux/android-tools/android-tools/core-debian/workaround-error-expected-primary-expression-before-.-token.patch | |||
@@ -0,0 +1,31 @@ | |||
1 | Description: code uses C99/C++20 constructs that g++ does not support | ||
2 | $ g++ liblog/fake_writer.cpp -o liblog/fake_writer.o -c -std=c++17 -fPIC -Iliblog/include -Iinclude -DLIBLOG_LOG_TAG=1006 -DFAKE_LOG_DEVICE=1 -DSNET_EVENT_LOG_TAG=1397638484 | ||
3 | liblog/fake_writer.cpp:36:5: error: expected primary-expression before ‘.’ token | ||
4 | .context.priv = &logFds, | ||
5 | ^ | ||
6 | This is an ugly hack. The actual fix is probably to compile using | ||
7 | clang. Otherwise, these .context.priv elements shuld be initialized | ||
8 | in a different way. | ||
9 | |||
10 | Forwarded: not-needed | ||
11 | |||
12 | --- a/liblog/fake_writer.cpp | ||
13 | +++ b/liblog/fake_writer.cpp | ||
14 | @@ -33,7 +33,6 @@ | ||
15 | |||
16 | struct android_log_transport_write fakeLoggerWrite = { | ||
17 | .node = {&fakeLoggerWrite.node, &fakeLoggerWrite.node}, | ||
18 | - .context.priv = &logFds, | ||
19 | .name = "fake", | ||
20 | .available = NULL, | ||
21 | .open = fakeOpen, | ||
22 | --- a/liblog/stderr_write.cpp | ||
23 | +++ b/liblog/stderr_write.cpp | ||
24 | @@ -56,7 +56,6 @@ | ||
25 | |||
26 | struct android_log_transport_write stderrLoggerWrite = { | ||
27 | .node = {&stderrLoggerWrite.node, &stderrLoggerWrite.node}, | ||
28 | - .context.priv = NULL, | ||
29 | .name = "stderr", | ||
30 | .available = stderrAvailable, | ||
31 | .open = stderrOpen, | ||