apt: update to 2.1.11

This commit is contained in:
Leonid Pliushch 2020-11-05 17:05:50 +02:00
parent 311978836f
commit 06fbff4755
37 changed files with 490 additions and 944 deletions

View File

@ -1,86 +0,0 @@
diff -u -r ../apt-1.6~alpha3/CMakeLists.txt ./CMakeLists.txt
--- ../apt-1.6~alpha3/CMakeLists.txt 2017-10-28 17:57:05.000000000 +0200
+++ ./CMakeLists.txt 2017-11-02 17:42:28.162838378 +0100
@@ -33,7 +33,6 @@
include(GNUInstallDirs)
include(TestBigEndian)
find_package(Threads REQUIRED)
-find_package(LFS REQUIRED)
find_package(Iconv REQUIRED)
find_package(Perl REQUIRED)
@@ -44,11 +43,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,12 +63,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()
-
find_package(GnuTLS REQUIRED)
if (GNUTLS_FOUND)
set(HAVE_GNUTLS 1)
@@ -87,22 +75,12 @@
endif()
-find_package(BZip2 REQUIRED)
-if (BZIP2_FOUND)
- set(HAVE_BZ2 1)
-endif()
-
find_package(LZMA REQUIRED)
if (LZMA_FOUND)
set(HAVE_LZMA 1)
endif()
-find_package(LZ4 REQUIRED)
-if (LZ4_FOUND)
- set(HAVE_LZ4 1)
-endif()
-
find_package(Udev)
if (UDEV_FOUND)
set(HAVE_UDEV 1)
@@ -184,10 +162,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)
@@ -215,11 +193,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)

View File

@ -1,42 +0,0 @@
diff -u -r ../apt-1.6~alpha3/apt-pkg/contrib/fileutl.cc ./apt-pkg/contrib/fileutl.cc
--- ../apt-1.6~alpha3/apt-pkg/contrib/fileutl.cc 2017-10-28 17:57:05.000000000 +0200
+++ ./apt-pkg/contrib/fileutl.cc 2017-11-02 17:38:43.633482989 +0100
@@ -37,7 +37,9 @@
#include <dirent.h>
#include <errno.h>
#include <fcntl.h>
+#ifndef __ANDROID__
#include <glob.h>
+#endif
#include <grp.h>
#include <pwd.h>
#include <signal.h>
@@ -2790,6 +2792,7 @@
}
/*}}}*/
+#ifndef __ANDROID__
// Glob - wrapper around "glob()" /*{{{*/
std::vector<std::string> Glob(std::string const &pattern, int flags)
{
@@ -2815,6 +2818,7 @@
globfree(&globbuf);
return result;
}
+#endif
/*}}}*/
static std::string APT_NONNULL(1) GetTempDirEnv(char const * const env) /*{{{*/
{
diff -u -r ../apt-1.6~alpha3/apt-pkg/contrib/fileutl.h ./apt-pkg/contrib/fileutl.h
--- ../apt-1.6~alpha3/apt-pkg/contrib/fileutl.h 2017-10-28 17:57:05.000000000 +0200
+++ ./apt-pkg/contrib/fileutl.h 2017-11-02 17:37:38.518249720 +0100
@@ -262,7 +262,9 @@
APT_HIDDEN std::string flNormalize(std::string file);
// simple c++ glob
+#ifndef __ANDROID__
std::vector<std::string> Glob(std::string const &pattern, int flags=0);
+#endif
/** \brief Popen() implementation that execv() instead of using a shell
*

View File

@ -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<char> 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<SrvRec> &Result)
{
unsigned char answer[PACKETSZ];

View File

@ -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 /*{{{*/
// ---------------------------------------------------------------------

View File

@ -1,28 +0,0 @@
diff -u -r ../apt-1.6~alpha3/apt-pkg/deb/debrecords.cc ./apt-pkg/deb/debrecords.cc
--- ../apt-1.6~alpha3/apt-pkg/deb/debrecords.cc 2017-10-28 17:57:05.000000000 +0200
+++ ./apt-pkg/deb/debrecords.cc 2017-11-02 17:40:35.816161798 +0100
@@ -23,7 +23,9 @@
#include <sstream>
#include <string>
#include <vector>
+#ifndef __ANDROID__
#include <langinfo.h>
+#endif
#include <string.h>
#include <apti18n.h>
@@ -151,12 +153,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;
}

View File

@ -1,50 +0,0 @@
--- ../cache/apt-1.4.7/apt-pkg/init.cc 2017-07-14 07:45:39.000000000 +1000
+++ ./apt-pkg/init.cc 2017-07-19 17:03:07.949752843 +1000
@@ -51,7 +51,7 @@
return vec;
}
-
+#ifndef __ANDROID__
// pkgInitArchTupleMap - Initialize the architecture tuple map /*{{{*/
// ---------------------------------------------------------------------
/* This initializes */
@@ -116,7 +116,7 @@
return true;
}
- /*}}}*/
+#endif /*}}}*/
// pkgInitConfig - Initialize the configuration class /*{{{*/
@@ -133,6 +133,7 @@
Cnf.CndSet("APT::Install-Recommends", true);
Cnf.CndSet("APT::Install-Suggests", false);
Cnf.CndSet("Dir","/");
+ Cnf.CndSet("Acquire::Languages", "none");
// State
Cnf.CndSet("Dir::State", STATE_DIR + 1);
@@ -158,9 +159,9 @@
Cnf.CndSet("Dir::Etc::trusted", "trusted.gpg");
Cnf.CndSet("Dir::Etc::trustedparts","trusted.gpg.d");
Cnf.CndSet("Dir::Bin::methods", LIBEXEC_DIR "/methods");
- Cnf.CndSet("Dir::Bin::solvers::",LIBEXEC_DIR "/solvers");
- Cnf.CndSet("Dir::Bin::planners::",LIBEXEC_DIR "/planners");
- Cnf.CndSet("Dir::Media::MountPath","/media/apt");
+ Cnf.CndSet("Dir::Bin::solvers::",LIBEXEC_DIR "/solvers");
+ Cnf.CndSet("Dir::Bin::planners::", LIBEXEC_DIR "/planners");
+ Cnf.CndSet("Dir::Media::MountPath","media/apt");
// State
Cnf.CndSet("Dir::Log", LOG_DIR + 1);
@@ -283,8 +284,6 @@
return _error->Error(_("Unable to determine a suitable packaging system type"));
}
- if (pkgInitArchTupleMap() == false)
- return false;
return Sys->Initialize(Cnf);
}

View File

@ -1,39 +0,0 @@
TERMUX_PKG_HOMEPAGE=https://packages.debian.org/apt
TERMUX_PKG_DESCRIPTION="Front-end for the dpkg package manager"
TERMUX_PKG_DEPENDS="libutil, libcurl, liblzma, dpkg, gpgv, libc++"
TERMUX_PKG_VERSION=1.6~alpha3
TERMUX_PKG_SHA256=2acd561ff04fc3efa4c590139ca60cfdbc93787ea80334f7448ecf466faab119
TERMUX_PKG_SRCURL=http://ftp.debian.org/debian/pool/main/a/apt/apt_${TERMUX_PKG_VERSION}.tar.xz
TERMUX_PKG_EXTRA_CONFIGURE_ARGS="
-DPERL_EXECUTABLE=$(which perl)
-DCMAKE_INSTALL_FULL_LOCALSTATEDIR=$TERMUX_PREFIX
-DCOMMON_ARCH=$TERMUX_ARCH
-DDPKG_DATADIR=$TERMUX_PREFIX/share/dpkg
-DUSE_NLS=OFF
-DWITH_DOC=OFF
"
TERMUX_PKG_ESSENTIAL=true
TERMUX_PKG_CONFFILES="etc/apt/sources.list"
TERMUX_PKG_CONFLICTS=apt-transport-https
TERMUX_PKG_REPLACES=apt-transport-https
TERMUX_PKG_RM_AFTER_INSTALL="
bin/apt-cdrom
bin/apt-extracttemplates
bin/apt-sortpkgs
etc/apt/apt.conf.d
lib/apt/apt-helper
lib/apt/methods/bzip2
lib/apt/methods/cdrom
lib/apt/methods/mirror
lib/apt/methods/rred
lib/apt/planners/
lib/apt/solvers/
lib/dpkg/
lib/libapt-inst.so
"
termux_step_post_make_install() {
printf "# The main termux repository:\ndeb [arch=all,${TERMUX_ARCH}] https://termux.net stable main\n" > $TERMUX_PREFIX/etc/apt/sources.list
cp $TERMUX_PKG_BUILDER_DIR/trusted.gpg $TERMUX_PREFIX/etc/apt/
rm $TERMUX_PREFIX/include/apt-pkg -r
}

View File

@ -1,43 +0,0 @@
diff -u -r ../apt-1.4.7/cmdline/apt-key.in ./cmdline/apt-key.in
--- ../apt-1.4.7/cmdline/apt-key.in 2017-07-13 23:45:39.000000000 +0200
+++ ./cmdline/apt-key.in 2017-07-26 12:18:17.424086422 +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
+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")"
@@ -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

View File

@ -1,18 +0,0 @@
diff -u -r ../apt-0.9.16.1/apt-pkg/contrib/cmndline.cc ./apt-pkg/contrib/cmndline.cc
--- ../apt-0.9.16.1/apt-pkg/contrib/cmndline.cc 2014-03-15 17:23:45.000000000 +0100
+++ ./apt-pkg/contrib/cmndline.cc 2014-03-25 01:10:30.764711007 +0100
@@ -27,6 +27,14 @@
/*}}}*/
using namespace std;
+#if defined(__ANDROID__)
+static char* strchrnul(char const* s, int c)
+{
+ char const* result = strchr(s, c);
+ return const_cast<char*>((result == NULL) ? (s + strlen(s)) : result);
+}
+#endif
+
// CommandLine::CommandLine - Constructor /*{{{*/
// ---------------------------------------------------------------------
/* */

View File

@ -1,18 +0,0 @@
diff -u -r ../apt-0.9.16.1/apt-pkg/deb/debsrcrecords.cc ./apt-pkg/deb/debsrcrecords.cc
--- ../apt-0.9.16.1/apt-pkg/deb/debsrcrecords.cc 2014-03-15 17:23:45.000000000 +0100
+++ ./apt-pkg/deb/debsrcrecords.cc 2014-03-25 01:23:30.652689687 +0100
@@ -26,6 +26,14 @@
#include <string>
#include <vector>
/*}}}*/
+#if defined(__ANDROID__)
+static char* strchrnul(char const* s, int c)
+{
+ char const* result = strchr(s, c);
+ return const_cast<char*>((result == NULL) ? (s + strlen(s)) : result);
+}
+#endif
+
using std::max;
using std::string;

View File

@ -1,27 +0,0 @@
diff -u -r ../apt-1.6~alpha3/methods/CMakeLists.txt ./methods/CMakeLists.txt
--- ../apt-1.6~alpha3/methods/CMakeLists.txt 2017-10-28 17:57:05.000000000 +0200
+++ ./methods/CMakeLists.txt 2017-11-02 17:45:55.436395981 +0100
@@ -9,11 +9,8 @@
add_executable(copy copy.cc)
add_executable(store store.cc)
add_executable(gpgv gpgv.cc)
-add_executable(cdrom cdrom.cc)
add_executable(http http_main.cc $<TARGET_OBJECTS:httplib> $<TARGET_OBJECTS:connectlib>)
add_executable(mirror mirror.cc $<TARGET_OBJECTS:httplib> $<TARGET_OBJECTS:connectlib>)
-add_executable(ftp ftp.cc $<TARGET_OBJECTS:connectlib>)
-add_executable(rred rred.cc)
add_executable(rsh rsh.cc)
target_compile_definitions(connectlib PRIVATE ${GNUTLS_DEFINITIONS})
@@ -22,10 +19,9 @@
# Additional libraries to link against for networked stuff
target_link_libraries(http ${GNUTLS_LIBRARIES})
target_link_libraries(mirror ${RESOLV_LIBRARIES} ${GNUTLS_LIBRARIES})
-target_link_libraries(ftp ${GNUTLS_LIBRARIES})
# Install the library
-install(TARGETS file copy store gpgv cdrom http ftp rred rsh mirror
+install(TARGETS file copy store gpgv http rsh mirror
RUNTIME DESTINATION ${CMAKE_INSTALL_LIBEXECDIR}/apt/methods)
add_slaves(${CMAKE_INSTALL_LIBEXECDIR}/apt/methods store)

View File

@ -1,24 +0,0 @@
diff -u -r ../apt-1.6~alpha3/methods/connect.cc ./methods/connect.cc
--- ../apt-1.6~alpha3/methods/connect.cc 2017-10-28 17:57:05.000000000 +0200
+++ ./methods/connect.cc 2017-11-02 17:47:18.803413361 +0100
@@ -164,7 +164,7 @@
// Check the socket for an error condition
unsigned int Err;
- unsigned int Len = sizeof(Err);
+ socklen_t Len = sizeof(Err);
if (getsockopt(Fd->Fd(), SOL_SOCKET, SO_ERROR, &Err, &Len) != 0)
return _error->Errno("getsockopt",_("Failed"));
@@ -335,7 +335,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

View File

@ -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 <string.h>
#include <iomanip>
#include <iostream>
-#include <langinfo.h>
+#ifdef __ANDROID__
+# include <termios.h>
+# else
+# include <langinfo.h>
+#endif
#include <unistd.h>
#include <signal.h>
#include <sys/ioctl.h>
@@ -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) {

View File

@ -1,16 +0,0 @@
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 @@
<!-- details about the keys used by the distribution -->
-<!ENTITY keyring-distro "Ubuntu">
-<!ENTITY keyring-package "<package>ubuntu-keyring</package>">
-<!ENTITY keyring-filename "<filename>/usr/share/keyrings/ubuntu-archive-keyring.gpg</filename>">
-<!ENTITY keyring-removed-filename "<filename>/usr/share/keyrings/ubuntu-archive-removed-keys.gpg</filename>">
-<!ENTITY keyring-master-filename "/usr/share/keyrings/ubuntu-master-keyring.gpg">
+<!ENTITY keyring-distro "Termux">
+<!ENTITY keyring-package "<package>termux-keyring</package>">
+<!ENTITY keyring-filename "<filename>@TERMUX_PREFIX@/share/keyrings/termux-archive-keyring.gpg</filename>">
+<!ENTITY keyring-removed-filename "<filename>@TERMUX_PREFIX@/share/keyrings/termux-archive-removed-keys.gpg</filename>">
+<!ENTITY keyring-master-filename "@TERMUX_PREFIX@/share/keyrings/termux-master-keyring.gpg">
<!ENTITY keyring-uri "http://archive.ubuntu.com/ubuntu/project/ubuntu-archive-keyring.gpg">

View File

@ -1,7 +1,7 @@
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 @@
diff -uNr apt-2.1.11/apt-pkg/CMakeLists.txt apt-2.1.11.mod/apt-pkg/CMakeLists.txt
--- apt-2.1.11/apt-pkg/CMakeLists.txt 2020-10-21 12:53:18.000000000 +0300
+++ apt-2.1.11.mod/apt-pkg/CMakeLists.txt 2020-11-05 13:54:37.761890653 +0200
@@ -52,7 +52,7 @@
)
target_link_libraries(apt-pkg
@ -10,55 +10,25 @@ diff -uNr apt-1.4.9/apt-pkg/CMakeLists.txt apt-1.4.9.mod/apt-pkg/CMakeLists.txt
${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.10/CMakeLists.txt apt-1.4.10.mod/CMakeLists.txt
--- apt-1.4.10/CMakeLists.txt 2020-05-12 20:46:37.000000000 +0100
+++ apt-1.4.10.mod/CMakeLists.txt 2020-08-01 05:17:56.965327833 +0100
@@ -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})
diff -uNr apt-2.1.11/CMakeLists.txt apt-2.1.11.mod/CMakeLists.txt
--- apt-2.1.11/CMakeLists.txt 2020-10-21 12:53:18.000000000 +0300
+++ apt-2.1.11.mod/CMakeLists.txt 2020-11-05 14:12:13.701910799 +0200
@@ -188,14 +188,6 @@
endif()
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)
@@ -100,10 +95,6 @@
endif()
-find_package(LZ4)
-if (LZ4_FOUND)
- set(HAVE_LZ4 1)
-# Handle resolving
-check_function_exists(res_ninit HAVE_LIBC_RESOLV)
-if(HAVE_LIBC_RESOLV)
- set(RESOLV_LIBRARIES)
-else()
- set(RESOLV_LIBRARIES -lresolv)
-endif()
# Mount()ing and stat()ing and friends
check_symbol_exists(statfs sys/vfs.h HAVE_VFS_H)
@@ -181,10 +172,10 @@
-
# Check multiversioning
include(CheckCxxTarget)
check_cxx_target(HAVE_FMV_SSE42_AND_CRC32 "sse4.2" "__builtin_ia32_crc32si(0,i)|__builtin_ia32_crc32hi(0,i)|__builtin_ia32_crc32qi(0,i)")
@@ -213,10 +205,6 @@
message(STATUS "Found dpkg data dir: ${DPKG_DATADIR_CMD}")
set(DPKG_DATADIR "${DPKG_DATADIR_CMD}" CACHE PATH "dpkg data directory")
endif()
@ -66,15 +36,11 @@ diff -uNr apt-1.4.10/CMakeLists.txt apt-1.4.10.mod/CMakeLists.txt
- 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)
@@ -212,11 +203,9 @@
add_subdirectory(apt-inst)
@@ -243,11 +231,9 @@
add_subdirectory(apt-private)
add_subdirectory(cmdline)
add_subdirectory(completions)
-add_subdirectory(doc)
@ -85,30 +51,26 @@ diff -uNr apt-1.4.10/CMakeLists.txt apt-1.4.10.mod/CMakeLists.txt
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)
diff -uNr apt-2.1.11/methods/CMakeLists.txt apt-2.1.11.mod/methods/CMakeLists.txt
--- apt-2.1.11/methods/CMakeLists.txt 2020-10-21 12:53:18.000000000 +0300
+++ apt-2.1.11.mod/methods/CMakeLists.txt 2020-11-05 13:56:28.194289638 +0200
@@ -11,7 +11,6 @@
add_executable(cdrom cdrom.cc)
add_executable(http http.cc basehttp.cc $<TARGET_OBJECTS:connectlib>)
add_executable(mirror mirror.cc)
-add_executable(ftp ftp.cc $<TARGET_OBJECTS:connectlib>)
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)
@@ -21,10 +20,9 @@
# Additional libraries to link against for networked stuff
target_link_libraries(http ${GNUTLS_LIBRARIES} $<$<BOOL:${SYSTEMD_FOUND}>:${SYSTEMD_LIBRARIES}>)
-target_link_libraries(ftp ${GNUTLS_LIBRARIES})
# 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
-install(TARGETS file copy store gpgv cdrom http ftp rred rsh mirror
+install(TARGETS file copy store gpgv cdrom http rred rsh mirror
RUNTIME DESTINATION ${CMAKE_INSTALL_LIBEXECDIR}/apt/methods)
add_slaves(${CMAKE_INSTALL_LIBEXECDIR}/apt/methods store gzip lzma bzip2 xz)
add_links(${CMAKE_INSTALL_LIBEXECDIR}/apt/methods mirror mirror+ftp mirror+http mirror+https mirror+file mirror+copy)

View File

@ -1,7 +1,7 @@
diff -u -r ../apt-1.2.12/apt-private/private-download.cc ./apt-private/private-download.cc
--- ../apt-1.2.12/apt-private/private-download.cc 2016-05-11 10:57:51.000000000 +0200
+++ ./apt-private/private-download.cc 2017-07-01 00:31:32.131776100 +0200
@@ -121,7 +121,6 @@
diff -uNr apt-2.1.11/apt-private/private-download.cc apt-2.1.11.mod/apt-private/private-download.cc
--- apt-2.1.11/apt-private/private-download.cc 2020-10-21 12:53:18.000000000 +0300
+++ apt-2.1.11.mod/apt-private/private-download.cc 2020-11-05 14:22:21.865355149 +0200
@@ -126,7 +126,6 @@
/*}}}*/
bool CheckFreeSpaceBeforeDownload(std::string const &Dir, unsigned long long FetchBytes)/*{{{*/
{

View File

@ -1,42 +0,0 @@
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 <dirent.h>
#include <signal.h>
#include <errno.h>
+#ifndef __ANDROID__
#include <glob.h>
+#endif
#include <pwd.h>
#include <grp.h>
@@ -2752,6 +2754,7 @@
}
/*}}}*/
+#ifndef __ANDROID__
// Glob - wrapper around "glob()" /*{{{*/
std::vector<std::string> 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<std::string> Glob(std::string const &pattern, int flags=0);
+#endif
/** \brief Popen() implementation that execv() instead of using a shell
*

View File

@ -0,0 +1,136 @@
diff -uNr apt-2.1.11/apt-pkg/contrib/strutl.cc apt-2.1.11.mod/apt-pkg/contrib/strutl.cc
--- apt-2.1.11/apt-pkg/contrib/strutl.cc 2020-10-21 12:53:18.000000000 +0300
+++ apt-2.1.11.mod/apt-pkg/contrib/strutl.cc 2020-11-05 15:55:19.852056516 +0200
@@ -146,6 +146,7 @@
}
}
+#ifndef __ANDROID__
/*}}}*/
// UTF8ToCodeset - Convert some UTF-8 string for some codeset /*{{{*/
// ---------------------------------------------------------------------
@@ -216,6 +217,7 @@
return true;
}
+#endif
/*}}}*/
// strstrip - Remove white space from the front and back of a string /*{{{*/
// ---------------------------------------------------------------------
diff -uNr apt-2.1.11/apt-pkg/deb/debrecords.cc apt-2.1.11.mod/apt-pkg/deb/debrecords.cc
--- apt-2.1.11/apt-pkg/deb/debrecords.cc 2020-10-21 12:53:18.000000000 +0300
+++ apt-2.1.11.mod/apt-pkg/deb/debrecords.cc 2020-11-05 15:54:06.103564689 +0200
@@ -22,7 +22,9 @@
#include <sstream>
#include <string>
#include <vector>
+#ifndef __ANDROID__
#include <langinfo.h>
+#endif
#include <string.h>
#include <apti18n.h>
@@ -150,12 +152,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-2.1.11/apt-private/private-main.cc apt-2.1.11.mod/apt-private/private-main.cc
--- apt-2.1.11/apt-private/private-main.cc 2020-10-21 12:53:18.000000000 +0300
+++ apt-2.1.11.mod/apt-private/private-main.cc 2020-11-05 15:52:47.895043715 +0200
@@ -18,11 +18,13 @@
void InitLocale(APT_CMD const binary) /*{{{*/
{
+#ifndef __ANDROID__
try {
std::locale::global(std::locale(""));
} catch (...) {
setlocale(LC_ALL, "");
}
+#endif
switch(binary)
{
case APT_CMD::APT:
diff -uNr apt-2.1.11/apt-private/private-output.cc apt-2.1.11.mod/apt-private/private-output.cc
--- apt-2.1.11/apt-private/private-output.cc 2020-10-21 12:53:18.000000000 +0300
+++ apt-2.1.11.mod/apt-private/private-output.cc 2020-11-05 15:56:57.320707244 +0200
@@ -680,6 +680,7 @@
c2o << Question << std::flush;
+#ifndef __ANDROID__
/* nl_langinfo does not support LANGUAGE setting, so we unset it here
to have the help-message (hopefully) match the expected characters */
char * language = getenv("LANGUAGE");
@@ -687,6 +688,7 @@
language = strdup(language);
if (language != NULL)
unsetenv("LANGUAGE");
+#endif
if (Default == true)
// TRANSLATOR: Yes/No question help-text: defaulting to Y[es]
@@ -701,11 +703,13 @@
// YESEXPR/NOEXPR defined in your l10n.
c2o << " " << _("[y/N]") << " " << std::flush;
+#ifndef __ANDROID__
if (language != NULL)
{
setenv("LANGUAGE", language, 0);
free(language);
}
+#endif
if (AssumeYes)
{
@@ -732,7 +736,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 -uNr apt-2.1.11/CMake/apti18n.h.in apt-2.1.11.mod/CMake/apti18n.h.in
--- apt-2.1.11/CMake/apti18n.h.in 2020-10-21 12:53:18.000000000 +0300
+++ apt-2.1.11.mod/CMake/apti18n.h.in 2020-11-05 15:52:47.899043742 +0200
@@ -22,7 +22,9 @@
# define N_(x) x
#else
// apt will not use any gettext
+#ifndef __ANDROID__
extern "C" inline char* setlocale(int, const char*) throw() { return nullptr; }
+#endif
extern "C" inline char* textdomain(const char*) throw() { return nullptr; }
extern "C" inline char* bindtextdomain(const char*, const char*) throw() { return nullptr; }
extern "C" inline char* dgettext(const char*, const char* msg) throw() { return const_cast<char*>(msg); }
diff -uNr apt-2.1.11/methods/aptmethod.h apt-2.1.11.mod/methods/aptmethod.h
--- apt-2.1.11/methods/aptmethod.h 2020-10-21 12:53:18.000000000 +0300
+++ apt-2.1.11.mod/methods/aptmethod.h 2020-11-05 15:52:47.899043742 +0200
@@ -479,11 +479,13 @@
aptMethod(std::string &&Binary, char const *const Ver, unsigned long const Flags) APT_NONNULL(3)
: pkgAcqMethod(Ver, Flags), Binary(Binary), SeccompFlags(0), methodNames({Binary})
{
+#ifndef __ANDROID__
try {
std::locale::global(std::locale(""));
} catch (...) {
setlocale(LC_ALL, "");
}
+#endif
}
};
class aptAuthConfMethod : public aptMethod

View File

@ -1,72 +0,0 @@
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 <sstream>
#include <string>
#include <vector>
+#ifndef __ANDROID__
#include <langinfo.h>
+#endif
#include <apti18n.h>
/*}}}*/
@@ -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 <string.h>
#include <iomanip>
#include <iostream>
-#include <langinfo.h>
+#ifdef __ANDROID__
+# include <termios.h>
+# else
+# include <langinfo.h>
+#endif
#include <unistd.h>
#include <signal.h>
#include <sys/ioctl.h>
@@ -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) {

View File

@ -0,0 +1,100 @@
diff -uNr apt-2.1.11/apt-pkg/contrib/srvrec.cc apt-2.1.11.mod/apt-pkg/contrib/srvrec.cc
--- apt-2.1.11/apt-pkg/contrib/srvrec.cc 2020-10-21 12:53:18.000000000 +0300
+++ apt-2.1.11.mod/apt-pkg/contrib/srvrec.cc 2020-11-05 16:37:46.301044740 +0200
@@ -6,6 +6,7 @@
##################################################################### */
/*}}}*/
+#ifndef __ANDROID__
#include <config.h>
#include <netdb.h>
@@ -202,3 +203,4 @@
return selected;
}
+#endif
diff -uNr apt-2.1.11/apt-pkg/contrib/srvrec.h apt-2.1.11.mod/apt-pkg/contrib/srvrec.h
--- apt-2.1.11/apt-pkg/contrib/srvrec.h 2020-10-21 12:53:18.000000000 +0300
+++ apt-2.1.11.mod/apt-pkg/contrib/srvrec.h 2020-11-05 16:37:46.301044740 +0200
@@ -8,6 +8,7 @@
/*}}}*/
#ifndef SRVREC_H
#define SRVREC_H
+#ifndef __ANDROID__
#include <string>
#include <vector>
@@ -54,3 +55,4 @@
APT_PUBLIC SrvRec PopFromSrvRecs(std::vector<SrvRec> &Recs);
#endif
+#endif
diff -uNr apt-2.1.11/cmdline/apt-helper.cc apt-2.1.11.mod/cmdline/apt-helper.cc
--- apt-2.1.11/cmdline/apt-helper.cc 2020-10-21 12:53:18.000000000 +0300
+++ apt-2.1.11.mod/cmdline/apt-helper.cc 2020-11-05 16:37:46.301044740 +0200
@@ -106,6 +106,7 @@
return true;
}
+#ifndef __ANDROID__
/*}}}*/
static bool DoSrvLookup(CommandLine &CmdL) /*{{{*/
{
@@ -134,6 +135,7 @@
return true;
}
/*}}}*/
+#endif
static const APT::Configuration::Compressor *FindCompressor(std::vector<APT::Configuration::Compressor> const &compressors, std::string const &name) /*{{{*/
{
APT::Configuration::Compressor const * compressor = NULL;
@@ -303,7 +305,9 @@
{
return {
{"download-file", &DoDownloadFile, _("download the given uri to the target-path")},
+#ifndef __ANDROID__
{"srv-lookup", &DoSrvLookup, _("lookup a SRV record (e.g. _http._tcp.ftp.debian.org)")},
+#endif
{"cat-file", &DoCatFile, _("concatenate files, with automatic decompression")},
{"auto-detect-proxy", &DoAutoDetectProxy, _("detect proxy using apt.conf")},
{"wait-online", &DoWaitOnline, _("wait for system to be online")},
diff -uNr apt-2.1.11/methods/connect.cc apt-2.1.11.mod/methods/connect.cc
--- apt-2.1.11/methods/connect.cc 2020-10-21 12:53:18.000000000 +0300
+++ apt-2.1.11.mod/methods/connect.cc 2020-11-05 16:42:47.459060807 +0200
@@ -49,7 +49,9 @@
static struct addrinfo *LastHostAddr = 0;
static struct addrinfo *LastUsed = 0;
+#ifndef __ANDROID__
static std::vector<SrvRec> SrvRecords;
+#endif
// Set of IP/hostnames that we timed out before or couldn't resolve
static std::set<std::string> bad_addr;
@@ -486,6 +488,9 @@
if (ConnectionAllowed(Service, Host) == false)
return ResultState::FATAL_ERROR;
+size_t stackSize = 0;
+
+#ifndef __ANDROID__
if(LastHost != Host || LastPort != Port)
{
SrvRecords.clear();
@@ -503,7 +508,6 @@
}
}
- size_t stackSize = 0;
// try to connect in the priority order of the srv records
std::string initialHost{std::move(Host)};
auto const initialPort = Port;
@@ -525,6 +529,7 @@
}
Host = std::move(initialHost);
Port = initialPort;
+#endif
// we have no (good) SrvRecords for this host, connect right away
_error->PushToStack();

View File

@ -1,7 +1,7 @@
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 @@
diff -uNr apt-2.1.11/apt-pkg/aptconfiguration.cc apt-2.1.11.mod/apt-pkg/aptconfiguration.cc
--- apt-2.1.11/apt-pkg/aptconfiguration.cc 2020-10-21 12:53:18.000000000 +0300
+++ apt-2.1.11.mod/apt-pkg/aptconfiguration.cc 2020-11-05 15:33:57.243575020 +0200
@@ -35,11 +35,11 @@
// setDefaultConfigurationForCompressors /*{{{*/
static void setDefaultConfigurationForCompressors() {
// Set default application paths to check for optional compression types
@ -9,14 +9,16 @@ diff -uNr apt-1.4.9/apt-pkg/aptconfiguration.cc apt-1.4.9.mod/apt-pkg/aptconfigu
- _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::zstd", "/usr/bin/zstd");
+ _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");
+ _config->CndSet("Dir::Bin::zstd", "@TERMUX_PREFIX@/bin/zstd");
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 @@
@@ -52,7 +52,7 @@
_config->Set("APT::Compressor::lzma::UncompressArg::", "-d");
}
} else {
@ -25,22 +27,22 @@ diff -uNr apt-1.4.9/apt-pkg/aptconfiguration.cc apt-1.4.9.mod/apt-pkg/aptconfigu
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 @@
diff -uNr apt-2.1.11/apt-pkg/contrib/cdromutl.cc apt-2.1.11.mod/apt-pkg/contrib/cdromutl.cc
--- apt-2.1.11/apt-pkg/contrib/cdromutl.cc 2020-10-21 12:53:18.000000000 +0300
+++ apt-2.1.11.mod/apt-pkg/contrib/cdromutl.cc 2020-11-05 15:39:34.309826732 +0200
@@ -262,7 +262,7 @@
string FindMountPointForDevice(const char *devnode)
{
// this is the order that mount uses as well
- std::vector<std::string> const mounts = _config->FindVector("Dir::state::MountPoints", "/etc/mtab,/proc/mount");
+ std::vector<std::string> const mounts = _config->FindVector("Dir::state::MountPoints", "@TERMUX_PREFIX@/etc/mtab,/proc/mount");
+ std::vector<std::string> const mounts = _config->FindVector("Dir::state::MountPoints", "/proc/mount");
for (std::vector<std::string>::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 @@
diff -uNr apt-2.1.11/apt-pkg/contrib/fileutl.cc apt-2.1.11.mod/apt-pkg/contrib/fileutl.cc
--- apt-2.1.11/apt-pkg/contrib/fileutl.cc 2020-10-21 12:53:18.000000000 +0300
+++ apt-2.1.11.mod/apt-pkg/contrib/fileutl.cc 2020-11-05 15:40:49.418311615 +0200
@@ -112,7 +112,7 @@
_exit(100);
}
@ -49,7 +51,7 @@ diff -uNr apt-1.4.9/apt-pkg/contrib/fileutl.cc apt-1.4.9.mod/apt-pkg/contrib/fil
_exit(100);
unsigned int Count = 1;
@@ -2790,10 +2790,10 @@
@@ -3105,10 +3105,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
@ -62,7 +64,7 @@ diff -uNr apt-1.4.9/apt-pkg/contrib/fileutl.cc apt-1.4.9.mod/apt-pkg/contrib/fil
return string(tmpdir);
}
@@ -3064,7 +3064,7 @@
@@ -3408,7 +3408,7 @@
setenv("LOGNAME", pw->pw_name, 1);
auto const shell = flNotDir(pw->pw_shell);
if (shell == "false" || shell == "nologin")
@ -71,9 +73,9 @@ diff -uNr apt-1.4.9/apt-pkg/contrib/fileutl.cc apt-1.4.9.mod/apt-pkg/contrib/fil
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
diff -uNr apt-2.1.11/apt-pkg/deb/dpkgpm.cc apt-2.1.11.mod/apt-pkg/deb/dpkgpm.cc
--- apt-2.1.11/apt-pkg/deb/dpkgpm.cc 2020-10-21 12:53:18.000000000 +0300
+++ apt-2.1.11.mod/apt-pkg/deb/dpkgpm.cc 2020-11-05 15:37:39.289084595 +0200
@@ -179,7 +179,7 @@
so we use the binary from util-linux */
static bool ionice(int PID)
@ -92,7 +94,7 @@ diff -uNr apt-1.4.9/apt-pkg/deb/dpkgpm.cc apt-1.4.9.mod/apt-pkg/deb/dpkgpm.cc
Args[1] = "-c3";
Args[2] = buf;
Args[3] = 0;
@@ -483,7 +483,7 @@
@@ -482,7 +482,7 @@
debSystem::DpkgChrootDirectory();
const char *Args[4];
@ -101,12 +103,9 @@ diff -uNr apt-1.4.9/apt-pkg/deb/dpkgpm.cc apt-1.4.9.mod/apt-pkg/deb/dpkgpm.cc
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);
@@ -2456,10 +2456,10 @@
}
+// 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"))
@ -117,29 +116,67 @@ diff -uNr apt-1.4.9/apt-pkg/deb/dpkgpm.cc apt-1.4.9.mod/apt-pkg/deb/dpkgpm.cc
if(log != NULL)
{
char buf[1024];
@@ -2416,13 +2418,13 @@
pclose(log);
}
@@ -2470,11 +2470,11 @@
}
+#endif
- // attach df -l log (to learn about filesystem status)
// 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("/bin/df -l -x squashfs","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
diff -uNr apt-2.1.11/apt-pkg/init.cc apt-2.1.11.mod/apt-pkg/init.cc
--- apt-2.1.11/apt-pkg/init.cc 2020-10-21 12:53:18.000000000 +0300
+++ apt-2.1.11.mod/apt-pkg/init.cc 2020-11-05 15:33:08.863245537 +0200
@@ -210,7 +210,7 @@
Cnf.CndSet("Acquire::Changelogs::AlwaysOnline::Origin::Ubuntu", true);
- Cnf.CndSet("DPkg::Path", "/usr/sbin:/usr/bin:/sbin:/bin");
+ Cnf.CndSet("DPkg::Path", "@TERMUX_PREFIX@/bin");
// Read an alternate config file
_error->PushToStack();
diff -uNr apt-2.1.11/apt-private/private-json-hooks.cc apt-2.1.11.mod/apt-private/private-json-hooks.cc
--- apt-2.1.11/apt-private/private-json-hooks.cc 2020-10-21 12:53:18.000000000 +0300
+++ apt-2.1.11.mod/apt-private/private-json-hooks.cc 2020-11-05 15:36:12.936497984 +0200
@@ -364,7 +364,7 @@
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;
diff -uNr apt-2.1.11/cmdline/apt-dump-solver.cc apt-2.1.11.mod/cmdline/apt-dump-solver.cc
--- apt-2.1.11/cmdline/apt-dump-solver.cc 2020-10-21 12:53:18.000000000 +0300
+++ apt-2.1.11.mod/cmdline/apt-dump-solver.cc 2020-11-05 15:40:23.190141970 +0200
@@ -76,7 +76,7 @@
{
EDSP::WriteError("ERR_NO_FILENAME", "You have to set the environment variable APT_EDSP_DUMP_FILENAME\n"
"to a valid filename to store the dump of EDSP solver input in.\n"
- "For example with: export APT_EDSP_DUMP_FILENAME=/tmp/dump.edsp", stdoutfd);
+ "For example with: export APT_EDSP_DUMP_FILENAME=@TERMUX_PREFIX@/tmp/dump.edsp", stdoutfd);
return 0;
}
}
diff -uNr apt-2.1.11/cmdline/apt-key.in apt-2.1.11.mod/cmdline/apt-key.in
--- apt-2.1.11/cmdline/apt-key.in 2020-10-21 12:53:18.000000000 +0300
+++ apt-2.1.11.mod/cmdline/apt-key.in 2020-11-05 15:43:52.271502576 +0200
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!@TERMUX_PREFIX@/bin/sh
set -e
unset GREP_OPTIONS GPGHOMEDIR CURRENTTRAP
@@ -356,7 +356,7 @@
if accessible_file_exists "$TRUSTEDFILE" && is_supported_keyring "$TRUSTEDFILE"; then
$ACTION "$TRUSTEDFILE" "$@"
fi
- local TRUSTEDPARTS="/etc/apt/trusted.gpg.d"
@ -147,7 +184,7 @@ diff -uNr apt-1.4.9/cmdline/apt-key.in apt-1.4.9.mod/cmdline/apt-key.in
eval "$(apt-config shell TRUSTEDPARTS Dir::Etc::TrustedParts/d)"
if [ -d "$TRUSTEDPARTS" ]; then
TRUSTEDPARTS="$(readlink -f "$TRUSTEDPARTS")"
@@ -439,7 +439,7 @@
@@ -535,7 +535,7 @@
merge_all_trusted_keyrings_into_pubring
FORCED_KEYRING="${GPGHOMEDIR}/forcedkeyid.gpg"
TRUSTEDFILE="${FORCED_KEYRING}"
@ -156,7 +193,7 @@ diff -uNr apt-1.4.9/cmdline/apt-key.in apt-1.4.9.mod/cmdline/apt-key.in
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 @@
@@ -547,13 +547,13 @@
else
touch "${GPGHOMEDIR}/pubring.gpg" "${GPGHOMEDIR}/pubring.orig.gpg"
fi
@ -172,7 +209,7 @@ diff -uNr apt-1.4.9/cmdline/apt-key.in apt-1.4.9.mod/cmdline/apt-key.in
exec sh '$(escape_shell "${GPG}")' --keyring '$(escape_shell "${TRUSTEDFILE}")' \"\$@\"" > "${GPGHOMEDIR}/gpg.1.sh"
GPG="${GPGHOMEDIR}/gpg.1.sh"
fi
@@ -542,7 +542,7 @@
@@ -653,7 +653,7 @@
done
if [ -z "$TRUSTEDFILE" ]; then
@ -181,16 +218,7 @@ diff -uNr apt-1.4.9/cmdline/apt-key.in apt-1.4.9.mod/cmdline/apt-key.in
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 @@
@@ -697,7 +697,7 @@
create_gpg_home
# now tell gpg that it shouldn't try to maintain this trustdb file

View File

@ -1,52 +0,0 @@
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<char> 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<SrvRec> &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

View File

@ -1,7 +1,7 @@
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 @@
diff -uNr apt-2.1.11/methods/basehttp.cc apt-2.1.11.mod/methods/basehttp.cc
--- apt-2.1.11/methods/basehttp.cc 2020-10-21 12:53:18.000000000 +0300
+++ apt-2.1.11.mod/methods/basehttp.cc 2020-11-05 16:03:27.279316512 +0200
@@ -93,7 +93,12 @@
// Evil servers return no version
if (Line[4] == '/')
{
@ -15,7 +15,7 @@ diff -uNr apt-1.4.9/methods/basehttp.cc apt-1.4.9.mod/methods/basehttp.cc
if (elements == 3)
{
Code[0] = '\0';
@@ -99,6 +104,7 @@
@@ -102,6 +107,7 @@
}
else if (elements != 4)
return _error->Error(_("The HTTP server sent an invalid reply header"));

View File

@ -1,15 +0,0 @@
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() {

View File

@ -0,0 +1,39 @@
diff -uNr apt-2.1.11/apt-pkg/init.cc apt-2.1.11.mod/apt-pkg/init.cc
--- apt-2.1.11/apt-pkg/init.cc 2020-11-05 15:59:00.521530818 +0200
+++ apt-2.1.11.mod/apt-pkg/init.cc 2020-11-05 16:10:07.441999422 +0200
@@ -51,6 +51,7 @@
}
+#ifndef __ANDROID__
// pkgInitArchTupleMap - Initialize the architecture tuple map /*{{{*/
// ---------------------------------------------------------------------
/* This initializes */
@@ -116,7 +117,7 @@
return true;
}
/*}}}*/
-
+#endif
// pkgInitConfig - Initialize the configuration class /*{{{*/
// ---------------------------------------------------------------------
@@ -132,6 +133,7 @@
Cnf.CndSet("APT::Install-Recommends", true);
Cnf.CndSet("APT::Install-Suggests", false);
Cnf.CndSet("Dir","/");
+ Cnf.CndSet("Acquire::Languages", "none");
// State
Cnf.CndSet("Dir::State", &STATE_DIR[1]);
@@ -281,8 +283,10 @@
return _error->Error(_("Unable to determine a suitable packaging system type"));
}
+#ifndef __ANDROID__
if (pkgInitArchTupleMap() == false)
return false;
+#endif
return Sys->Initialize(Cnf);
}

View File

@ -0,0 +1,12 @@
diff -uNr apt-2.1.11/cmdline/apt-key.in apt-2.1.11.mod/cmdline/apt-key.in
--- apt-2.1.11/cmdline/apt-key.in 2020-11-05 15:59:00.521530818 +0200
+++ apt-2.1.11.mod/cmdline/apt-key.in 2020-11-05 16:12:58.999142102 +0200
@@ -84,7 +84,7 @@
}
requires_root() {
- if [ "$(id -u)" -ne 0 ]; then
+ if [ ! -d "@TERMUX_PREFIX@" ] && [ "$(id -u)" -ne 0 ]; then
apt_error "This command can only be used by root."
exit 1
fi

View File

@ -1,18 +0,0 @@
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 @@
<!-- details about the keys used by the distribution -->
-<!ENTITY keyring-distro "Ubuntu">
-<!ENTITY keyring-package "<package>ubuntu-keyring</package>">
-<!ENTITY keyring-filename "<filename>/usr/share/keyrings/ubuntu-archive-keyring.gpg</filename>">
-<!ENTITY keyring-removed-filename "<filename>/usr/share/keyrings/ubuntu-archive-removed-keys.gpg</filename>">
-<!ENTITY keyring-master-filename "/usr/share/keyrings/ubuntu-master-keyring.gpg">
+<!ENTITY keyring-distro "Termux">
+<!ENTITY keyring-package "<package>termux-keyring</package>">
+<!ENTITY keyring-filename "<filename>@TERMUX_PREFIX@/share/keyrings/termux-archive-keyring.gpg</filename>">
+<!ENTITY keyring-removed-filename "<filename>@TERMUX_PREFIX@/share/keyrings/termux-archive-removed-keys.gpg</filename>">
+<!ENTITY keyring-master-filename "@TERMUX_PREFIX@/share/keyrings/termux-master-keyring.gpg">
<!ENTITY keyring-uri "http://archive.ubuntu.com/ubuntu/project/ubuntu-archive-keyring.gpg">
<!ENTITY sourceslist-list-format "deb http://us.archive.ubuntu.com/ubuntu &ubuntu-codename; main restricted

View File

@ -1,51 +0,0 @@
diff -uNr apt-1.4.9/apt-pkg/init.cc apt-1.4.9.mod/apt-pkg/init.cc
--- apt-1.4.9/apt-pkg/init.cc 2019-01-18 12:42:07.000000000 +0200
+++ apt-1.4.9.mod/apt-pkg/init.cc 2019-11-12 22:55:03.409615793 +0200
@@ -51,7 +51,7 @@
return vec;
}
-
+#ifndef __ANDROID__
// pkgInitArchTupleMap - Initialize the architecture tuple map /*{{{*/
// ---------------------------------------------------------------------
/* This initializes */
@@ -116,7 +116,7 @@
return true;
}
- /*}}}*/
+#endif /*}}}*/
// pkgInitConfig - Initialize the configuration class /*{{{*/
@@ -133,6 +133,7 @@
Cnf.CndSet("APT::Install-Recommends", true);
Cnf.CndSet("APT::Install-Suggests", false);
Cnf.CndSet("Dir","/");
+ Cnf.CndSet("Acquire::Languages", "none");
// State
Cnf.CndSet("Dir::State", STATE_DIR + 1);
@@ -158,9 +159,9 @@
Cnf.CndSet("Dir::Etc::trusted", "trusted.gpg");
Cnf.CndSet("Dir::Etc::trustedparts","trusted.gpg.d");
Cnf.CndSet("Dir::Bin::methods", LIBEXEC_DIR "/methods");
- Cnf.CndSet("Dir::Bin::solvers::",LIBEXEC_DIR "/solvers");
- Cnf.CndSet("Dir::Bin::planners::",LIBEXEC_DIR "/planners");
- Cnf.CndSet("Dir::Media::MountPath","/media/apt");
+ Cnf.CndSet("Dir::Bin::solvers::",LIBEXEC_DIR "/solvers");
+ Cnf.CndSet("Dir::Bin::planners::", LIBEXEC_DIR "/planners");
+ Cnf.CndSet("Dir::Media::MountPath","media/apt");
// State
Cnf.CndSet("Dir::Log", LOG_DIR + 1);
@@ -283,8 +284,6 @@
return _error->Error(_("Unable to determine a suitable packaging system type"));
}
- if (pkgInitArchTupleMap() == false)
- return false;
return Sys->Initialize(Cnf);
}

View File

@ -0,0 +1,23 @@
diff -uNr apt-2.1.11/apt-pkg/acquire-item.cc apt-2.1.11.mod/apt-pkg/acquire-item.cc
--- apt-2.1.11/apt-pkg/acquire-item.cc 2020-10-21 12:53:18.000000000 +0300
+++ apt-2.1.11.mod/apt-pkg/acquire-item.cc 2020-11-05 16:53:16.611724426 +0200
@@ -170,6 +170,7 @@
{
std::string m;
strprintf(m, msg, repo.c_str());
+#ifndef __ANDROID__
if (isError)
{
_error->Error("%s", m.c_str());
@@ -181,6 +182,11 @@
_error->Notice("%s", _("Data from such a repository can't be authenticated and is therefore potentially dangerous to use."));
}
_error->Notice("%s", _("See apt-secure(8) manpage for repository creation and user configuration details."));
+#else
+ _error->Error("%s", m.c_str());
+ _error->Notice("%s", _("Metadata integrity can't be verified, repository is disabled now."));
+ _error->Notice("%s", _("Possible cause: repository is under maintenance or down (wrong sources.list URL?)."));
+#endif
return false;
}
/*}}}*/

View File

@ -1,11 +0,0 @@
diff -uNr apt-1.4.9/apt-private/private-download.cc apt-1.4.9.mod/apt-private/private-download.cc
--- apt-1.4.9/apt-private/private-download.cc 2019-01-18 12:42:07.000000000 +0200
+++ apt-1.4.9.mod/apt-private/private-download.cc 2019-11-13 14:22:40.305931068 +0200
@@ -127,7 +127,6 @@
/*}}}*/
bool CheckFreeSpaceBeforeDownload(std::string const &Dir, unsigned long long FetchBytes)/*{{{*/
{
- uint32_t const RAMFS_MAGIC = 0x858458f6;
/* Check for enough free space, but only if we are actually going to
download */
if (_config->FindB("APT::Get::Print-URIs", false) == true ||

View File

@ -1,53 +1,54 @@
diff -uNr apt-1.4.9/cmdline/apt.cc apt-1.4.9.mod/cmdline/apt.cc
--- apt-1.4.9/cmdline/apt.cc 2019-01-18 12:42:07.000000000 +0200
+++ apt-1.4.9.mod/cmdline/apt.cc 2019-11-13 14:55:50.954692940 +0200
@@ -97,6 +97,12 @@
diff -uNr apt-2.1.11/cmdline/apt.cc apt-2.1.11.mod/cmdline/apt.cc
--- apt-2.1.11/cmdline/apt.cc 2020-10-21 12:53:18.000000000 +0300
+++ apt-2.1.11.mod/cmdline/apt.cc 2020-11-05 16:56:10.361005861 +0200
@@ -101,6 +101,11 @@
/*}}}*/
int main(int argc, const char *argv[]) /*{{{*/
{
+ if (getuid() == 0) {
+ std::cout << "You should not use command 'apt' as root." << std::endl;
+ std::cout << "This is dangerous as may damage your Termux installation and data." << std::endl;
+ std::cout << "Ability to run this command as root has been disabled permanently for safety purposes." << std::endl;
+ return 1;
+ }
+
CommandLine CmdL;
auto const Cmds = ParseCommandLine(CmdL, APT_CMD::APT, &_config, &_system, argc, argv, &ShowHelp, &GetCommands);
diff -uNr apt-1.4.9/cmdline/apt-get.cc apt-1.4.9.mod/cmdline/apt-get.cc
--- apt-1.4.9/cmdline/apt-get.cc 2019-01-18 12:42:07.000000000 +0200
+++ apt-1.4.9.mod/cmdline/apt-get.cc 2019-11-13 14:55:50.954692940 +0200
@@ -432,6 +432,12 @@
diff -uNr apt-2.1.11/cmdline/apt-get.cc apt-2.1.11.mod/cmdline/apt-get.cc
--- apt-2.1.11/cmdline/apt-get.cc 2020-10-21 12:53:18.000000000 +0300
+++ apt-2.1.11.mod/cmdline/apt-get.cc 2020-11-05 16:56:49.205289051 +0200
@@ -430,6 +430,11 @@
/*}}}*/
int main(int argc,const char *argv[]) /*{{{*/
{
+ if (getuid() == 0) {
+ std::cout << "You should not use command 'apt-get' as root." << std::endl;
+ std::cout << "This is dangerous as may damage your Termux installation and data." << std::endl;
+ std::cout << "Ability to run this command as root has been disabled permanently for safety purposes." << std::endl;
+ return 1;
+ }
+
// Parse the command line and initialize the package library
CommandLine CmdL;
auto const Cmds = ParseCommandLine(CmdL, APT_CMD::APT_GET, &_config, &_system, argc, argv, &ShowHelp, &GetCommands);
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-13 14:55:25.431240010 +0200
+++ apt-1.4.9.mod/cmdline/apt-key.in 2019-11-13 15:04:25.853655116 +0200
@@ -15,8 +15,11 @@
aptkey_echo() { echo "$@"; }
diff -uNr apt-2.1.11/cmdline/apt-key.in apt-2.1.11.mod/cmdline/apt-key.in
--- apt-2.1.11/cmdline/apt-key.in 2020-11-05 16:50:45.426584174 +0200
+++ apt-2.1.11.mod/cmdline/apt-key.in 2020-11-05 16:59:59.422661972 +0200
@@ -83,11 +83,11 @@
chmod 700 "$GPGHOMEDIR"
}
-requires_root() {
- :
- if [ ! -d "@TERMUX_PREFIX@" ] && [ "$(id -u)" -ne 0 ]; then
- apt_error "This command can only be used by root."
- exit 1
- fi
+assert_no_root() {
+ if [ "$(id -u)" = "0" ]; then
+ apt_error "Refusing to run 'apt-key' as root to prevent damage to your Termux installation."
+ exit 1
+ fi
+ if [ "$(id -u)" = "0" ]; then
+ apt_error "Ability to run this command as root has been disabled for safety purposes."
+ exit 1
+ fi
}
command_available() {
@@ -510,7 +513,6 @@
@@ -624,7 +624,6 @@
create_new_keyring() { if [ ! -r "$FORCED_KEYRING" ]; then TRUSTEDFILE='/dev/null'; FORCED_KEYRING="$TRUSTEDFILE"; fi; }
;;
--fakeroot)
@ -55,7 +56,7 @@ diff -uNr apt-1.4.9/cmdline/apt-key.in apt-1.4.9.mod/cmdline/apt-key.in
;;
--quiet)
aptkey_echo() { true; }
@@ -706,7 +708,7 @@
@@ -762,7 +761,7 @@
case "$command" in
add)
warn_on_script_usage
@ -64,10 +65,10 @@ diff -uNr apt-1.4.9/cmdline/apt-key.in apt-1.4.9.mod/cmdline/apt-key.in
setup_merged_keyring
aptkey_execute "$GPG" --quiet --batch --import "$@"
merge_back_changes
@@ -714,19 +716,19 @@
;;
@@ -771,20 +770,20 @@
del|rm|remove)
# no script warning here as removing 'add' usage needs 'del' for cleanup
warn_outside_maintscript
- requires_root
+ assert_no_root
foreach_keyring_do 'remove_key_from_keyring' "$@"
@ -82,21 +83,21 @@ diff -uNr apt-1.4.9/cmdline/apt-key.in apt-1.4.9.mod/cmdline/apt-key.in
merge_back_changes
;;
net-update)
warn_on_script_usage
- requires_root
+ assert_no_root
setup_merged_keyring
net_update
merge_back_changes
diff -uNr apt-1.4.9/cmdline/apt-mark.cc apt-1.4.9.mod/cmdline/apt-mark.cc
--- apt-1.4.9/cmdline/apt-mark.cc 2019-01-18 12:42:07.000000000 +0200
+++ apt-1.4.9.mod/cmdline/apt-mark.cc 2019-11-13 14:55:50.958026289 +0200
@@ -316,6 +316,12 @@
diff -uNr apt-2.1.11/cmdline/apt-mark.cc apt-2.1.11.mod/cmdline/apt-mark.cc
--- apt-2.1.11/cmdline/apt-mark.cc 2020-10-21 12:53:18.000000000 +0300
+++ apt-2.1.11.mod/cmdline/apt-mark.cc 2020-11-05 16:57:19.205507031 +0200
@@ -449,6 +449,11 @@
/*}}}*/
int main(int argc,const char *argv[]) /*{{{*/
{
+ if (getuid() == 0) {
+ std::cout << "You should not use command 'apt-mark' as root." << std::endl;
+ std::cout << "This is dangerous as may damage your Termux installation and data." << std::endl;
+ std::cout << "Ability to run this command as root has been disabled permanently for safety purposes." << std::endl;
+ return 1;
+ }
+

View File

@ -0,0 +1,12 @@
diff -uNr apt-2.1.11/apt-private/private-cmndline.cc apt-2.1.11.mod/apt-private/private-cmndline.cc
--- apt-2.1.11/apt-private/private-cmndline.cc 2020-10-21 12:53:18.000000000 +0300
+++ apt-2.1.11.mod/apt-private/private-cmndline.cc 2020-11-05 17:01:40.119381470 +0200
@@ -473,7 +473,7 @@
_config->CndSet("Binary::apt::APT::Get::Upgrade-Allow-New", true);
_config->CndSet("Binary::apt::APT::Cmd::Show-Update-Stats", true);
_config->CndSet("Binary::apt::DPkg::Progress-Fancy", true);
- _config->CndSet("Binary::apt::APT::Keep-Downloaded-Packages", false);
+ _config->CndSet("Binary::apt::APT::Keep-Downloaded-Packages", true);
_config->CndSet("Binary::apt::APT::Get::Update::InteractiveReleaseInfoChanges", true);
_config->CndSet("Binary::apt::APT::Cmd::Pattern-Only", true);

View File

@ -1,26 +0,0 @@
diff -uNr apt-1.4.9/apt-pkg/acquire-item.cc apt-1.4.9.mod/apt-pkg/acquire-item.cc
--- apt-1.4.9/apt-pkg/acquire-item.cc 2019-01-18 12:42:07.000000000 +0200
+++ apt-1.4.9.mod/apt-pkg/acquire-item.cc 2020-01-16 01:46:26.562224655 +0200
@@ -180,17 +180,11 @@
{
std::string m;
strprintf(m, msg, repo.c_str());
- if (isError)
- {
- _error->Error("%s", m.c_str());
- _error->Notice("%s", _("Updating from such a repository can't be done securely, and is therefore disabled by default."));
- }
- else
- {
- _error->Warning("%s", m.c_str());
- _error->Notice("%s", _("Data from such a repository can't be authenticated and is therefore potentially dangerous to use."));
- }
- _error->Notice("%s", _("See apt-secure(8) manpage for repository creation and user configuration details."));
+
+ _error->Error("%s", m.c_str());
+ _error->Notice("%s", _("Metadata integrity can't be verified, repository is disabled now."));
+ _error->Notice("%s", _("Possible cause: repository is under maintenance or down (wrong sources.list URL?)."));
+
return false;
}
/*}}}*/

View File

@ -1,10 +1,7 @@
Patch to encourage third-parties to compile own packages instead
of using hosted by Termux.
diff -uNr apt-1.4.10/cmdline/apt.cc apt-1.4.10.mod/cmdline/apt.cc
--- apt-1.4.10/cmdline/apt.cc 2020-09-28 02:39:43.263956603 +0300
+++ apt-1.4.10.mod/cmdline/apt.cc 2020-09-28 02:40:31.852376007 +0300
@@ -103,6 +103,26 @@
diff -uNr apt-2.1.11/cmdline/apt.cc apt-2.1.11.mod/cmdline/apt.cc
--- apt-2.1.11/cmdline/apt.cc 2020-11-05 16:56:10.361005861 +0200
+++ apt-2.1.11.mod/cmdline/apt.cc 2020-11-05 17:03:32.752181628 +0200
@@ -106,6 +106,26 @@
return 1;
}

View File

@ -1,13 +0,0 @@
diff --git a/apt-private/private-cmndline.cc b/apt-private/private-cmndline.cc
index de3992a00..96b2c1251 100644
--- a/apt-private/private-cmndline.cc
+++ b/apt-private/private-cmndline.cc
@@ -461,7 +461,7 @@ static void BinarySpecificConfiguration(char const * const Binary) /*{{{*/
_config->CndSet("Binary::apt::APT::Get::Upgrade-Allow-New", true);
_config->CndSet("Binary::apt::APT::Cmd::Show-Update-Stats", true);
_config->CndSet("Binary::apt::DPkg::Progress-Fancy", true);
- _config->CndSet("Binary::apt::APT::Keep-Downloaded-Packages", false);
+ _config->CndSet("Binary::apt::APT::Keep-Downloaded-Packages", true);
}
if (binary == "apt-config")
_config->CndSet("Binary::apt-get::Acquire::AllowInsecureRepositories", true);

View File

@ -1,12 +1,11 @@
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.10
TERMUX_PKG_REVISION=6
TERMUX_PKG_SRCURL=http://ftp.debian.org/debian/pool/main/a/apt/apt_${TERMUX_PKG_VERSION}.tar.xz
TERMUX_PKG_SHA256=eaa314e8ebc9e62fedf316d196d1a99d894fd715e6385ed18afd41cc2cd5b127
TERMUX_PKG_VERSION=2.1.11
TERMUX_PKG_SRCURL=http://deb.debian.org/debian/pool/main/a/apt/apt_${TERMUX_PKG_VERSION}.tar.xz
TERMUX_PKG_SHA256=f49f0652d5d2cfa157f0197d9ce03953970a108813568bb1c69553fd3d5a4be3
# apt-key requires utilities from coreutils, findutils, gpgv, grep, sed.
TERMUX_PKG_DEPENDS="coreutils, dpkg, findutils, gpgv, grep, libbz2, libc++, libcurl, liblzma, sed, termux-licenses, zlib"
TERMUX_PKG_DEPENDS="coreutils, dpkg, findutils, gpgv, grep, libbz2, libc++, libcurl, liblz4, liblzma, sed, termux-licenses, zlib"
TERMUX_PKG_CONFLICTS="apt-transport-https, libapt-pkg"
TERMUX_PKG_REPLACES="apt-transport-https, libapt-pkg"
TERMUX_PKG_RECOMMENDS="game-repo, science-repo"
@ -57,7 +56,7 @@ termux_step_pre_configure() {
# Prefix verification patch should be applied only for the
# builds with original prefix.
if [ "$TERMUX_PREFIX" = "/data/data/com.termux/files/usr" ]; then
patch -p1 -i $TERMUX_PKG_BUILDER_DIR/0013-verify-prefix.patch.txt
patch -p1 -i $TERMUX_PKG_BUILDER_DIR/0011-verify-prefix.patch.txt
fi
}