- Fixes https://github.com/termux/termux-packages/issues/28485
- Change `TERMUX_PKG_SRCURL` to the source that is used by Arch Linux, which has enabled Arch Linux to get version 6.19 already, which caused the repology auto update method to attempt to update to the same version as Arch Linux and fail because it's not available at the current `TERMUX_PKG_SRCURL` used by Termux for `ethtool`
- debpython is the commands `py3compile` and `py3clean` from Debian. I
am calling them that because a large chunk of their source code is
found inside a folder inside Debian's source code named "debpython"
- 5348f70466
- rather than packaging `.pyc` files into packages, `py3compile` and
`py3clean` can be called from `postinst` and `prerm` scripts to
generate all `.pyc` for the `.py` files in the package immediately
after the package is installed, and remove all `.pyc` files immediately
before uninstalling the package, respectively
- fixes the error `trying to overwrite '/data/data/com.termux/files/usr/lib/python3.12/__pycache__/cProfile.cpython-312.pyc'` when packages were built on-device, but at the same time, also:
- prevents the warnings `dpkg: warning: while removing python, directory '/data/data/com.termux/files/usr/lib/python3.12/site-packages' not empty so not removed` as long as no packages were installed using `pip`
- The `termux_step_create_python_debscripts.sh` can configure work on debpython (i.e. its `py3copile` and `py3clean` commands) from the glibc package `python-glibc`, if some glibc package is being compiled.
- New variables have been implemented:
- `TERMUX_PYTHON_CROSSENV_BUILDHOME` - location of crossenv's python build libraries.
- `TERMUX_PKG_PYTHON_RUNTIME_DEPS` - configures the installation of the python modules via pip3 in the pkg's debscripts. If not configured in the package, it will use the value from `TERMUX_PKG_PYTHON_TARGET_DEPS`. If the variable is set to `false`, then the customization of installing python modules will be disabled, even if the `TERMUX_PKG_PYTHON_TARGET_DEPS` variable is set in the package.
- `TERMUX_SUBPKG_PYTHON_RUNTIME_DEPS` - configures the installation of the python modules via pip3 in the subpkg's debscripts.
- Implemented reconfiguration of prefixes in python module `sysconfig` and setting in `TERMUX_PYTHON_CROSSENV_BUILDHOME`, so that python modules from crossenv building can specify system paths of termux for correct compilation.
- Added automatic addition of `python-glibc{-glibc}` dependency when using the `TERMUX_PKG_PYTHON_RUNTIME_DEPS` (for pkg; will be disabled, i.e. will not be added, if the variable is set to `false`) or `TERMUX_SUBPKG_PYTHON_RUNTIME_DEPS` (for subpkg) value.
> How to add a new Python package after this?
Everything is the same, except, now, this block is no longer necessary in `build.sh`.
```bash
termux_step_create_debscripts() {
cat <<- EOF > ./postinst
#!$TERMUX_PREFIX/bin/sh
echo "Installing dependencies through pip..."
pip3 install ${TERMUX_PKG_PYTHON_TARGET_DEPS//, / }
EOF
}
```
- Instead, `scripts/build/termux_step_create_python_debscripts.sh` can now detect the presence of `pip` package lists in `$TERMUX_PKG_PYTHON_TARGET_DEPS`, `$TERMUX_SUBPKG_PYTHON_TARGET_DEPS`, and the `METADATA` file of the Python package if it exists, and automatically insert them as a block into the `postinst` script for all relevant packages.
- `$TERMUX_PKG_PYTHON_TARGET_DEPS` is used for `pip` dependencies that are both on-device build-time and on-device run-time dependencies, and `$TERMUX_PKG_PYTHON_RUNTIME_DEPS` is used for runtime-only `pip` dependencies. `$TERMUX_PKG_PYTHON_RUNTIME_DEPS` overrides `$TERMUX_PKG_PYTHON_TARGET_DEPS` for runtime dependencies,
- i.e. if `TERMUX_PKG_PYTHON_RUNTIME_DEPS` is not specified, but `TERMUX_PKG_PYTHON_TARGET_DEPS` is, then `TERMUX_PKG_PYTHON_TARGET_DEPS` will be used as both on-device build and on-device runtime dependencies,
- but if `TERMUX_PKG_PYTHON_RUNTIME_DEPS` is specified, then `TERMUX_PKG_PYTHON_TARGET_DEPS`, if specified, is used only for on-device build-time dependencies.
- If `python-pip` is not already in the dependencies of any package that needs it, the build will fail with an error instructing maintainers to add `python-pip` to the dependencies of the package that needs it.
Co-authored-by: Maxython <mixython@gmail.com>
- Fixes https://github.com/termux/termux-packages/issues/20913
- The `lsusb` command from Desktop Linux
- Brief comparison with `/system/bin/lsusb` showcasing obvious benefits:
```
~ $ /system/bin/lsusb --help
Toybox 0.8.6-android multicall binary (see toybox --help)
usage: lsusb [-i]
List USB hosts/devices.
-i ID database (default /etc/usb.ids[.gz])
~ $ lsusb --help
Usage: lsusb [options]...
List USB devices
-v, --verbose
Increase verbosity (show descriptors)
-s [[bus]:][devnum]
Show only devices with specified device and/or
bus numbers (in decimal)
-d vendor:[product]
Show only devices with the specified vendor and
product ID numbers (in hexadecimal)
-D device
Selects which device lsusb will examine
-t, --tree
Dump the physical USB device hierarchy as a tree
-V, --version
Show version of program
-h, --help
Show usage and help
~ $ sudo /system/bin/lsusb
Bus 001 Device 017: ID 17ef:a395
Bus 001 Device 018: ID 17ef:a38f
Bus 001 Device 001: ID 1d6b:0002
Bus 001 Device 016: ID 17ef:a394
Bus 001 Device 015: ID 17ef:a387
Bus 001 Device 014: ID 17ef:a392
Bus 001 Device 019: ID 17ef:30d1
Bus 002 Device 001: ID 1d6b:0003
~ $ sudo lsusb
unable to initialize usb specBus 001 Device 001: ID 1d6b:0002 Linux 4.14.190-lineage-gef0cb31b13 xhci-hcd xHCI Host Controller
Bus 001 Device 014: ID 17ef:a392 VIA Labs, Inc. USB2.0 Hub
Bus 001 Device 015: ID 17ef:a387 Realtek USB-C Dock Ethernet
Bus 001 Device 016: ID 17ef:a394 VIA Labs, Inc. USB2.0 Hub
Bus 001 Device 017: ID 17ef:a395 Lenovo USB2.0 Hub
Bus 001 Device 018: ID 17ef:a38f Cypress Semiconductor 40AS
Bus 001 Device 019: ID 17ef:30d1 Lenovo ThinkPad USB-C Dock Gen2 USB Audio
Bus 002 Device 001: ID 1d6b:0003 Linux 4.14.190-lineage-gef0cb31b13 xhci-hcd xHCI Host Controller
~ $
```
- Unfortunately, it seems like it must be in root-packages because it doesn't really show all the useful information such as device names if run through `termux-usb` rootlessly:
```
~ $ termux-usb -r -E -e "lsusb" /dev/bus/usb/001/019
unable to initialize usb specBus 001 Device 019: ID 17ef:30d1
~ $
```
- Remove `NOCONFIGURE=1` and `-I"$TERMUX_PREFIX/share/aclocal/"` from `termux_step_pre_configure` to stop error:
```
libtool: Version mismatch error. This is libtool 2.4.7 Debian-2.4.7-7build1, but the
libtool: definition of this LT_INIT comes from libtool 2.5.4.
libtool: You should recreate aclocal.m4 with macros from libtool 2.4.7 Debian-2.4.7-7build1
libtool: and run autoconf again.
```
- Add `includedir="/include"` to `termux_step_make_install` to avoid the `termux_step_massage` duplicate prefix error