A small percentage of users reporting issue where `pkg install` shows that
package is not available, though it is present in our apt repository. This
happens when sources.list has been changed without subsequent `apt update`.
Now `pkg` will force run `apt update` if sources.list was modified after
packages list update but cache still not expired.
We have never used it as standalone host but instead as persistent URL pointing
to the actual stable repository or other mirror shown by termux-change-repo
utility.
In issue https://github.com/termux/termux-packages/issues/6160 I have found
that community repo "its-pointless.github.io" specifies us as maintainer
for its packages. This is NOT TRUE and potentially misleads people using
these packages.
Now TERMUX_PKG_MAINTAINER will contain a default value which is neutral
and not specify maintainer. So all packages now have to override it to
the correct value.
[skip ci]
%ci:no-build
Before this, we had only '--connect-timeout 5' option specified but unfortunately
it doesn't work in cases when remote host is behind some proxy (e.g. CloudFlare)
but is not connected to Internet.
To prevent curl from hanging for unspecified amount of time, we need to introduce
external timeout here.
* Weight-based mirror selection: do not give each mirror same usage ratio as hosts have different properties.
* Rotate mirrors after 6h: pkg now checks usability of all mirrors before selecting one, this takes time but we may want to reduce delays before the actual `apt` operation will be started.
* Update apt cache after 20min: reduce amount of necessary package list queries. We even can go with 1h, but since we prefer origin repository over mirrors as download source, 20 minutes should be fine.
* Avoid long lines.
* Add missing info for some commands.
* Do not show deb cache size if its size cannot be determined, for example if cache dir was deleted.
See https://github.com/termux/termux-packages/issues/5620.
Implements automatic mirror selection:
* Pick a random URL of top 4 mirrors of Termux main repository and use it during 30 minutes limit, then rotate to a new one. Distribute traffic accross multiple mirrors, including origin Bintray repository.
* During 30 minutes limit, let `pkg` to check whether mirror is accessible on each run. If mirror is not accessible, use a new one. Mirrors are not guaranteed to be 100% accessible, so let pkg to check which one is working before using `apt`.
* Skip rotating if using `.cn` mirrors - Chinese users will not want to use something else due to great firewall and download speed issues.