mirror of
https://github.com/termux-pacman/termux-packages.git
synced 2026-02-12 21:00:57 +00:00
- Fixes https://github.com/termux/termux-packages/issues/23605 - brings termux-apt to have feature-parity with termux-pacman, since termux-pacman always shows these warnings if unofficial packages are detected: ``` warning: htop: local (3.2.1-1) is newer than extra (3.2.0-1) ``` that capability of termux-pacman is inherited from the distro Arch Linux through `pacman`. however, without the command `apt-show-versions`, it is very difficult to identify and remove packages that are in the same situation in termux-apt. Example output on a device that became filled with a mess of unofficial packages: ``` ~ $ apt-show-versions | grep -e "newer than" -e "No available" apt-show-versions:all 0.22.16 installed: No available version in archive arpack-ng:aarch64 1:3.9.0-1 newer than version in archive blender:aarch64 1:3.6.23 installed: No available version in archive blender4:aarch64 4.5.2 installed: No available version in archive code-server:aarch64 4.101.2 installed: No available version in archive electrum:all 4.5.8-3 newer than version in archive elisa:aarch64 25.08.0 installed: No available version in archive embree:aarch64 4.4.0 installed: No available version in archive frida:aarch64 17.2.11-1 installed: No available version in archive frida-dev:aarch64 17.2.11-1 installed: No available version in archive frida-python:aarch64 17.2.11-1 installed: No available version in archive gjs:aarch64 1.84.2 installed: No available version in archive glew:aarch64 2.2.0-13 newer than version in archive hash-slinger:all 3.4-1 newer than version in archive libspnav:aarch64 1.2 installed: No available version in archive libspnav-static:aarch64 1.2 installed: No available version in archive libxcb-errors:aarch64 1.0.1 installed: No available version in archive libxcb-errors-static:aarch64 1.0.1 installed: No available version in archive lv2:aarch64 1.18.10-6 newer than version in archive manim:aarch64 0.19.0-3 newer than version in archive materialx:aarch64 1.39.3 installed: No available version in archive nala:all 0.16.0-1 newer than version in archive ndk:all 27b installed: No available version in archive nodejs-22:aarch64 22.15.1 installed: No available version in archive openshadinglanguage:aarch64 1.14.6.0 installed: No available version in archive orca:all 48.6-1 newer than version in archive pyqt5:aarch64 5.15.11-2 newer than version in archive pyside6:aarch64 6.9.1 installed: No available version in archive pyside6-tools:aarch64 6.9.1 installed: No available version in archive python-opengl:all 3.1.6-2 installed: No available version in archive python-scipy:aarch64 1:1.16.0 newer than version in archive python-tldp:all 0.7.5-6 newer than version in archive python-xlib:all 0.33-2 newer than version in archive qrupdate-ng:aarch64 1:1.1.5-1 newer than version in archive rdircd:all 2023.02.07-2 newer than version in archive shiboken6:aarch64 6.9.1 installed: No available version in archive squashfs-tools:aarch64 4.2-p20130326-0 installed: No available version in archive srt2vobsub:all 1.0-5 newer than version in archive suitesparse:aarch64 1:7.9.0 newer than version in archive sundials:aarch64 1:7.4.0 newer than version in archive supertux-data:all 0.6.3 installed: No available version in archive termux-gui-package:all 0.1.6-3 newer than version in archive termux-gui-pm:all 1.0.0-3 newer than version in archive termux-wsi-layer:aarch64 0.0.1 installed: No available version in archive usd:aarch64 25.05.01 installed: No available version in archive xfce4-panel-profiles:all 1.1.1-2 newer than version in archive ytui-music:aarch64 2.0.0-beta-3 newer than version in archive zmap:aarch64 1:4.3.2 installed: No available version in archive ~ $ ``` while the best solution is arguably to never install unofficial packages in the first place, once they have already been installed, the next best solution is to have some way to efficiently get rid of them without having to completely uninstall Termux and clean install a new Termux.
75 lines
3.0 KiB
Diff
75 lines
3.0 KiB
Diff
--- a/apt-show-versions
|
|
+++ b/apt-show-versions
|
|
@@ -1,4 +1,4 @@
|
|
-#!/usr/bin/perl -w
|
|
+#!@TERMUX_PREFIX@/bin/perl -w
|
|
|
|
# apt-show-versions - Lists available package versions with distribution
|
|
|
|
@@ -33,9 +33,9 @@ use strict;
|
|
use Getopt::Long;
|
|
use Storable qw(nstore retrieve);
|
|
|
|
-my $apackagescachefile="/var/cache/apt-show-versions/apackages-multiarch";
|
|
-my $ipackagescachefile="/var/cache/apt-show-versions/ipackages-multiarch";
|
|
-my $filescachefile="/var/cache/apt-show-versions/files";
|
|
+my $apackagescachefile="@TERMUX_PREFIX@/var/cache/apt-show-versions/apackages-multiarch";
|
|
+my $ipackagescachefile="@TERMUX_PREFIX@/var/cache/apt-show-versions/ipackages-multiarch";
|
|
+my $filescachefile="@TERMUX_PREFIX@/var/cache/apt-show-versions/files";
|
|
my $cachefilemode=0644;
|
|
|
|
use AptPkg::Cache;
|
|
@@ -134,9 +134,9 @@ Usage:
|
|
|
|
Options:
|
|
-stf|--status-file=<file> Use <file> as the dpkg status file instead
|
|
- of /var/lib/dpkg/status
|
|
+ of @TERMUX_PREFIX@/var/lib/dpkg/status
|
|
-ld|list-dir=<directory> Use <directory> as path to apt's list files instead
|
|
- of /var/state/apt/lists/ or /var/lib/apt/lists/
|
|
+ of @TERMUX_PREFIX@/var/state/apt/lists/ or @TERMUX_PREFIX@/var/lib/apt/lists/
|
|
-p|--package=<package> Print versions for <package>.
|
|
-r|--regex Read package with -p as regex
|
|
-R|--regex-all Like --regex, but also show not installed packages.
|
|
@@ -162,7 +162,7 @@ else {
|
|
}
|
|
|
|
# Path to dpkg status file
|
|
-my $status_file = $opts{'status-file'} || "/var/lib/dpkg/status";
|
|
+my $status_file = $opts{'status-file'} || "@TERMUX_PREFIX@/var/lib/dpkg/status";
|
|
my @files;
|
|
my $filesref;
|
|
|
|
@@ -572,7 +572,7 @@ sub parse_file {
|
|
my ($key, $value, $package, $packages);
|
|
|
|
my $release = &determine_pkgfile_release($file);
|
|
- open FILE, "/usr/lib/apt/apt-helper cat-file $file|" or &die("Can't open file $file: $!\n");
|
|
+ open FILE, "@TERMUX_PREFIX@/lib/apt/apt-helper cat-file $file|" or &die("Can't open file $file: $!\n");
|
|
if ($opts{'verbose'}) {print "Parsing $file...";};
|
|
while (<FILE>) {
|
|
if (/^$/){
|
|
@@ -902,12 +902,12 @@ package and via a cron.daily job.
|
|
|
|
=item B<-stf> I<file>, B<--status-file>=I<file>
|
|
|
|
-Use I<file> as the dpkg status file instead of /var/lib/dpkg/status
|
|
+Use I<file> as the dpkg status file instead of @TERMUX_PREFIX@/var/lib/dpkg/status
|
|
|
|
=item B<-ld> I<directory>, B<--list-dir>=I<directory>
|
|
|
|
Use I<directory> as path to apt's list files instead of
|
|
-/var/state/apt/lists/ or /var/lib/apt/lists/
|
|
+@TERMUX_PREFIX@/var/state/apt/lists/ or @TERMUX_PREFIX@/var/lib/apt/lists/
|
|
|
|
=item B<-h>, B<--help>
|
|
|
|
--- a/debian/apt-show-versions.apt.conf
|
|
+++ b/debian/apt-show-versions.apt.conf
|
|
@@ -1,4 +1,4 @@
|
|
// When Apt's cache is updated (i.e. apt-get update)
|
|
APT::Update::Post-Invoke-Success {
|
|
-"test -x /usr/bin/apt-show-versions || exit 0 ; apt-show-versions -i";
|
|
+"test -x @TERMUX_PREFIX@/bin/apt-show-versions || exit 0 ; apt-show-versions -i";
|
|
};
|