From e37bd49713cd89808b9cdf5bc5e1efb7715b6b10 Mon Sep 17 00:00:00 2001 From: TomIO Date: Thu, 22 May 2025 03:57:35 +0200 Subject: [PATCH 01/13] addpkg(main/sequoia-sq): 1.3.1 Co-authored-by: Jia Yuan Lo Co-authored-by: Robert Kirkman Co-authored-by: Twaik Yont <9674930+twaik@users.noreply.github.com> --- packages/sequoia-sq/0001-openpgp-cert-d.diff | 20 ++++++ packages/sequoia-sq/build.sh | 73 ++++++++++++++++++++ scripts/setup-ubuntu.sh | 3 + 3 files changed, 96 insertions(+) create mode 100644 packages/sequoia-sq/0001-openpgp-cert-d.diff create mode 100644 packages/sequoia-sq/build.sh diff --git a/packages/sequoia-sq/0001-openpgp-cert-d.diff b/packages/sequoia-sq/0001-openpgp-cert-d.diff new file mode 100644 index 000000000000000..c0bb3ea72dce87c --- /dev/null +++ b/packages/sequoia-sq/0001-openpgp-cert-d.diff @@ -0,0 +1,20 @@ +https://gitlab.com/sequoia-pgp/pgp-cert-d/-/issues/54 + +--- a/src/unixdir.rs ++++ b/src/unixdir.rs +@@ -81,9 +81,15 @@ + } + + /// Whether a file is a directory. ++ #[cfg(not(all(target_os = "android", target_pointer_width = "32")))] + pub fn is_dir(&self) -> bool { + (self.0.st_mode & libc::S_IFMT) == libc::S_IFDIR + } ++ ++ #[cfg(all(target_os = "android", target_pointer_width = "32"))] ++ pub fn is_dir(&self) -> bool { ++ (self.0.st_mode & libc::S_IFMT as u32) == libc::S_IFDIR as u32 ++ } + } + + impl std::convert::From<&crate::unixdir::Metadata> for Tag { diff --git a/packages/sequoia-sq/build.sh b/packages/sequoia-sq/build.sh new file mode 100644 index 000000000000000..cdaa4e9298f0a32 --- /dev/null +++ b/packages/sequoia-sq/build.sh @@ -0,0 +1,73 @@ +TERMUX_PKG_HOMEPAGE="https://sequoia-pgp.org/" +TERMUX_PKG_DESCRIPTION="OpenPGP command-line tool from Sequoia" +TERMUX_PKG_LICENSE="GPL-2.0-only" +TERMUX_PKG_MAINTAINER="@termux" +TERMUX_PKG_VERSION=1.3.1 +TERMUX_PKG_SRCURL=https://gitlab.com/sequoia-pgp/sequoia-sq/-/archive/v${TERMUX_PKG_VERSION}/sequoia-sq-v${TERMUX_PKG_VERSION}.tar.gz +TERMUX_PKG_SHA256=9f112096f413e195ec737c81abb5649604f16e1f6dbe64a8accc5bb3ad39e239 +TERMUX_PKG_BUILD_DEPENDS="capnproto" +TERMUX_PKG_DEPENDS="bzip2, libgmp, nettle, openssl, sqlite" +TERMUX_PKG_BUILD_IN_SRC=true + +termux_step_pre_configure() { + termux_setup_rust + termux_setup_capnp + + # The `nettle-sys` and `openssl-sys` crates fail to compile if we don't set this. + HOST_TRIPLET="$(gcc -dumpmachine)" + PKG_CONFIG_PATH_x86_64_unknown_linux_gnu="$(grep 'DefaultSearchPaths:' "/usr/share/pkgconfig/personality.d/${HOST_TRIPLET}.personality" | cut -d ' ' -f 2)" + export PKG_CONFIG_PATH_x86_64_unknown_linux_gnu # Declare and export separately, see http://shellcheck.net/wiki/SC2155 + + # /usr/include/nettle/bignum.h:50:11: fatal error: 'gmp.h' file not found + # thread 'main' panicked at /home/builder/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/nettle-sys-2.3.1/build.rs:214:39: + echo "INFO: Fixing gmp.pc to point to gmp.h location" + sed -e "s|^includedir=.*|includedir=/usr/include/x86_64-linux-gnu|" /usr/lib/x86_64-linux-gnu/pkgconfig/gmp.pc > "${TERMUX_PKG_TMPDIR}/gmp.pc" + diff -uN /usr/lib/x86_64-linux-gnu/pkgconfig/gmp.pc "${TERMUX_PKG_TMPDIR}/gmp.pc" || : + PKG_CONFIG_PATH_x86_64_unknown_linux_gnu="${TERMUX_PKG_TMPDIR}:${PKG_CONFIG_PATH_x86_64_unknown_linux_gnu}" + + # error: function-like macro '__GLIBC_USE' is not defined + export BINDGEN_EXTRA_CLANG_ARGS_${CARGO_TARGET_NAME//-/_}="--sysroot ${TERMUX_STANDALONE_TOOLCHAIN}/sysroot --target=${CARGO_TARGET_NAME}" + + # clashes with rust host build + unset CFLAGS + + # fix 32bit Android openpgp-cert-d build + if (( TERMUX_ARCH_BITS == 32 )); then + rm -rf .cargo + cargo vendor + mkdir .cargo + cat <<-EOL >.cargo/config.toml + [source.crates-io] + replace-with = "vendored-sources" + + [source.vendored-sources] + directory = "vendor" + + [patch.crates-io] + openpgp-cert-d = { path = "./patch-openpgp-cert-d" } + EOL + + rm -rf patch-openpgp-cert-d + cp -rf vendor/openpgp-cert-d patch-openpgp-cert-d + patch -p1 -d patch-openpgp-cert-d -i "${TERMUX_PKG_BUILDER_DIR}/0001-openpgp-cert-d.diff" + fi +} + +termux_step_make() { + cargo build \ + --features default \ + --jobs "${TERMUX_PKG_MAKE_PROCESSES}" \ + --target "${CARGO_TARGET_NAME}" \ + --release +} + +termux_step_make_install() { + RELEASE_DIR="${TERMUX_PKG_SRCDIR}/target/${CARGO_TARGET_NAME}/release" + COMPLETIONS_DIR="$(echo "${RELEASE_DIR}"/build/sequoia-sq-*/out/shell-completions)" + install -Dm700 -t "${TERMUX_PREFIX}/bin" "${RELEASE_DIR}/sq" + install -Dm600 -t "${TERMUX_PREFIX}/share/man/man1" "${RELEASE_DIR}"/build/sequoia-sq-*/out/man-pages/*.1 + install -Dm600 -t "${TERMUX_PREFIX}/share/bash-completion/completions" "${COMPLETIONS_DIR}/sq.bash" + install -Dm600 -t "${TERMUX_PREFIX}/share/fish/vendor_completions.d" "${COMPLETIONS_DIR}/sq.fish" + install -Dm600 -t "${TERMUX_PREFIX}/share/zsh/site-functions" "${COMPLETIONS_DIR}/_sq" + install -Dm600 -t "${TERMUX_PREFIX}/share/elvish/lib" "${COMPLETIONS_DIR}/sq.elv" +} diff --git a/scripts/setup-ubuntu.sh b/scripts/setup-ubuntu.sh index 4e769836121bec8..9340d8d7df97b8d 100755 --- a/scripts/setup-ubuntu.sh +++ b/scripts/setup-ubuntu.sh @@ -241,6 +241,9 @@ PACKAGES+=" bash-static" # Needed by apt. PACKAGES+=" triehash" +# Needed by sequoia-sq (dependency of apt) +PACKAGES+=" nettle-dev" + # Needed by aspell dictionaries. PACKAGES+=" aspell" From f45b9cc90a2cc628787b38428bc7b882c91ba833 Mon Sep 17 00:00:00 2001 From: TomIO Date: Sun, 15 Jun 2025 21:07:57 +0200 Subject: [PATCH 02/13] addpkg(main/sequoia-sqv): 1.3.0 Co-authored-by: Jia Yuan Lo --- packages/sequoia-sqv/build.sh | 50 +++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 packages/sequoia-sqv/build.sh diff --git a/packages/sequoia-sqv/build.sh b/packages/sequoia-sqv/build.sh new file mode 100644 index 000000000000000..6f6fdabf0b856c2 --- /dev/null +++ b/packages/sequoia-sqv/build.sh @@ -0,0 +1,50 @@ +TERMUX_PKG_HOMEPAGE="https://sequoia-pgp.org/" +TERMUX_PKG_DESCRIPTION="Simple OpenPGP signature verification program" +TERMUX_PKG_LICENSE="GPL-2.0-only" +TERMUX_PKG_MAINTAINER="@termux" +TERMUX_PKG_VERSION=1.3.0 +TERMUX_PKG_SRCURL=https://gitlab.com/sequoia-pgp/sequoia-sqv/-/archive/v${TERMUX_PKG_VERSION}/sequoia-sqv-v${TERMUX_PKG_VERSION}.tar.gz +TERMUX_PKG_SHA256=0b2db2ec20aa76e7df5fec9768eb6c1950952af02c886d3fa951d4fdf2e2b8d6 +TERMUX_PKG_DEPENDS="libgmp, nettle" +TERMUX_PKG_BUILD_IN_SRC=true + +termux_step_pre_configure() { + termux_setup_rust + + # The `nettle-sys` crate fails to compile if we don't set this. + HOST_TRIPLET="$(gcc -dumpmachine)" + PKG_CONFIG_PATH_x86_64_unknown_linux_gnu="$(grep 'DefaultSearchPaths:' "/usr/share/pkgconfig/personality.d/${HOST_TRIPLET}.personality" | cut -d ' ' -f 2)" + export PKG_CONFIG_PATH_x86_64_unknown_linux_gnu # Declare and export separately, see http://shellcheck.net/wiki/SC2155 + + # /usr/include/nettle/bignum.h:50:11: fatal error: 'gmp.h' file not found + # thread 'main' panicked at /home/builder/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/nettle-sys-2.3.1/build.rs:214:39: + echo "INFO: Fixing gmp.pc to point to gmp.h location" + sed -e "s|^includedir=.*|includedir=/usr/include/x86_64-linux-gnu|" /usr/lib/x86_64-linux-gnu/pkgconfig/gmp.pc > "${TERMUX_PKG_TMPDIR}/gmp.pc" + diff -uN /usr/lib/x86_64-linux-gnu/pkgconfig/gmp.pc "${TERMUX_PKG_TMPDIR}/gmp.pc" || : + PKG_CONFIG_PATH_x86_64_unknown_linux_gnu="${TERMUX_PKG_TMPDIR}:${PKG_CONFIG_PATH_x86_64_unknown_linux_gnu}" + + # error: function-like macro '__GLIBC_USE' is not defined + export BINDGEN_EXTRA_CLANG_ARGS_${CARGO_TARGET_NAME//-/_}="--sysroot ${TERMUX_STANDALONE_TOOLCHAIN}/sysroot --target=${CARGO_TARGET_NAME}" + + # clashes with rust host build + unset CFLAGS +} + +termux_step_make() { + cargo build \ + --features default \ + --jobs "${TERMUX_PKG_MAKE_PROCESSES}" \ + --target "${CARGO_TARGET_NAME}" \ + --release +} + +termux_step_make_install() { + RELEASE_DIR="${TERMUX_PKG_SRCDIR}/target/${CARGO_TARGET_NAME}/release" + COMPLETIONS_DIR="$(echo "${RELEASE_DIR}"/build/sequoia-sqv-*/out/shell-completions)" + install -Dm700 -t "${TERMUX_PREFIX}/bin" "${RELEASE_DIR}/sqv" + install -Dm600 -t "${TERMUX_PREFIX}/share/man/man1" "${RELEASE_DIR}"/build/sequoia-sqv-*/out/man-pages/*.1 + install -Dm600 -t "${TERMUX_PREFIX}/share/bash-completion/completions" "${COMPLETIONS_DIR}/sqv.bash" + install -Dm600 -t "${TERMUX_PREFIX}/share/fish/vendor_completions.d" "${COMPLETIONS_DIR}/sqv.fish" + install -Dm600 -t "${TERMUX_PREFIX}/share/zsh/site-functions" "${COMPLETIONS_DIR}/_sqv" + install -Dm600 -t "${TERMUX_PREFIX}/share/elvish/lib" "${COMPLETIONS_DIR}/sqv.elv" +} From 4dc8b8c5928c9a3a7d419e865a2f95b0ab5ec473 Mon Sep 17 00:00:00 2001 From: TomIO Date: Wed, 9 Apr 2025 01:24:50 +0200 Subject: [PATCH 03/13] bump(main/apt): 3.1.11 Co-authored-by: Chongyun Lee <45286352+licy183@users.noreply.github.com> Co-authored-by: Biswapriyo Nath --- packages/apt/0000-cmake-fix.patch | 76 +++----- packages/apt/0003-no-srv-records.patch | 56 +++--- packages/apt/0004-no-hardcoded-paths.patch | 167 ++++++------------ packages/apt/0007-aptkey-no-root.patch | 12 -- .../0007-libcxx-deque-incomplete-type.patch | 139 +++++++++++++++ packages/apt/0010-prevent-usage-as-root.patch | 100 +++-------- .../apt/0011-keep-downloaded-packages.patch | 25 +-- .../0012-ndk-28-template-instantiation.patch | 160 +++++++++++++++++ packages/apt/0012-ndk-r27.patch | 18 -- packages/apt/0013-fix-patterns.patch | 45 ----- packages/apt/0013-ndk-28-char_traits.patch | 52 ++++++ .../apt/0014-iwyu-apt-pkg-solver3.h.patch | 10 ++ packages/apt/build.sh | 32 ++-- packages/apt/emergency-restore.sh.in | 68 +++++++ packages/apt/preinst.sh.in | 27 +++ 15 files changed, 610 insertions(+), 377 deletions(-) delete mode 100644 packages/apt/0007-aptkey-no-root.patch create mode 100644 packages/apt/0007-libcxx-deque-incomplete-type.patch create mode 100644 packages/apt/0012-ndk-28-template-instantiation.patch delete mode 100644 packages/apt/0012-ndk-r27.patch delete mode 100644 packages/apt/0013-fix-patterns.patch create mode 100644 packages/apt/0013-ndk-28-char_traits.patch create mode 100644 packages/apt/0014-iwyu-apt-pkg-solver3.h.patch create mode 100644 packages/apt/emergency-restore.sh.in create mode 100644 packages/apt/preinst.sh.in diff --git a/packages/apt/0000-cmake-fix.patch b/packages/apt/0000-cmake-fix.patch index ab4d63fb1acea93..797231d91ed9260 100644 --- a/packages/apt/0000-cmake-fix.patch +++ b/packages/apt/0000-cmake-fix.patch @@ -1,19 +1,8 @@ -diff -uNr apt-2.1.13/apt-pkg/CMakeLists.txt apt-2.1.13.mod/apt-pkg/CMakeLists.txt ---- apt-2.1.13/apt-pkg/CMakeLists.txt 2020-12-10 16:40:27.000000000 +0200 -+++ apt-2.1.13.mod/apt-pkg/CMakeLists.txt 2020-12-11 18:10:24.236801758 +0200 -@@ -52,7 +52,7 @@ - ) - - 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} -diff -uNr apt-2.2.0/CMakeLists.txt apt-2.2.0.mod/CMakeLists.txt ---- apt-2.2.0/CMakeLists.txt 2020-12-10 16:40:27.000000000 +0200 -+++ apt-2.2.0.mod/CMakeLists.txt 2020-12-11 18:10:24.236801758 +0200 -@@ -189,14 +189,6 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 19e61cd14..a4b9a8aa4 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -193,14 +193,6 @@ if (NOT HAVE_SIGHANDLER_T) endif() endif() @@ -28,18 +17,7 @@ diff -uNr apt-2.2.0/CMakeLists.txt apt-2.2.0.mod/CMakeLists.txt # Configure some variables like package, version and architecture. set(PACKAGE ${PROJECT_NAME}) set(PACKAGE_MAIL "APT Development Team ") -@@ -209,10 +201,6 @@ - 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 ROOT_GROUP) - execute_process(COMMAND id -gn root - OUTPUT_VARIABLE ROOT_GROUP OUTPUT_STRIP_TRAILING_WHITESPACE) -@@ -243,7 +231,6 @@ +@@ -255,7 +247,6 @@ add_subdirectory(doc) add_subdirectory(dselect) add_subdirectory(ftparchive) add_subdirectory(methods) @@ -47,37 +25,25 @@ diff -uNr apt-2.2.0/CMakeLists.txt apt-2.2.0.mod/CMakeLists.txt if (USE_NLS) add_subdirectory(po) -diff -uNr apt-2.1.13/methods/CMakeLists.txt apt-2.1.13.mod/methods/CMakeLists.txt ---- apt-2.1.13/methods/CMakeLists.txt 2020-12-10 16:40:27.000000000 +0200 -+++ apt-2.1.13.mod/methods/CMakeLists.txt 2020-12-11 18:11:00.833144879 +0200 -@@ -11,7 +11,6 @@ - add_executable(cdrom cdrom.cc) - add_executable(http http.cc basehttp.cc $) - add_executable(mirror mirror.cc) --add_executable(ftp ftp.cc $) - add_executable(rred rred.cc) - add_executable(rsh rsh.cc) - -@@ -23,12 +22,11 @@ - - # Additional libraries to link against for networked stuff - target_link_libraries(http $<$:${GNUTLS_LIBRARIES}> $<$:${SYSTEMD_LIBRARIES}>) --target_link_libraries(ftp $<$:${GNUTLS_LIBRARIES}>) - - target_link_libraries(rred apt-private) - - # Install the library --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) +diff --git a/apt-pkg/CMakeLists.txt b/apt-pkg/CMakeLists.txt +index 7aaacd9d9..b577e4f12 100644 +--- a/apt-pkg/CMakeLists.txt ++++ b/apt-pkg/CMakeLists.txt +@@ -61,7 +61,7 @@ target_include_directories(apt-pkg + ) - add_links(${CMAKE_INSTALL_LIBEXECDIR}/apt/methods mirror mirror+ftp mirror+http mirror+https mirror+file mirror+copy) + 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} diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt -index 3060949..3ce03b6 100644 +index 2df0ce721..25441d936 100644 --- a/doc/CMakeLists.txt +++ b/doc/CMakeLists.txt -@@ -1,15 +1,6 @@ - include(Documentation) +@@ -3,15 +3,6 @@ include(Documentation) + endif() set(LINGUAS - de diff --git a/packages/apt/0003-no-srv-records.patch b/packages/apt/0003-no-srv-records.patch index 97a61be36f2aece..bc1dd5d9ce3f46b 100644 --- a/packages/apt/0003-no-srv-records.patch +++ b/packages/apt/0003-no-srv-records.patch @@ -1,6 +1,7 @@ -diff -uNr apt-2.1.18/apt-pkg/contrib/srvrec.cc apt-2.1.18.mod/apt-pkg/contrib/srvrec.cc ---- apt-2.1.18/apt-pkg/contrib/srvrec.cc 2021-01-13 18:37:30.000000000 +0200 -+++ apt-2.1.18.mod/apt-pkg/contrib/srvrec.cc 2021-02-03 21:38:17.382553856 +0200 +diff --git a/apt-pkg/contrib/srvrec.cc b/apt-pkg/contrib/srvrec.cc +index 3ddb95abb..3275b6da2 100644 +--- a/apt-pkg/contrib/srvrec.cc ++++ b/apt-pkg/contrib/srvrec.cc @@ -6,6 +6,7 @@ ##################################################################### */ @@ -9,14 +10,15 @@ diff -uNr apt-2.1.18/apt-pkg/contrib/srvrec.cc apt-2.1.18.mod/apt-pkg/contrib/sr #include #include -@@ -202,3 +203,4 @@ +@@ -210,3 +211,4 @@ SrvRec PopFromSrvRecs(std::vector &Recs) return selected; } +#endif -diff -uNr apt-2.1.18/apt-pkg/contrib/srvrec.h apt-2.1.18.mod/apt-pkg/contrib/srvrec.h ---- apt-2.1.18/apt-pkg/contrib/srvrec.h 2021-01-13 18:37:30.000000000 +0200 -+++ apt-2.1.18.mod/apt-pkg/contrib/srvrec.h 2021-02-03 21:38:17.386553898 +0200 +diff --git a/apt-pkg/contrib/srvrec.h b/apt-pkg/contrib/srvrec.h +index 1e981d3d7..f49c91737 100644 +--- a/apt-pkg/contrib/srvrec.h ++++ b/apt-pkg/contrib/srvrec.h @@ -8,6 +8,7 @@ /*}}}*/ #ifndef SRVREC_H @@ -25,15 +27,16 @@ diff -uNr apt-2.1.18/apt-pkg/contrib/srvrec.h apt-2.1.18.mod/apt-pkg/contrib/srv #include #include -@@ -54,3 +55,4 @@ +@@ -55,3 +56,4 @@ APT_PUBLIC bool GetSrvRecords(std::string host, int port, std::vector &R APT_PUBLIC SrvRec PopFromSrvRecs(std::vector &Recs); #endif +#endif -diff -uNr apt-2.1.18/cmdline/apt-helper.cc apt-2.1.18.mod/cmdline/apt-helper.cc ---- apt-2.1.18/cmdline/apt-helper.cc 2021-01-13 18:37:30.000000000 +0200 -+++ apt-2.1.18.mod/cmdline/apt-helper.cc 2021-02-03 21:38:17.386553898 +0200 -@@ -106,6 +106,7 @@ +diff --git a/cmdline/apt-helper.cc b/cmdline/apt-helper.cc +index 4404259d8..518c98179 100644 +--- a/cmdline/apt-helper.cc ++++ b/cmdline/apt-helper.cc +@@ -106,6 +106,7 @@ static bool DoDownloadFile(CommandLine &CmdL) /*{{{*/ return true; } @@ -41,7 +44,7 @@ diff -uNr apt-2.1.18/cmdline/apt-helper.cc apt-2.1.18.mod/cmdline/apt-helper.cc /*}}}*/ static bool DoSrvLookup(CommandLine &CmdL) /*{{{*/ { -@@ -134,6 +135,7 @@ +@@ -134,6 +135,7 @@ static bool DoSrvLookup(CommandLine &CmdL) /*{{{*/ return true; } /*}}}*/ @@ -49,20 +52,21 @@ diff -uNr apt-2.1.18/cmdline/apt-helper.cc apt-2.1.18.mod/cmdline/apt-helper.cc static const APT::Configuration::Compressor *FindCompressor(std::vector const &compressors, std::string const &name) /*{{{*/ { APT::Configuration::Compressor const * compressor = NULL; -@@ -311,7 +313,9 @@ +@@ -341,7 +343,9 @@ static std::vector GetCommands() /*{{{*/ { return { - {"download-file", &DoDownloadFile, _("download the given uri to the target-path")}, + {"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)")}, + {"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.18/methods/connect.cc apt-2.1.18.mod/methods/connect.cc ---- apt-2.1.18/methods/connect.cc 2021-01-13 18:37:30.000000000 +0200 -+++ apt-2.1.18.mod/methods/connect.cc 2021-02-03 21:41:48.220687372 +0200 -@@ -49,7 +49,9 @@ + {"cat-file", &DoCatFile, _("concatenate files, with automatic decompression")}, + {"hash-file", &DoHashFile, _("hash file")}, + {"auto-detect-proxy", &DoAutoDetectProxy, _("detect proxy using apt.conf")}, +diff --git a/methods/connect.cc b/methods/connect.cc +index 96c169e79..27d7c727b 100644 +--- a/methods/connect.cc ++++ b/methods/connect.cc +@@ -52,7 +52,9 @@ static std::string LastService; static struct addrinfo *LastHostAddr = 0; static struct addrinfo *LastUsed = 0; @@ -72,7 +76,7 @@ diff -uNr apt-2.1.18/methods/connect.cc apt-2.1.18.mod/methods/connect.cc // Set of IP/hostnames that we timed out before or couldn't resolve static std::set bad_addr; -@@ -486,6 +488,10 @@ +@@ -489,6 +491,10 @@ ResultState Connect(std::string Host, int Port, const char *Service, // Used by getaddrinfo(); prefer port if given, else fallback to service std::string ServiceNameOrPort = Port != 0 ? std::to_string(Port) : Service; @@ -83,7 +87,7 @@ diff -uNr apt-2.1.18/methods/connect.cc apt-2.1.18.mod/methods/connect.cc if(LastHost != Host || LastService != ServiceNameOrPort) { SrvRecords.clear(); -@@ -503,7 +509,6 @@ +@@ -506,7 +512,6 @@ ResultState Connect(std::string Host, int Port, const char *Service, } } @@ -91,7 +95,7 @@ diff -uNr apt-2.1.18/methods/connect.cc apt-2.1.18.mod/methods/connect.cc // try to connect in the priority order of the srv records std::string initialHost{std::move(Host)}; auto const initialPort = Port; -@@ -525,6 +530,7 @@ +@@ -528,6 +533,7 @@ ResultState Connect(std::string Host, int Port, const char *Service, } Host = std::move(initialHost); Port = initialPort; diff --git a/packages/apt/0004-no-hardcoded-paths.patch b/packages/apt/0004-no-hardcoded-paths.patch index 525cf91a5c69add..8e0dd50871afb45 100644 --- a/packages/apt/0004-no-hardcoded-paths.patch +++ b/packages/apt/0004-no-hardcoded-paths.patch @@ -1,7 +1,8 @@ -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 @@ +diff --git a/apt-pkg/aptconfiguration.cc b/apt-pkg/aptconfiguration.cc +index 96ff8b285..4d6e631b0 100644 +--- a/apt-pkg/aptconfiguration.cc ++++ b/apt-pkg/aptconfiguration.cc +@@ -35,11 +35,11 @@ namespace APT { // setDefaultConfigurationForCompressors /*{{{*/ static void setDefaultConfigurationForCompressors() { // Set default application paths to check for optional compression types @@ -18,7 +19,7 @@ diff -uNr apt-2.1.11/apt-pkg/aptconfiguration.cc apt-2.1.11.mod/apt-pkg/aptconfi 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"); -@@ -52,7 +52,7 @@ +@@ -52,7 +52,7 @@ static void setDefaultConfigurationForCompressors() { _config->Set("APT::Compressor::lzma::UncompressArg::", "-d"); } } else { @@ -27,10 +28,11 @@ diff -uNr apt-2.1.11/apt-pkg/aptconfiguration.cc apt-2.1.11.mod/apt-pkg/aptconfi 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-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 @@ +diff --git a/apt-pkg/contrib/cdromutl.cc b/apt-pkg/contrib/cdromutl.cc +index ff8fb4835..f2b2b8464 100644 +--- a/apt-pkg/contrib/cdromutl.cc ++++ b/apt-pkg/contrib/cdromutl.cc +@@ -262,7 +262,7 @@ bool IdentCdrom(string CD,string &Res,unsigned int Version) string FindMountPointForDevice(const char *devnode) { // this is the order that mount uses as well @@ -38,20 +40,21 @@ diff -uNr apt-2.1.11/apt-pkg/contrib/cdromutl.cc apt-2.1.11.mod/apt-pkg/contrib/ + std::vector const mounts = _config->FindVector("Dir::state::MountPoints", "/proc/mount"); for (std::vector::const_iterator m = mounts.begin(); m != mounts.end(); ++m) - if (FileExists(*m) == true) -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 @@ + if (FILE * f = fopen(m->c_str(), "r")) +diff --git a/apt-pkg/contrib/fileutl.cc b/apt-pkg/contrib/fileutl.cc +index 4dd7b1ac3..057935e35 100644 +--- a/apt-pkg/contrib/fileutl.cc ++++ b/apt-pkg/contrib/fileutl.cc +@@ -120,7 +120,7 @@ bool RunScripts(const char *Cnf) _exit(100); } - if (chdir("/tmp/") != 0) + if (chdir("@TERMUX_PREFIX@/tmp/") != 0) _exit(100); - + unsigned int Count = 1; -@@ -3105,10 +3105,10 @@ +@@ -3086,10 +3086,10 @@ static std::string APT_NONNULL(1) GetTempDirEnv(char const * const env) /*{{{*/ 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 @@ -64,7 +67,7 @@ diff -uNr apt-2.1.11/apt-pkg/contrib/fileutl.cc apt-2.1.11.mod/apt-pkg/contrib/f return string(tmpdir); } -@@ -3408,7 +3408,7 @@ +@@ -3389,7 +3389,7 @@ bool DropPrivileges() /*{{{*/ setenv("LOGNAME", pw->pw_name, 1); auto const shell = flNotDir(pw->pw_shell); if (shell == "false" || shell == "nologin") @@ -73,10 +76,11 @@ diff -uNr apt-2.1.11/apt-pkg/contrib/fileutl.cc apt-2.1.11.mod/apt-pkg/contrib/f else setenv("SHELL", pw->pw_shell, 1); auto const apt_setenv_tmp = [](char const * const env) { -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 @@ +diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc +index 09f3e4783..8387d4864 100644 +--- a/apt-pkg/deb/dpkgpm.cc ++++ b/apt-pkg/deb/dpkgpm.cc +@@ -185,7 +185,7 @@ namespace so we use the binary from util-linux */ static bool ionice(int PID) { @@ -85,7 +89,7 @@ diff -uNr apt-2.1.11/apt-pkg/deb/dpkgpm.cc apt-2.1.11.mod/apt-pkg/deb/dpkgpm.cc return false; pid_t Process = ExecFork(); if (Process == 0) -@@ -187,7 +187,7 @@ +@@ -193,7 +193,7 @@ static bool ionice(int PID) char buf[32]; snprintf(buf, sizeof(buf), "-p%d", PID); const char *Args[4]; @@ -94,7 +98,7 @@ diff -uNr apt-2.1.11/apt-pkg/deb/dpkgpm.cc apt-2.1.11.mod/apt-pkg/deb/dpkgpm.cc Args[1] = "-c3"; Args[2] = buf; Args[3] = 0; -@@ -482,7 +482,7 @@ +@@ -476,7 +476,7 @@ bool pkgDPkgPM::RunScriptsWithPkgs(const char *Cnf) debSystem::DpkgChrootDirectory(); const char *Args[4]; @@ -103,49 +107,40 @@ diff -uNr apt-2.1.11/apt-pkg/deb/dpkgpm.cc apt-2.1.11.mod/apt-pkg/deb/dpkgpm.cc Args[1] = "-c"; Args[2] = Opts->Value.c_str(); Args[3] = 0; -@@ -2456,10 +2456,10 @@ +@@ -2453,11 +2453,11 @@ void pkgDPkgPM::WriteApportReport(const char *pkgpath, const char *errormsg) } // attach dmesg log (to learn about segfaults) - if (FileExists("/bin/dmesg")) +- CopyIndented("Dmesg:\n", make_unique_popen("/bin/dmesg","r").get(), report); + 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]; -@@ -2470,11 +2470,11 @@ - } ++ CopyIndented("Dmesg:\n", make_unique_popen("@TERMUX_PREFIX@/bin/dmesg","r").get(), report); // attach df -l log (to learn about filesystem status) - if (FileExists("/bin/df")) +- CopyIndented("Df:\n", make_unique_popen("/bin/df -l -x squashfs","r").get(), report); + if (FileExists("@TERMUX_PREFIX@/bin/df")) - { - - fprintf(report, "Df:\n"); -- 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-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); - ++ CopyIndented("Df:\n", make_unique_popen("@TERMUX_PREFIX@/bin/df","r").get(), report); + } + /*}}}*/ +diff --git a/apt-pkg/init.cc b/apt-pkg/init.cc +index 61d45e37e..bb01d3185 100644 +--- a/apt-pkg/init.cc ++++ b/apt-pkg/init.cc +@@ -224,7 +224,7 @@ bool pkgInitConfig(Configuration &Cnf) + Cnf.CndSet("Acquire::Snapshots::URI::Host::ppa.launchpadcontent.net", "https://snapshot.ppa.launchpadcontent.net/@PATH@/@SNAPSHOTID@/"); + Cnf.CndSet("Acquire::Snapshots::URI::Host::ppa.launchpad.net", "https://snapshot.ppa.launchpadcontent.net/@PATH@/@SNAPSHOTID@/"); - 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 @@ +diff --git a/apt-private/private-json-hooks.cc b/apt-private/private-json-hooks.cc +index 6169488f6..fb71cbfe6 100644 +--- a/apt-private/private-json-hooks.cc ++++ b/apt-private/private-json-hooks.cc +@@ -471,7 +471,7 @@ bool RunJsonHook(std::string const &option, std::string const &method, const cha DpkgChrootDirectory(); const char *Args[4]; @@ -154,10 +149,11 @@ diff -uNr apt-2.1.11/apt-private/private-json-hooks.cc apt-2.1.11.mod/apt-privat 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 @@ +diff --git a/cmdline/apt-dump-solver.cc b/cmdline/apt-dump-solver.cc +index 05142d9dd..26565b292 100644 +--- a/cmdline/apt-dump-solver.cc ++++ b/cmdline/apt-dump-solver.cc +@@ -77,7 +77,7 @@ int main(int argc,const char *argv[]) /*{{{*/ { 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" @@ -166,64 +162,3 @@ diff -uNr apt-2.1.11/cmdline/apt-dump-solver.cc apt-2.1.11.mod/cmdline/apt-dump- 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" -+ 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")" -@@ -535,7 +535,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 -@@ -547,13 +547,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 -@@ -653,7 +653,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 -@@ -697,7 +697,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/0007-aptkey-no-root.patch b/packages/apt/0007-aptkey-no-root.patch deleted file mode 100644 index a30e06ba9ed3529..000000000000000 --- a/packages/apt/0007-aptkey-no-root.patch +++ /dev/null @@ -1,12 +0,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-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 diff --git a/packages/apt/0007-libcxx-deque-incomplete-type.patch b/packages/apt/0007-libcxx-deque-incomplete-type.patch new file mode 100644 index 000000000000000..b8a7a877ff28b52 --- /dev/null +++ b/packages/apt/0007-libcxx-deque-incomplete-type.patch @@ -0,0 +1,139 @@ +The support for incomplete type in libcxx's deque requires `LIBCXX_ABI_VERSION >= 2`, but NDK's libcxx has version 1 + +[1] https://github.com/llvm/llvm-project/blob/a29be9f28e8e0d4ca7a8a3cfdffe616ac780c754/libcxx/include/deque#L278 +[2] https://github.com/llvm/llvm-project/blob/a29be9f28e8e0d4ca7a8a3cfdffe616ac780c754/libcxx/include/__configuration/abi.h#L40-L45 + +--- a/apt-pkg/solver3.h ++++ b/apt-pkg/solver3.h +@@ -80,7 +80,64 @@ + { + enum class Decision : uint16_t; + enum class Hint : uint16_t; +- struct Var; ++ /** ++ * \brief Tagged union holding either a package, version, or nothing; representing the reason for installing something. ++ * ++ * We want to keep track of the reason why things are being installed such that ++ * we can have sensible debugging abilities; and we want to generically refer to ++ * both packages and versions as variables, hence this class was added. ++ * ++ */ ++ struct Var ++ { ++ uint32_t value; ++ ++ explicit constexpr Var(uint32_t value = 0) : value{value} {} ++ explicit Var(pkgCache::PkgIterator const &Pkg) : value(uint32_t(Pkg.MapPointer()) << 1) {} ++ explicit Var(pkgCache::VerIterator const &Ver) : value(uint32_t(Ver.MapPointer()) << 1 | 1) {} ++ ++ inline constexpr bool isVersion() const { return value & 1; } ++ inline constexpr uint32_t mapPtr() const { return value >> 1; } ++ ++ // \brief Return the package, if any, otherwise 0. ++ map_pointer Pkg() const ++ { ++ return isVersion() ? 0 : map_pointer{mapPtr()}; ++ } ++ // \brief Return the version, if any, otherwise 0. ++ map_pointer Ver() const ++ { ++ return isVersion() ? map_pointer{mapPtr()} : 0; ++ } ++ // \brief Return the package iterator if storing a package, or an empty one ++ pkgCache::PkgIterator Pkg(pkgCache &cache) const ++ { ++ return isVersion() ? pkgCache::PkgIterator() : pkgCache::PkgIterator(cache, cache.PkgP + Pkg()); ++ } ++ // \brief Return the version iterator if storing a package, or an empty end. ++ pkgCache::VerIterator Ver(pkgCache &cache) const ++ { ++ return isVersion() ? pkgCache::VerIterator(cache, cache.VerP + Ver()) : pkgCache::VerIterator(); ++ } ++ // \brief Return a package, cast from version if needed ++ pkgCache::PkgIterator CastPkg(pkgCache &cache) const ++ { ++ return isVersion() ? Ver(cache).ParentPkg() : Pkg(cache); ++ } ++ // \brief Check if there is no reason. ++ constexpr bool empty() const { return value == 0; } ++ constexpr bool operator!=(Var const other) const { return value != other.value; } ++ constexpr bool operator==(Var const other) const { return value == other.value; } ++ ++ std::string toString(pkgCache &cache) const ++ { ++ if (auto P = Pkg(cache); not P.end()) ++ return P.FullName(); ++ if (auto V = Ver(cache); not V.end()) ++ return V.ParentPkg().FullName() + "=" + V.VerStr(); ++ return "(root)"; ++ } ++ }; + struct CompareProviders3; + struct State; + struct Clause; +@@ -321,65 +378,6 @@ + }; // namespace APT + + /** +- * \brief Tagged union holding either a package, version, or nothing; representing the reason for installing something. +- * +- * We want to keep track of the reason why things are being installed such that +- * we can have sensible debugging abilities; and we want to generically refer to +- * both packages and versions as variables, hence this class was added. +- * +- */ +-struct APT::Solver::Var +-{ +- uint32_t value; +- +- explicit constexpr Var(uint32_t value = 0) : value{value} {} +- explicit Var(pkgCache::PkgIterator const &Pkg) : value(uint32_t(Pkg.MapPointer()) << 1) {} +- explicit Var(pkgCache::VerIterator const &Ver) : value(uint32_t(Ver.MapPointer()) << 1 | 1) {} +- +- inline constexpr bool isVersion() const { return value & 1; } +- inline constexpr uint32_t mapPtr() const { return value >> 1; } +- +- // \brief Return the package, if any, otherwise 0. +- map_pointer Pkg() const +- { +- return isVersion() ? 0 : map_pointer{mapPtr()}; +- } +- // \brief Return the version, if any, otherwise 0. +- map_pointer Ver() const +- { +- return isVersion() ? map_pointer{mapPtr()} : 0; +- } +- // \brief Return the package iterator if storing a package, or an empty one +- pkgCache::PkgIterator Pkg(pkgCache &cache) const +- { +- return isVersion() ? pkgCache::PkgIterator() : pkgCache::PkgIterator(cache, cache.PkgP + Pkg()); +- } +- // \brief Return the version iterator if storing a package, or an empty end. +- pkgCache::VerIterator Ver(pkgCache &cache) const +- { +- return isVersion() ? pkgCache::VerIterator(cache, cache.VerP + Ver()) : pkgCache::VerIterator(); +- } +- // \brief Return a package, cast from version if needed +- pkgCache::PkgIterator CastPkg(pkgCache &cache) const +- { +- return isVersion() ? Ver(cache).ParentPkg() : Pkg(cache); +- } +- // \brief Check if there is no reason. +- constexpr bool empty() const { return value == 0; } +- constexpr bool operator!=(Var const other) const { return value != other.value; } +- constexpr bool operator==(Var const other) const { return value == other.value; } +- +- std::string toString(pkgCache &cache) const +- { +- if (auto P = Pkg(cache); not P.end()) +- return P.FullName(); +- if (auto V = Ver(cache); not V.end()) +- return V.ParentPkg().FullName() + "=" + V.VerStr(); +- return "(root)"; +- } +-}; +- +-/** + * \brief A single clause + * + * A clause is a normalized, expanded dependency, translated into an implication diff --git a/packages/apt/0010-prevent-usage-as-root.patch b/packages/apt/0010-prevent-usage-as-root.patch index e3469d425b75df0..1204d963034aaaf 100644 --- a/packages/apt/0010-prevent-usage-as-root.patch +++ b/packages/apt/0010-prevent-usage-as-root.patch @@ -1,22 +1,24 @@ -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 @@ +diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc +index ae2356325..fdde111f3 100644 +--- a/cmdline/apt-get.cc ++++ b/cmdline/apt-get.cc +@@ -440,6 +440,11 @@ static std::vector GetCommands() /*{{{*/ /*}}}*/ - int main(int argc, const char *argv[]) /*{{{*/ + int main(int argc,const char *argv[]) /*{{{*/ { + if (getuid() == 0) { + 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, &_config, &_system, argc, argv, &ShowHelp, &GetCommands); - -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 @@ + auto const Cmds = ParseCommandLine(CmdL, APT_CMD::APT_GET, &_config, &_system, argc, argv, &ShowHelp, &GetCommands); +diff --git a/cmdline/apt-mark.cc b/cmdline/apt-mark.cc +index 180247cd0..e3f24ec8b 100644 +--- a/cmdline/apt-mark.cc ++++ b/cmdline/apt-mark.cc +@@ -432,6 +432,11 @@ static std::vector GetCommands() /*{{{*/ /*}}}*/ int main(int argc,const char *argv[]) /*{{{*/ { @@ -25,76 +27,16 @@ diff -uNr apt-2.1.11/cmdline/apt-get.cc apt-2.1.11.mod/cmdline/apt-get.cc + 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-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 "Ability to run this command as root has been disabled for safety purposes." -+ exit 1 -+ fi - } + auto const Cmds = ParseCommandLine(CmdL, APT_CMD::APT_MARK, &_config, &_system, argc, argv, &ShowHelp, &GetCommands); - command_available() { -@@ -624,7 +624,6 @@ - create_new_keyring() { if [ ! -r "$FORCED_KEYRING" ]; then TRUSTEDFILE='/dev/null'; FORCED_KEYRING="$TRUSTEDFILE"; fi; } - ;; - --fakeroot) -- requires_root() { true; } - ;; - --quiet) - aptkey_echo() { true; } -@@ -762,7 +761,7 @@ - case "$command" in - add) - warn_on_script_usage -- requires_root -+ assert_no_root - setup_merged_keyring - aptkey_execute "$GPG" --quiet --batch --import "$@" - merge_back_changes -@@ -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' "$@" - aptkey_echo "OK" - ;; - update) - warn_on_script_usage -- requires_root -+ assert_no_root - setup_merged_keyring - update - 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-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 @@ +diff --git a/cmdline/apt.cc b/cmdline/apt.cc +index af8a95fa5..88c2692ad 100644 +--- a/cmdline/apt.cc ++++ b/cmdline/apt.cc +@@ -105,6 +105,11 @@ static std::vector GetCommands() /*{{{*/ /*}}}*/ - int main(int argc,const char *argv[]) /*{{{*/ + int main(int argc, const char *argv[]) /*{{{*/ { + if (getuid() == 0) { + std::cout << "Ability to run this command as root has been disabled permanently for safety purposes." << std::endl; @@ -102,5 +44,5 @@ diff -uNr apt-2.1.11/cmdline/apt-mark.cc apt-2.1.11.mod/cmdline/apt-mark.cc + } + CommandLine CmdL; - auto const Cmds = ParseCommandLine(CmdL, APT_CMD::APT_MARK, &_config, &_system, argc, argv, &ShowHelp, &GetCommands); + auto const Cmds = ParseCommandLine(CmdL, APT_CMD::APT, &_config, &_system, argc, argv, &ShowHelp, &GetCommands); diff --git a/packages/apt/0011-keep-downloaded-packages.patch b/packages/apt/0011-keep-downloaded-packages.patch index dbc1b508e9a09df..af8ddff0ae14377 100644 --- a/packages/apt/0011-keep-downloaded-packages.patch +++ b/packages/apt/0011-keep-downloaded-packages.patch @@ -1,12 +1,13 @@ -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); - +diff --git a/apt-private/private-cmndline.cc b/apt-private/private-cmndline.cc +index c26a3f7f4..bfd42d84f 100644 +--- a/apt-private/private-cmndline.cc ++++ b/apt-private/private-cmndline.cc +@@ -512,7 +512,7 @@ static void BinarySpecificConfiguration(char const * const Binary) /*{{{*/ + _config->CndSet("Version::1.1::APT::Get::Upgrade-Allow-New", true); + _config->CndSet("Version::1.1::APT::Cmd::Show-Update-Stats", true); + _config->CndSet("Version::1.2::DPkg::Progress-Fancy", true); +- _config->CndSet("Version::1.2::APT::Keep-Downloaded-Packages", false); ++ _config->CndSet("Version::1.2::APT::Keep-Downloaded-Packages", true); + _config->CndSet("Version::1.5::APT::Get::Update::InteractiveReleaseInfoChanges", true); + _config->CndSet("Version::2.0::APT::Cmd::Pattern-Only", true); + _config->CndSet("Version::3.0::Pager", true); diff --git a/packages/apt/0012-ndk-28-template-instantiation.patch b/packages/apt/0012-ndk-28-template-instantiation.patch new file mode 100644 index 000000000000000..e54009be44c0c71 --- /dev/null +++ b/packages/apt/0012-ndk-28-template-instantiation.patch @@ -0,0 +1,160 @@ +Since LLVM 19, referencing non-existent methods inside templates +is no longer allowed, even if the template is never instantiated. + +Remove the use of `std::forward_list` in `apt-pkg/cacheset.h`, as +`std::forward_list` does not provide a `size()` method. + +See [1] for details. + +[1]: https://github.com/llvm/llvm-project/pull/90152 + +--- a/apt-pkg/cacheset.h ++++ b/apt-pkg/cacheset.h +@@ -13,7 +13,9 @@ + #include + #include + #if __cplusplus >= 201103L ++#if 0 + #include ++#endif + #include + #include + #endif +@@ -540,11 +542,13 @@ + _cont.push_back(*p); + } + #if __cplusplus >= 201103L ++#if 0 + template<> template void PackageContainer >::insert(PackageContainer const &pkgcont) { + for (typename PackageContainer::const_iterator p = pkgcont.begin(); p != pkgcont.end(); ++p) + _cont.push_front(*p); + } + #endif ++#endif + template<> template void PackageContainer >::insert(PackageContainer const &pkgcont) { + for (typename PackageContainer::const_iterator p = pkgcont.begin(); p != pkgcont.end(); ++p) + _cont.push_back(*p); +@@ -562,6 +566,7 @@ + return true; + } + #if __cplusplus >= 201103L ++#if 0 + template<> inline bool PackageContainer >::insert(pkgCache::PkgIterator const &P) { + if (P.end() == true) + return false; +@@ -569,6 +574,7 @@ + return true; + } + #endif ++#endif + template<> inline bool PackageContainer >::insert(pkgCache::PkgIterator const &P) { + if (P.end() == true) + return false; +@@ -586,11 +592,13 @@ + _cont.push_back(*p); + } + #if __cplusplus >= 201103L ++#if 0 + template<> inline void PackageContainer >::insert(const_iterator begin, const_iterator end) { + for (const_iterator p = begin; p != end; ++p) + _cont.push_front(*p); + } + #endif ++#endif + template<> inline void PackageContainer >::insert(const_iterator begin, const_iterator end) { + for (const_iterator p = begin; p != end; ++p) + _cont.push_back(*p); +@@ -618,11 +626,13 @@ + return true; + } + #if __cplusplus >= 201103L ++#if 0 + template<> template inline bool PackageContainer >::sort(Compare Comp) { + _cont.sort(Comp); + return true; + } + #endif ++#endif + template<> template inline bool PackageContainer >::sort(Compare Comp) { + std::sort(_cont.begin(), _cont.end(), Comp); + return true; +@@ -687,8 +697,10 @@ + typedef PackageContainer > PackageSet; + #if __cplusplus >= 201103L + typedef PackageContainer > PackageUnorderedSet; ++#if 0 + typedef PackageContainer > PackageForwardList; + #endif ++#endif + typedef PackageContainer > PackageList; + typedef PackageContainer > PackageDeque; + typedef PackageContainer > PackageVector; +@@ -977,11 +989,13 @@ + _cont.push_back(*v); + } + #if __cplusplus >= 201103L ++#if 0 + template<> template void VersionContainer >::insert(VersionContainer const &vercont) { + for (typename VersionContainer::const_iterator v = vercont.begin(); v != vercont.end(); ++v) + _cont.push_front(*v); + } + #endif ++#endif + template<> template void VersionContainer >::insert(VersionContainer const &vercont) { + for (typename VersionContainer::const_iterator v = vercont.begin(); v != vercont.end(); ++v) + _cont.push_back(*v); +@@ -999,6 +1013,7 @@ + return true; + } + #if __cplusplus >= 201103L ++#if 0 + template<> inline bool VersionContainer >::insert(pkgCache::VerIterator const &V) { + if (V.end() == true) + return false; +@@ -1006,6 +1021,7 @@ + return true; + } + #endif ++#endif + template<> inline bool VersionContainer >::insert(pkgCache::VerIterator const &V) { + if (V.end() == true) + return false; +@@ -1023,11 +1039,13 @@ + _cont.push_back(*v); + } + #if __cplusplus >= 201103L ++#if 0 + template<> inline void VersionContainer >::insert(const_iterator begin, const_iterator end) { + for (const_iterator v = begin; v != end; ++v) + _cont.push_front(*v); + } + #endif ++#endif + template<> inline void VersionContainer >::insert(const_iterator begin, const_iterator end) { + for (const_iterator v = begin; v != end; ++v) + _cont.push_back(*v); +@@ -1055,11 +1073,13 @@ + return true; + } + #if __cplusplus >= 201103L ++#if 0 + template<> template inline bool VersionContainer >::sort(Compare Comp) { + _cont.sort(Comp); + return true; + } + #endif ++#endif + template<> template inline bool VersionContainer >::sort(Compare Comp) { + std::sort(_cont.begin(), _cont.end(), Comp); + return true; +@@ -1069,8 +1089,10 @@ + typedef VersionContainer > VersionSet; + #if __cplusplus >= 201103L + typedef VersionContainer > VersionUnorderedSet; ++#if 0 + typedef VersionContainer > VersionForwardList; + #endif ++#endif + typedef VersionContainer > VersionList; + typedef VersionContainer > VersionDeque; + typedef VersionContainer > VersionVector; diff --git a/packages/apt/0012-ndk-r27.patch b/packages/apt/0012-ndk-r27.patch deleted file mode 100644 index 3fa8380b63c8048..000000000000000 --- a/packages/apt/0012-ndk-r27.patch +++ /dev/null @@ -1,18 +0,0 @@ -Just to make libcxx happy - ---- a/apt-pkg/cacheset.h -+++ b/apt-pkg/cacheset.h -@@ -218,11 +218,11 @@ - operator container_iterator(void) const { return _iter; } - inline iterator_type& operator++() { ++_iter; return static_cast(*this); } - inline iterator_type operator++(int) { iterator_type tmp(*this); operator++(); return tmp; } -- inline iterator_type operator+(typename container_iterator::difference_type const &n) { return iterator_type(_iter + n); } -+ inline iterator_type operator+(typename container_iterator::difference_type const &n) const { return iterator_type(_iter + n); } - inline iterator_type operator+=(typename container_iterator::difference_type const &n) { _iter += n; return static_cast(*this); } - inline iterator_type& operator--() { --_iter;; return static_cast(*this); } - inline iterator_type operator--(int) { iterator_type tmp(*this); operator--(); return tmp; } -- inline iterator_type operator-(typename container_iterator::difference_type const &n) { return iterator_type(_iter - n); } -+ inline iterator_type operator-(typename container_iterator::difference_type const &n) const { return iterator_type(_iter - n); } - inline typename container_iterator::difference_type operator-(iterator_type const &b) { return (_iter - b._iter); } - inline iterator_type operator-=(typename container_iterator::difference_type const &n) { _iter -= n; return static_cast(*this); } - inline bool operator!=(iterator_type const &i) const { return _iter != i._iter; } diff --git a/packages/apt/0013-fix-patterns.patch b/packages/apt/0013-fix-patterns.patch deleted file mode 100644 index 0956f39391a00e8..000000000000000 --- a/packages/apt/0013-fix-patterns.patch +++ /dev/null @@ -1,45 +0,0 @@ -https://github.com/Debian/apt/pull/136 -diff --git a/apt-pkg/cachefilter-patterns.cc b/apt-pkg/cachefilter-patterns.cc -index 12d8ae748..7a3255f41 100644 ---- a/apt-pkg/cachefilter-patterns.cc -+++ b/apt-pkg/cachefilter-patterns.cc -@@ -30,7 +30,7 @@ static const constexpr struct - {"c"_sv, "?config-files"_sv, false}, - // FIXME: The words after ~D should be case-insensitive - {"DDepends:"_sv, "?depends"_sv, true}, -- {"DPre-Depends:"_sv, "?pre-depends"_sv, true}, -+ {"DPreDepends:"_sv, "?predepends"_sv, true}, - {"DSuggests:"_sv, "?suggests"_sv, true}, - {"DRecommends:"_sv, "?recommends"_sv, true}, - {"DConflicts:"_sv, "?conflicts"_sv, true}, -@@ -40,7 +40,7 @@ static const constexpr struct - {"DEnhances:"_sv, "?enhances"_sv, true}, - {"D"_sv, "?depends"_sv, true}, - {"RDepends:"_sv, "?reverse-depends"_sv, true}, -- {"RPre-Depends:"_sv, "?reverse-pre-depends"_sv, true}, -+ {"RPreDepends:"_sv, "?reverse-predepends"_sv, true}, - {"RSuggests:"_sv, "?reverse-suggests"_sv, true}, - {"RRecommends:"_sv, "?reverse-recommends"_sv, true}, - {"RConflicts:"_sv, "?reverse-conflicts"_sv, true}, -diff --git a/doc/apt-patterns.7.xml b/doc/apt-patterns.7.xml -index 6b1c0f20b..bbcf01138 100644 ---- a/doc/apt-patterns.7.xml -+++ b/doc/apt-patterns.7.xml -@@ -161,14 +161,15 @@ - - - ?depends(PATTERN)~DPATTERN -- ?pre-depends(PATTERN)~DPre-Depends:PATTERN -+ ?predepends(PATTERN)~DPreDepends:PATTERN - ?suggests(PATTERN)~DSuggests:PATTERN -+ ?recommends(PATTERN)~DRecommends:PATTERN - ?conflicts(PATTERN)~DConflicts:PATTERN - ?replaces(PATTERN)~DReplaces:PATTERN - ?obsoletes(PATTERN)~DObsoletes:PATTERN - ?breaks(PATTERN)~DBreaks:PATTERN - ?enhances(PATTERN)~DEnhances:PATTERN -- Selects versions depending/pre-depending/suggesting/conflicting/etc on/with/ packages matching PATTERN. -+ Selects versions depending/pre-depending/suggesting/recommending/conflicting/etc on/with/ packages matching PATTERN. - - - ?reverse-depType(PATTERN) diff --git a/packages/apt/0013-ndk-28-char_traits.patch b/packages/apt/0013-ndk-28-char_traits.patch new file mode 100644 index 000000000000000..ba5243c66803d8f --- /dev/null +++ b/packages/apt/0013-ndk-28-char_traits.patch @@ -0,0 +1,52 @@ +Since LLVM 19, `std::char_traits<>` is only provided for `char`, `char8_t`, +`char16_t`, `char32_t`, and `wchar_t`. Any instantiation with other types +will result in a compilation error. + +This patch replace all usages of `std::basic_string_view` +with a custom `ByteView` implementation. + +--- a/apt-pkg/contrib/hashes.cc ++++ b/apt-pkg/contrib/hashes.cc +@@ -33,6 +33,24 @@ + #include + /*}}}*/ + ++#if defined(__clang__) && __clang_major__ >= 19 ++class ByteView { ++public: ++ constexpr ByteView() noexcept : data_(nullptr), size_(0) {} ++ constexpr ByteView(const unsigned char* data, std::size_t size) noexcept ++ : data_(data), size_(size) {} ++ ++ constexpr std::size_t size() const noexcept { return size_; } ++ constexpr const unsigned char& operator[](std::size_t i) const noexcept { return data_[i]; } ++ ++private: ++ const unsigned char* data_; ++ std::size_t size_; ++}; ++#else ++using ByteView = std::basic_string_view; ++#endif ++ + const char * HashString::_SupportedHashes[] = + { + "SHA512", "SHA256", "SHA1", "MD5Sum", "Checksum-FileSize", NULL +@@ -296,7 +314,7 @@ + return !(*this == other); + } + /*}}}*/ +-static APT_PURE std::string HexDigest(std::basic_string_view const &Sum) ++static APT_PURE std::string HexDigest(ByteView const &Sum) + { + char Conv[16] = + {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', +@@ -360,7 +378,7 @@ + EVP_DigestFinal_ex(tmpContext, Sum, nullptr); + EVP_MD_CTX_destroy(tmpContext); + +- return ::HexDigest(std::basic_string_view(Sum, Size)); ++ return ::HexDigest(ByteView(Sum, Size)); + } + + bool Enable(HashAlgo const &algo) diff --git a/packages/apt/0014-iwyu-apt-pkg-solver3.h.patch b/packages/apt/0014-iwyu-apt-pkg-solver3.h.patch new file mode 100644 index 000000000000000..b5e6fab7be6b8c8 --- /dev/null +++ b/packages/apt/0014-iwyu-apt-pkg-solver3.h.patch @@ -0,0 +1,10 @@ +--- a/apt-pkg/solver3.h ++++ b/apt-pkg/solver3.h +@@ -8,6 +8,7 @@ + */ + + #include ++#include + #include + #include + #include diff --git a/packages/apt/build.sh b/packages/apt/build.sh index cb404982091b5c6..1753d259449c191 100644 --- a/packages/apt/build.sh +++ b/packages/apt/build.sh @@ -1,19 +1,18 @@ 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_LICENSE="BSD 3-Clause, GPL-2.0-only, GPL-2.0-or-later, MIT" TERMUX_PKG_MAINTAINER="@termux" -TERMUX_PKG_VERSION="2.8.1" -TERMUX_PKG_REVISION=2 +TERMUX_PKG_VERSION="3.1.11" # old tarball are removed in https://deb.debian.org/debian/pool/main/a/apt/apt_${TERMUX_PKG_VERSION}.tar.xz -TERMUX_PKG_SRCURL=https://salsa.debian.org/apt-team/apt/-/archive/${TERMUX_PKG_VERSION}/apt-${TERMUX_PKG_VERSION}.tar.bz2 -TERMUX_PKG_SHA256=87ca18392c10822a133b738118505f7d04e0b31ba1122bf5d32911311cb2dc7e +TERMUX_PKG_SRCURL=https://salsa.debian.org/apt-team/apt/-/archive/${TERMUX_PKG_VERSION}/apt-${TERMUX_PKG_VERSION}.tar.gz +TERMUX_PKG_SHA256=da0d2b29fde9d8cfbbb61a6f2e781901ff45d445b06b8da114b571f22c4642e4 # apt-key requires utilities from coreutils, findutils, gpgv, grep, sed. -TERMUX_PKG_DEPENDS="coreutils, dpkg, findutils, gpgv, grep, libandroid-glob, libbz2, libc++, libiconv, libgcrypt, libgnutls, liblz4, liblzma, sed, termux-keyring, termux-licenses, xxhash, zlib, zstd" -TERMUX_PKG_BUILD_DEPENDS="docbook-xsl,libdb" +TERMUX_PKG_DEPENDS="coreutils, dpkg, findutils, grep, libandroid-glob, libbz2, libc++, libiconv, liblz4, liblzma, libseccomp, openssl, sed, sequoia-sqv | gpgv, termux-keyring, termux-licenses, xxhash, zlib, zstd" +TERMUX_PKG_BUILD_DEPENDS="docbook-xsl, libdb, gnupg, sequoia-sqv" TERMUX_PKG_CONFLICTS="apt-transport-https, libapt-pkg, unstable-repo, game-repo, science-repo" TERMUX_PKG_REPLACES="apt-transport-https, libapt-pkg, unstable-repo, game-repo, science-repo" TERMUX_PKG_PROVIDES="unstable-repo, game-repo, science-repo" -TERMUX_PKG_SUGGESTS="gnupg" +TERMUX_PKG_SUGGESTS="gnupg, less" TERMUX_PKG_ESSENTIAL=true TERMUX_PKG_CONFFILES=" @@ -30,6 +29,7 @@ TERMUX_PKG_EXTRA_CONFIGURE_ARGS=" -DUSE_NLS=OFF -DWITH_DOC=OFF -DWITH_DOC_MANPAGES=ON +-DDEFAULT_PAGER=$TERMUX_PREFIX/bin/less " # ubuntu uses instead $PREFIX/lib instead of $PREFIX/libexec to @@ -78,14 +78,18 @@ termux_step_post_make_install() { echo "deb https://packages-cf.termux.dev/apt/termux-main/ stable main" echo "# The main termux repository, without cloudflare cache" echo "# deb https://packages.termux.dev/apt/termux-main/ stable main" - } > $TERMUX_PREFIX/etc/apt/sources.list + } > "$TERMUX_PREFIX/etc/apt/sources.list" # apt-transport-tor - ln -sfr $TERMUX_PREFIX/lib/apt/methods/http $TERMUX_PREFIX/lib/apt/methods/tor - ln -sfr $TERMUX_PREFIX/lib/apt/methods/http $TERMUX_PREFIX/lib/apt/methods/tor+http - ln -sfr $TERMUX_PREFIX/lib/apt/methods/https $TERMUX_PREFIX/lib/apt/methods/tor+https + ln -sfr "$TERMUX_PREFIX/lib/apt/methods/http" "$TERMUX_PREFIX/lib/apt/methods/tor" + ln -sfr "$TERMUX_PREFIX/lib/apt/methods/http" "$TERMUX_PREFIX/lib/apt/methods/tor+http" + ln -sfr "$TERMUX_PREFIX/lib/apt/methods/https" "$TERMUX_PREFIX/lib/apt/methods/tor+https" # Workaround for "empty" subpackage: local dir=$TERMUX_PREFIX/share/apt-transport-tor - mkdir -p $dir - touch $dir/.placeholder + mkdir -p "$dir" + touch "$dir/.placeholder" + + sed -e "s|@TERMUX_PREFIX@|${TERMUX_PREFIX}|g" \ + -e "s|@TERMUX_ARCH@|${TERMUX_ARCH}|g" \ + "$TERMUX_SCRIPTDIR/packages/apt/emergency-restore.sh.in" > "$TERMUX_PREFIX/bin/apt-emergency-restore" } diff --git a/packages/apt/emergency-restore.sh.in b/packages/apt/emergency-restore.sh.in new file mode 100644 index 000000000000000..a5675e5394a213d --- /dev/null +++ b/packages/apt/emergency-restore.sh.in @@ -0,0 +1,68 @@ +#!@TERMUX_PREFIX@/bin/sh +# shellcheck shell=dash + +set -eu + +is_installed() { + case "$(dpkg-query -W -f '${db:Status-Status}' "$1" 2>/dev/null)" in + 'not-installed'|'config-files') return 1;; + esac +} + +was_upgraded() { + case "$1" in + # Versions of the rebuilt packages prior to the Apt 3.x merge + 'apt') OLD_VERSION='2.8.1-1';; + 'dpkg') OLD_VERSION='1.22.6-1';; + 'apt-file') OLD_VERSION='3.3';; + 'libapt-pkg-perl') OLD_VERSION='0.1.40-10';; + 'nala') OLD_VERSION='0.16.0';; + 'synaptic') OLD_VERSION='0.91.7-1';; + 'termux-tools') OLD_VERSION='1.46.0+really1.45.0';; + *) # How did we get here? + echo "Package '$1' isn't covered by this script." + return 1 + ;; + esac + + INSTALLED_VERSION="$(dpkg-query -W -f '${Version}' "$1")" + + dpkg --compare-versions "$INSTALLED_VERSION" le "$OLD_VERSION" +} + +download_backup() { + PKG_NAME="$1" + was_upgraded "$PKG_NAME" || return 1 + + TERMUX_ARCH="@TERMUX_ARCH@" + OUTPUT_FILE"${TMPDIR:-@TERMUX_PREFIX@/tmp}/${PKG_NAME}_${OLD_VERSION}_${TERMUX_ARCH}.deb" + PKG_URL="$MIRROR_URL" + curl -L "$PKG_URL" -o "$OUTPUT_FILE" +} + +downgrade() { + # Check that 'dpkg' is in a sane enough state to mark itself 'ok' + case "$(dpkg-query -W -f '${Status}' dpkg)" in + *' ok '*);; + *) # If 'dpkg' isn't in a known 'ok' state something has gone very wrong. + echo "Something is seriously wrong with 'dpkg'." + echo "Unable to proceed with automatic restore." + exit 1 + ;; + esac + + for package in 'dpkg' 'apt' 'libapt-pkg-perl' 'apt-file' 'nala' 'synaptic' 'termux-tools'; do + echo "Checking: '$package'" + + # Do we even have this package? + is_installed "$package" || continue + + # Download the old DEB if needed + download_backup "$package" + + done + # Force install the old version. + dpkg -i "$OUTPUT_FILE" +} + +downgrade diff --git a/packages/apt/preinst.sh.in b/packages/apt/preinst.sh.in new file mode 100644 index 000000000000000..b87fccb7410222f --- /dev/null +++ b/packages/apt/preinst.sh.in @@ -0,0 +1,27 @@ +#!@TERMUX_PREFIX@/bin/bash +# shellcheck shell=bash + +if [[ "$1" == "install" || "$1" == "upgrade" && "$#" -ge 2 ]]; then + if [[ -f "@TERMUX_PREFIX@/etc/apt/@LEGACY_SOURCES@" ]]; then + echo + echo "================================" + echo "Legacy repo file found for '@REPO@' repository." + echo "The legacy '@LEGACY_SOURCES@' entry will be migrated" + echo "to 'sources.list.d/@REPO@.sources' as part of the update." + mv -vf \ + '@TERMUX_PREFIX@/etc/apt/@LEGACY_SOURCES@' \ + '@TERMUX_PREFIX@/etc/apt/@LEGACY_SOURCES@.bak' + echo "A backup copy of the old '@LEGACY_SOURCES@' apt sources config file" + echo "has been saved to '@TERMUX_PREFIX@/etc/apt/@LEGACY_SOURCES@.bak'" + echo "================================" + echo + echo "Press any key to acknowledge this." + echo "The update will proceed automatically in 10 seconds." + read -rt 10 -n 1 _ || : &> /dev/null + # Since be only read 1 byte above we need to flush + # the input to not accidentally auto-skip further reads + # e.g if a user presses the down arrow `^[[B` (3 bytes) to skip. + read -rt 0 _ || : &> /dev/null + echo + fi +fi From e8212f8f230ed1aad5c7d2a90e81ce39c0bfbcc9 Mon Sep 17 00:00:00 2001 From: TomIO Date: Sun, 4 May 2025 11:24:10 +0200 Subject: [PATCH 04/13] bump(main/dpkg): 1.22.21 --- packages/dpkg/build.sh | 23 +++++++++++++++-------- packages/dpkg/configure.diff | 4 ++-- packages/dpkg/src-configure.c.patch | 23 ++++++++++++----------- 3 files changed, 29 insertions(+), 21 deletions(-) diff --git a/packages/dpkg/build.sh b/packages/dpkg/build.sh index e66a59bbb00a46e..91c963277b1fbf6 100644 --- a/packages/dpkg/build.sh +++ b/packages/dpkg/build.sh @@ -2,11 +2,10 @@ TERMUX_PKG_HOMEPAGE=https://packages.debian.org/dpkg TERMUX_PKG_DESCRIPTION="Debian package management system" TERMUX_PKG_LICENSE="GPL-2.0" TERMUX_PKG_MAINTAINER="@termux" -TERMUX_PKG_VERSION="1.22.6" -TERMUX_PKG_REVISION=4 +TERMUX_PKG_VERSION="1.22.21" # old tarball are removed in https://mirrors.kernel.org/debian/pool/main/d/dpkg/dpkg_${TERMUX_PKG_VERSION}.tar.xz -TERMUX_PKG_SRCURL=git+https://salsa.debian.org/dpkg-team/dpkg.git -TERMUX_PKG_GIT_BRANCH="${TERMUX_PKG_VERSION}" +TERMUX_PKG_SRCURL=https://salsa.debian.org/dpkg-team/dpkg/-/archive/${TERMUX_PKG_VERSION}/dpkg-${TERMUX_PKG_VERSION}.tar.gz +TERMUX_PKG_SHA256=81fb9aff0e6e790f5c5d327643b1dea34e89900b0a8e10f48b7ee5fe7c07dd8d TERMUX_PKG_AUTO_UPDATE=false TERMUX_PKG_DEPENDS="bzip2, coreutils, diffutils, gzip, less, libbz2, liblzma, libmd, tar, xz-utils, zlib, zstd" TERMUX_PKG_ANTI_BUILD_DEPENDS="clang" @@ -72,13 +71,21 @@ share/polkit-1 " termux_step_pre_configure() { - ( - cd "${TERMUX_PKG_SRCDIR}" && \ - ./autogen && \ + # `dpkg`'s configure script expects the `.dist-version` file to contain the package version. + # This is missing in the tarballs from salsa.debian.org/dpkg-team/dpkg + echo "$TERMUX_PKG_VERSION" > "$TERMUX_PKG_SRCDIR/.dist-version" + + # `.dist-vcs-id` isn't strictly required, but configure complains if its missing. + git ls-remote https://salsa.debian.org/dpkg-team/dpkg.git \ + | grep -F "refs/tags/$TERMUX_PKG_VERSION^{}" \ + | cut -f1 > "$TERMUX_PKG_SRCDIR/.dist-vcs-id" + + ( # Do this in a subshell so we don't have to `cd` back + cd "${TERMUX_PKG_SRCDIR}" && ./autogen patch -p1 -i "${TERMUX_PKG_BUILDER_DIR}"/configure.diff ) export TAR=tar # To make sure dpkg tries to use "tar" instead of e.g. "gnutar" (which happens when building on OS X) - perl -p -i -e "s/TERMUX_ARCH/$TERMUX_ARCH/" $TERMUX_PKG_SRCDIR/configure + sed -i "s/@TERMUX_ARCH@/$TERMUX_ARCH/" "$TERMUX_PKG_SRCDIR/configure" sed -i 's/$req_vars = \$arch_vars.$varname./if ($varname eq "DEB_HOST_ARCH_CPU" or $varname eq "DEB_HOST_ARCH"){ print("'$TERMUX_ARCH'");exit; }; $req_vars = $arch_vars{$varname}/' scripts/dpkg-architecture.pl } diff --git a/packages/dpkg/configure.diff b/packages/dpkg/configure.diff index 7b37512c0f4f559..600837c5ef18fef 100644 --- a/packages/dpkg/configure.diff +++ b/packages/dpkg/configure.diff @@ -6,7 +6,7 @@ diff -u -r ../dpkg-1.21.7/configure ./configure printf %s "checking dpkg cpu type... " >&6; } - cpu_type=$(PERL=$PERL ${CONFIG_SHELL-/bin/sh} "$srcdir/build-aux/run-script" scripts/dpkg-architecture.pl -t$host -qDEB_HOST_ARCH_CPU 2>/dev/null) -+ cpu_type=TERMUX_ARCH ++ cpu_type=@TERMUX_ARCH@ if test "x$cpu_type" = "x" then : @@ -15,7 +15,7 @@ diff -u -r ../dpkg-1.21.7/configure ./configure printf %s "checking dpkg architecture name... " >&6; } - dpkg_arch=$(PERL=$PERL ${CONFIG_SHELL-/bin/sh} "$srcdir/build-aux/run-script" scripts/dpkg-architecture.pl -t$host -qDEB_HOST_ARCH 2>/dev/null) -+ dpkg_arch=TERMUX_ARCH ++ dpkg_arch=@TERMUX_ARCH@ if test "x$dpkg_arch" = "x" then : diff --git a/packages/dpkg/src-configure.c.patch b/packages/dpkg/src-configure.c.patch index 689b2aabb2107d6..b3d9454aba8d702 100644 --- a/packages/dpkg/src-configure.c.patch +++ b/packages/dpkg/src-configure.c.patch @@ -1,16 +1,17 @@ -diff -u -r ../dpkg-1.18.15/src/configure.c ./src/configure.c ---- ../dpkg-1.18.15/src/configure.c 2016-11-11 22:18:40.000000000 -0500 -+++ ./src/main/configure.c 2016-12-03 16:32:43.719508056 -0500 -@@ -497,8 +497,10 @@ - pkg_name(pkg, pnaw_nonambig), cdr2.buf, +diff --git a/src/main/configure.c b/src/main/configure.c +index 4cdd67f0e..3306e00b4 100644 +--- a/src/main/configure.c ++++ b/src/main/configure.c +@@ -499,8 +499,10 @@ deferred_configure_conffile(struct pkginfo *pkg, struct conffile *conff) + pkg_name(pkg, pnaw_nonambig), cdr_old.buf, strerror(errno)); if (!(what & CFOF_USER_DEL)) -- if (link(cdr.buf, cdr2.buf)) +- if (link(cdr.buf, cdr_old.buf)) - warning(_("%s: failed to link '%.250s' to '%.250s': %s"), -+ /** Termux modification: Use rename(2) instead of link(2), to avoid hard -+ links which does not work on Android 6.0 or later. */ -+ if (rename(cdr.buf, cdr2.buf)) -+ warning(_("%s: failed to rename '%.250s' to '%.250s': %s"), ++ /** Termux modification: Use rename(2) instead of link(2), to avoid hard ++ links which do not work on Android 6.0 or later. */ ++ if (rename(cdr.buf, cdr_old.buf)) ++ warning(_("%s: failed to rename '%.250s' to '%.250s': %s"), pkg_name(pkg, pnaw_nonambig), cdr.buf, - cdr2.buf, strerror(errno)); + cdr_old.buf, strerror(errno)); /* Fall through. */ From 9f14e95bdba0d6212e924c85b90b8aee999add1e Mon Sep 17 00:00:00 2001 From: TomIO Date: Wed, 23 Apr 2025 18:00:39 +0200 Subject: [PATCH 05/13] bump(main/libapt-pkg-perl): 0.1.42 --- packages/libapt-pkg-perl/build.sh | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/packages/libapt-pkg-perl/build.sh b/packages/libapt-pkg-perl/build.sh index f08c3e3e20278ac..d824e8dc26eb5dd 100644 --- a/packages/libapt-pkg-perl/build.sh +++ b/packages/libapt-pkg-perl/build.sh @@ -2,29 +2,31 @@ TERMUX_PKG_HOMEPAGE=https://packages.debian.org/libapt-pkg-perl TERMUX_PKG_DESCRIPTION="Perl interface to APT's libapt-pkg" TERMUX_PKG_LICENSE="GPL-3.0" TERMUX_PKG_MAINTAINER="@termux" -TERMUX_PKG_VERSION=0.1.40 -TERMUX_PKG_REVISION=13 -TERMUX_PKG_SRCURL=http://deb.debian.org/debian/pool/main/liba/libapt-pkg-perl/libapt-pkg-perl_${TERMUX_PKG_VERSION}.tar.xz -TERMUX_PKG_SHA256=524d2ef77f3d6896c50e7674022d85e4a391a6a2b3c65ba5e50ac671fa7ce4a1 -TERMUX_PKG_DEPENDS="apt, libc++, perl" +TERMUX_PKG_VERSION=0.1.42 +# old tarballs are removed from http://deb.debian.org/debian/pool/main/liba/libapt-pkg-perl/libapt-pkg-perl_${TERMUX_PKG_VERSION}.tar.xz +TERMUX_PKG_SRCURL=https://salsa.debian.org/bod/libapt-pkg-perl/-/archive/v${TERMUX_PKG_VERSION}/libapt-pkg-perl-v${TERMUX_PKG_VERSION}.tar.gz +TERMUX_PKG_SHA256=28c0688c3807912d372ef1bed2a490526704f902211bc916d49ec420a48d2ee3 +TERMUX_PKG_DEPENDS="apt (>= 3.0.0), libc++, perl" TERMUX_PKG_BUILD_IN_SRC=true termux_step_make() { - local perl_version=$(. $TERMUX_SCRIPTDIR/packages/perl/build.sh; echo $TERMUX_PKG_VERSION) + local perl_version + perl_version=$(. "$TERMUX_SCRIPTDIR/packages/perl/build.sh"; echo "${TERMUX_PKG_VERSION[0]}") CFLAGS+=" -I$TERMUX_PREFIX/lib/perl5/$perl_version/${TERMUX_ARCH}-android/CORE \ -I$TERMUX_PREFIX/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" LDFLAGS+=" -L$TERMUX_PREFIX/lib/perl5/$perl_version/${TERMUX_ARCH}-android/CORE \ -L$TERMUX_PREFIX/lib -lperl" perl Makefile.PL INSTALLDIRS=perl DESTDIR="$TERMUX_PKG_MASSAGEDIR" \ INSTALLMAN3DIR="$TERMUX_PREFIX/share/man/man3" \ - LIB=$TERMUX_PREFIX/lib/perl5/site_perl/$perl_version/${TERMUX_ARCH}-android + LIB="$TERMUX_PREFIX/lib/perl5/site_perl/$perl_version/${TERMUX_ARCH}-android" make CC="${CC}++" LD="${CC}++" OTHERLDFLAGS="$LDFLAGS" CCFLAGS="$CFLAGS" } termux_step_post_massage() { - local perl_version=$(. $TERMUX_SCRIPTDIR/packages/perl/build.sh; echo $TERMUX_PKG_VERSION) - mv $TERMUX_PKG_MASSAGEDIR/$TERMUX_PREFIX/lib/perl5/site_perl/$perl_version/${TERMUX_ARCH}-android/x86_64-linux-gnu-thread-multi/* \ - $TERMUX_PKG_MASSAGEDIR/$TERMUX_PREFIX/lib/perl5/site_perl/$perl_version/${TERMUX_ARCH}-android/ - rmdir $TERMUX_PKG_MASSAGEDIR/$TERMUX_PREFIX/lib/perl5/site_perl/$perl_version/${TERMUX_ARCH}-android/x86_64-linux-gnu-thread-multi + local perl_version + perl_version=$(. "$TERMUX_SCRIPTDIR/packages/perl/build.sh"; echo "${TERMUX_PKG_VERSION[0]}") + mv "$TERMUX_PKG_MASSAGEDIR/$TERMUX_PREFIX/lib/perl5/site_perl/$perl_version/${TERMUX_ARCH}-android/x86_64-linux-gnu-thread-multi"/* \ + "$TERMUX_PKG_MASSAGEDIR/$TERMUX_PREFIX/lib/perl5/site_perl/$perl_version/${TERMUX_ARCH}-android/" + rmdir "$TERMUX_PKG_MASSAGEDIR/$TERMUX_PREFIX/lib/perl5/site_perl/$perl_version/${TERMUX_ARCH}-android/x86_64-linux-gnu-thread-multi" } From 0f2b16f0d40e5394c460465885ed9f40a048317e Mon Sep 17 00:00:00 2001 From: TomIO Date: Wed, 23 Apr 2025 18:03:16 +0200 Subject: [PATCH 06/13] revbump(main/apt-file): after `apt` update --- packages/apt-file/build.sh | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/packages/apt-file/build.sh b/packages/apt-file/build.sh index b7baac0dcf3397e..8ad61318ab134d4 100644 --- a/packages/apt-file/build.sh +++ b/packages/apt-file/build.sh @@ -3,18 +3,21 @@ TERMUX_PKG_DESCRIPTION="search for files within packages" TERMUX_PKG_LICENSE="GPL-2.0" TERMUX_PKG_MAINTAINER="@termux" TERMUX_PKG_VERSION=3.3 +TERMUX_PKG_REVISION=1 TERMUX_PKG_SRCURL=http://deb.debian.org/debian/pool/main/a/apt-file/apt-file_${TERMUX_PKG_VERSION}.tar.xz TERMUX_PKG_SHA256=2ab7109340054f0073c690d62d055c31bf69e1f50fb65b080bbf0d4ae572dae7 TERMUX_PKG_DEPENDS="apt, libapt-pkg-perl, libregexp-assemble-perl, perl" TERMUX_PKG_REPLACES="whatprovides" TERMUX_PKG_BUILD_IN_SRC=true TERMUX_PKG_PLATFORM_INDEPENDENT=true -TERMUX_PKG_EXTRA_MAKE_ARGS="DESTDIR=$TERMUX_PREFIX BINDIR=$TERMUX_PREFIX/bin \ - MANDIR=$TERMUX_PREFIX/share/man/man1" +TERMUX_PKG_EXTRA_MAKE_ARGS=" + DESTDIR=$TERMUX_PREFIX + BINDIR=$TERMUX_PREFIX/bin + MANDIR=$TERMUX_PREFIX/share/man/man1 +" termux_step_post_make_install() { - mkdir -p $TERMUX_PREFIX/etc/bash_completion.d/ - cp $TERMUX_PKG_SRCDIR/debian/bash-completion \ - $TERMUX_PREFIX/etc/bash_completion.d/apt-file + install -Dm644 "$TERMUX_PKG_SRCDIR/debian/bash-completion" \ + "$TERMUX_PREFIX/etc/bash_completion.d/apt-file" } From cbf046b058eec42a0cb384a305d1d692d2c88109 Mon Sep 17 00:00:00 2001 From: TomIO Date: Mon, 5 May 2025 15:34:59 +0200 Subject: [PATCH 07/13] revbump(main/nala): after `apt` update --- packages/nala/build.sh | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/packages/nala/build.sh b/packages/nala/build.sh index e99a55d344e173b..08d6f1d22a11fb8 100644 --- a/packages/nala/build.sh +++ b/packages/nala/build.sh @@ -3,8 +3,9 @@ TERMUX_PKG_DESCRIPTION="Commandline frontend for the apt package manager" TERMUX_PKG_LICENSE="GPL-3.0" TERMUX_PKG_MAINTAINER="@termux" TERMUX_PKG_VERSION="0.16.0" -TERMUX_PKG_SRCURL=https://gitlab.com/volian/nala/-/archive/v${TERMUX_PKG_VERSION}/nala-v${TERMUX_PKG_VERSION}.tar.bz2 -TERMUX_PKG_SHA256=49e384aa3b94597d09c61b7accc41d1cf10cb6beea85d4620c80c28d7cdc4d5f +TERMUX_PKG_REVISION=1 +TERMUX_PKG_SRCURL="https://gitlab.com/volian/nala/-/archive/v${TERMUX_PKG_VERSION}/nala-v${TERMUX_PKG_VERSION}.tar.gz" +TERMUX_PKG_SHA256=e36488f96facf4dbbeaf2fb252eb3bfa421a96f290e666d9a37137ec58eccd4c TERMUX_PKG_DEPENDS="python-apt, python-pip" TERMUX_PKG_PLATFORM_INDEPENDENT=true TERMUX_PKG_BUILD_IN_SRC=true @@ -23,17 +24,17 @@ termux_step_post_make_install() { pandoc "${file}" --output="${file%.*}" --standalone \ --variable=header:"Nala User Manual" \ --variable=footer:"${TERMUX_PKG_VERSION}" \ - --variable=date:"$(date -d @${SOURCE_DATE_EPOCH})" \ + --variable=date:"$(date -d "@${SOURCE_DATE_EPOCH}")" \ --variable=section:8 \ --from rst --to man install -Dm600 -t "$TERMUX_PREFIX"/share/man/man8/ "${file%.*}" done - install -Dm600 -t $TERMUX_PREFIX/etc/nala debian/nala.conf - install -Dm600 debian/nala.fish "$TERMUX_PREFIX"/share/fish/vendor_completions.d/nala.fish - install -Dm600 debian/bash-completion "$TERMUX_PREFIX"/share/bash-completion/completions/nala - install -Dm600 debian/_nala "$TERMUX_PREFIX"/share/zsh/site-functions/_nala + install -Dm600 -t "$TERMUX_PREFIX/etc/nala" debian/nala.conf + install -Dm600 debian/nala.fish "$TERMUX_PREFIX/share/fish/vendor_completions.d/nala.fish" + install -Dm600 debian/bash-completion "$TERMUX_PREFIX/share/bash-completion/completions/nala" + install -Dm600 debian/_nala "$TERMUX_PREFIX/share/zsh/site-functions/_nala" } termux_step_create_debscripts() { From bb034b0a28462221facfb657a7b419a9fab4d465 Mon Sep 17 00:00:00 2001 From: TomIO Date: Fri, 30 May 2025 19:51:35 +0200 Subject: [PATCH 08/13] revbump(x11/synaptic): after `apt` update --- x11-packages/synaptic/build.sh | 5 ++--- .../synaptic/common-rpackagelister.cc.patch | 16 ++++++++++++++++ 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/x11-packages/synaptic/build.sh b/x11-packages/synaptic/build.sh index 8b8a9182cb0a747..b07eaa29418f554 100644 --- a/x11-packages/synaptic/build.sh +++ b/x11-packages/synaptic/build.sh @@ -3,6 +3,7 @@ TERMUX_PKG_DESCRIPTION="Synaptic is a graphical package management tool based on TERMUX_PKG_LICENSE="GPL-2.0" TERMUX_PKG_MAINTAINER="@Yisus7u7" TERMUX_PKG_VERSION="0.91.7" +TERMUX_PKG_REVISION=1 TERMUX_PKG_SRCURL=https://github.com/mvo5/synaptic/archive/refs/tags/${TERMUX_PKG_VERSION}.tar.gz TERMUX_PKG_SHA256=6da82e1ff9f0bd00b34db02ea7d291caeeb546303ba639a8e32ebac8a5db6ccf TERMUX_PKG_AUTO_UPDATE=true @@ -13,11 +14,9 @@ TERMUX_PKG_BUILD_IN_SRC=true termux_step_pre_configure(){ NOCONFIGURE=1 ./autogen.sh - # Fix "error: no template named binary_function" (binary_function was removed in c++17): - CXXFLAGS+=" -std=c++14" } termux_step_post_make_install(){ - install -Dm700 -t ${TERMUX_PREFIX}/bin ./gtk/synaptic + install -Dm700 -t "${TERMUX_PREFIX}/bin" ./gtk/synaptic } diff --git a/x11-packages/synaptic/common-rpackagelister.cc.patch b/x11-packages/synaptic/common-rpackagelister.cc.patch index 0ea4ba540d80006..e1a4d19c10443b9 100644 --- a/x11-packages/synaptic/common-rpackagelister.cc.patch +++ b/x11-packages/synaptic/common-rpackagelister.cc.patch @@ -27,3 +27,19 @@ (!_xapianDatabase )) { if(_config->FindB("Debug::Synaptic::Xapian",false)) std::cerr << "xapain index not build yet" << std::endl; +@@ -924,11 +922,11 @@ void RPackageLister::getSummary(int &held, int &kept, int &essential, + + + +-struct bla:public binary_function { +- bool operator() (RPackage *a, RPackage *b) { ++auto bla() { ++ return [](RPackage* a, RPackage* b) -> bool { + return strcmp(a->name(), b->name()) < 0; +- } +-}; ++ }; ++} + + void RPackageLister::saveUndoState(pkgState &state) + { From 28955d968e5abc5b4d0be1caae302961ed31530e Mon Sep 17 00:00:00 2001 From: TomIO Date: Wed, 23 Apr 2025 23:08:13 +0200 Subject: [PATCH 09/13] chore(main/apt): adopt deb822 format for repo --- packages/apt/build.sh | 62 +++++++++++++++++++++++++------------ packages/apt/postinst.sh.in | 11 +++++++ 2 files changed, 53 insertions(+), 20 deletions(-) create mode 100644 packages/apt/postinst.sh.in diff --git a/packages/apt/build.sh b/packages/apt/build.sh index 1753d259449c191..332d39e73abab39 100644 --- a/packages/apt/build.sh +++ b/packages/apt/build.sh @@ -15,10 +15,6 @@ TERMUX_PKG_PROVIDES="unstable-repo, game-repo, science-repo" TERMUX_PKG_SUGGESTS="gnupg, less" TERMUX_PKG_ESSENTIAL=true -TERMUX_PKG_CONFFILES=" -etc/apt/sources.list -" - TERMUX_PKG_EXTRA_CONFIGURE_ARGS=" -DCMAKE_POLICY_VERSION_MINIMUM=3.5 -DPERL_EXECUTABLE=$(command -v perl) @@ -55,37 +51,45 @@ share/man/man1/apt-transport-mirror.1 share/man/man8/apt-cdrom.8 " -termux_step_pre_configure() { - # Certain packages are not safe to build on device because their - # build.sh script deletes specific files in $TERMUX_PREFIX. - if $TERMUX_ON_DEVICE_BUILD; then - termux_error_exit "Package '$TERMUX_PKG_NAME' is not safe for on-device builds." - fi +TERMUX_PKG_ON_DEVICE_BUILD_NOT_SUPPORTED=true +termux_step_pre_configure() { # Fix i686 builds. CXXFLAGS+=" -Wno-c++11-narrowing" # Fix glob() on Android 7. LDFLAGS+=" -Wl,--no-as-needed -landroid-glob" # for manpage build - local docbook_xsl_version=$(. $TERMUX_SCRIPTDIR/packages/docbook-xsl/build.sh; echo $TERMUX_PKG_VERSION) + local docbook_xsl_version + docbook_xsl_version=$(. "$TERMUX_SCRIPTDIR/packages/docbook-xsl/build.sh"; echo "$TERMUX_PKG_VERSION") TERMUX_PKG_EXTRA_CONFIGURE_ARGS+=" -DDOCBOOK_XSL=$TERMUX_PREFIX/share/xml/docbook/xsl-stylesheets-$docbook_xsl_version-nons" } termux_step_post_make_install() { - { - echo "# The main termux repository, with cloudflare cache" - echo "deb https://packages-cf.termux.dev/apt/termux-main/ stable main" - echo "# The main termux repository, without cloudflare cache" - echo "# deb https://packages.termux.dev/apt/termux-main/ stable main" - } > "$TERMUX_PREFIX/etc/apt/sources.list" + mkdir -p "$TERMUX_PREFIX/etc/apt/sources.list.d" + { # write deb822 source entries for the main repo + printf '%s\n' \ + "# The main termux repository, with cloudflare cache" \ + "Types: deb" \ + "URIs: https://packages-cf.termux.dev/apt/termux-main/" \ + "Suites: stable" \ + "Components: main" \ + "Signed-By: $TERMUX_PREFIX/etc/apt/trusted.gpg.d/grimler.gpg, $TERMUX_PREFIX/etc/apt/trusted.gpg.d/termux-autobuilds.gpg" \ + "" \ + "# The main termux repository, without cloudflare cache" \ + "#Types: deb" \ + "#URIs: https://packages-cf.termux.dev/apt/termux-main/" \ + "#Suites: stable" \ + "#Components: main" \ + "#Signed-By: $TERMUX_PREFIX/etc/apt/trusted.gpg.d/grimler.gpg, $TERMUX_PREFIX/etc/apt/trusted.gpg.d/termux-autobuilds.gpg" + } > "$TERMUX_PREFIX/etc/apt/sources.list.d/main.sources" # apt-transport-tor - ln -sfr "$TERMUX_PREFIX/lib/apt/methods/http" "$TERMUX_PREFIX/lib/apt/methods/tor" - ln -sfr "$TERMUX_PREFIX/lib/apt/methods/http" "$TERMUX_PREFIX/lib/apt/methods/tor+http" + ln -sfr "$TERMUX_PREFIX/lib/apt/methods/http" "$TERMUX_PREFIX/lib/apt/methods/tor" + ln -sfr "$TERMUX_PREFIX/lib/apt/methods/http" "$TERMUX_PREFIX/lib/apt/methods/tor+http" ln -sfr "$TERMUX_PREFIX/lib/apt/methods/https" "$TERMUX_PREFIX/lib/apt/methods/tor+https" # Workaround for "empty" subpackage: - local dir=$TERMUX_PREFIX/share/apt-transport-tor + local dir="$TERMUX_PREFIX/share/apt-transport-tor" mkdir -p "$dir" touch "$dir/.placeholder" @@ -93,3 +97,21 @@ termux_step_post_make_install() { -e "s|@TERMUX_ARCH@|${TERMUX_ARCH}|g" \ "$TERMUX_SCRIPTDIR/packages/apt/emergency-restore.sh.in" > "$TERMUX_PREFIX/bin/apt-emergency-restore" } + +termux_step_create_debscripts() { + [[ "$TERMUX_PACKAGE_FORMAT" == 'pacman' ]] && return 0 + + local REPO="main" + local LEGACY_SOURCES="sources.list" # Note that this is not in sources.list.d/ + sed -e "s|@LEGACY_SOURCES@|$LEGACY_SOURCES|g" \ + -e "s|@TERMUX_PREFIX@|$TERMUX_PREFIX|g" \ + -e "s|@REPO@|$REPO|g" \ + "$TERMUX_SCRIPTDIR/packages/apt/preinst.sh.in" > ./preinst + + sed -e "s|@LEGACY_SOURCES@|$LEGACY_SOURCES|g" \ + -e "s|@TERMUX_PREFIX@|$TERMUX_PREFIX|g" \ + -e "s|@REPO@|$REPO|g" \ + "$TERMUX_SCRIPTDIR/packages/apt/postinst.sh.in" > ./postinst + + chmod +x ./preinst ./postinst +} diff --git a/packages/apt/postinst.sh.in b/packages/apt/postinst.sh.in new file mode 100644 index 000000000000000..dd373136cebb9b2 --- /dev/null +++ b/packages/apt/postinst.sh.in @@ -0,0 +1,11 @@ +#!@TERMUX_PREFIX@/bin/sh +if [ "$1" = "configure" ]; then + rm -f "@TERMUX_PREFIX@/etc/apt/@LEGACY_SOURCES@" +fi + +echo "Downloading updated package list ..." +if [ -d "@TERMUX_PREFIX@/etc/termux/chosen_mirrors" ] || [ -f "@TERMUX_PREFIX@/etc/termux/chosen_mirrors" ]; then + pkg --check-mirror update +else + apt update +fi From 600d30e286445f0def643c41e3cd8bc952f36739 Mon Sep 17 00:00:00 2001 From: TomIO Date: Wed, 23 Apr 2025 23:08:13 +0200 Subject: [PATCH 10/13] chore(main/x11-repo): adopt deb822 format for repo --- packages/x11-repo/build.sh | 55 +++++++++++++++++++++++--------------- 1 file changed, 34 insertions(+), 21 deletions(-) diff --git a/packages/x11-repo/build.sh b/packages/x11-repo/build.sh index 5e6ad887b919bd1..cf3f680d5f9cc15 100644 --- a/packages/x11-repo/build.sh +++ b/packages/x11-repo/build.sh @@ -1,34 +1,47 @@ -TERMUX_PKG_HOMEPAGE=https://github.com/termux/x11-packages +TERMUX_PKG_HOMEPAGE=https://github.com/termux/termux-packages TERMUX_PKG_DESCRIPTION="Package repository containing X11 programs and libraries" TERMUX_PKG_LICENSE="Apache-2.0" TERMUX_PKG_MAINTAINER="@termux" -TERMUX_PKG_VERSION=8.4 -TERMUX_PKG_REVISION=1 +TERMUX_PKG_VERSION=8.5 TERMUX_PKG_AUTO_UPDATE=false TERMUX_PKG_DEPENDS="termux-keyring" TERMUX_PKG_SKIP_SRC_EXTRACT=true TERMUX_PKG_PLATFORM_INDEPENDENT=true termux_step_make_install() { - mkdir -p $TERMUX_PREFIX/etc/apt/sources.list.d - { - echo "# The x11 termux repository, with cloudflare cache" - echo "deb https://packages-cf.termux.dev/apt/termux-x11/ x11 main" - echo "# The x11 termux repository, without cloudflare cache" - echo "# deb https://packages.termux.dev/apt/termux-x11/ x11 main" - } > $TERMUX_PREFIX/etc/apt/sources.list.d/x11.list + mkdir -p "$TERMUX_PREFIX/etc/apt/sources.list.d" + { # write deb822 source entries for the x11 repo + printf '%s\n' \ + "# The termux x11 repository, with cloudflare cache" \ + "Types: deb" \ + "URIs: https://packages-cf.termux.dev/apt/termux-x11/" \ + "Suites: x11" \ + "Components: main" \ + "Signed-By: $TERMUX_PREFIX/etc/apt/trusted.gpg.d/grimler.gpg, $TERMUX_PREFIX/etc/apt/trusted.gpg.d/termux-autobuilds.gpg" \ + "" \ + "# The termux x11 repository, without cloudflare cache" \ + "#Types: deb" \ + "#URIs: https://packages.termux.dev/apt/termux-x11/" \ + "#Suites: x11" \ + "#Components: main" \ + "#Signed-By: $TERMUX_PREFIX/etc/apt/trusted.gpg.d/grimler.gpg, $TERMUX_PREFIX/etc/apt/trusted.gpg.d/termux-autobuilds.gpg" + } > "$TERMUX_PREFIX/etc/apt/sources.list.d/x11.sources" } termux_step_create_debscripts() { - [ "$TERMUX_PACKAGE_FORMAT" = "pacman" ] && return 0 - cat <<- EOF > ./postinst - #!$TERMUX_PREFIX/bin/sh - echo "Downloading updated package list ..." - if [ -d "$TERMUX_PREFIX/etc/termux/chosen_mirrors" ] || [ -f "$TERMUX_PREFIX/etc/termux/chosen_mirrors" ]; then - pkg --check-mirror update - else - apt update - fi - exit 0 - EOF + [[ "$TERMUX_PACKAGE_FORMAT" == 'pacman' ]] && return 0 + + local REPO="x11" + local LEGACY_SOURCES="sources.list.d/${REPO}.list" + sed -e "s|@LEGACY_SOURCES@|${LEGACY_SOURCES}|g" \ + -e "s|@TERMUX_PREFIX@|${TERMUX_PREFIX}|g" \ + -e "s|@REPO@|${REPO}|g" \ + "$TERMUX_SCRIPTDIR/packages/apt/preinst.sh.in" > ./preinst + + sed -e "s|@LEGACY_SOURCES@|${LEGACY_SOURCES}|g" \ + -e "s|@TERMUX_PREFIX@|${TERMUX_PREFIX}|g" \ + -e "s|@REPO@|${REPO}|g" \ + "$TERMUX_SCRIPTDIR/packages/apt/postinst.sh.in" > ./postinst + + chmod +x ./preinst ./postinst } From b716518fd0ecbe940a4101a2886eb801a870988d Mon Sep 17 00:00:00 2001 From: TomIO Date: Wed, 23 Apr 2025 23:08:13 +0200 Subject: [PATCH 11/13] chore(main/root-repo): adopt deb822 format for repo --- packages/root-repo/build.sh | 55 +++++++++++++++++++++++-------------- 1 file changed, 34 insertions(+), 21 deletions(-) diff --git a/packages/root-repo/build.sh b/packages/root-repo/build.sh index 214ffa8d9831464..b375c798ca67c9f 100644 --- a/packages/root-repo/build.sh +++ b/packages/root-repo/build.sh @@ -1,34 +1,47 @@ -TERMUX_PKG_HOMEPAGE=https://github.com/termux/termux-root-packages +TERMUX_PKG_HOMEPAGE=https://github.com/termux/termux-packages TERMUX_PKG_DESCRIPTION="Package repository containing programs for rooted devices" TERMUX_PKG_LICENSE="Apache-2.0" TERMUX_PKG_MAINTAINER="Henrik Grimler @Grimler91" -TERMUX_PKG_VERSION=2.4 -TERMUX_PKG_REVISION=2 +TERMUX_PKG_VERSION=2.5 TERMUX_PKG_AUTO_UPDATE=false TERMUX_PKG_DEPENDS="termux-keyring" TERMUX_PKG_SKIP_SRC_EXTRACT=true TERMUX_PKG_PLATFORM_INDEPENDENT=true termux_step_make_install() { - mkdir -p $TERMUX_PREFIX/etc/apt/sources.list.d - { - echo "# The root termux repository, with cloudflare cache" - echo "deb https://packages-cf.termux.dev/apt/termux-root/ root stable" - echo "# The root termux repository, without cloudflare cache" - echo "# deb https://packages.termux.dev/apt/termux-root/ root stable" - } > $TERMUX_PREFIX/etc/apt/sources.list.d/root.list + mkdir -p "$TERMUX_PREFIX/etc/apt/sources.list.d" + { # write deb822 source entries for the root repo + printf '%s\n' \ + "# The termux root repository, with cloudflare cache" \ + "Types: deb" \ + "URIs: https://packages-cf.termux.dev/apt/termux-root/" \ + "Suites: root" \ + "Components: stable" \ + "Signed-By: $TERMUX_PREFIX/etc/apt/trusted.gpg.d/grimler.gpg, $TERMUX_PREFIX/etc/apt/trusted.gpg.d/termux-autobuilds.gpg" \ + "" \ + "# The termux root repository, without cloudflare cache" \ + "#Types: deb" \ + "#URIs: https://packages.termux.dev/apt/termux-root/" \ + "#Suites: root" \ + "#Components: stable" \ + "#Signed-By: $TERMUX_PREFIX/etc/apt/trusted.gpg.d/grimler.gpg, $TERMUX_PREFIX/etc/apt/trusted.gpg.d/termux-autobuilds.gpg" + } > "$TERMUX_PREFIX/etc/apt/sources.list.d/root.sources" } termux_step_create_debscripts() { - [ "$TERMUX_PACKAGE_FORMAT" = "pacman" ] && return 0 - cat <<- EOF > ./postinst - #!$TERMUX_PREFIX/bin/sh - echo "Downloading updated package list ..." - if [ -d "$TERMUX_PREFIX/etc/termux/chosen_mirrors" ] || [ -f "$TERMUX_PREFIX/etc/termux/chosen_mirrors" ]; then - pkg --check-mirror update - else - apt update - fi - exit 0 - EOF + [[ "$TERMUX_PACKAGE_FORMAT" == 'pacman' ]] && return 0 + + local REPO="root" + local LEGACY_SOURCES="sources.list.d/${REPO}.list" + sed -e "s|@LEGACY_SOURCES@|${LEGACY_SOURCES}|g" \ + -e "s|@TERMUX_PREFIX@|${TERMUX_PREFIX}|g" \ + -e "s|@REPO@|${REPO}|g" \ + "$TERMUX_SCRIPTDIR/packages/apt/preinst.sh.in" > ./preinst + + sed -e "s|@LEGACY_SOURCES@|${LEGACY_SOURCES}|g" \ + -e "s|@TERMUX_PREFIX@|${TERMUX_PREFIX}|g" \ + -e "s|@REPO@|${REPO}|g" \ + "$TERMUX_SCRIPTDIR/packages/apt/postinst.sh.in" > ./postinst + + chmod +x ./preinst ./postinst } From db45dde64073c1f6205da0d4e3f0b11ca24b298f Mon Sep 17 00:00:00 2001 From: TomIO Date: Wed, 23 Apr 2025 23:08:13 +0200 Subject: [PATCH 12/13] chore(main/tur-repo): adopt deb822 format for repo --- packages/tur-repo/build.sh | 37 +++++++++++++++++++++++++++---------- 1 file changed, 27 insertions(+), 10 deletions(-) diff --git a/packages/tur-repo/build.sh b/packages/tur-repo/build.sh index 5211b81c214eb23..6e692c73596fbb8 100644 --- a/packages/tur-repo/build.sh +++ b/packages/tur-repo/build.sh @@ -2,23 +2,40 @@ TERMUX_PKG_HOMEPAGE=https://github.com/termux-user-repository/tur TERMUX_PKG_DESCRIPTION="A single and trusted place for all unofficial/less popular termux packages" TERMUX_PKG_LICENSE="Apache-2.0" TERMUX_PKG_MAINTAINER="@termux-user-repository" -TERMUX_PKG_VERSION=1.0.1 +TERMUX_PKG_VERSION=1.0.2 TERMUX_PKG_AUTO_UPDATE=false TERMUX_PKG_SKIP_SRC_EXTRACT=true TERMUX_PKG_PLATFORM_INDEPENDENT=true termux_step_make_install() { - mkdir -p $TERMUX_PREFIX/etc/apt/sources.list.d - echo "deb https://tur.kcubeterm.com tur-packages tur tur-on-device tur-continuous" > $TERMUX_PREFIX/etc/apt/sources.list.d/tur.list + mkdir -p "$TERMUX_PREFIX/etc/apt/sources.list.d" + { # write deb822 source entries for the TUR repo + printf '%s\n' \ + "# A single and trusted place for all unofficial/less popular termux packages" \ + "Types: deb" \ + "URIs: https://tur.kcubeterm.com/" \ + "Suites: tur-packages" \ + "Components: tur tur-on-device tur-continuous" \ + "Signed-By: $TERMUX_PREFIX/etc/apt/trusted.gpg.d/tur.gpg" + } > "$TERMUX_PREFIX/etc/apt/sources.list.d/tur.sources" ## tur gpg key - mkdir -p $TERMUX_PREFIX/etc/apt/trusted.gpg.d - install -Dm600 $TERMUX_PKG_BUILDER_DIR/tur.gpg $TERMUX_PREFIX/etc/apt/trusted.gpg.d/ + install -Dm600 "$TERMUX_PKG_BUILDER_DIR/tur.gpg" "$TERMUX_PREFIX/etc/apt/trusted.gpg.d/" } termux_step_create_debscripts() { - [ "$TERMUX_PACKAGE_FORMAT" = "pacman" ] && return 0 - echo "#!$TERMUX_PREFIX/bin/sh" > postinst - echo "echo Downloading updated package list ..." >> postinst - echo "apt update" >> postinst - echo "exit 0" >> postinst + [[ "$TERMUX_PACKAGE_FORMAT" == 'pacman' ]] && return 0 + + local REPO="tur" + local LEGACY_SOURCES="sources.list.d/${REPO}.list" + sed -e "s|@LEGACY_SOURCES@|${LEGACY_SOURCES}|g" \ + -e "s|@TERMUX_PREFIX@|${TERMUX_PREFIX}|g" \ + -e "s|@REPO@|${REPO}|g" \ + "$TERMUX_SCRIPTDIR/packages/apt/preinst.sh.in" > ./preinst + + sed -e "s|@LEGACY_SOURCES@|${LEGACY_SOURCES}|g" \ + -e "s|@TERMUX_PREFIX@|${TERMUX_PREFIX}|g" \ + -e "s|@REPO@|${REPO}|g" \ + "$TERMUX_SCRIPTDIR/packages/apt/postinst.sh.in" > ./postinst + + chmod +x ./preinst ./postinst } From 78c7d5cc7282f3422157692cd98db84eee4dd512 Mon Sep 17 00:00:00 2001 From: TomIO Date: Sun, 4 May 2025 13:39:32 +0200 Subject: [PATCH 13/13] chore(main/glibc-repo): adopt deb822 format for repo --- packages/glibc-repo/build.sh | 47 ++++++++++++++++++++++++++---------- 1 file changed, 34 insertions(+), 13 deletions(-) diff --git a/packages/glibc-repo/build.sh b/packages/glibc-repo/build.sh index 6ac61d7369b7486..c74cab31f6fdc26 100644 --- a/packages/glibc-repo/build.sh +++ b/packages/glibc-repo/build.sh @@ -2,25 +2,46 @@ TERMUX_PKG_HOMEPAGE=https://github.com/termux/glibc-packages TERMUX_PKG_DESCRIPTION="A package repository containing glibc-based programs and libraries" TERMUX_PKG_LICENSE="Apache-2.0" TERMUX_PKG_MAINTAINER="@termux-pacman" -TERMUX_PKG_VERSION=1.0 +TERMUX_PKG_VERSION=1.1 TERMUX_PKG_AUTO_UPDATE=false +TERMUX_PKG_DEPENDS="termux-keyring" TERMUX_PKG_SKIP_SRC_EXTRACT=true TERMUX_PKG_PLATFORM_INDEPENDENT=true termux_step_make_install() { - mkdir -p $TERMUX_PREFIX/etc/apt/sources.list.d - { - echo "# The glibc termux repository, with cloudflare cache" - echo "deb https://packages-cf.termux.dev/apt/termux-glibc/ glibc stable" - echo "# The glibc termux repository, without cloudflare cache" - echo "# deb https://packages.termux.dev/apt/termux-glibc/ glibc stable" - } > $TERMUX_PREFIX/etc/apt/sources.list.d/glibc.list + mkdir -p "$TERMUX_PREFIX/etc/apt/sources.list.d" + { # write deb822 source entries for the x11 repo + printf '%s\n' \ + "# The termux glibc repository, with cloudflare cache" \ + "Types: deb" \ + "URIs: https://packages-cf.termux.dev/apt/termux-glibc/" \ + "Suites: glibc" \ + "Components: stable" \ + "Signed-By: $TERMUX_PREFIX/etc/apt/trusted.gpg.d/grimler.gpg, $TERMUX_PREFIX/etc/apt/trusted.gpg.d/termux-autobuilds.gpg" \ + "" \ + "# The termux glibc repository, without cloudflare cache" \ + "#Types: deb" \ + "#URIs: https://packages.termux.dev/apt/termux-glibc/" \ + "#Suites: glibc" \ + "#Components: stable" \ + "#Signed-By: $TERMUX_PREFIX/etc/apt/trusted.gpg.d/grimler.gpg, $TERMUX_PREFIX/etc/apt/trusted.gpg.d/termux-autobuilds.gpg" + } > "$TERMUX_PREFIX/etc/apt/sources.list.d/glibc.sources" } termux_step_create_debscripts() { - [ "$TERMUX_PACKAGE_FORMAT" = "pacman" ] && return 0 - echo "#!$TERMUX_PREFIX/bin/sh" > postinst - echo "echo Downloading updated package list ..." >> postinst - echo "apt update" >> postinst - echo "exit 0" >> postinst + [[ "$TERMUX_PACKAGE_FORMAT" == 'pacman' ]] && return 0 + + local REPO="glibc" + local LEGACY_SOURCES="sources.list.d/${REPO}.list" + sed -e "s|@LEGACY_SOURCES@|${LEGACY_SOURCES}|g" \ + -e "s|@TERMUX_PREFIX@|${TERMUX_PREFIX}|g" \ + -e "s|@REPO@|${REPO}|g" \ + "$TERMUX_SCRIPTDIR/packages/apt/preinst.sh.in" > ./preinst + + sed -e "s|@LEGACY_SOURCES@|${LEGACY_SOURCES}|g" \ + -e "s|@TERMUX_PREFIX@|${TERMUX_PREFIX}|g" \ + -e "s|@REPO@|${REPO}|g" \ + "$TERMUX_SCRIPTDIR/packages/apt/postinst.sh.in" > ./postinst + + chmod +x ./preinst ./postinst }