diff --git a/packages/apt/0000-cmake-fix.patch b/packages/apt/0000-cmake-fix.patch new file mode 100644 index 000000000..a0ceb9147 --- /dev/null +++ b/packages/apt/0000-cmake-fix.patch @@ -0,0 +1,139 @@ +diff -uNr apt-1.4.9/apt-pkg/CMakeLists.txt apt-1.4.9.mod/apt-pkg/CMakeLists.txt +--- apt-1.4.9/apt-pkg/CMakeLists.txt 2019-01-18 12:42:07.000000000 +0200 ++++ apt-1.4.9.mod/apt-pkg/CMakeLists.txt 2019-11-12 22:32:19.117227283 +0200 +@@ -48,13 +48,12 @@ + ) + + target_link_libraries(apt-pkg +- PRIVATE -lutil ${CMAKE_DL_LIBS} ${RESOLV_LIBRARIES} ++ PRIVATE ${CMAKE_DL_LIBS} ${RESOLV_LIBRARIES} + ${CMAKE_THREAD_LIBS_INIT} + ${ZLIB_LIBRARIES} + ${BZIP2_LIBRARIES} + ${LZMA_LIBRARIES} + ${LZ4_LIBRARIES} +- ${ICONV_LIBRARIES} + ) + set_target_properties(apt-pkg PROPERTIES VERSION ${MAJOR}.${MINOR}) + set_target_properties(apt-pkg PROPERTIES SOVERSION ${MAJOR}) +diff -uNr apt-1.4.9/CMakeLists.txt apt-1.4.9.mod/CMakeLists.txt +--- apt-1.4.9/CMakeLists.txt 2019-01-18 12:42:07.000000000 +0200 ++++ apt-1.4.9.mod/CMakeLists.txt 2019-11-12 22:32:24.393914821 +0200 +@@ -4,6 +4,7 @@ + # set minimum version + project(apt) + cmake_minimum_required(VERSION 3.4.0) ++include(CheckSymbolExists) + # Generic header locations + include_directories(${PROJECT_BINARY_DIR}/include) + +@@ -33,7 +34,6 @@ + include(GNUInstallDirs) + include(TestBigEndian) + find_package(Threads) +-find_package(LFS REQUIRED) + find_package(Iconv REQUIRED) + + find_package(Perl REQUIRED) +@@ -44,11 +44,6 @@ + include_directories(${Intl_INCLUDE_DIRS}) + endif() + +-# Add large file support +-add_compile_options(${LFS_COMPILE_OPTIONS}) +-add_definitions(${LFS_DEFINITIONS}) +-link_libraries(${LFS_LIBRARIES}) +- + # Set compiler flags + set(CMAKE_CXX_STANDARD 11) + set(CMAKE_CXX_STANDARD_REQUIRED ON) +@@ -69,13 +64,6 @@ + add_optional_compile_options(Wsign-promo) + add_optional_compile_options(Wundef) + +-# apt-ftparchive dependencies +-find_package(BerkeleyDB REQUIRED) +-if (BERKELEY_DB_FOUND) +- set(HAVE_BDB 1) +-endif() +- +- + # apt-transport-https dependencies + find_package(CURL REQUIRED) + if (CURL_FOUND) +@@ -89,21 +77,12 @@ + endif() + + +-find_package(BZip2) +-if (BZIP2_FOUND) +- set(HAVE_BZ2 1) +-endif() +- + find_package(LZMA) + if (LZMA_FOUND) + set(HAVE_LZMA 1) + endif() + + +-find_package(LZ4) +-if (LZ4_FOUND) +- set(HAVE_LZ4 1) +-endif() + + # Mount()ing and stat()ing and friends + check_symbol_exists(statfs sys/vfs.h HAVE_VFS_H) +@@ -180,10 +159,10 @@ + message(STATUS "Found dpkg data dir: ${DPKG_DATADIR_CMD}") + set(DPKG_DATADIR "${DPKG_DATADIR_CMD}" CACHE PATH "dpkg data directory") + endif() +-if (NOT DEFINED COMMON_ARCH) +- execute_process(COMMAND dpkg-architecture -qDEB_HOST_ARCH +- OUTPUT_VARIABLE COMMON_ARCH OUTPUT_STRIP_TRAILING_WHITESPACE) +-endif() ++# if (NOT DEFINED COMMON_ARCH) ++# execute_process(COMMAND dpkg-architecture -qDEB_HOST_ARCH ++ #OUTPUT_VARIABLE COMMON_ARCH OUTPUT_STRIP_TRAILING_WHITESPACE) ++# endif() + if (NOT DEFINED ROOT_GROUP) + execute_process(COMMAND id -gn root + OUTPUT_VARIABLE ROOT_GROUP OUTPUT_STRIP_TRAILING_WHITESPACE) +@@ -211,11 +190,8 @@ + add_subdirectory(apt-inst) + add_subdirectory(cmdline) + add_subdirectory(completions) +-add_subdirectory(doc) + add_subdirectory(dselect) +-add_subdirectory(ftparchive) + add_subdirectory(methods) +-add_subdirectory(test) + + if (USE_NLS) + add_subdirectory(po) +diff -uNr apt-1.4.9/methods/CMakeLists.txt apt-1.4.9.mod/methods/CMakeLists.txt +--- apt-1.4.9/methods/CMakeLists.txt 2019-01-18 12:42:07.000000000 +0200 ++++ apt-1.4.9.mod/methods/CMakeLists.txt 2019-11-12 22:32:30.553939187 +0200 +@@ -7,7 +7,7 @@ + add_executable(http http.cc http_main.cc rfc2553emu.cc connect.cc basehttp.cc) + add_executable(mirror mirror.cc http.cc rfc2553emu.cc connect.cc basehttp.cc) + add_executable(https https.cc basehttp.cc) +-add_executable(ftp ftp.cc rfc2553emu.cc connect.cc) ++# add_executable(ftp ftp.cc rfc2553emu.cc connect.cc) + add_executable(rred rred.cc) + add_executable(rsh rsh.cc) + +@@ -23,12 +23,12 @@ + target_link_libraries(http apt-pkg) + target_link_libraries(mirror apt-pkg ${RESOLV_LIBRARIES}) + target_link_libraries(https apt-pkg ${CURL_LIBRARIES}) +-target_link_libraries(ftp apt-pkg) ++#target_link_libraries(ftp apt-pkg) + target_link_libraries(rred apt-pkg) + target_link_libraries(rsh apt-pkg) + + # Install the library +-install(TARGETS file copy store gpgv cdrom http https ftp rred rsh mirror ++install(TARGETS file copy store gpgv cdrom http https rred rsh mirror + RUNTIME DESTINATION ${CMAKE_INSTALL_LIBEXECDIR}/apt/methods) + + add_slaves(${CMAKE_INSTALL_LIBEXECDIR}/apt/methods store gzip lzma bzip2 xz) diff --git a/packages/apt/0001-hardcoded-paths-fix.patch b/packages/apt/0001-hardcoded-paths-fix.patch new file mode 100644 index 000000000..05f6f03bf --- /dev/null +++ b/packages/apt/0001-hardcoded-paths-fix.patch @@ -0,0 +1,201 @@ +diff -uNr apt-1.4.9/apt-pkg/aptconfiguration.cc apt-1.4.9.mod/apt-pkg/aptconfiguration.cc +--- apt-1.4.9/apt-pkg/aptconfiguration.cc 2019-01-18 12:42:07.000000000 +0200 ++++ apt-1.4.9.mod/apt-pkg/aptconfiguration.cc 2019-11-12 22:10:28.531994919 +0200 +@@ -35,10 +35,10 @@ + // setDefaultConfigurationForCompressors /*{{{*/ + static void setDefaultConfigurationForCompressors() { + // Set default application paths to check for optional compression types +- _config->CndSet("Dir::Bin::gzip", "/bin/gzip"); +- _config->CndSet("Dir::Bin::bzip2", "/bin/bzip2"); +- _config->CndSet("Dir::Bin::xz", "/usr/bin/xz"); +- _config->CndSet("Dir::Bin::lz4", "/usr/bin/lz4"); ++ _config->CndSet("Dir::Bin::gzip", "@TERMUX_PREFIX@/bin/gzip"); ++ _config->CndSet("Dir::Bin::bzip2", "@TERMUX_PREFIX@/bin/bzip2"); ++ _config->CndSet("Dir::Bin::xz", "@TERMUX_PREFIX@/bin/xz"); ++ _config->CndSet("Dir::Bin::lz4", "@TERMUX_PREFIX@/bin/lz4"); + if (FileExists(_config->Find("Dir::Bin::xz")) == true) { + _config->Set("Dir::Bin::lzma", _config->Find("Dir::Bin::xz")); + _config->Set("APT::Compressor::lzma::Binary", "xz"); +@@ -51,7 +51,7 @@ + _config->Set("APT::Compressor::lzma::UncompressArg::", "-d"); + } + } else { +- _config->CndSet("Dir::Bin::lzma", "/usr/bin/lzma"); ++ _config->CndSet("Dir::Bin::lzma", "@TERMUX_PREFIX@/bin/lzma"); + if (_config->Exists("APT::Compressor::lzma::CompressArg") == false) { + _config->Set("APT::Compressor::lzma::CompressArg::", "--suffix="); + _config->Set("APT::Compressor::lzma::CompressArg::", "-6"); +diff -uNr apt-1.4.9/apt-pkg/contrib/cdromutl.cc apt-1.4.9.mod/apt-pkg/contrib/cdromutl.cc +--- apt-1.4.9/apt-pkg/contrib/cdromutl.cc 2019-01-18 12:42:07.000000000 +0200 ++++ apt-1.4.9.mod/apt-pkg/contrib/cdromutl.cc 2019-11-12 22:10:38.788703372 +0200 +@@ -268,7 +268,7 @@ + string FindMountPointForDevice(const char *devnode) + { + // this is the order that mount uses as well +- std::vector const mounts = _config->FindVector("Dir::state::MountPoints", "/etc/mtab,/proc/mount"); ++ std::vector const mounts = _config->FindVector("Dir::state::MountPoints", "@TERMUX_PREFIX@/etc/mtab,/proc/mount"); + + for (std::vector::const_iterator m = mounts.begin(); m != mounts.end(); ++m) + if (FileExists(*m) == true) +diff -uNr apt-1.4.9/apt-pkg/contrib/fileutl.cc apt-1.4.9.mod/apt-pkg/contrib/fileutl.cc +--- apt-1.4.9/apt-pkg/contrib/fileutl.cc 2019-01-18 12:42:07.000000000 +0200 ++++ apt-1.4.9.mod/apt-pkg/contrib/fileutl.cc 2019-11-12 22:12:25.625803839 +0200 +@@ -106,7 +106,7 @@ + _exit(100); + } + +- if (chdir("/tmp/") != 0) ++ if (chdir("@TERMUX_PREFIX@/tmp/") != 0) + _exit(100); + + unsigned int Count = 1; +@@ -2790,10 +2790,10 @@ + struct stat st; + if (!tmpdir || strlen(tmpdir) == 0 || // tmpdir is set + stat(tmpdir, &st) != 0 || (st.st_mode & S_IFDIR) == 0) // exists and is directory +- tmpdir = "/tmp"; ++ tmpdir = "@TERMUX_PREFIX@/tmp"; + else if (geteuid() != 0 && // root can do everything anyway + faccessat(AT_FDCWD, tmpdir, R_OK | W_OK | X_OK, AT_EACCESS) != 0) // current user has rwx access to directory +- tmpdir = "/tmp"; ++ tmpdir = "@TERMUX_PREFIX@/tmp"; + + return string(tmpdir); + } +@@ -3064,7 +3064,7 @@ + setenv("LOGNAME", pw->pw_name, 1); + auto const shell = flNotDir(pw->pw_shell); + if (shell == "false" || shell == "nologin") +- setenv("SHELL", "/bin/sh", 1); ++ setenv("SHELL", "@TERMUX_PREFIX@/bin/sh", 1); + else + setenv("SHELL", pw->pw_shell, 1); + auto const apt_setenv_tmp = [](char const * const env) { +diff -uNr apt-1.4.9/apt-pkg/deb/dpkgpm.cc apt-1.4.9.mod/apt-pkg/deb/dpkgpm.cc +--- apt-1.4.9/apt-pkg/deb/dpkgpm.cc 2019-01-18 12:42:07.000000000 +0200 ++++ apt-1.4.9.mod/apt-pkg/deb/dpkgpm.cc 2019-11-12 22:18:36.777295457 +0200 +@@ -179,7 +179,7 @@ + so we use the binary from util-linux */ + static bool ionice(int PID) + { +- if (!FileExists("/usr/bin/ionice")) ++ if (!FileExists("@TERMUX_PREFIX@/bin/ionice")) + return false; + pid_t Process = ExecFork(); + if (Process == 0) +@@ -187,7 +187,7 @@ + char buf[32]; + snprintf(buf, sizeof(buf), "-p%d", PID); + const char *Args[4]; +- Args[0] = "/usr/bin/ionice"; ++ Args[0] = "@TERMUX_PREFIX@/bin/ionice"; + Args[1] = "-c3"; + Args[2] = buf; + Args[3] = 0; +@@ -483,7 +483,7 @@ + + debSystem::DpkgChrootDirectory(); + const char *Args[4]; +- Args[0] = "/bin/sh"; ++ Args[0] = "@TERMUX_PREFIX@/bin/sh"; + Args[1] = "-c"; + Args[2] = Opts->Value.c_str(); + Args[3] = 0; +@@ -2403,11 +2403,13 @@ + fprintf(report, " %s: %s\n", pkgname.c_str(), opstr); + } + ++// Android doesn't allow to use dmesg without root. ++#ifndef __ANDROID__ + // attach dmesg log (to learn about segfaults) +- if (FileExists("/bin/dmesg")) ++ if (FileExists("@TERMUX_PREFIX@/bin/dmesg")) + { + fprintf(report, "Dmesg:\n"); +- FILE *log = popen("/bin/dmesg","r"); ++ FILE *log = popen("@TERMUX_PREFIX@/bin/dmesg","r"); + if(log != NULL) + { + char buf[1024]; +@@ -2416,13 +2418,13 @@ + pclose(log); + } + } ++#endif + +- // attach df -l log (to learn about filesystem status) +- if (FileExists("/bin/df")) ++ // attach df log (to learn about filesystem status) ++ if (FileExists("@TERMUX_PREFIX@/bin/df")) + { +- + fprintf(report, "Df:\n"); +- FILE *log = popen("/bin/df -l","r"); ++ FILE *log = popen("@TERMUX_PREFIX@/bin/df","r"); + if(log != NULL) + { + char buf[1024]; +diff -uNr apt-1.4.9/cmdline/apt-key.in apt-1.4.9.mod/cmdline/apt-key.in +--- apt-1.4.9/cmdline/apt-key.in 2019-01-18 12:42:07.000000000 +0200 ++++ apt-1.4.9.mod/cmdline/apt-key.in 2019-11-12 22:27:00.015963736 +0200 +@@ -260,7 +260,7 @@ + if accessible_file_exists "$TRUSTEDFILE"; then + $ACTION "$TRUSTEDFILE" "$@" + fi +- local TRUSTEDPARTS="/etc/apt/trusted.gpg.d" ++ local TRUSTEDPARTS="@TERMUX_PREFIX@/etc/apt/trusted.gpg.d" + eval "$(apt-config shell TRUSTEDPARTS Dir::Etc::TrustedParts/d)" + if [ -d "$TRUSTEDPARTS" ]; then + TRUSTEDPARTS="$(readlink -f "$TRUSTEDPARTS")" +@@ -439,7 +439,7 @@ + merge_all_trusted_keyrings_into_pubring + FORCED_KEYRING="${GPGHOMEDIR}/forcedkeyid.gpg" + TRUSTEDFILE="${FORCED_KEYRING}" +- echo "#!/bin/sh ++ echo "#!@TERMUX_PREFIX@/bin/sh + exec sh '($(escape_shell "${GPG}")' --keyring '$(escape_shell "${TRUSTEDFILE}")' \"\$@\"" > "${GPGHOMEDIR}/gpg.1.sh" + GPG="${GPGHOMEDIR}/gpg.1.sh" + # ignore error as this "just" means we haven't found the forced keyid and the keyring will be empty +@@ -451,13 +451,13 @@ + else + touch "${GPGHOMEDIR}/pubring.gpg" "${GPGHOMEDIR}/pubring.orig.gpg" + fi +- echo "#!/bin/sh ++ echo "#!@TERMUX_PREFIX@/bin/sh + exec sh '$(escape_shell "${GPG}")' --keyring '$(escape_shell "${GPGHOMEDIR}/pubring.gpg")' \"\$@\"" > "${GPGHOMEDIR}/gpg.1.sh" + GPG="${GPGHOMEDIR}/gpg.1.sh" + else + TRUSTEDFILE="$(dearmor_filename "$FORCED_KEYRING")" + create_new_keyring "$TRUSTEDFILE" +- echo "#!/bin/sh ++ echo "#!@TERMUX_PREFIX@/bin/sh + exec sh '$(escape_shell "${GPG}")' --keyring '$(escape_shell "${TRUSTEDFILE}")' \"\$@\"" > "${GPGHOMEDIR}/gpg.1.sh" + GPG="${GPGHOMEDIR}/gpg.1.sh" + fi +@@ -542,7 +542,7 @@ + done + + if [ -z "$TRUSTEDFILE" ]; then +- TRUSTEDFILE="/etc/apt/trusted.gpg" ++ TRUSTEDFILE="@TERMUX_PREFIX@/etc/apt/trusted.gpg" + eval $(apt-config shell TRUSTEDFILE Apt::GPGV::TrustedKeyring) + eval $(apt-config shell TRUSTEDFILE Dir::Etc::Trusted/f) + fi +@@ -612,7 +612,7 @@ + unset TMPDIR + fi + fi +- GPGHOMEDIR="$(mktemp --directory --tmpdir 'apt-key-gpghome.XXXXXXXXXX')" ++ GPGHOMEDIR="$(mktemp -d -t 'apt-key-gpghome.XXXXXXXXXX')" + CURRENTTRAP="${CURRENTTRAP} cleanup_gpg_home;" + trap "${CURRENTTRAP}" 0 HUP INT QUIT ILL ABRT FPE SEGV PIPE TERM + if [ -z "$GPGHOMEDIR" ]; then +@@ -654,7 +654,7 @@ + create_gpg_home + + # now tell gpg that it shouldn't try to maintain this trustdb file +- echo "#!/bin/sh ++ echo "#!@TERMUX_PREFIX@/bin/sh + exec '$(escape_shell "${GPG_EXE}")' --ignore-time-conflict --no-options --no-default-keyring \\ + --homedir '$(escape_shell "${GPGHOMEDIR}")' --no-auto-check-trustdb --trust-model always \"\$@\"" > "${GPGHOMEDIR}/gpg.0.sh" + GPG_SH="${GPGHOMEDIR}/gpg.0.sh" diff --git a/packages/apt/0002-glob.patch b/packages/apt/0002-glob.patch new file mode 100644 index 000000000..7e8641073 --- /dev/null +++ b/packages/apt/0002-glob.patch @@ -0,0 +1,42 @@ +diff -uNr apt-1.4.9/apt-pkg/contrib/fileutl.cc apt-1.4.9.mod/apt-pkg/contrib/fileutl.cc +--- apt-1.4.9/apt-pkg/contrib/fileutl.cc 2019-11-12 22:12:25.625803839 +0200 ++++ apt-1.4.9.mod/apt-pkg/contrib/fileutl.cc 2019-11-12 22:36:46.021615823 +0200 +@@ -46,7 +46,9 @@ + #include + #include + #include ++#ifndef __ANDROID__ + #include ++#endif + #include + #include + +@@ -2752,6 +2754,7 @@ + } + /*}}}*/ + ++#ifndef __ANDROID__ + // Glob - wrapper around "glob()" /*{{{*/ + std::vector Glob(std::string const &pattern, int flags) + { +@@ -2777,6 +2780,7 @@ + globfree(&globbuf); + return result; + } ++#endif + /*}}}*/ + static std::string APT_NONNULL(1) GetTempDirEnv(char const * const env) /*{{{*/ + { +diff -uNr apt-1.4.9/apt-pkg/contrib/fileutl.h apt-1.4.9.mod/apt-pkg/contrib/fileutl.h +--- apt-1.4.9/apt-pkg/contrib/fileutl.h 2019-01-18 12:42:07.000000000 +0200 ++++ apt-1.4.9.mod/apt-pkg/contrib/fileutl.h 2019-11-12 22:36:46.021615823 +0200 +@@ -239,7 +239,9 @@ + APT_HIDDEN std::string flNormalize(std::string file); + + // simple c++ glob ++#ifndef __ANDROID__ + std::vector Glob(std::string const &pattern, int flags=0); ++#endif + + /** \brief Popen() implementation that execv() instead of using a shell + * diff --git a/packages/apt/0003-langinfo-and-codeset.patch b/packages/apt/0003-langinfo-and-codeset.patch new file mode 100644 index 000000000..64304f716 --- /dev/null +++ b/packages/apt/0003-langinfo-and-codeset.patch @@ -0,0 +1,72 @@ +diff -uNr apt-1.4.9/apt-pkg/contrib/strutl.cc apt-1.4.9.mod/apt-pkg/contrib/strutl.cc +--- apt-1.4.9/apt-pkg/contrib/strutl.cc 2019-01-18 12:42:07.000000000 +0200 ++++ apt-1.4.9.mod/apt-pkg/contrib/strutl.cc 2019-11-12 22:39:32.592335551 +0200 +@@ -100,6 +100,7 @@ + } + } + /*}}}*/ ++#ifndef __ANDROID__ + // UTF8ToCodeset - Convert some UTF-8 string for some codeset /*{{{*/ + // --------------------------------------------------------------------- + /* This is handy to use before display some information for enduser */ +@@ -169,6 +170,7 @@ + + return true; + } ++#endif + /*}}}*/ + // strstrip - Remove white space from the front and back of a string /*{{{*/ + // --------------------------------------------------------------------- +diff -uNr apt-1.4.9/apt-pkg/deb/debrecords.cc apt-1.4.9.mod/apt-pkg/deb/debrecords.cc +--- apt-1.4.9/apt-pkg/deb/debrecords.cc 2019-01-18 12:42:07.000000000 +0200 ++++ apt-1.4.9.mod/apt-pkg/deb/debrecords.cc 2019-11-12 22:39:37.975693094 +0200 +@@ -25,7 +25,9 @@ + #include + #include + #include ++#ifndef __ANDROID__ + #include ++#endif + + #include + /*}}}*/ +@@ -152,12 +154,14 @@ + orig = Section.FindS("Description"); + } + ++#ifndef __ANDROID__ + char const * const codeset = nl_langinfo(CODESET); + if (strcmp(codeset,"UTF-8") != 0) { + string dest; + UTF8ToCodeset(codeset, orig, &dest); + return dest; + } ++#endif + + return orig; + } +diff -uNr apt-1.4.9/apt-private/private-output.cc apt-1.4.9.mod/apt-private/private-output.cc +--- apt-1.4.9/apt-private/private-output.cc 2019-01-18 12:42:07.000000000 +0200 ++++ apt-1.4.9.mod/apt-private/private-output.cc 2019-11-12 22:39:43.812385978 +0200 +@@ -20,7 +20,11 @@ + #include + #include + #include +-#include ++#ifdef __ANDROID__ ++# include ++# else ++# include ++#endif + #include + #include + #include +@@ -717,7 +721,7 @@ + regex_t Pattern; + int Res; + +- Res = regcomp(&Pattern, nl_langinfo(YESEXPR), ++ Res = regcomp(&Pattern, "^[yY]", + REG_EXTENDED|REG_ICASE|REG_NOSUB); + + if (Res != 0) { diff --git a/packages/apt/0004-srv-records.patch b/packages/apt/0004-srv-records.patch new file mode 100644 index 000000000..032a22ea6 --- /dev/null +++ b/packages/apt/0004-srv-records.patch @@ -0,0 +1,52 @@ +diff -uNr apt-1.4.9/apt-pkg/contrib/srvrec.cc apt-1.4.9.mod/apt-pkg/contrib/srvrec.cc +--- apt-1.4.9/apt-pkg/contrib/srvrec.cc 2019-01-18 12:42:07.000000000 +0200 ++++ apt-1.4.9.mod/apt-pkg/contrib/srvrec.cc 2019-11-12 22:41:25.142836445 +0200 +@@ -40,14 +40,24 @@ + struct servent *s_ent = nullptr; + std::vector buf(1024); + ++#ifdef __ANDROID__ ++ s_ent = getservbyport(htons(port), "tcp"); ++ if (s_ent == nullptr) return false; ++#else + res = getservbyport_r(htons(port), "tcp", &s_ent_buf, buf.data(), buf.size(), &s_ent); + if (res != 0 || s_ent == nullptr) + return false; ++#endif + + strprintf(target, "_%s._tcp.%s", s_ent->s_name, host.c_str()); + return GetSrvRecords(target, Result); + } + ++#ifdef __ANDROID__ ++extern "C" int __dn_skipname(const unsigned char* comp_dn, const unsigned char* eom); ++static inline int dn_skipname(const unsigned char* a, const unsigned char* b) { return __dn_skipname(a,b); } ++#endif ++ + bool GetSrvRecords(std::string name, std::vector &Result) + { + unsigned char answer[PACKETSZ]; +diff -uNr apt-1.4.9/methods/connect.cc apt-1.4.9.mod/methods/connect.cc +--- apt-1.4.9/methods/connect.cc 2019-01-18 12:42:07.000000000 +0200 ++++ apt-1.4.9.mod/methods/connect.cc 2019-11-12 22:41:29.396188505 +0200 +@@ -129,7 +129,7 @@ + + // Check the socket for an error condition + unsigned int Err; +- unsigned int Len = sizeof(Err); ++ socklen_t Len = sizeof(Err); + if (getsockopt(Fd,SOL_SOCKET,SO_ERROR,&Err,&Len) != 0) + return _error->Errno("getsockopt",_("Failed")); + +@@ -301,7 +301,10 @@ + if(LastHost != Host || LastPort != Port) + { + SrvRecords.clear(); +- if (_config->FindB("Acquire::EnableSrvRecords", true) == true) ++ /* Disable by default in Termux due to it breaking on (some) HTC ++ devices (https://github.com/termux/termux-packages/issues/99). */ ++ ++ if (_config->FindB("Acquire::EnableSrvRecords", false) == true) + { + GetSrvRecords(Host, DefPort, SrvRecords); + // RFC2782 defines that a lonely '.' target is an abort reason diff --git a/packages/apt/methods-basehttp.cc.patch b/packages/apt/0005-http2-fix.patch similarity index 75% rename from packages/apt/methods-basehttp.cc.patch rename to packages/apt/0005-http2-fix.patch index 7ec8bb8ef..01925fdd7 100644 --- a/packages/apt/methods-basehttp.cc.patch +++ b/packages/apt/0005-http2-fix.patch @@ -1,6 +1,6 @@ -diff -u -r ../apt-1.4.8/methods/basehttp.cc ./methods/basehttp.cc ---- ../apt-1.4.8/methods/basehttp.cc 2017-09-13 16:47:33.000000000 +0000 -+++ ./methods/basehttp.cc 2018-12-30 21:42:01.326143988 +0000 +diff -uNr apt-1.4.9/methods/basehttp.cc apt-1.4.9.mod/methods/basehttp.cc +--- apt-1.4.9/methods/basehttp.cc 2019-01-18 12:42:07.000000000 +0200 ++++ apt-1.4.9.mod/methods/basehttp.cc 2019-11-12 22:43:18.109996205 +0200 @@ -90,7 +90,12 @@ // Evil servers return no version if (Line[4] == '/') diff --git a/packages/apt/0006-apt-key-nonroot.patch b/packages/apt/0006-apt-key-nonroot.patch new file mode 100644 index 000000000..8a4f781b0 --- /dev/null +++ b/packages/apt/0006-apt-key-nonroot.patch @@ -0,0 +1,15 @@ +diff -uNr apt-1.4.9/cmdline/apt-key.in apt-1.4.9.mod/cmdline/apt-key.in +--- apt-1.4.9/cmdline/apt-key.in 2019-11-12 22:27:00.015963736 +0200 ++++ apt-1.4.9.mod/cmdline/apt-key.in 2019-11-12 22:46:00.284024293 +0200 +@@ -16,10 +16,7 @@ + aptkey_echo() { echo "$@"; } + + requires_root() { +- if [ "$(id -u)" -ne 0 ]; then +- apt_error "This command can only be used by root." +- exit 1 +- fi ++ : + } + + command_available() { diff --git a/packages/apt/vendor.patch b/packages/apt/0007-termux-apt-vendor.patch similarity index 71% rename from packages/apt/vendor.patch rename to packages/apt/0007-termux-apt-vendor.patch index f8463644b..76ee4fcaa 100644 --- a/packages/apt/vendor.patch +++ b/packages/apt/0007-termux-apt-vendor.patch @@ -1,7 +1,7 @@ -diff -u -r ../upstream.git/vendor/ubuntu/apt-vendor.ent ./vendor/ubuntu/apt-vendor.ent ---- ../upstream.git/vendor/ubuntu/apt-vendor.ent 2014-04-25 13:39:00.000000000 +0200 -+++ ./vendor/ubuntu/apt-vendor.ent 2014-06-03 11:53:11.535752314 +0200 -@@ -1,7 +1,7 @@ +diff -uNr apt-1.4.9/vendor/ubuntu/apt-vendor.ent apt-1.4.9.mod/vendor/ubuntu/apt-vendor.ent +--- apt-1.4.9/vendor/ubuntu/apt-vendor.ent 2019-01-18 12:42:07.000000000 +0200 ++++ apt-1.4.9.mod/vendor/ubuntu/apt-vendor.ent 2019-11-12 22:53:10.802486744 +0200 +@@ -1,9 +1,9 @@ - -ubuntu-keyring"> @@ -14,3 +14,5 @@ diff -u -r ../upstream.git/vendor/ubuntu/apt-vendor.ent ./vendor/ubuntu/apt-vend +@TERMUX_PREFIX@/share/keyrings/termux-archive-removed-keys.gpg"> + + + CndSet("Dir::Bin::gzip", "/bin/gzip"); -- _config->CndSet("Dir::Bin::bzip2", "/bin/bzip2"); -- _config->CndSet("Dir::Bin::xz", "/usr/bin/xz"); -- _config->CndSet("Dir::Bin::lz4", "/usr/bin/lz4"); -+ _config->CndSet("Dir::Bin::gzip", "@TERMUX_PREFIX@/bin/gzip"); -+ _config->CndSet("Dir::Bin::bzip2", "@TERMUX_PREFIX@/bin/bzip2"); -+ _config->CndSet("Dir::Bin::xz", "@TERMUX_PREFIX@/bin/xz"); -+ _config->CndSet("Dir::Bin::lz4", "@TERMUX_PREFIX@/bin/lz4"); - if (FileExists(_config->Find("Dir::Bin::xz")) == true) { - _config->Set("Dir::Bin::lzma", _config->Find("Dir::Bin::xz")); - _config->Set("APT::Compressor::lzma::Binary", "xz"); -@@ -51,7 +51,7 @@ - _config->Set("APT::Compressor::lzma::UncompressArg::", "-d"); - } - } else { -- _config->CndSet("Dir::Bin::lzma", "/usr/bin/lzma"); -+ _config->CndSet("Dir::Bin::lzma", "@TERMUX_PREFIX@/bin/lzma"); - if (_config->Exists("APT::Compressor::lzma::CompressArg") == false) { - _config->Set("APT::Compressor::lzma::CompressArg::", "--suffix="); - _config->Set("APT::Compressor::lzma::CompressArg::", "-6"); diff --git a/packages/apt/apt-pkg-contrib-cdromutl.cc.patch b/packages/apt/apt-pkg-contrib-cdromutl.cc.patch deleted file mode 100644 index 47a0e4de1..000000000 --- a/packages/apt/apt-pkg-contrib-cdromutl.cc.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -uNr apt-1.4.8/apt-pkg/contrib/cdromutl.cc apt-1.4.8.mod/apt-pkg/contrib/cdromutl.cc ---- apt-1.4.8/apt-pkg/contrib/cdromutl.cc 2017-09-13 19:47:33.000000000 +0300 -+++ apt-1.4.8.mod/apt-pkg/contrib/cdromutl.cc 2018-06-19 13:55:06.720435620 +0300 -@@ -268,7 +268,7 @@ - string FindMountPointForDevice(const char *devnode) - { - // this is the order that mount uses as well -- std::vector const mounts = _config->FindVector("Dir::state::MountPoints", "/etc/mtab,/proc/mount"); -+ std::vector const mounts = _config->FindVector("Dir::state::MountPoints", "@TERMUX_PREFIX@/etc/mtab,/proc/mount"); - - for (std::vector::const_iterator m = mounts.begin(); m != mounts.end(); ++m) - if (FileExists(*m) == true) diff --git a/packages/apt/apt-pkg-contrib-fileutl.cc.patch b/packages/apt/apt-pkg-contrib-fileutl.cc.patch deleted file mode 100644 index 99925d335..000000000 --- a/packages/apt/apt-pkg-contrib-fileutl.cc.patch +++ /dev/null @@ -1,24 +0,0 @@ -diff -uNr apt-1.4.8/apt-pkg/contrib/fileutl.cc apt-1.4.8.mod/apt-pkg/contrib/fileutl.cc ---- apt-1.4.8/apt-pkg/contrib/fileutl.cc 2018-06-19 13:55:47.313771042 +0300 -+++ apt-1.4.8.mod/apt-pkg/contrib/fileutl.cc 2018-06-19 13:41:41.387060822 +0300 -@@ -3068,7 +3068,7 @@ - setenv("LOGNAME", pw->pw_name, 1); - auto const shell = flNotDir(pw->pw_shell); - if (shell == "false" || shell == "nologin") -- setenv("SHELL", "/bin/sh", 1); -+ setenv("SHELL", "@TERMUX_PREFIX@/bin/sh", 1); - else - setenv("SHELL", pw->pw_shell, 1); - auto const apt_setenv_tmp = [](char const * const env) { -diff -uNr apt-1.4.8/apt-pkg/contrib/fileutl.cc apt-1.4.8.mod/apt-pkg/contrib/fileutl.cc ---- apt-1.4.8/apt-pkg/contrib/fileutl.cc 2018-06-19 16:51:22.570980141 +0300 -+++ apt-1.4.8.mod/apt-pkg/contrib/fileutl.cc 2018-06-19 16:52:20.507649790 +0300 -@@ -108,7 +108,7 @@ - _exit(100); - } - -- if (chdir("/tmp/") != 0) -+ if (chdir("@TERMUX_PREFIX@/tmp/") != 0) - _exit(100); - - unsigned int Count = 1; diff --git a/packages/apt/apt-pkg-contrib-fileutl.patch b/packages/apt/apt-pkg-contrib-fileutl.patch deleted file mode 100644 index 991409fef..000000000 --- a/packages/apt/apt-pkg-contrib-fileutl.patch +++ /dev/null @@ -1,55 +0,0 @@ -diff -u -r ../apt-1.4.7/apt-pkg/contrib/fileutl.cc ./apt-pkg/contrib/fileutl.cc ---- ../apt-1.4.7/apt-pkg/contrib/fileutl.cc 2017-07-13 23:45:39.000000000 +0200 -+++ ./apt-pkg/contrib/fileutl.cc 2017-09-17 20:46:39.567888481 +0200 -@@ -46,7 +46,9 @@ - #include - #include - #include -+#ifndef __ANDROID__ - #include -+#endif - #include - #include - -@@ -2752,6 +2754,7 @@ - } - /*}}}*/ - -+#ifndef __ANDROID__ - // Glob - wrapper around "glob()" /*{{{*/ - std::vector Glob(std::string const &pattern, int flags) - { -@@ -2777,6 +2780,7 @@ - globfree(&globbuf); - return result; - } -+#endif - /*}}}*/ - static std::string APT_NONNULL(1) GetTempDirEnv(char const * const env) /*{{{*/ - { -@@ -2794,10 +2794,10 @@ - struct stat st; - if (!tmpdir || strlen(tmpdir) == 0 || // tmpdir is set - stat(tmpdir, &st) != 0 || (st.st_mode & S_IFDIR) == 0) // exists and is directory -- tmpdir = "/tmp"; -+ tmpdir = "@TERMUX_PREFIX@/tmp"; - else if (geteuid() != 0 && // root can do everything anyway - faccessat(AT_FDCWD, tmpdir, R_OK | W_OK | X_OK, AT_EACCESS) != 0) // current user has rwx access to directory -- tmpdir = "/tmp"; -+ tmpdir = "@TERMUX_PREFIX@/tmp"; - - return string(tmpdir); - } -diff -u -r ../apt-1.4.7/apt-pkg/contrib/fileutl.h ./apt-pkg/contrib/fileutl.h ---- ../apt-1.4.7/apt-pkg/contrib/fileutl.h 2017-07-13 23:45:39.000000000 +0200 -+++ ./apt-pkg/contrib/fileutl.h 2017-08-26 22:05:52.875932441 +0200 -@@ -239,7 +239,9 @@ - APT_HIDDEN std::string flNormalize(std::string file); - - // simple c++ glob -+#ifndef __ANDROID__ - std::vector Glob(std::string const &pattern, int flags=0); -+#endif - - /** \brief Popen() implementation that execv() instead of using a shell - * diff --git a/packages/apt/apt-pkg-contrib-srvrec.cc.patch b/packages/apt/apt-pkg-contrib-srvrec.cc.patch deleted file mode 100644 index d698023f6..000000000 --- a/packages/apt/apt-pkg-contrib-srvrec.cc.patch +++ /dev/null @@ -1,28 +0,0 @@ -diff -u -r ../apt-1.1.3/apt-pkg/contrib/srvrec.cc ./apt-pkg/contrib/srvrec.cc ---- ../apt-1.1.3/apt-pkg/contrib/srvrec.cc 2015-11-30 03:08:24.000000000 -0500 -+++ ./apt-pkg/contrib/srvrec.cc 2015-12-03 16:21:54.397715576 -0500 -@@ -40,14 +40,24 @@ - struct servent *s_ent = nullptr; - std::vector buf(1024); - -+#ifdef __ANDROID__ -+ s_ent = getservbyport(htons(port), "tcp"); -+ if (s_ent == nullptr) return false; -+#else - res = getservbyport_r(htons(port), "tcp", &s_ent_buf, buf.data(), buf.size(), &s_ent); - if (res != 0 || s_ent == nullptr) - return false; -+#endif - - strprintf(target, "_%s._tcp.%s", s_ent->s_name, host.c_str()); - return GetSrvRecords(target, Result); - } - -+#ifdef __ANDROID__ -+extern "C" int __dn_skipname(const unsigned char* comp_dn, const unsigned char* eom); -+static inline int dn_skipname(const unsigned char* a, const unsigned char* b) { return __dn_skipname(a,b); } -+#endif -+ - bool GetSrvRecords(std::string name, std::vector &Result) - { - unsigned char answer[PACKETSZ]; diff --git a/packages/apt/apt-pkg-contrib-strutl.cc.patch b/packages/apt/apt-pkg-contrib-strutl.cc.patch deleted file mode 100644 index fdb5d2422..000000000 --- a/packages/apt/apt-pkg-contrib-strutl.cc.patch +++ /dev/null @@ -1,19 +0,0 @@ -diff -u -r ../apt-1.4.7/apt-pkg/contrib/strutl.cc ./apt-pkg/contrib/strutl.cc ---- ../apt-1.4.7/apt-pkg/contrib/strutl.cc 2017-07-13 23:45:39.000000000 +0200 -+++ ./apt-pkg/contrib/strutl.cc 2017-07-23 22:58:23.103247428 +0200 -@@ -100,6 +100,7 @@ - } - } - /*}}}*/ -+#ifndef __ANDROID__ - // UTF8ToCodeset - Convert some UTF-8 string for some codeset /*{{{*/ - // --------------------------------------------------------------------- - /* This is handy to use before display some information for enduser */ -@@ -169,6 +170,7 @@ - - return true; - } -+#endif - /*}}}*/ - // strstrip - Remove white space from the front and back of a string /*{{{*/ - // --------------------------------------------------------------------- diff --git a/packages/apt/apt-pkg-deb-debrecords.cc.patch b/packages/apt/apt-pkg-deb-debrecords.cc.patch deleted file mode 100644 index 3b512df95..000000000 --- a/packages/apt/apt-pkg-deb-debrecords.cc.patch +++ /dev/null @@ -1,28 +0,0 @@ -diff -u -r ../apt-1.1.3/apt-pkg/deb/debrecords.cc ./apt-pkg/deb/debrecords.cc ---- ../apt-1.1.3/apt-pkg/deb/debrecords.cc 2015-11-30 03:08:24.000000000 -0500 -+++ ./apt-pkg/deb/debrecords.cc 2015-12-03 16:30:51.506746167 -0500 -@@ -25,7 +25,9 @@ - #include - #include - #include -+#ifndef __ANDROID__ - #include -+#endif - - #include - /*}}}*/ -@@ -143,12 +145,14 @@ - orig = Section.FindS("Description"); - } - -+#ifndef __ANDROID__ - char const * const codeset = nl_langinfo(CODESET); - if (strcmp(codeset,"UTF-8") != 0) { - string dest; - UTF8ToCodeset(codeset, orig, &dest); - return dest; - } -+#endif - - return orig; - } diff --git a/packages/apt/apt-pkg-deb-dpkgpm.cc.patch b/packages/apt/apt-pkg-deb-dpkgpm.cc.patch deleted file mode 100644 index 8c9177c86..000000000 --- a/packages/apt/apt-pkg-deb-dpkgpm.cc.patch +++ /dev/null @@ -1,107 +0,0 @@ -diff -u -r ../apt-1.4.8/apt-pkg/deb/dpkgpm.cc ./apt-pkg/deb/dpkgpm.cc ---- ../apt-1.4.8/apt-pkg/deb/dpkgpm.cc 2017-09-13 18:47:33.000000000 +0200 -+++ ./apt-pkg/deb/dpkgpm.cc 2017-12-29 01:29:53.178628587 +0100 -@@ -1281,8 +1281,13 @@ - sigemptyset(&d->sigmask); - sigaddset(&d->sigmask, SIGTTOU); - sigprocmask(SIG_BLOCK,&d->sigmask, &d->original_sigmask); -+#ifndef __ANDROID__ -+ // This fails on Android 8.0 - see -+ // https://github.com/termux/termux-packages/issues/1359 -+ // We silence the warning here to avoid it being shown for every apt operation. - if (tcsetattr(STDIN_FILENO, TCSAFLUSH, &raw_tt) == -1) - _error->Errno("tcsetattr", "Setting in Start via TCSAFLUSH for stdin failed!"); -+#endif - sigprocmask(SIG_SETMASK, &d->original_sigmask, NULL); - - } -@@ -1361,8 +1366,13 @@ - } - if(d->master >= 0) - { -+#ifndef __ANDROID__ -+ // This fails on Android 8.0 - see -+ // https://github.com/termux/termux-packages/issues/1359 -+ // We silence the warning here to avoid it being shown for every apt operation. - if (d->tt_is_valid == true && tcsetattr(STDIN_FILENO, TCSAFLUSH, &d->tt) == -1) - _error->FatalE("tcsetattr", "Setting in Stop via TCSAFLUSH for stdin failed!"); -+#endif - close(d->master); - d->master = -1; - } -diff -uNr apt-1.4.8/apt-pkg/deb/dpkgpm.cc apt-1.4.8.mod/apt-pkg/deb/dpkgpm.cc ---- apt-1.4.8/apt-pkg/deb/dpkgpm.cc 2018-06-19 13:55:47.330437710 +0300 -+++ apt-1.4.8.mod/apt-pkg/deb/dpkgpm.cc 2018-06-19 13:54:21.810433307 +0300 -@@ -179,7 +179,7 @@ - so we use the binary from util-linux */ - static bool ionice(int PID) - { -- if (!FileExists("/usr/bin/ionice")) -+ if (!FileExists("@TERMUX_PREFIX@/bin/ionice")) - return false; - pid_t Process = ExecFork(); - if (Process == 0) -@@ -187,7 +187,7 @@ - char buf[32]; - snprintf(buf, sizeof(buf), "-p%d", PID); - const char *Args[4]; -- Args[0] = "/usr/bin/ionice"; -+ Args[0] = "@TERMUX_PREFIX@/bin/ionice"; - Args[1] = "-c3"; - Args[2] = buf; - Args[3] = 0; -@@ -483,7 +483,7 @@ - - debSystem::DpkgChrootDirectory(); - const char *Args[4]; -- Args[0] = "/bin/sh"; -+ Args[0] = "@TERMUX_PREFIX@/bin/sh"; - Args[1] = "-c"; - Args[2] = Opts->Value.c_str(); - Args[3] = 0; -@@ -2413,11 +2413,14 @@ - fprintf(report, " %s: %s\n", pkgname.c_str(), opstr); - } - -+// In latest versions of Android, we can't use 'dmesg' -+// without root. -+#ifndef __ANDROID__ - // attach dmesg log (to learn about segfaults) -- if (FileExists("/bin/dmesg")) -+ if (FileExists("@TERMUX_PREFIX@/bin/dmesg")) - { - fprintf(report, "Dmesg:\n"); -- FILE *log = popen("/bin/dmesg","r"); -+ FILE *log = popen("@TERMUX_PREFIX@/bin/dmesg","r"); - if(log != NULL) - { - char buf[1024]; -@@ -2426,13 +2429,18 @@ - pclose(log); - } - } -+#endif - -+// Current Termux implementation of 'df' is just a wrapper -+// for /system/bin/df which may don't understand additional -+// parameters such as '-l'. -+#ifndef __ANDROID__ - // attach df -l log (to learn about filesystem status) -- if (FileExists("/bin/df")) -+ if (FileExists("@TERMUX_PREFIX@/bin/df")) - { - - fprintf(report, "Df:\n"); -- FILE *log = popen("/bin/df -l","r"); -+ FILE *log = popen("@TERMUX_PREFIX@/bin/df -l","r"); - if(log != NULL) - { - char buf[1024]; -@@ -2441,6 +2449,7 @@ - pclose(log); - } - } -+#endif - - fclose(report); - diff --git a/packages/apt/build.sh b/packages/apt/build.sh index 89fb66e33..83fff6785 100644 --- a/packages/apt/build.sh +++ b/packages/apt/build.sh @@ -2,15 +2,15 @@ TERMUX_PKG_HOMEPAGE=https://packages.debian.org/apt TERMUX_PKG_DESCRIPTION="Front-end for the dpkg package manager" TERMUX_PKG_LICENSE="GPL-2.0" TERMUX_PKG_VERSION=1.4.9 -TERMUX_PKG_REVISION=19 +TERMUX_PKG_REVISION=20 TERMUX_PKG_SRCURL=http://ftp.debian.org/debian/pool/main/a/apt/apt_${TERMUX_PKG_VERSION}.tar.xz TERMUX_PKG_SHA256=d4d65e7c84da86f3e6dcc933bba46a08db429c9d933b667c864f5c0e880bac0d # apt-key requires utilities from coreutils, findutils, gpgv, grep, sed. TERMUX_PKG_DEPENDS="coreutils, dpkg, findutils, gpgv, grep, libc++, libcurl, liblzma, sed, termux-licenses, zlib" TERMUX_PKG_CONFLICTS="apt-transport-https" TERMUX_PKG_REPLACES="apt-transport-https" -TERMUX_PKG_RECOMMENDS="game-repo, science-repo" -TERMUX_PKG_SUGGESTS="unstable-repo" +TERMUX_PKG_RECOMMENDS="game-repo, gnupg, science-repo" +TERMUX_PKG_SUGGESTS="unstable-repo, x11-repo" TERMUX_PKG_ESSENTIAL=true TERMUX_PKG_CONFFILES=" diff --git a/packages/apt/cmdline-apt-key.in.patch b/packages/apt/cmdline-apt-key.in.patch deleted file mode 100644 index 465695b2a..000000000 --- a/packages/apt/cmdline-apt-key.in.patch +++ /dev/null @@ -1,77 +0,0 @@ -diff -uNr apt-1.4.8/cmdline/apt-key.in apt-1.4.8.mod/cmdline/apt-key.in ---- apt-1.4.8/cmdline/apt-key.in 2017-09-13 19:47:33.000000000 +0300 -+++ apt-1.4.8.mod/cmdline/apt-key.in 2018-06-19 18:18:43.024583291 +0300 -@@ -16,10 +16,7 @@ - aptkey_echo() { echo "$@"; } - - requires_root() { -- if [ "$(id -u)" -ne 0 ]; then -- apt_error "This command can only be used by root." -- exit 1 -- fi -+continue - } - - command_available() { -@@ -260,7 +257,7 @@ - if accessible_file_exists "$TRUSTEDFILE"; then - $ACTION "$TRUSTEDFILE" "$@" - fi -- local TRUSTEDPARTS="/etc/apt/trusted.gpg.d" -+ local TRUSTEDPARTS="@TERMUX_PREFIX@/etc/apt/trusted.gpg.d" - eval "$(apt-config shell TRUSTEDPARTS Dir::Etc::TrustedParts/d)" - if [ -d "$TRUSTEDPARTS" ]; then - TRUSTEDPARTS="$(readlink -f "$TRUSTEDPARTS")" -@@ -439,7 +436,7 @@ - merge_all_trusted_keyrings_into_pubring - FORCED_KEYRING="${GPGHOMEDIR}/forcedkeyid.gpg" - TRUSTEDFILE="${FORCED_KEYRING}" -- echo "#!/bin/sh -+ echo "#!@TERMUX_PREFIX@/bin/sh - exec sh '($(escape_shell "${GPG}")' --keyring '$(escape_shell "${TRUSTEDFILE}")' \"\$@\"" > "${GPGHOMEDIR}/gpg.1.sh" - GPG="${GPGHOMEDIR}/gpg.1.sh" - # ignore error as this "just" means we haven't found the forced keyid and the keyring will be empty -@@ -451,13 +448,13 @@ - else - touch "${GPGHOMEDIR}/pubring.gpg" "${GPGHOMEDIR}/pubring.orig.gpg" - fi -- echo "#!/bin/sh -+ echo "#!@TERMUX_PREFIX@/bin/sh - exec sh '$(escape_shell "${GPG}")' --keyring '$(escape_shell "${GPGHOMEDIR}/pubring.gpg")' \"\$@\"" > "${GPGHOMEDIR}/gpg.1.sh" - GPG="${GPGHOMEDIR}/gpg.1.sh" - else - TRUSTEDFILE="$(dearmor_filename "$FORCED_KEYRING")" - create_new_keyring "$TRUSTEDFILE" -- echo "#!/bin/sh -+ echo "#!@TERMUX_PREFIX@/bin/sh - exec sh '$(escape_shell "${GPG}")' --keyring '$(escape_shell "${TRUSTEDFILE}")' \"\$@\"" > "${GPGHOMEDIR}/gpg.1.sh" - GPG="${GPGHOMEDIR}/gpg.1.sh" - fi -@@ -542,7 +539,7 @@ - done - - if [ -z "$TRUSTEDFILE" ]; then -- TRUSTEDFILE="/etc/apt/trusted.gpg" -+ TRUSTEDFILE="@TERMUX_PREFIX@/etc/apt/trusted.gpg" - eval $(apt-config shell TRUSTEDFILE Apt::GPGV::TrustedKeyring) - eval $(apt-config shell TRUSTEDFILE Dir::Etc::Trusted/f) - fi -@@ -612,7 +609,8 @@ - unset TMPDIR - fi - fi -- GPGHOMEDIR="$(mktemp --directory --tmpdir 'apt-key-gpghome.XXXXXXXXXX')" -+ # Use short options as busybox mktemp does not support long ones: -+ GPGHOMEDIR="$(mktemp -d -t 'apt-key-gpghome.XXXXXXXXXX')" - CURRENTTRAP="${CURRENTTRAP} cleanup_gpg_home;" - trap "${CURRENTTRAP}" 0 HUP INT QUIT ILL ABRT FPE SEGV PIPE TERM - if [ -z "$GPGHOMEDIR" ]; then -@@ -654,7 +652,7 @@ - create_gpg_home - - # now tell gpg that it shouldn't try to maintain this trustdb file -- echo "#!/bin/sh -+ echo "#!@TERMUX_PREFIX@/bin/sh - exec '$(escape_shell "${GPG_EXE}")' --ignore-time-conflict --no-options --no-default-keyring \\ - --homedir '$(escape_shell "${GPGHOMEDIR}")' --no-auto-check-trustdb --trust-model always \"\$@\"" > "${GPGHOMEDIR}/gpg.0.sh" - GPG_SH="${GPGHOMEDIR}/gpg.0.sh" diff --git a/packages/apt/methods-cmakelist.patch b/packages/apt/methods-cmakelist.patch deleted file mode 100644 index 38fd2a32f..000000000 --- a/packages/apt/methods-cmakelist.patch +++ /dev/null @@ -1,26 +0,0 @@ ---- ../cache/apt-1.4.7/methods/CMakeLists.txt 2017-07-14 07:45:39.000000000 +1000 -+++ ./methods/CMakeLists.txt 2017-07-20 09:31:59.432583795 +1000 -@@ -7,7 +7,7 @@ - add_executable(http http.cc http_main.cc rfc2553emu.cc connect.cc basehttp.cc) - add_executable(mirror mirror.cc http.cc rfc2553emu.cc connect.cc basehttp.cc) - add_executable(https https.cc basehttp.cc) --add_executable(ftp ftp.cc rfc2553emu.cc connect.cc) -+# add_executable(ftp ftp.cc rfc2553emu.cc connect.cc) - add_executable(rred rred.cc) - add_executable(rsh rsh.cc) - -@@ -23,12 +23,12 @@ - target_link_libraries(http apt-pkg) - target_link_libraries(mirror apt-pkg ${RESOLV_LIBRARIES}) - target_link_libraries(https apt-pkg ${CURL_LIBRARIES}) --target_link_libraries(ftp apt-pkg) -+#target_link_libraries(ftp apt-pkg) - target_link_libraries(rred apt-pkg) - target_link_libraries(rsh apt-pkg) - - # Install the library --install(TARGETS file copy store gpgv cdrom http https ftp rred rsh mirror -+install(TARGETS file copy store gpgv cdrom http https rred rsh mirror - RUNTIME DESTINATION ${CMAKE_INSTALL_LIBEXECDIR}/apt/methods) - - add_slaves(${CMAKE_INSTALL_LIBEXECDIR}/apt/methods store gzip lzma bzip2 xz) diff --git a/packages/apt/methods-connect.cc.patch b/packages/apt/methods-connect.cc.patch deleted file mode 100644 index 2767a572a..000000000 --- a/packages/apt/methods-connect.cc.patch +++ /dev/null @@ -1,23 +0,0 @@ ---- ../cache/apt-1.4.7/methods/connect.cc 2017-07-14 07:45:39.000000000 +1000 -+++ ./methods/connect.cc 2017-07-23 10:50:27.755510218 +1000 -@@ -129,7 +129,7 @@ - - // Check the socket for an error condition - unsigned int Err; -- unsigned int Len = sizeof(Err); -+ socklen_t Len = sizeof(Err); - if (getsockopt(Fd,SOL_SOCKET,SO_ERROR,&Err,&Len) != 0) - return _error->Errno("getsockopt",_("Failed")); - -@@ -301,7 +301,10 @@ - if(LastHost != Host || LastPort != Port) - { - SrvRecords.clear(); -- if (_config->FindB("Acquire::EnableSrvRecords", true) == true) -+ /* Disable by default in Termux due to it breaking on (some) HTC -+ devices (https://github.com/termux/termux-packages/issues/99). */ -+ -+ if (_config->FindB("Acquire::EnableSrvRecords", false) == true) - { - GetSrvRecords(Host, DefPort, SrvRecords); - // RFC2782 defines that a lonely '.' target is an abort reason diff --git a/packages/apt/private-output-no-langinfo.patch b/packages/apt/private-output-no-langinfo.patch deleted file mode 100644 index 6bf021081..000000000 --- a/packages/apt/private-output-no-langinfo.patch +++ /dev/null @@ -1,25 +0,0 @@ -diff -u -r ../upstream.git/apt-private/private-output.cc ./apt-private/private-output.cc ---- ../upstream.git/apt-private/private-output.cc 2014-06-10 15:24:50.000000000 +0200 -+++ ./apt-private/private-output.cc 2014-06-15 02:40:10.539223656 +0200 -@@ -20,7 +20,11 @@ - #include - #include - #include --#include -+#ifdef __ANDROID__ -+# include -+# else -+# include -+#endif - #include - #include - #include -@@ -764,7 +768,7 @@ - regex_t Pattern; - int Res; - -- Res = regcomp(&Pattern, nl_langinfo(YESEXPR), -+ Res = regcomp(&Pattern, "^[yY]", - REG_EXTENDED|REG_ICASE|REG_NOSUB); - - if (Res != 0) {