apt 1.4.7 working...

This commit is contained in:
its-pointless 2017-07-20 13:47:45 +10:00 committed by Fredrik Fornwall
parent f03731c8d1
commit b2e7b17d35
15 changed files with 375 additions and 0 deletions

View File

@ -0,0 +1,28 @@
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

@ -0,0 +1,28 @@
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 <sstream>
#include <string>
#include <vector>
+#ifndef __ANDROID__
#include <langinfo.h>
+#endif
#include <apti18n.h>
/*}}}*/
@@ -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;
}

View File

@ -0,0 +1,50 @@
--- ../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

@ -0,0 +1,11 @@
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 @@
/*}}}*/
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

@ -0,0 +1,18 @@
TERMUX_PKG_HOMEPAGE=https://packages.debian.org/apt
TERMUX_PKG_DESCRIPTION="Front-end for the dpkg package manager"
TERMUX_PKG_DEPENDS="libbz2, liblzma, dpkg, gpgv, libc++"
TERMUX_PKG_VERSION=1.4.7
TERMUX_PKG_SRCURL=http://ftp.debian.org/debian/pool/main/a/apt/apt_${TERMUX_PKG_VERSION}.tar.xz
TERMUX_PKG_SHA256=ea2a2e8e08daf8ea11aeaa86928d943a42ce53989165a30cc828838d470b7719
TERMUX_PKG_EXTRA_CONFIGURE_ARGS=" -DCOMMON_ARCH=$TERMUX_ARCH -DUSE_NLS=OFF -DDPKG_DATADIR=$TERMUX_PREFIX/share/dpkg -DCMAKE_INSTALL_FULL_LOCALSTATEDIR=$TERMUX_PREFIX"
TERMUX_PKG_FOLDERNAME=apt-${TERMUX_PKG_VERSION}
TERMUX_PKG_ESSENTIAL=yes
TERMUX_PKG_CONFFILES="etc/apt/sources.list"
termux_step_pre_configure () {
LDFLAGS+=" -landroid-glob"
}
termux_step_post_make_install() {
printf "# The main termux repository:\ndeb [arch=all,${TERMUX_ARCH}] http://termux.net stable main\n" > $TERMUX_PREFIX/etc/apt/sources.list
cp $TERMUX_PKG_BUILDER_DIR/trusted.gpg $TERMUX_PREFIX/etc/apt/
rm /data/data/com.termux/files/usr/include/apt-pkg -r
}

View File

@ -0,0 +1,58 @@
--- ../cache/apt-1.4.7/CMakeLists.txt 2017-07-14 07:45:39.000000000 +1000
+++ ./CMakeLists.txt 2017-07-20 13:31:00.727044330 +1000
@@ -33,7 +33,7 @@
include(GNUInstallDirs)
include(TestBigEndian)
find_package(Threads)
-find_package(LFS REQUIRED)
+# find_package(LFS REQUIRED)
find_package(Iconv REQUIRED)
find_package(Perl REQUIRED)
@@ -45,9 +45,9 @@
endif()
# Add large file support
-add_compile_options(${LFS_COMPILE_OPTIONS})
-add_definitions(${LFS_DEFINITIONS})
-link_libraries(${LFS_LIBRARIES})
+# add_compile_options(${LFS_COMPILE_OPTIONS})
+# add_definitions(${LFS_DEFINITIONS})
+# link_libraries(${LFS_LIBRARIES})
# Set compiler flags
set(CMAKE_CXX_STANDARD 11)
@@ -100,10 +100,6 @@
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 +176,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,7 +207,6 @@
add_subdirectory(apt-inst)
add_subdirectory(cmdline)
add_subdirectory(completions)
-add_subdirectory(doc)
add_subdirectory(dselect)
add_subdirectory(ftparchive)
add_subdirectory(methods)

View File

@ -0,0 +1,36 @@
--- ../cache/apt-1.4.7/CMakeLists.txt 2017-07-14 07:45:39.000000000 +1000
+++ ./CMakeLists.txt 2017-07-20 13:44:59.821008899 +1000
@@ -100,10 +100,6 @@
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 +176,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,7 +207,6 @@
add_subdirectory(apt-inst)
add_subdirectory(cmdline)
add_subdirectory(completions)
-add_subdirectory(doc)
add_subdirectory(dselect)
add_subdirectory(ftparchive)
add_subdirectory(methods)

View File

@ -0,0 +1,32 @@
--- ../cache/apt-1.4.7/cmdline/apt-key.in 2017-07-14 07:45:39.000000000 +1000
+++ ./cmdline/apt-key.in 2017-07-19 17:43:09.131197161 +1000
@@ -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="/data/data/com.termux/files/usr/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="/data/data/com.termux/files/usr/etc/apt/trusted.gpg"
eval $(apt-config shell TRUSTEDFILE Apt::GPGV::TrustedKeyring)
eval $(apt-config shell TRUSTEDFILE Dir::Etc::Trusted/f)
fi

View File

@ -0,0 +1,18 @@
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

@ -0,0 +1,18 @@
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

@ -0,0 +1,26 @@
--- ../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)

View File

@ -0,0 +1,11 @@
--- ../cache/apt-1.4.7/methods/connect.cc 2017-07-14 07:45:39.000000000 +1000
+++ ./methods/connect.cc 2017-07-20 09:33:48.701839138 +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"));

View File

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

Binary file not shown.

View File

@ -0,0 +1,16 @@
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">